@g4rcez/components 4.0.2 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/SKILL.md +120 -153
- package/ai/docs/Alert.md +47 -48
- package/ai/docs/AnimatedList.md +88 -87
- package/ai/docs/Autocomplete.md +102 -106
- package/ai/docs/Button.md +33 -33
- package/ai/docs/Calendar.md +67 -101
- package/ai/docs/Card.md +59 -55
- package/ai/docs/Checkbox.md +77 -82
- package/ai/docs/CommandPalette.md +154 -172
- package/ai/docs/DatePicker.md +45 -64
- package/ai/docs/Dropdown.md +98 -126
- package/ai/docs/Empty.md +41 -44
- package/ai/docs/Expand.md +40 -54
- package/ai/docs/FileUpload.md +102 -109
- package/ai/docs/Form.md +35 -29
- package/ai/docs/FormReset.md +37 -37
- package/ai/docs/Heading.md +4 -6
- package/ai/docs/Input.md +73 -98
- package/ai/docs/InputField.md +67 -67
- package/ai/docs/List.md +88 -85
- package/ai/docs/Menu.md +62 -60
- package/ai/docs/Modal.md +129 -136
- package/ai/docs/MultiSelect.md +65 -84
- package/ai/docs/Notifications.md +96 -96
- package/ai/docs/PageCalendar.md +88 -97
- package/ai/docs/Polymorph.md +25 -41
- package/ai/docs/Progress.md +55 -51
- package/ai/docs/Radiobox.md +49 -41
- package/ai/docs/RenderOnView.md +26 -32
- package/ai/docs/Resizable.md +60 -65
- package/ai/docs/Select.md +158 -158
- package/ai/docs/Shortcut.md +14 -14
- package/ai/docs/Skeleton.md +56 -60
- package/ai/docs/Slider.md +26 -49
- package/ai/docs/Slot.md +15 -17
- package/ai/docs/Spinner.md +17 -15
- package/ai/docs/Stats.md +44 -42
- package/ai/docs/Step.md +60 -60
- package/ai/docs/Switch.md +44 -54
- package/ai/docs/Table.md +124 -136
- package/ai/docs/Tabs.md +90 -90
- package/ai/docs/Tag.md +63 -65
- package/ai/docs/TaskList.md +40 -50
- package/ai/docs/Textarea.md +47 -70
- package/ai/docs/Timeline.md +98 -96
- package/ai/docs/Toolbar.md +46 -46
- package/ai/docs/Tooltip.md +103 -103
- package/ai/docs/Typography.md +55 -55
- package/ai/docs/Wizard.md +104 -109
- package/ai/docs/index.md +116 -116
- package/dist/autocomplete-DcTNOwyg.js +393 -0
- package/dist/autocomplete-DcTNOwyg.js.map +1 -0
- package/dist/{calendar-B5lSd0ID.js → calendar-BJMHRoy2.js} +104 -105
- package/dist/calendar-BJMHRoy2.js.map +1 -0
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.js +10 -10
- package/dist/components/core/button.js.map +1 -1
- package/dist/components/core/button.jsx +79 -0
- package/dist/components/core/heading.jsx +4 -0
- package/dist/components/core/polymorph.d.ts +1 -1
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/core/polymorph.jsx +5 -0
- package/dist/components/core/render-on-view.jsx +31 -0
- package/dist/components/core/resizable.jsx +51 -0
- package/dist/components/core/slot.d.ts.map +1 -1
- package/dist/components/core/slot.jsx +156 -0
- package/dist/components/core/tag.d.ts +1 -1
- package/dist/components/core/tag.d.ts.map +1 -1
- package/dist/components/core/tag.js +4 -4
- package/dist/components/core/tag.js.map +1 -1
- package/dist/components/core/tag.jsx +51 -0
- package/dist/components/core/typography.jsx +18 -0
- package/dist/components/display/alert.d.ts +1 -1
- package/dist/components/display/alert.d.ts.map +1 -1
- package/dist/components/display/alert.js +48 -46
- package/dist/components/display/alert.js.map +1 -1
- package/dist/components/display/alert.jsx +61 -0
- package/dist/components/display/calendar.js +6 -6
- package/dist/components/display/calendar.jsx +299 -0
- package/dist/components/display/card.js +2 -2
- package/dist/components/display/card.js.map +1 -1
- package/dist/components/display/card.jsx +43 -0
- package/dist/components/display/empty.jsx +11 -0
- package/dist/components/display/list.js +1 -1
- package/dist/components/display/list.js.map +1 -1
- package/dist/components/display/list.jsx +81 -0
- package/dist/components/display/notifications.d.ts +1 -1
- package/dist/components/display/notifications.d.ts.map +1 -1
- package/dist/components/display/notifications.js +3 -3
- package/dist/components/display/notifications.jsx +126 -0
- package/dist/components/display/progress.jsx +11 -0
- package/dist/components/display/shortcut.jsx +23 -0
- package/dist/components/display/skeleton.d.ts.map +1 -1
- package/dist/components/display/skeleton.jsx +19 -0
- package/dist/components/display/spinner.d.ts.map +1 -1
- package/dist/components/display/spinner.jsx +11 -0
- package/dist/components/display/stats.js +1 -1
- package/dist/components/display/stats.jsx +20 -0
- package/dist/components/display/step.jsx +131 -0
- package/dist/components/display/tabs.d.ts +1 -1
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.js +2 -2
- package/dist/components/display/tabs.jsx +125 -0
- package/dist/components/display/timeline.js +1 -1
- package/dist/components/display/timeline.jsx +25 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -1
- package/dist/components/floating/command-palette.jsx +197 -0
- package/dist/components/floating/dropdown.d.ts.map +1 -1
- package/dist/components/floating/dropdown.js +25 -17
- package/dist/components/floating/dropdown.js.map +1 -1
- package/dist/components/floating/dropdown.jsx +56 -0
- package/dist/components/floating/expand.js +7 -7
- package/dist/components/floating/expand.js.map +1 -1
- package/dist/components/floating/expand.jsx +44 -0
- package/dist/components/floating/menu.js +10 -10
- package/dist/components/floating/menu.js.map +1 -1
- package/dist/components/floating/menu.jsx +147 -0
- package/dist/components/floating/modal.d.ts +4 -4
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.js +106 -102
- package/dist/components/floating/modal.js.map +1 -1
- package/dist/components/floating/modal.jsx +301 -0
- package/dist/components/floating/toolbar.jsx +5 -0
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.js +14 -14
- package/dist/components/floating/tooltip.js.map +1 -1
- package/dist/components/floating/tooltip.jsx +58 -0
- package/dist/components/floating/wizard.jsx +161 -0
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.js +6 -6
- package/dist/components/form/autocomplete.jsx +278 -0
- package/dist/components/form/checkbox.js +1 -1
- package/dist/components/form/checkbox.jsx +12 -0
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +5 -5
- package/dist/components/form/date-picker.jsx +115 -0
- package/dist/components/form/file-upload.d.ts.map +1 -1
- package/dist/components/form/file-upload.js +2 -2
- package/dist/components/form/file-upload.jsx +134 -0
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/form.jsx +10 -0
- package/dist/components/form/formReset.jsx +17 -0
- package/dist/components/form/free-text.d.ts.map +1 -1
- package/dist/components/form/free-text.jsx +41 -0
- package/dist/components/form/input-field.d.ts +11 -11
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.jsx +58 -0
- package/dist/components/form/input.js +1 -1
- package/dist/components/form/input.jsx +36 -0
- package/dist/components/form/multi-select.d.ts.map +1 -1
- package/dist/components/form/multi-select.jsx +336 -0
- package/dist/components/form/radiobox.js +1 -1
- package/dist/components/form/radiobox.jsx +6 -0
- package/dist/components/form/select.js +3 -3
- package/dist/components/form/select.jsx +42 -0
- package/dist/components/form/slider.jsx +45 -0
- package/dist/components/form/switch.js +2 -2
- package/dist/components/form/switch.js.map +1 -1
- package/dist/components/form/switch.jsx +46 -0
- package/dist/components/form/task-list.jsx +26 -0
- package/dist/components/form/textarea.jsx +12 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +44 -0
- package/dist/components/page-calendar/calendar-header.jsx +83 -0
- package/dist/components/page-calendar/day-view.jsx +94 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -1
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.jsx +46 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +93 -0
- package/dist/components/page-calendar/week-view.jsx +71 -0
- package/dist/components/table/filter.jsx +141 -0
- package/dist/components/table/group.jsx +68 -0
- package/dist/components/table/index.d.ts +2 -3
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.jsx +60 -0
- package/dist/components/table/inner-table.d.ts +2 -3
- package/dist/components/table/inner-table.d.ts.map +1 -1
- package/dist/components/table/inner-table.jsx +102 -0
- package/dist/components/table/metadata.jsx +36 -0
- package/dist/components/table/pagination.d.ts +3 -1
- package/dist/components/table/pagination.d.ts.map +1 -1
- package/dist/components/table/pagination.jsx +74 -0
- package/dist/components/table/row.d.ts +4 -5
- package/dist/components/table/row.d.ts.map +1 -1
- package/dist/components/table/row.jsx +49 -0
- package/dist/components/table/sort.d.ts.map +1 -1
- package/dist/components/table/sort.jsx +109 -0
- package/dist/components/table/table-lib.d.ts +1 -1
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/table-lib.js +83 -0
- package/dist/components/table/table.context.jsx +4 -0
- package/dist/components/table/table.js +3 -3
- package/dist/components/table/thead.jsx +103 -0
- package/dist/config/context.js +12 -0
- package/dist/config/default-translations.d.ts +4 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.jsx +87 -0
- package/dist/config/default-tweaks.js +4 -0
- package/dist/constants.js +2 -0
- package/dist/{date-picker-DwNo22lx.js → date-picker-Bnl07nd8.js} +8 -6
- package/dist/date-picker-Bnl07nd8.js.map +1 -0
- package/dist/{dom-Dl8XH0CK.js → dom-CyQHY7ID.js} +66 -61
- package/dist/dom-CyQHY7ID.js.map +1 -0
- package/dist/{file-upload-Brf2NkLr.js → file-upload-93d5DR4q.js} +139 -129
- package/dist/file-upload-93d5DR4q.js.map +1 -0
- package/dist/{floating-ui.react-QNHG9W4N.js → floating-ui.react-M2PGXLDp.js} +8 -8
- package/dist/floating-ui.react-M2PGXLDp.js.map +1 -0
- package/dist/{fns-D2eyJKd5.js → fns-C7Dt27Qd.js} +2 -2
- package/dist/fns-C7Dt27Qd.js.map +1 -0
- package/dist/hooks/use-click-outside.js +17 -0
- package/dist/hooks/use-color-parser.js +9 -0
- package/dist/hooks/use-components-provider.jsx +22 -0
- package/dist/hooks/use-debounce.d.ts +3 -3
- package/dist/hooks/use-debounce.d.ts.map +1 -1
- package/dist/hooks/use-debounce.js +12 -0
- package/dist/hooks/use-floating-ref.js +6 -0
- package/dist/hooks/use-form.d.ts +14 -13
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +563 -0
- package/dist/hooks/use-hover.js +18 -0
- package/dist/hooks/use-input-id.js +5 -0
- package/dist/hooks/use-is-coarse-device.js +12 -0
- package/dist/hooks/use-locale.js +10 -0
- package/dist/hooks/use-media-query.js +25 -0
- package/dist/hooks/use-on-event.js +7 -0
- package/dist/hooks/use-parent.js +21 -0
- package/dist/hooks/use-preferences.js +23 -0
- package/dist/hooks/use-previous.js +9 -0
- package/dist/hooks/use-reactive.js +9 -0
- package/dist/hooks/use-remove-scroll.d.ts.map +1 -1
- package/dist/hooks/use-remove-scroll.js +48 -0
- package/dist/hooks/use-resize-observer.js +17 -0
- package/dist/hooks/use-stable-ref.js +9 -0
- package/dist/hooks/use-swipe.js +17 -0
- package/dist/hooks/use-translations.d.ts +4 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/hooks/use-translations.js +9 -0
- package/dist/hooks/use-tweaks.js +9 -0
- package/dist/hooks/use-window-size.js +14 -0
- package/dist/index-BJ1ayTam.js +126 -0
- package/dist/index-BJ1ayTam.js.map +1 -0
- package/dist/index-C-PuFUZi.js.map +1 -1
- package/dist/{index-BelDtX5M.js → index-DDeQW0JW.js} +399 -404
- package/dist/index-DDeQW0JW.js.map +1 -0
- package/dist/index-DE4shK8D.js +215 -0
- package/dist/index-DE4shK8D.js.map +1 -0
- package/dist/{index-DJSMaZR4.js → index-DlJ_2RBL.js} +2 -2
- package/dist/index-DlJ_2RBL.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.esm-BaIwleSE.js.map +1 -1
- package/dist/index.js +20 -8177
- package/dist/index.js.map +1 -1
- package/dist/{input-CrGrSnUt.js → input-_MVxmIpu.js} +116 -114
- package/dist/input-_MVxmIpu.js.map +1 -0
- package/dist/{input-field-5vYcz5tT.js → input-field-CDCOODOl.js} +63 -47
- package/dist/input-field-CDCOODOl.js.map +1 -0
- package/dist/lib/combi-keys.js +60 -0
- package/dist/lib/dict.d.ts +1 -4
- package/dist/lib/dict.d.ts.map +1 -1
- package/dist/lib/dict.js +28 -0
- package/dist/lib/dom.d.ts +3 -2
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/dom.js +66 -0
- package/dist/lib/fns.js +46 -0
- package/dist/lib/fzf.d.ts.map +1 -1
- package/dist/lib/fzf.js +115 -0
- package/dist/lib/keyboard-area.js +14 -0
- package/dist/notifications-Dp0ydKJS.js +2576 -0
- package/dist/notifications-Dp0ydKJS.js.map +1 -0
- package/dist/polymorph-B5n9fs_K.js.map +1 -1
- package/dist/preset/plugin.tailwind.d.ts.map +1 -1
- package/dist/preset/plugin.tailwind.js +20 -18
- package/dist/preset/preset.tailwind.js +24 -25
- package/dist/preset/src/styles/common.js +6 -3
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +9 -5
- package/dist/preset/src/styles/design-tokens.js +68 -89
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +9 -5
- package/dist/preset/src/styles/theme.js +7 -4
- package/dist/preset/src/styles/theme.types.d.ts +2 -1
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/preset/src/styles/theme.types.js +2 -1
- package/dist/skeleton-BjJobYYf.js +24 -0
- package/dist/skeleton-BjJobYYf.js.map +1 -0
- package/dist/slot-CRyweuj0.js.map +1 -1
- package/dist/styles/common.js +6 -3
- package/dist/styles/dark.d.ts.map +1 -1
- package/dist/styles/dark.js +9 -5
- package/dist/styles/design-tokens.js +68 -89
- package/dist/styles/light.d.ts.map +1 -1
- package/dist/styles/light.js +9 -5
- package/dist/styles/theme.js +7 -4
- package/dist/styles/theme.types.d.ts +2 -1
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/theme.types.js +2 -1
- package/dist/tabs-B0g7YtQv.js +123 -0
- package/dist/tabs-B0g7YtQv.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/{context-BFXNJVn2.js → use-translations-DSltA7H_.js} +38 -30
- package/dist/use-translations-DSltA7H_.js.map +1 -0
- package/package.json +99 -86
- package/ai/docs/TransferList.md +0 -142
- package/dist/autocomplete-Cn9Z2hLq.js +0 -375
- package/dist/autocomplete-Cn9Z2hLq.js.map +0 -1
- package/dist/calendar-B5lSd0ID.js.map +0 -1
- package/dist/components/form/transfer-list.d.ts +0 -14
- package/dist/components/form/transfer-list.d.ts.map +0 -1
- package/dist/components/form/transfer-list.js +0 -55
- package/dist/components/form/transfer-list.js.map +0 -1
- package/dist/context-BFXNJVn2.js.map +0 -1
- package/dist/date-picker-DwNo22lx.js.map +0 -1
- package/dist/dom-Dl8XH0CK.js.map +0 -1
- package/dist/file-upload-Brf2NkLr.js.map +0 -1
- package/dist/floating-ui.react-QNHG9W4N.js.map +0 -1
- package/dist/fns-D2eyJKd5.js.map +0 -1
- package/dist/index-BelDtX5M.js.map +0 -1
- package/dist/index-DJSMaZR4.js.map +0 -1
- package/dist/index-Z-fZHxfJ.js +0 -335
- package/dist/index-Z-fZHxfJ.js.map +0 -1
- package/dist/input-CrGrSnUt.js.map +0 -1
- package/dist/input-field-5vYcz5tT.js.map +0 -1
- package/dist/notifications-cUdVPs-B.js +0 -2786
- package/dist/notifications-cUdVPs-B.js.map +0 -1
- package/dist/skeleton-D75GFBV6.js +0 -10
- package/dist/skeleton-D75GFBV6.js.map +0 -1
- package/dist/tabs-S00a8qq8.js +0 -106
- package/dist/tabs-S00a8qq8.js.map +0 -1
- package/dist/use-translations-BwLKTrZv.js +0 -10
- package/dist/use-translations-BwLKTrZv.js.map +0 -1
package/ai/docs/FileUpload.md
CHANGED
|
@@ -19,54 +19,54 @@ import { FileUpload } from "@g4rcez/components/file-upload";
|
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
21
|
|
|
22
|
-
| Prop
|
|
23
|
-
|
|
24
|
-
| `files`
|
|
25
|
-
| `onDrop`
|
|
26
|
-
| `onDeleteFile`
|
|
27
|
-
| `idle`
|
|
28
|
-
| `File`
|
|
29
|
-
| `accept`
|
|
30
|
-
| `multiple`
|
|
31
|
-
| `maxFiles`
|
|
32
|
-
| `maxSize`
|
|
33
|
-
| `disabled`
|
|
34
|
-
| `name`
|
|
35
|
-
| `...DropzoneProps` |
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
| ------------------ | ------------------------------------ | --------------- | -------------------------------------------------------------------- |
|
|
24
|
+
| `files` | `File[]` | - | Controlled files array |
|
|
25
|
+
| `onDrop` | `(files: File[]) => void` | - | Called when files are dropped or selected |
|
|
26
|
+
| `onDeleteFile` | `(file: File) => void` | - | Called when the delete button on a file item is clicked |
|
|
27
|
+
| `idle` | `React.ReactElement` | Default idle UI | Content to show when no files are present and the area is not active |
|
|
28
|
+
| `File` | `React.FC<{ file: File }>` | - | Custom component rendered below each file's name/size row |
|
|
29
|
+
| `accept` | `string \| Record<string, string[]>` | - | Accepted file types (forwarded to `react-dropzone`) |
|
|
30
|
+
| `multiple` | `boolean` | `false` | Allow selecting more than one file |
|
|
31
|
+
| `maxFiles` | `number` | - | Maximum number of files |
|
|
32
|
+
| `maxSize` | `number` | - | Maximum file size in bytes |
|
|
33
|
+
| `disabled` | `boolean` | `false` | Disable the drop zone |
|
|
34
|
+
| `name` | `string` | - | Name for the underlying `<input>` |
|
|
35
|
+
| `...DropzoneProps` | | | All `react-dropzone` props are supported |
|
|
36
36
|
|
|
37
37
|
## Design Tokens
|
|
38
38
|
|
|
39
39
|
Tokens this component reads. Customize by overriding these CSS variables in your theme.
|
|
40
40
|
|
|
41
|
-
| Token
|
|
42
|
-
|
|
43
|
-
| `border-card-border` | `--card-border`
|
|
44
|
-
| `bg-card-background` | `--card-background` | Drop zone background when files are present
|
|
45
|
-
| `text-foreground`
|
|
46
|
-
| `text-primary`
|
|
47
|
-
| `text-danger`
|
|
41
|
+
| Token | CSS Variable | Purpose |
|
|
42
|
+
| -------------------- | ------------------- | --------------------------------------------------------------- |
|
|
43
|
+
| `border-card-border` | `--card-border` | Border between file list items and default drop zone border |
|
|
44
|
+
| `bg-card-background` | `--card-background` | Drop zone background when files are present |
|
|
45
|
+
| `text-foreground` | `--foreground` | General text color |
|
|
46
|
+
| `text-primary` | `--primary` | Folder icon color and "browse" link color in default idle state |
|
|
47
|
+
| `text-danger` | `--danger` | Delete button hover color |
|
|
48
48
|
|
|
49
49
|
## Drag and Drop States
|
|
50
50
|
|
|
51
|
-
| State
|
|
52
|
-
|
|
53
|
-
| Idle (empty)
|
|
54
|
-
| Drag active
|
|
51
|
+
| State | Description |
|
|
52
|
+
| ------------- | -------------------------------------------------------------------------- |
|
|
53
|
+
| Idle (empty) | Displays the `idle` prop or the default folder icon with an upload prompt |
|
|
54
|
+
| Drag active | Replaces the idle UI with an open folder icon while dragging |
|
|
55
55
|
| Files present | Renders the file list; drop zone border becomes solid and background fills |
|
|
56
56
|
|
|
57
57
|
## File Type Rendering
|
|
58
58
|
|
|
59
59
|
The component automatically selects an icon based on file extension:
|
|
60
60
|
|
|
61
|
-
| Extension(s)
|
|
62
|
-
|
|
63
|
-
| csv, xls, xlsx | `SheetIcon`
|
|
64
|
-
| pdf, txt
|
|
65
|
-
| json
|
|
66
|
-
| mp3
|
|
67
|
-
| mp4, mov
|
|
68
|
-
| Images
|
|
69
|
-
| Other
|
|
61
|
+
| Extension(s) | Icon |
|
|
62
|
+
| -------------- | ------------------------ |
|
|
63
|
+
| csv, xls, xlsx | `SheetIcon` |
|
|
64
|
+
| pdf, txt | `FileTextIcon` |
|
|
65
|
+
| json | `FileJsonIcon` |
|
|
66
|
+
| mp3 | `AudioLinesIcon` |
|
|
67
|
+
| mp4, mov | `FileVideo2` |
|
|
68
|
+
| Images | Inline `<img>` thumbnail |
|
|
69
|
+
| Other | Generic `FileIcon` |
|
|
70
70
|
|
|
71
71
|
Clicking a file thumbnail opens a `Modal` viewer with full-size preview for images, `<video>` player for videos, and `<audio>` player for audio files.
|
|
72
72
|
|
|
@@ -78,19 +78,19 @@ Clicking a file thumbnail opens a `Modal` viewer with full-size preview for imag
|
|
|
78
78
|
import { FileUpload } from "@g4rcez/components/file-upload";
|
|
79
79
|
|
|
80
80
|
function ImageUpload() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
const [images, setImages] = useState<File[]>([]);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<FileUpload
|
|
85
|
+
files={images}
|
|
86
|
+
onDrop={(added) => setImages((prev) => [...prev, ...added])}
|
|
87
|
+
onDeleteFile={(file) => setImages((prev) => prev.filter((f) => f !== file))}
|
|
88
|
+
accept="image/*"
|
|
89
|
+
multiple
|
|
90
|
+
maxFiles={10}
|
|
91
|
+
maxSize={5 * 1024 * 1024}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
96
|
|
|
@@ -98,18 +98,18 @@ function ImageUpload() {
|
|
|
98
98
|
|
|
99
99
|
```tsx
|
|
100
100
|
function AvatarUpload() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
const [file, setFile] = useState<File | null>(null);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<FileUpload
|
|
105
|
+
files={file ? [file] : []}
|
|
106
|
+
onDrop={(files) => setFile(files[0])}
|
|
107
|
+
onDeleteFile={() => setFile(null)}
|
|
108
|
+
accept="image/jpeg,image/png"
|
|
109
|
+
multiple={false}
|
|
110
|
+
maxSize={2 * 1024 * 1024}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
@@ -119,44 +119,35 @@ function AvatarUpload() {
|
|
|
119
119
|
import { UploadSimpleIcon } from "@phosphor-icons/react";
|
|
120
120
|
|
|
121
121
|
const CustomIdle = () => (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
<div className="flex flex-col items-center gap-2 py-10">
|
|
123
|
+
<UploadSimpleIcon size={48} className="text-primary" />
|
|
124
|
+
<p className="text-foreground font-medium">Drop files here</p>
|
|
125
|
+
<p className="text-muted-foreground text-sm">PDF, DOCX, up to 10 MB each</p>
|
|
126
|
+
</div>
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
-
<FileUpload
|
|
130
|
-
files={[]}
|
|
131
|
-
onDrop={setFiles}
|
|
132
|
-
idle={<CustomIdle />}
|
|
133
|
-
accept="application/pdf,.docx"
|
|
134
|
-
multiple
|
|
135
|
-
/>
|
|
129
|
+
<FileUpload files={[]} onDrop={setFiles} idle={<CustomIdle />} accept="application/pdf,.docx" multiple />;
|
|
136
130
|
```
|
|
137
131
|
|
|
138
132
|
### Custom per-file renderer
|
|
139
133
|
|
|
140
134
|
```tsx
|
|
141
135
|
const ProgressRow = ({ file }: { file: File }) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
136
|
+
const progress = useUploadProgress(file);
|
|
137
|
+
return (
|
|
138
|
+
<div className="flex flex-col gap-1 pb-2">
|
|
139
|
+
<div className="flex justify-between text-xs text-muted-foreground">
|
|
140
|
+
<span>{progress < 100 ? "Uploading..." : "Done"}</span>
|
|
141
|
+
<span>{progress}%</span>
|
|
142
|
+
</div>
|
|
143
|
+
<div className="h-1.5 rounded-full bg-muted overflow-hidden">
|
|
144
|
+
<div className="h-full rounded-full bg-primary transition-all" style={{ width: `${progress}%` }} />
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
157
148
|
};
|
|
158
149
|
|
|
159
|
-
<FileUpload files={files} onDrop={setFiles} File={ProgressRow} multiple
|
|
150
|
+
<FileUpload files={files} onDrop={setFiles} File={ProgressRow} multiple />;
|
|
160
151
|
```
|
|
161
152
|
|
|
162
153
|
### Inside a form
|
|
@@ -166,28 +157,30 @@ import { Form } from "@g4rcez/components/form";
|
|
|
166
157
|
import { Button } from "@g4rcez/components/button";
|
|
167
158
|
|
|
168
159
|
function SubmissionForm() {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
160
|
+
const [attachments, setAttachments] = useState<File[]>([]);
|
|
161
|
+
|
|
162
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
163
|
+
const data = new FormData(e.currentTarget);
|
|
164
|
+
attachments.forEach((f) => data.append("attachments", f));
|
|
165
|
+
submitToServer(data);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Form onSubmit={handleSubmit} className="flex flex-col gap-base">
|
|
170
|
+
<FileUpload
|
|
171
|
+
name="attachments"
|
|
172
|
+
files={attachments}
|
|
173
|
+
onDrop={(added) => setAttachments((prev) => [...prev, ...added])}
|
|
174
|
+
onDeleteFile={(f) => setAttachments((prev) => prev.filter((x) => x !== f))}
|
|
175
|
+
accept="image/*,.pdf"
|
|
176
|
+
multiple
|
|
177
|
+
maxSize={10 * 1024 * 1024}
|
|
178
|
+
/>
|
|
179
|
+
<Button theme="primary" type="submit">
|
|
180
|
+
Submit
|
|
181
|
+
</Button>
|
|
182
|
+
</Form>
|
|
183
|
+
);
|
|
191
184
|
}
|
|
192
185
|
```
|
|
193
186
|
|
package/ai/docs/Form.md
CHANGED
|
@@ -21,12 +21,12 @@ import { Form } from "@g4rcez/components/form";
|
|
|
21
21
|
|
|
22
22
|
`Form` accepts all standard HTML `<form>` attributes.
|
|
23
23
|
|
|
24
|
-
| Prop
|
|
25
|
-
|
|
26
|
-
| `onSubmit`
|
|
27
|
-
| `children`
|
|
28
|
-
| `className` | `string`
|
|
29
|
-
| `...props`
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| ----------- | --------------------------------------------------- | ------- | ---------------------------------------------------------------------- |
|
|
26
|
+
| `onSubmit` | `(event: React.FormEvent<HTMLFormElement>) => void` | - | Submit handler. `preventDefault()` is called before this. |
|
|
27
|
+
| `children` | `React.ReactNode` | - | Form fields and other content. |
|
|
28
|
+
| `className` | `string` | - | CSS classes for the `<form>` element. |
|
|
29
|
+
| `...props` | `React.ComponentProps<"form">` | - | All standard form attributes (`action`, `method`, `noValidate`, etc.). |
|
|
30
30
|
|
|
31
31
|
## Design Tokens
|
|
32
32
|
|
|
@@ -42,18 +42,20 @@ import { Input } from "@g4rcez/components/input";
|
|
|
42
42
|
import { Button } from "@g4rcez/components/button";
|
|
43
43
|
|
|
44
44
|
function LoginForm() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
46
|
+
const data = new FormData(e.currentTarget);
|
|
47
|
+
console.log(Object.fromEntries(data));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Form onSubmit={handleSubmit} className="flex flex-col gap-base max-w-sm">
|
|
52
|
+
<Input name="email" type="email" title="Email" required />
|
|
53
|
+
<Input name="password" type="password" title="Password" required />
|
|
54
|
+
<Button theme="primary" type="submit">
|
|
55
|
+
Log in
|
|
56
|
+
</Button>
|
|
57
|
+
</Form>
|
|
58
|
+
);
|
|
57
59
|
}
|
|
58
60
|
```
|
|
59
61
|
|
|
@@ -61,26 +63,30 @@ function LoginForm() {
|
|
|
61
63
|
|
|
62
64
|
```tsx
|
|
63
65
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const formData = new FormData(e.currentTarget);
|
|
67
|
+
const payload = Object.fromEntries(formData);
|
|
68
|
+
await fetch("/api/contact", { method: "POST", body: JSON.stringify(payload) });
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
<Form onSubmit={handleSubmit} className="flex flex-col gap-base">
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
<Input name="name" title="Name" required />
|
|
73
|
+
<Input name="message" title="Message" />
|
|
74
|
+
<Button theme="primary" type="submit">
|
|
75
|
+
Send
|
|
76
|
+
</Button>
|
|
77
|
+
</Form>;
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
### Multi-column layout
|
|
77
81
|
|
|
78
82
|
```tsx
|
|
79
83
|
<Form className="grid grid-cols-2 gap-base max-w-2xl">
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
<Input name="firstName" title="First name" required />
|
|
85
|
+
<Input name="lastName" title="Last name" required />
|
|
86
|
+
<Input name="email" type="email" title="Email" container="col-span-2" required />
|
|
87
|
+
<Button type="submit" theme="primary" container="col-start-2">
|
|
88
|
+
Save
|
|
89
|
+
</Button>
|
|
84
90
|
</Form>
|
|
85
91
|
```
|
|
86
92
|
|
package/ai/docs/FormReset.md
CHANGED
|
@@ -20,14 +20,14 @@ import { formReset } from "@g4rcez/components";
|
|
|
20
20
|
## Signature
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
-
function formReset(form?: HTMLFormElement | null): void
|
|
23
|
+
function formReset(form?: HTMLFormElement | null): void;
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Parameters
|
|
27
27
|
|
|
28
|
-
| Parameter | Type
|
|
29
|
-
|
|
30
|
-
| `form`
|
|
28
|
+
| Parameter | Type | Description |
|
|
29
|
+
| --------- | -------------------------------------- | ------------------------------------------------------------------ |
|
|
30
|
+
| `form` | `HTMLFormElement \| null \| undefined` | The form element to reset. Safely no-ops if `null` or `undefined`. |
|
|
31
31
|
|
|
32
32
|
## How It Works
|
|
33
33
|
|
|
@@ -48,21 +48,23 @@ import { Button } from "@g4rcez/components/button";
|
|
|
48
48
|
import { formReset } from "@g4rcez/components";
|
|
49
49
|
|
|
50
50
|
function ContactForm() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
const formRef = useRef<HTMLFormElement>(null);
|
|
52
|
+
|
|
53
|
+
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
54
|
+
const data = new FormData(e.currentTarget);
|
|
55
|
+
await submitToServer(Object.fromEntries(data));
|
|
56
|
+
formReset(formRef.current);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Form ref={formRef} onSubmit={handleSubmit} className="flex flex-col gap-base">
|
|
61
|
+
<Input name="name" title="Name" required />
|
|
62
|
+
<Input name="email" type="email" title="Email" required />
|
|
63
|
+
<Button theme="primary" type="submit">
|
|
64
|
+
Send
|
|
65
|
+
</Button>
|
|
66
|
+
</Form>
|
|
67
|
+
);
|
|
66
68
|
}
|
|
67
69
|
```
|
|
68
70
|
|
|
@@ -70,24 +72,22 @@ function ContactForm() {
|
|
|
70
72
|
|
|
71
73
|
```tsx
|
|
72
74
|
function EditForm({ defaultValues }: { defaultValues: Record<string, string> }) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</
|
|
88
|
-
|
|
89
|
-
</Form>
|
|
90
|
-
);
|
|
75
|
+
const formRef = useRef<HTMLFormElement>(null);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Form ref={formRef} onSubmit={handleSave} className="flex flex-col gap-base">
|
|
79
|
+
<Input name="title" title="Title" defaultValue={defaultValues.title} />
|
|
80
|
+
<Input name="description" title="Description" defaultValue={defaultValues.description} />
|
|
81
|
+
<div className="flex gap-sm">
|
|
82
|
+
<Button theme="primary" type="submit">
|
|
83
|
+
Save
|
|
84
|
+
</Button>
|
|
85
|
+
<Button theme="ghost" type="button" onClick={() => formReset(formRef.current)}>
|
|
86
|
+
Cancel
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</Form>
|
|
90
|
+
);
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
package/ai/docs/Heading.md
CHANGED
|
@@ -19,9 +19,9 @@ import { Heading } from "@g4rcez/components";
|
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
21
|
|
|
22
|
-
| Prop
|
|
23
|
-
|
|
24
|
-
| `children` | `React.ReactNode` | -
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
| ---------- | ----------------- | ------- | -------------------------- |
|
|
24
|
+
| `children` | `React.ReactNode` | - | The content of the heading |
|
|
25
25
|
|
|
26
26
|
## Design Tokens
|
|
27
27
|
|
|
@@ -54,9 +54,7 @@ import { Polymorph } from "@g4rcez/components";
|
|
|
54
54
|
### Applying Typography Styles
|
|
55
55
|
|
|
56
56
|
```tsx
|
|
57
|
-
<Heading className="text-2xl font-bold text-foreground">
|
|
58
|
-
Dashboard Overview
|
|
59
|
-
</Heading>
|
|
57
|
+
<Heading className="text-2xl font-bold text-foreground">Dashboard Overview</Heading>
|
|
60
58
|
```
|
|
61
59
|
|
|
62
60
|
## Do
|