### Build and Start Frontile Site Source: https://github.com/josemarluedke/frontile/blob/main/AGENTS.md Builds or starts the Frontile documentation site. Useful for previewing documentation changes. ```bash cd site && pnpm build ``` ```bash cd site && pnpm start ``` -------------------------------- ### Install Frontile Packages Source: https://github.com/josemarluedke/frontile/blob/main/docs/index.md Install Frontile and its theme package using pnpm. ```sh pnpm install frontile @frontile/theme ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/josemarluedke/frontile/blob/main/site/README.md Use this command to install all necessary project dependencies after cloning the repository. ```bash pnpm install ``` -------------------------------- ### Install Dependencies Source: https://github.com/josemarluedke/frontile/blob/main/test-app/README.md Install all project dependencies using npm. ```bash npm install ``` -------------------------------- ### Install Frontile Forms Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/forms-legacy.md Remove the legacy package and install the new frontile and @frontile/theme packages. ```bash # Remove the legacy package npm uninstall @frontile/forms-legacy # Install the new package npm install frontile @frontile/theme ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/josemarluedke/frontile/blob/main/README.md Commands to clone the Frontile repository, navigate into the directory, and install project dependencies using pnpm. ```sh git clone https://github.com/josemarluedke/frontile.git cd frontile pnpm install ``` -------------------------------- ### Start Development Server Source: https://github.com/josemarluedke/frontile/blob/main/test-app/README.md Start the Ember development server to run the application locally. ```bash npm run start ``` -------------------------------- ### Basic Modal Example Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/overlays/modal.md A fundamental example demonstrating how to implement a basic modal with header, body, and footer. Use the `@isOpen` and `@onClose` arguments to control visibility. The modal can be closed by clicking the backdrop or the provided buttons. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; import { Modal } from 'frontile'; import { Button } from 'frontile'; export default class BasicModal extends Component { @tracked isOpen = false; @action toggle() { this.isOpen = !this.isOpen; } } ``` -------------------------------- ### Start Development Server Source: https://github.com/josemarluedke/frontile/blob/main/AGENTS.md Launch the development server for the 'test-app'. This command is used for local development and testing changes in real-time. ```bash pnpm start # Starts test-app dev server ``` -------------------------------- ### Run Site Development Server Source: https://github.com/josemarluedke/frontile/blob/main/CLAUDE.md Starts the development server for the documentation site. Useful for previewing doc changes. ```bash cd site && pnpm start ``` -------------------------------- ### Install Theme Package Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/overview.md Install the theme package using Ember CLI. ```bash ember install @frontile/theme ``` -------------------------------- ### Complete Brand Theme Configuration Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/configuration/customization.md A full example demonstrating how to configure Frontile for a brand, including custom colors, fonts, and component styles. ```js const { frontile } = require('@frontile/theme/plugin'); module.exports = frontile({ defaultTheme: 'light', themes: { light: { colors: { // Purple brand color primary: { subtle: '#faf5ff', soft: '#c084fc', medium: '#9333ea', strong: '#581c87' }, // Success remains green success: { subtle: '#f0fdf4', soft: '#86efac', medium: '#22c55e', strong: '#14532d' }, // Custom orange warning warning: { subtle: '#fff7ed', soft: '#fdba74', medium: '#f97316', strong: '#7c2d12' } } }, dark: { colors: { primary: { subtle: '#581c87', soft: '#9333ea', medium: '#a855f7', strong: '#f3e8ff' } // ... other colors } } } }); ``` ```css @import 'tailwindcss' source('../../'); @plugin "./../../frontile.js"; @import "@frontile/theme"; /* Load custom fonts */ @font-face { font-family: 'Poppins'; src: url('/fonts/poppins-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; } @theme { /* Typography */ --font-header: 'Poppins', system-ui, sans-serif; --font-body: 'Poppins', system-ui, sans-serif; --font-label: 'Poppins', system-ui, sans-serif; /* Rounded design */ --radius: 12px; --radius-xl: 20px; --radius-2xl: 24px; /* Slightly larger icons */ --size-icon-sm: 16px; --size-icon-md: 20px; --size-icon-lg: 24px; /* Subtle opacity changes */ --opacity-hover: .9; --opacity-disabled: .5; } /* Component customization */ :root { /* Wider modals */ --modal-md: 36rem; --modal-lg: 52rem; } ``` -------------------------------- ### Component Examples with Theme Inverse Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/configuration/theme-switching.md Shows how Frontile components like Chip and ProgressBar automatically adapt to the 'theme-inverse' class. This example displays a project status section with various chips and a progress bar. ```gts import { Button, Chip, ProgressBar } from 'frontile'; ``` -------------------------------- ### Install Forms-Legacy Package Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/changeset-form.md This command sequence installs the forms-legacy package, which is part of the minimal-effort approach for migrating changeset forms. ```bash npm uninstall @frontile/changeset-form npm install @frontile/forms-legacy # Keep: ember-changeset ember-changeset-validations # Build the package pnpm --filter forms-legacy build ``` -------------------------------- ### Install Dependencies for Modern Forms Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/changeset-form.md Remove deprecated packages and install the necessary frontile and valibot packages for the recommended migration approach. ```bash npm uninstall @frontile/changeset-form @frontile/forms-legacy npm uninstall ember-changeset ember-changeset-validations npm install frontile @frontile/theme valibot ``` -------------------------------- ### Complete Form Example Source: https://github.com/josemarluedke/frontile/blob/main/packages/changeset-form/docs/changeset-form-usage.md This example shows a full implementation of a form using ChangesetForm, including text inputs, textarea, select, checkbox group, radio group, and submit/reset buttons. It also displays the changeset's validation state. ```gts import Component from '@glimmer/component'; import { ChangesetForm } from '@frontile/changeset-form'; import Button from '@frontile/buttons/components/button'; import { changeset } from 'ember-changesets'; import validateFormat from 'ember-changeset-validations/validators/format'; import validatePresence from 'ember-changeset-validations/validators/presence'; export const myValidations = { firstName: validatePresence(true), lastName: validatePresence(true), email: validateFormat({ type: 'email' }), countries: validatePresence(true) }; export default class Demo extends Component { validations = myValidations; countries = [ 'Brazil', 'India', 'Israel', 'Japan', 'United Kingdom', 'United States' ]; model = { firstName: null, lastName: null, email: 'frontile@example.com', comments: 'Changeset forms are great! 🚀', countries: ['Brazil', 'United States'], coreValues: { hungry: true, humble: true, curious: true }, favoriteMeal: 'lunch' }; } ``` -------------------------------- ### Nested Modals Example Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/overlays/modal.md Demonstrates how to open multiple modals sequentially, with each modal maintaining its own focus trap and backdrop. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; import { Modal } from 'frontile'; import { Button } from 'frontile'; export default class NestedModals extends Component { @tracked firstModalOpen = false; @tracked secondModalOpen = false; @tracked thirdModalOpen = false; @action toggleFirst() { this.firstModalOpen = !this.firstModalOpen; } @action toggleSecond() { this.secondModalOpen = !this.secondModalOpen; } @action toggleThird() { this.thirdModalOpen = !this.thirdModalOpen; } @action closeAll() { this.thirdModalOpen = false; this.secondModalOpen = false; this.firstModalOpen = false; } } ``` -------------------------------- ### Run Frontile Test App Source: https://github.com/josemarluedke/frontile/blob/main/README.md Command to start the development server for the Frontile test application using pnpm. ```sh pnpm start ``` -------------------------------- ### Remove Old Packages and Install Consolidated Package Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/v0.18/package-consolidation.md Use these commands to uninstall the old @frontile/* packages and install the new 'frontile' package. This applies to npm, pnpm, and yarn. ```bash # Remove old packages npm uninstall @frontile/buttons @frontile/collections @frontile/forms \ @frontile/overlays @frontile/notifications @frontile/status @frontile/utilities # Install the consolidated package (if not already installed) npm install frontile @frontile/theme ``` ```bash # pnpm pnpm remove @frontile/buttons @frontile/collections @frontile/forms \ @frontile/overlays @frontile/notifications @frontile/status @frontile/utilities pnpm add frontile @frontile/theme # yarn yarn remove @frontile/buttons @frontile/collections @frontile/forms \ @frontile/overlays @frontile/notifications @frontile/status @frontile/utilities yarn add frontile @frontile/theme ``` -------------------------------- ### Border Width Examples Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/design-tokens/borders.md Provides practical examples of using border width tokens in common UI components. Includes a subtle card with a thin border, a standard input field with a default border, and a selected item with a heavy border. ```gts ``` -------------------------------- ### ProgressBar with Description Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/status/progress-bar.md Example of using the ProgressBar with both a label and a description to provide more context. ```gjs import { ProgressBar } from 'frontile'; ``` -------------------------------- ### Initialize Frontile Tests Source: https://github.com/josemarluedke/frontile/blob/main/site/tests/index.html Imports necessary testing modules and starts the test runner. Ensure all test files are discoverable by the module loader. ```javascript import "ember-testing"; import { start } from "./test-helper"; import.meta.glob("./**/*.{js,ts,gjs,gts}", { eager: true }); start(); ``` -------------------------------- ### Basic ProgressBar Usage Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/status/progress-bar.md A simple example of how to use the ProgressBar component with a progress value and a label. ```gjs import { ProgressBar } from 'frontile'; ``` -------------------------------- ### Update Custom Theme Configuration (v0.17) Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/v0.18/theme-configuration.md Example of a custom Frontile theme configuration file structure before v0.18. ```javascript const { frontile } = require('@frontile/theme/plugin'); module.exports = frontile({ hoverOpacity: 0.9, disabledOpacity: 0.4, // other flat properties }); ``` -------------------------------- ### Setting Up Global Styles Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/component-styles.md Create a theme file (e.g., `app/theme.js`) to define global style customizations for Frontile components. ```javascript // app/theme.js import { useStyles, registerCustomStyles, tv } from '@frontile/theme'; const components = useStyles(); registerCustomStyles({ // stuff ... }); ``` ```javascript // app/app.js import Application from '@ember/application'; // stuff... import './theme'; // Import your theme file here export default class App extends Application { // stuff... } loadInitializers(App, config.modulePrefix); ``` -------------------------------- ### Displaying All Icon Sizes Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/design-tokens/icons.md This example demonstrates how to use various icon size utility classes to display different icon sizes. It imports an icon component and applies size classes like `size-icon-pico` and `size-icon-mega` to visually represent each size. Use this to see all available icon sizes in action. ```gts import { CheckIcon } from 'site/components/icons'; ``` -------------------------------- ### Install Frontile Component Library Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/README.md Use the Ember CLI to install the frontile addon into your Ember Octane application. ```sh ember install frontile ``` -------------------------------- ### Template-Only Component Example Source: https://github.com/josemarluedke/frontile/blob/main/AGENTS.md Example of a template-only component using TypeScript and the TOC helper. Ensure to import 'TOC' from '@ember/component/template-only'. ```typescript import type { TOC } from '@ember/component/template-only'; export interface Signature { Args: { title: string; }; } const MyComponent: TOC = ; export default MyComponent; ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/josemarluedke/frontile/blob/main/test-app/README.md Change the current directory to the cloned test-app folder. ```bash cd test-app ``` -------------------------------- ### Checkbox Group Data Management Example Source: https://github.com/josemarluedke/frontile/blob/main/docs/migrations/forms-legacy.md Example of how to manage selected values for CheckboxGroup, which remains the same pattern as the legacy component. ```js // Tracking selected values (same pattern as before) @tracked selectedInterests = []; isInterestSelected(value) { return this.selectedInterests.includes(value); } setInterests = (value, isChecked) => { if (isChecked) { this.selectedInterests = [...this.selectedInterests, value]; } else { this.selectedInterests = this.selectedInterests.filter(v => v !== value); } }; ``` -------------------------------- ### Create a Themed Button Source: https://github.com/josemarluedke/frontile/blob/main/docs/theming/overview.md This example shows how to create a button that automatically adapts to light and dark themes using Frontile's color utilities. The `on-primary-medium` class ensures optimal text contrast for accessibility. ```gts ``` -------------------------------- ### Build for Production Source: https://github.com/josemarluedke/frontile/blob/main/test-app/README.md Build the application for production deployment. ```bash npm run build ``` -------------------------------- ### Notification Placement Example Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/docs/notifications-usage.md Control where notifications appear on screen using the `@placement` argument. This example demonstrates setting the placement via radio buttons. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { service } from '@ember/service'; import { Button } from 'frontile'; import { RadioGroup } from 'frontile'; import { NotificationsContainer, type NotificationsService } from 'frontile'; export default class PositionExample extends Component { @service notifications!: NotificationsService; @tracked placement = 'bottom-right'; placements = [ { key: 'top-left', label: 'Top Left' }, { key: 'top-center', label: 'Top Center' }, { key: 'top-right', label: 'Top Right' }, { key: 'bottom-left', label: 'Bottom Left' }, { key: 'bottom-center', label: 'Bottom Center' }, { key: 'bottom-right', label: 'Bottom Right' } ]; setPlacement = (placement: string) => { this.placement = placement; }; showNotification = () => { this.notifications.add(`Positioned at ${this.placement}`, { appearance: 'info' }); }; } ``` -------------------------------- ### Input with Start and End Content Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/forms/input.md Shows how to add custom content, such as currency symbols or buttons, at the start and end of the input field using named blocks. ```gts import Component from '@glimmer/component'; import { Input } from 'frontile'; import { SearchIcon } from 'site/components/icons'; export default class InputWithContent extends Component { } ``` -------------------------------- ### Comprehensive Form Example with All Component Types Source: https://github.com/josemarluedke/frontile/blob/main/packages/frontile/src/components/forms/form.md Demonstrates the usage of the Form component with a wide array of Frontile's form elements, including Input, Textarea, NativeSelect, Select, RadioGroup, CheckboxGroup, and Checkbox. It also shows how to handle form changes and submissions, and display the form data. ```gts import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { Form, Input, Textarea, Checkbox, CheckboxGroup, RadioGroup, NativeSelect, Select, type FormResultData } from 'frontile'; import { Button } from 'frontile'; export default class ComprehensiveForm extends Component { @tracked formData: FormResultData = {}; @tracked lastEventType = ''; @tracked selectedSkillLevel: string | null = null; countries = [ 'United States', 'Canada', 'United Kingdom', 'Australia', 'Germany' ]; skillLevels = [ { label: 'Beginner (0-1 years)', key: 'beginner' }, { label: 'Intermediate (2-5 years)', key: 'intermediate' }, { label: 'Advanced (5+ years)', key: 'advanced' }, { label: 'Expert (10+ years)', key: 'expert' } ]; handleFormChange = (data: FormResultData, event: Event) => { this.formData = data; this.lastEventType = 'input'; console.log('Form input:', { data, event }); }; handleFormSubmit = (data: FormResultData, event: SubmitEvent) => { this.formData = data; this.lastEventType = 'submit'; console.log('Form submit:', { data, event }); }; handleSkillLevelChange = (selectedKey: string | null) => { this.selectedSkillLevel = selectedKey; };