@g4rcez/components 4.0.2 → 4.1.1
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.js +10 -10
- package/dist/components/core/button.js.map +1 -1
- package/dist/components/core/tag.js +4 -4
- package/dist/components/core/tag.js.map +1 -1
- package/dist/components/display/alert.js +48 -46
- package/dist/components/display/alert.js.map +1 -1
- package/dist/components/display/calendar.js +6 -6
- package/dist/components/display/card.js +2 -2
- package/dist/components/display/card.js.map +1 -1
- package/dist/components/display/list.js +1 -1
- package/dist/components/display/list.js.map +1 -1
- package/dist/components/display/notifications.js +3 -3
- package/dist/components/display/stats.js +1 -1
- package/dist/components/display/tabs.js +2 -2
- package/dist/components/display/timeline.js +1 -1
- package/dist/components/floating/dropdown.js +25 -17
- package/dist/components/floating/dropdown.js.map +1 -1
- package/dist/components/floating/expand.js +7 -7
- package/dist/components/floating/expand.js.map +1 -1
- package/dist/components/floating/menu.js +10 -10
- package/dist/components/floating/menu.js.map +1 -1
- package/dist/components/floating/modal.js +106 -102
- package/dist/components/floating/modal.js.map +1 -1
- package/dist/components/floating/tooltip.js +14 -14
- package/dist/components/floating/tooltip.js.map +1 -1
- package/dist/components/form/autocomplete.js +6 -6
- package/dist/components/form/checkbox.js +1 -1
- package/dist/components/form/date-picker.js +5 -5
- package/dist/components/form/file-upload.js +2 -2
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/input.js +1 -1
- package/dist/components/form/radiobox.js +1 -1
- package/dist/components/form/select.js +3 -3
- package/dist/components/form/switch.js +2 -2
- package/dist/components/form/switch.js.map +1 -1
- package/dist/components/table/table.js +3 -3
- 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/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 +2810 -2756
- 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/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/{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/core/button.d.ts +0 -77
- package/dist/components/core/button.d.ts.map +0 -1
- package/dist/components/core/heading.d.ts +0 -3
- package/dist/components/core/heading.d.ts.map +0 -1
- package/dist/components/core/polymorph.d.ts +0 -10
- package/dist/components/core/polymorph.d.ts.map +0 -1
- package/dist/components/core/render-on-view.d.ts +0 -7
- package/dist/components/core/render-on-view.d.ts.map +0 -1
- package/dist/components/core/resizable.d.ts +0 -3
- package/dist/components/core/resizable.d.ts.map +0 -1
- package/dist/components/core/slot.d.ts +0 -16
- package/dist/components/core/slot.d.ts.map +0 -1
- package/dist/components/core/tag.d.ts +0 -35
- package/dist/components/core/tag.d.ts.map +0 -1
- package/dist/components/core/typography.d.ts +0 -25
- package/dist/components/core/typography.d.ts.map +0 -1
- package/dist/components/display/alert.d.ts +0 -28
- package/dist/components/display/alert.d.ts.map +0 -1
- package/dist/components/display/calendar.d.ts +0 -42
- package/dist/components/display/calendar.d.ts.map +0 -1
- package/dist/components/display/card.d.ts +0 -29
- package/dist/components/display/card.d.ts.map +0 -1
- package/dist/components/display/empty.d.ts +0 -8
- package/dist/components/display/empty.d.ts.map +0 -1
- package/dist/components/display/list.d.ts +0 -16
- package/dist/components/display/list.d.ts.map +0 -1
- package/dist/components/display/notifications.d.ts +0 -27
- package/dist/components/display/notifications.d.ts.map +0 -1
- package/dist/components/display/progress.d.ts +0 -13
- package/dist/components/display/progress.d.ts.map +0 -1
- package/dist/components/display/shortcut.d.ts +0 -4
- package/dist/components/display/shortcut.d.ts.map +0 -1
- package/dist/components/display/skeleton.d.ts +0 -12
- package/dist/components/display/skeleton.d.ts.map +0 -1
- package/dist/components/display/spinner.d.ts +0 -5
- package/dist/components/display/spinner.d.ts.map +0 -1
- package/dist/components/display/stats.d.ts +0 -12
- package/dist/components/display/stats.d.ts.map +0 -1
- package/dist/components/display/step.d.ts +0 -24
- package/dist/components/display/step.d.ts.map +0 -1
- package/dist/components/display/tabs.d.ts +0 -24
- package/dist/components/display/tabs.d.ts.map +0 -1
- package/dist/components/display/timeline.d.ts +0 -10
- package/dist/components/display/timeline.d.ts.map +0 -1
- package/dist/components/floating/command-palette.d.ts +0 -49
- package/dist/components/floating/command-palette.d.ts.map +0 -1
- package/dist/components/floating/dropdown.d.ts +0 -15
- package/dist/components/floating/dropdown.d.ts.map +0 -1
- package/dist/components/floating/expand.d.ts +0 -11
- package/dist/components/floating/expand.d.ts.map +0 -1
- package/dist/components/floating/menu.d.ts +0 -52
- package/dist/components/floating/menu.d.ts.map +0 -1
- package/dist/components/floating/modal.d.ts +0 -60
- package/dist/components/floating/modal.d.ts.map +0 -1
- package/dist/components/floating/toolbar.d.ts +0 -6
- package/dist/components/floating/toolbar.d.ts.map +0 -1
- package/dist/components/floating/tooltip.d.ts +0 -17
- package/dist/components/floating/tooltip.d.ts.map +0 -1
- package/dist/components/floating/wizard.d.ts +0 -26
- package/dist/components/floating/wizard.d.ts.map +0 -1
- package/dist/components/form/autocomplete.d.ts +0 -16
- package/dist/components/form/autocomplete.d.ts.map +0 -1
- package/dist/components/form/checkbox.d.ts +0 -12
- package/dist/components/form/checkbox.d.ts.map +0 -1
- package/dist/components/form/date-picker.d.ts +0 -10
- package/dist/components/form/date-picker.d.ts.map +0 -1
- package/dist/components/form/file-upload.d.ts +0 -15
- package/dist/components/form/file-upload.d.ts.map +0 -1
- package/dist/components/form/form.d.ts +0 -3
- package/dist/components/form/form.d.ts.map +0 -1
- package/dist/components/form/formReset.d.ts +0 -2
- package/dist/components/form/formReset.d.ts.map +0 -1
- package/dist/components/form/free-text.d.ts +0 -11
- package/dist/components/form/free-text.d.ts.map +0 -1
- package/dist/components/form/input-field.d.ts +0 -34
- package/dist/components/form/input-field.d.ts.map +0 -1
- package/dist/components/form/input.d.ts +0 -52
- package/dist/components/form/input.d.ts.map +0 -1
- package/dist/components/form/multi-select.d.ts +0 -19
- package/dist/components/form/multi-select.d.ts.map +0 -1
- package/dist/components/form/radiobox.d.ts +0 -7
- package/dist/components/form/radiobox.d.ts.map +0 -1
- package/dist/components/form/select.d.ts +0 -13
- package/dist/components/form/select.d.ts.map +0 -1
- package/dist/components/form/slider.d.ts +0 -7
- package/dist/components/form/slider.d.ts.map +0 -1
- package/dist/components/form/switch.d.ts +0 -9
- package/dist/components/form/switch.d.ts.map +0 -1
- package/dist/components/form/task-list.d.ts +0 -3
- package/dist/components/form/task-list.d.ts.map +0 -1
- package/dist/components/form/textarea.d.ts +0 -6
- package/dist/components/form/textarea.d.ts.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/components/index.d.ts +0 -46
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/page-calendar/calendar-header.d.ts +0 -16
- package/dist/components/page-calendar/calendar-header.d.ts.map +0 -1
- package/dist/components/page-calendar/day-view.d.ts +0 -12
- package/dist/components/page-calendar/day-view.d.ts.map +0 -1
- package/dist/components/page-calendar/event-pill.d.ts +0 -9
- package/dist/components/page-calendar/event-pill.d.ts.map +0 -1
- package/dist/components/page-calendar/index.d.ts +0 -4
- package/dist/components/page-calendar/index.d.ts.map +0 -1
- package/dist/components/page-calendar/month-view.d.ts +0 -11
- package/dist/components/page-calendar/month-view.d.ts.map +0 -1
- package/dist/components/page-calendar/page-calendar.d.ts +0 -18
- package/dist/components/page-calendar/page-calendar.d.ts.map +0 -1
- package/dist/components/page-calendar/page-calendar.types.d.ts +0 -18
- package/dist/components/page-calendar/page-calendar.types.d.ts.map +0 -1
- package/dist/components/page-calendar/page-calendar.utils.d.ts +0 -24
- package/dist/components/page-calendar/page-calendar.utils.d.ts.map +0 -1
- package/dist/components/page-calendar/week-view.d.ts +0 -11
- package/dist/components/page-calendar/week-view.d.ts.map +0 -1
- package/dist/components/table/filter.d.ts +0 -42
- package/dist/components/table/filter.d.ts.map +0 -1
- package/dist/components/table/group.d.ts +0 -17
- package/dist/components/table/group.d.ts.map +0 -1
- package/dist/components/table/index.d.ts +0 -20
- package/dist/components/table/index.d.ts.map +0 -1
- package/dist/components/table/inner-table.d.ts +0 -29
- package/dist/components/table/inner-table.d.ts.map +0 -1
- package/dist/components/table/metadata.d.ts +0 -4
- package/dist/components/table/metadata.d.ts.map +0 -1
- package/dist/components/table/pagination.d.ts +0 -3
- package/dist/components/table/pagination.d.ts.map +0 -1
- package/dist/components/table/row.d.ts +0 -12
- package/dist/components/table/row.d.ts.map +0 -1
- package/dist/components/table/sort.d.ts +0 -28
- package/dist/components/table/sort.d.ts.map +0 -1
- package/dist/components/table/table-lib.d.ts +0 -135
- package/dist/components/table/table-lib.d.ts.map +0 -1
- package/dist/components/table/table.context.d.ts +0 -10
- package/dist/components/table/table.context.d.ts.map +0 -1
- package/dist/components/table/thead.d.ts +0 -9
- package/dist/components/table/thead.d.ts.map +0 -1
- package/dist/config/context.d.ts +0 -21
- package/dist/config/context.d.ts.map +0 -1
- package/dist/config/default-translations.d.ts +0 -90
- package/dist/config/default-translations.d.ts.map +0 -1
- package/dist/config/default-tweaks.d.ts +0 -13
- package/dist/config/default-tweaks.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.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/hooks/use-click-outside.d.ts +0 -3
- package/dist/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/hooks/use-color-parser.d.ts +0 -2
- package/dist/hooks/use-color-parser.d.ts.map +0 -1
- package/dist/hooks/use-components-provider.d.ts +0 -15
- package/dist/hooks/use-components-provider.d.ts.map +0 -1
- package/dist/hooks/use-debounce.d.ts +0 -5
- package/dist/hooks/use-debounce.d.ts.map +0 -1
- package/dist/hooks/use-floating-ref.d.ts +0 -2
- package/dist/hooks/use-floating-ref.d.ts.map +0 -1
- package/dist/hooks/use-form.d.ts +0 -394
- package/dist/hooks/use-form.d.ts.map +0 -1
- package/dist/hooks/use-hover.d.ts +0 -3
- package/dist/hooks/use-hover.d.ts.map +0 -1
- package/dist/hooks/use-input-id.d.ts +0 -4
- package/dist/hooks/use-input-id.d.ts.map +0 -1
- package/dist/hooks/use-is-coarse-device.d.ts +0 -2
- package/dist/hooks/use-is-coarse-device.d.ts.map +0 -1
- package/dist/hooks/use-locale.d.ts +0 -3
- package/dist/hooks/use-locale.d.ts.map +0 -1
- package/dist/hooks/use-media-query.d.ts +0 -2
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-on-event.d.ts +0 -4
- package/dist/hooks/use-on-event.d.ts.map +0 -1
- package/dist/hooks/use-parent.d.ts +0 -3
- package/dist/hooks/use-parent.d.ts.map +0 -1
- package/dist/hooks/use-preferences.d.ts +0 -2
- package/dist/hooks/use-preferences.d.ts.map +0 -1
- package/dist/hooks/use-previous.d.ts +0 -2
- package/dist/hooks/use-previous.d.ts.map +0 -1
- package/dist/hooks/use-reactive.d.ts +0 -2
- package/dist/hooks/use-reactive.d.ts.map +0 -1
- package/dist/hooks/use-remove-scroll.d.ts +0 -4
- package/dist/hooks/use-remove-scroll.d.ts.map +0 -1
- package/dist/hooks/use-resize-observer.d.ts +0 -2
- package/dist/hooks/use-resize-observer.d.ts.map +0 -1
- package/dist/hooks/use-stable-ref.d.ts +0 -2
- package/dist/hooks/use-stable-ref.d.ts.map +0 -1
- package/dist/hooks/use-swipe.d.ts +0 -8
- package/dist/hooks/use-swipe.d.ts.map +0 -1
- package/dist/hooks/use-translations.d.ts +0 -88
- package/dist/hooks/use-translations.d.ts.map +0 -1
- package/dist/hooks/use-tweaks.d.ts +0 -3
- package/dist/hooks/use-tweaks.d.ts.map +0 -1
- package/dist/hooks/use-window-size.d.ts +0 -5
- package/dist/hooks/use-window-size.d.ts.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/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/input-CrGrSnUt.js.map +0 -1
- package/dist/input-field-5vYcz5tT.js.map +0 -1
- package/dist/lib/combi-keys.d.ts +0 -15
- package/dist/lib/combi-keys.d.ts.map +0 -1
- package/dist/lib/dict.d.ts +0 -12
- package/dist/lib/dict.d.ts.map +0 -1
- package/dist/lib/dom.d.ts +0 -19
- package/dist/lib/dom.d.ts.map +0 -1
- package/dist/lib/fns.d.ts +0 -11
- package/dist/lib/fns.d.ts.map +0 -1
- package/dist/lib/fzf.d.ts +0 -16
- package/dist/lib/fzf.d.ts.map +0 -1
- package/dist/lib/keyboard-area.d.ts +0 -16
- package/dist/lib/keyboard-area.d.ts.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/types.d.ts +0 -26
- package/dist/types.d.ts.map +0 -1
- package/dist/use-translations-BwLKTrZv.js +0 -10
- package/dist/use-translations-BwLKTrZv.js.map +0 -1
package/ai/docs/Calendar.md
CHANGED
|
@@ -20,39 +20,39 @@ import type { Range, Locales } from "@g4rcez/components/calendar";
|
|
|
20
20
|
|
|
21
21
|
## Props
|
|
22
22
|
|
|
23
|
-
| Prop
|
|
24
|
-
|
|
25
|
-
| `date`
|
|
26
|
-
| `range`
|
|
27
|
-
| `rangeMode`
|
|
28
|
-
| `markRange`
|
|
29
|
-
| `markToday`
|
|
30
|
-
| `type`
|
|
31
|
-
| `datetimeTitle`
|
|
32
|
-
| `onChange`
|
|
33
|
-
| `changeOnlyOnClick` | `boolean`
|
|
34
|
-
| `onChangeYear`
|
|
35
|
-
| `onChangeMonth`
|
|
36
|
-
| `disabledDate`
|
|
37
|
-
| `RenderOnDay`
|
|
38
|
-
| `locale`
|
|
39
|
-
| `labelRange`
|
|
40
|
-
| `styles`
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| ------------------- | ------------------------------- | -------- | --------------------------------------------------------------------- |
|
|
25
|
+
| `date` | `Date` | — | Selected date (single-date mode) |
|
|
26
|
+
| `range` | `Range` | — | Selected range `{ from?: Date; to?: Date }` |
|
|
27
|
+
| `rangeMode` | `boolean` | `false` | Enable range selection mode |
|
|
28
|
+
| `markRange` | `boolean` | `true` | Visually highlight dates inside a range |
|
|
29
|
+
| `markToday` | `boolean` | `true` | Emphasize today's date |
|
|
30
|
+
| `type` | `"date" \| "datetime"` | `"date"` | Show an additional time input when `"datetime"` |
|
|
31
|
+
| `datetimeTitle` | `string` | — | Label for the time input in `"datetime"` mode |
|
|
32
|
+
| `onChange` | `OnChangeDate \| OnChangeRange` | — | Called when a date or range changes |
|
|
33
|
+
| `changeOnlyOnClick` | `boolean` | `false` | Suppress onChange on keyboard navigation; fire only on explicit click |
|
|
34
|
+
| `onChangeYear` | `(date: Date) => void` | — | Called when the year changes |
|
|
35
|
+
| `onChangeMonth` | `(date: Date) => void` | — | Called when the month changes |
|
|
36
|
+
| `disabledDate` | `(date: Date) => boolean` | — | Return `true` to disable a specific date |
|
|
37
|
+
| `RenderOnDay` | `React.FC<{ date: Date }>` | — | Custom renderer overlaid on each day cell |
|
|
38
|
+
| `locale` | `Locales` | — | BCP 47 locale string for month/weekday labels |
|
|
39
|
+
| `labelRange` | `{ from: string; to: string }` | — | Labels shown on the selected range endpoints |
|
|
40
|
+
| `styles` | `CalendarStyles` | — | Fine-grained class overrides per calendar section |
|
|
41
41
|
|
|
42
42
|
## Design Tokens
|
|
43
43
|
|
|
44
44
|
Tokens this component reads. Customize by overriding these CSS variables in your theme.
|
|
45
45
|
|
|
46
|
-
| Token
|
|
47
|
-
|
|
48
|
-
| `bg-primary`
|
|
49
|
-
| `text-primary-foreground`
|
|
50
|
-
| `hover:bg-primary`
|
|
51
|
-
| `hover:text-primary-foreground` | `--primary-foreground` | Navigation button hover text
|
|
52
|
-
| `text-primary`
|
|
53
|
-
| `text-disabled`
|
|
54
|
-
| `border-card-border`
|
|
55
|
-
| `text-foreground`
|
|
46
|
+
| Token | CSS Variable | Purpose |
|
|
47
|
+
| ------------------------------- | ---------------------- | ----------------------------------------- |
|
|
48
|
+
| `bg-primary` | `--primary` | Selected day background |
|
|
49
|
+
| `text-primary-foreground` | `--primary-foreground` | Selected day text |
|
|
50
|
+
| `hover:bg-primary` | `--primary` | Navigation button hover background |
|
|
51
|
+
| `hover:text-primary-foreground` | `--primary-foreground` | Navigation button hover text |
|
|
52
|
+
| `text-primary` | `--primary` | "Today" button and year/month hover color |
|
|
53
|
+
| `text-disabled` | `--disabled` | Days outside the current month |
|
|
54
|
+
| `border-card-border` | `--card-border` | Range highlight border |
|
|
55
|
+
| `text-foreground` | `--foreground` | Range endpoint label |
|
|
56
56
|
|
|
57
57
|
## Examples
|
|
58
58
|
|
|
@@ -62,15 +62,9 @@ Tokens this component reads. Customize by overriding these CSS variables in your
|
|
|
62
62
|
import { useState } from "react";
|
|
63
63
|
|
|
64
64
|
function DatePicker() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<Calendar
|
|
69
|
-
date={selectedDate}
|
|
70
|
-
onChange={setSelectedDate}
|
|
71
|
-
markToday
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
65
|
+
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
|
66
|
+
|
|
67
|
+
return <Calendar date={selectedDate} onChange={setSelectedDate} markToday />;
|
|
74
68
|
}
|
|
75
69
|
```
|
|
76
70
|
|
|
@@ -81,17 +75,9 @@ import { useState } from "react";
|
|
|
81
75
|
import { Calendar, type Range } from "@g4rcez/components/calendar";
|
|
82
76
|
|
|
83
77
|
function DateRangePicker() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<Calendar
|
|
88
|
-
range={range}
|
|
89
|
-
rangeMode
|
|
90
|
-
markRange
|
|
91
|
-
onChange={setRange}
|
|
92
|
-
labelRange={{ from: "Start Date", to: "End Date" }}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
78
|
+
const [range, setRange] = useState<Range>({ from: undefined, to: undefined });
|
|
79
|
+
|
|
80
|
+
return <Calendar range={range} rangeMode markRange onChange={setRange} labelRange={{ from: "Start Date", to: "End Date" }} />;
|
|
95
81
|
}
|
|
96
82
|
```
|
|
97
83
|
|
|
@@ -99,44 +85,40 @@ function DateRangePicker() {
|
|
|
99
85
|
|
|
100
86
|
```tsx
|
|
101
87
|
const isPastDate = (date: Date): boolean => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
const today = new Date();
|
|
89
|
+
today.setHours(0, 0, 0, 0);
|
|
90
|
+
return date < today;
|
|
105
91
|
};
|
|
106
92
|
|
|
107
|
-
<Calendar
|
|
108
|
-
date={selectedDate}
|
|
109
|
-
onChange={setSelectedDate}
|
|
110
|
-
disabledDate={isPastDate}
|
|
111
|
-
/>
|
|
93
|
+
<Calendar date={selectedDate} onChange={setSelectedDate} disabledDate={isPastDate} />;
|
|
112
94
|
```
|
|
113
95
|
|
|
114
96
|
### Booking Calendar with Range Restrictions
|
|
115
97
|
|
|
116
98
|
```tsx
|
|
117
99
|
function BookingCalendar() {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
100
|
+
const [bookingRange, setBookingRange] = useState<Range>({});
|
|
101
|
+
|
|
102
|
+
const isDateDisabled = (date: Date): boolean => {
|
|
103
|
+
const today = new Date();
|
|
104
|
+
const minDate = new Date(today);
|
|
105
|
+
minDate.setDate(today.getDate() + 2);
|
|
106
|
+
const maxDate = new Date(today);
|
|
107
|
+
maxDate.setDate(today.getDate() + 90);
|
|
108
|
+
return date < minDate || date > maxDate;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Calendar
|
|
113
|
+
range={bookingRange}
|
|
114
|
+
rangeMode
|
|
115
|
+
markRange
|
|
116
|
+
markToday
|
|
117
|
+
onChange={setBookingRange}
|
|
118
|
+
disabledDate={isDateDisabled}
|
|
119
|
+
labelRange={{ from: "Check-in", to: "Check-out" }}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
140
122
|
}
|
|
141
123
|
```
|
|
142
124
|
|
|
@@ -146,17 +128,10 @@ function BookingCalendar() {
|
|
|
146
128
|
import { Calendar, type Locales } from "@g4rcez/components/calendar";
|
|
147
129
|
|
|
148
130
|
function InternationalCalendar() {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<Calendar
|
|
154
|
-
date={selectedDate}
|
|
155
|
-
onChange={setSelectedDate}
|
|
156
|
-
locale={locale}
|
|
157
|
-
markToday
|
|
158
|
-
/>
|
|
159
|
-
);
|
|
131
|
+
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
|
132
|
+
const [locale, setLocale] = useState<Locales>("en");
|
|
133
|
+
|
|
134
|
+
return <Calendar date={selectedDate} onChange={setSelectedDate} locale={locale} markToday />;
|
|
160
135
|
}
|
|
161
136
|
```
|
|
162
137
|
|
|
@@ -164,20 +139,11 @@ function InternationalCalendar() {
|
|
|
164
139
|
|
|
165
140
|
```tsx
|
|
166
141
|
function EventDot({ date }: { date: Date }) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
170
|
-
return hasEvent ? (
|
|
171
|
-
<span className="absolute bottom-1 left-1/2 -translate-x-1/2 size-1 rounded-full bg-primary" />
|
|
172
|
-
) : null;
|
|
142
|
+
const hasEvent = myEvents.some((e) => e.date.toDateString() === date.toDateString());
|
|
143
|
+
return hasEvent ? <span className="absolute bottom-1 left-1/2 -translate-x-1/2 size-1 rounded-full bg-primary" /> : null;
|
|
173
144
|
}
|
|
174
145
|
|
|
175
|
-
<Calendar
|
|
176
|
-
date={selectedDate}
|
|
177
|
-
onChange={setSelectedDate}
|
|
178
|
-
RenderOnDay={EventDot}
|
|
179
|
-
markToday
|
|
180
|
-
/>
|
|
146
|
+
<Calendar date={selectedDate} onChange={setSelectedDate} RenderOnDay={EventDot} markToday />;
|
|
181
147
|
```
|
|
182
148
|
|
|
183
149
|
## Do
|
package/ai/docs/Card.md
CHANGED
|
@@ -21,40 +21,40 @@ import { Card } from "@g4rcez/components/card";
|
|
|
21
21
|
|
|
22
22
|
### Card
|
|
23
23
|
|
|
24
|
-
| Prop
|
|
25
|
-
|
|
26
|
-
| `title`
|
|
27
|
-
| `loading`
|
|
28
|
-
| `titleClassName` | `string`
|
|
29
|
-
| `header`
|
|
30
|
-
| `container`
|
|
31
|
-
| `as`
|
|
32
|
-
| `className`
|
|
33
|
-
| `children`
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| ---------------- | ---------------------------- | ------- | ------------------------------------------------- |
|
|
26
|
+
| `title` | `React.ReactNode` | — | Renders an automatic header with border separator |
|
|
27
|
+
| `loading` | `boolean` | — | Replaces content with animated skeleton lines |
|
|
28
|
+
| `titleClassName` | `string` | `""` | Additional classes for the title header element |
|
|
29
|
+
| `header` | `React.ReactElement \| null` | `null` | Custom header element; overrides `title` |
|
|
30
|
+
| `container` | `string` | `""` | Additional classes for the outer card element |
|
|
31
|
+
| `as` | `React.ElementType` | `"div"` | Polymorphic root element |
|
|
32
|
+
| `className` | `string` | `""` | Additional classes for the card body element |
|
|
33
|
+
| `children` | `React.ReactNode` | — | Card body content |
|
|
34
34
|
|
|
35
35
|
### Card.Title
|
|
36
36
|
|
|
37
37
|
A composable header with a title and an optional navigation/action area.
|
|
38
38
|
|
|
39
|
-
| Prop
|
|
40
|
-
|
|
41
|
-
| `title`
|
|
42
|
-
| `titleTag` | `React.ElementType`
|
|
43
|
-
| `navTag`
|
|
44
|
-
| `as`
|
|
45
|
-
| `children` | `React.ReactNode`
|
|
39
|
+
| Prop | Type | Default | Description |
|
|
40
|
+
| ---------- | ------------------------------ | ------- | ----------------------------------------------- |
|
|
41
|
+
| `title` | `React.ReactElement \| string` | — | Title content |
|
|
42
|
+
| `titleTag` | `React.ElementType` | `"h2"` | Element type for the title |
|
|
43
|
+
| `navTag` | `React.ElementType` | `"nav"` | Element type for the actions wrapper |
|
|
44
|
+
| `as` | `React.ElementType` | `"div"` | Element type for the container |
|
|
45
|
+
| `children` | `React.ReactNode` | — | Action elements rendered in the navigation area |
|
|
46
46
|
|
|
47
47
|
## Design Tokens
|
|
48
48
|
|
|
49
49
|
Tokens this component reads. Customize by overriding these CSS variables in your theme.
|
|
50
50
|
|
|
51
|
-
| Token
|
|
52
|
-
|
|
53
|
-
| `bg-card-background` | `--card-background` | Card surface color
|
|
54
|
-
| `border-card-border` | `--card-border`
|
|
55
|
-
| `rounded-card`
|
|
56
|
-
| `shadow-shadow-card` | `--shadow-card`
|
|
57
|
-
| `bg-muted`
|
|
51
|
+
| Token | CSS Variable | Purpose |
|
|
52
|
+
| -------------------- | ------------------- | ------------------------------- |
|
|
53
|
+
| `bg-card-background` | `--card-background` | Card surface color |
|
|
54
|
+
| `border-card-border` | `--card-border` | Card border and title separator |
|
|
55
|
+
| `rounded-card` | `--radius-card` | Corner radius |
|
|
56
|
+
| `shadow-shadow-card` | `--shadow-card` | Card drop shadow |
|
|
57
|
+
| `bg-muted` | `--muted` | Skeleton loading lines |
|
|
58
58
|
|
|
59
59
|
## Examples
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ Tokens this component reads. Customize by overriding these CSS variables in your
|
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
64
|
<Card>
|
|
65
|
-
|
|
65
|
+
<p>Card content goes here.</p>
|
|
66
66
|
</Card>
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -70,10 +70,10 @@ Tokens this component reads. Customize by overriding these CSS variables in your
|
|
|
70
70
|
|
|
71
71
|
```tsx
|
|
72
72
|
<Card title="User Profile">
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
<div className="space-y-4">
|
|
74
|
+
<p>Name: John Doe</p>
|
|
75
|
+
<p>Email: john@example.com</p>
|
|
76
|
+
</div>
|
|
77
77
|
</Card>
|
|
78
78
|
```
|
|
79
79
|
|
|
@@ -81,7 +81,7 @@ Tokens this component reads. Customize by overriding these CSS variables in your
|
|
|
81
81
|
|
|
82
82
|
```tsx
|
|
83
83
|
<Card title="Analytics" loading={isLoading}>
|
|
84
|
-
|
|
84
|
+
<p>Loaded content rendered here when not loading.</p>
|
|
85
85
|
</Card>
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -91,26 +91,30 @@ Tokens this component reads. Customize by overriding these CSS variables in your
|
|
|
91
91
|
import { Button } from "@g4rcez/components/button";
|
|
92
92
|
|
|
93
93
|
<Card>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</
|
|
94
|
+
<Card.Title title="Project Overview">
|
|
95
|
+
<Button theme="primary" size="small">
|
|
96
|
+
Edit
|
|
97
|
+
</Button>
|
|
98
|
+
<Button theme="neutral" size="small">
|
|
99
|
+
Share
|
|
100
|
+
</Button>
|
|
101
|
+
</Card.Title>
|
|
102
|
+
|
|
103
|
+
<p>Project description and details.</p>
|
|
104
|
+
</Card>;
|
|
101
105
|
```
|
|
102
106
|
|
|
103
107
|
### Custom Header
|
|
104
108
|
|
|
105
109
|
```tsx
|
|
106
110
|
<Card
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
header={
|
|
112
|
+
<header className="flex justify-between items-center p-4 border-b border-card-border">
|
|
113
|
+
<h2 className="text-foreground font-semibold">Custom Header</h2>
|
|
114
|
+
</header>
|
|
115
|
+
}
|
|
112
116
|
>
|
|
113
|
-
|
|
117
|
+
<p>Content with a completely custom header.</p>
|
|
114
118
|
</Card>
|
|
115
119
|
```
|
|
116
120
|
|
|
@@ -118,17 +122,17 @@ import { Button } from "@g4rcez/components/button";
|
|
|
118
122
|
|
|
119
123
|
```tsx
|
|
120
124
|
<Card title="Dashboard">
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
126
|
+
<Card title="Statistics">
|
|
127
|
+
<p>Chart content here</p>
|
|
128
|
+
</Card>
|
|
129
|
+
<Card title="Recent Activity">
|
|
130
|
+
<ul>
|
|
131
|
+
<li>User logged in</li>
|
|
132
|
+
<li>New order received</li>
|
|
133
|
+
</ul>
|
|
134
|
+
</Card>
|
|
135
|
+
</div>
|
|
132
136
|
</Card>
|
|
133
137
|
```
|
|
134
138
|
|
|
@@ -136,7 +140,7 @@ import { Button } from "@g4rcez/components/button";
|
|
|
136
140
|
|
|
137
141
|
```tsx
|
|
138
142
|
<Card as="article" title="Blog Post">
|
|
139
|
-
|
|
143
|
+
<p>Blog post content.</p>
|
|
140
144
|
</Card>
|
|
141
145
|
```
|
|
142
146
|
|
package/ai/docs/Checkbox.md
CHANGED
|
@@ -19,41 +19,41 @@ import { Checkbox } from "@g4rcez/components/checkbox";
|
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
21
|
|
|
22
|
-
| Prop
|
|
23
|
-
|
|
24
|
-
| `checked`
|
|
25
|
-
| `onChange`
|
|
26
|
-
| `disabled`
|
|
27
|
-
| `loading`
|
|
28
|
-
| `error`
|
|
29
|
-
| `asTask`
|
|
30
|
-
| `size`
|
|
31
|
-
| `container`
|
|
32
|
-
| `labelClassName` | `string`
|
|
33
|
-
| `className`
|
|
34
|
-
| `children`
|
|
35
|
-
| `...props`
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
| ---------------- | -------------------------------------------------- | ---------- | ---------------------------------------------------------- |
|
|
24
|
+
| `checked` | `boolean` | - | Controlled checked state |
|
|
25
|
+
| `onChange` | `(e: React.ChangeEvent<HTMLInputElement>) => void` | - | Change handler |
|
|
26
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
27
|
+
| `loading` | `boolean` | `false` | Loading state — disables the checkbox while loading |
|
|
28
|
+
| `error` | `string` | - | Error message rendered below the label |
|
|
29
|
+
| `asTask` | `boolean` | `false` | Task mode: applies strikethrough to the label when checked |
|
|
30
|
+
| `size` | `"medium" \| "large"` | `"medium"` | Checkbox size |
|
|
31
|
+
| `container` | `string` | - | Extra CSS classes for the outer `<label>` wrapper |
|
|
32
|
+
| `labelClassName` | `string` | - | Extra CSS classes for the error text element |
|
|
33
|
+
| `className` | `string` | - | Extra CSS classes for the `<input>` element |
|
|
34
|
+
| `children` | `React.ReactNode` | - | Label content |
|
|
35
|
+
| `...props` | `React.InputHTMLAttributes<HTMLInputElement>` | - | All standard input attributes |
|
|
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
|
-
| `text-primary`
|
|
44
|
-
| `border-card-border` | `--card-border` | Unchecked border color
|
|
45
|
-
| `text-danger`
|
|
46
|
-
| `text-disabled`
|
|
47
|
-
| `focus:ring-primary` | `--primary`
|
|
41
|
+
| Token | CSS Variable | Purpose |
|
|
42
|
+
| -------------------- | --------------- | ------------------------------------ |
|
|
43
|
+
| `text-primary` | `--primary` | Checkbox accent / checked color |
|
|
44
|
+
| `border-card-border` | `--card-border` | Unchecked border color |
|
|
45
|
+
| `text-danger` | `--danger` | Error message text color |
|
|
46
|
+
| `text-disabled` | `--disabled` | Opacity and cursor on disabled state |
|
|
47
|
+
| `focus:ring-primary` | `--primary` | Focus ring color |
|
|
48
48
|
|
|
49
49
|
## Variants
|
|
50
50
|
|
|
51
51
|
### Size
|
|
52
52
|
|
|
53
|
-
| Value
|
|
54
|
-
|
|
53
|
+
| Value | Description |
|
|
54
|
+
| ---------- | ------------------------------------- |
|
|
55
55
|
| `"medium"` | Default size — 1rem × 1rem (`size-4`) |
|
|
56
|
-
| `"large"`
|
|
56
|
+
| `"large"` | Larger touch target |
|
|
57
57
|
|
|
58
58
|
### Task mode
|
|
59
59
|
|
|
@@ -66,12 +66,9 @@ When `asTask={true}`, the label text receives a strikethrough style when the che
|
|
|
66
66
|
```tsx
|
|
67
67
|
const [accepted, setAccepted] = useState(false);
|
|
68
68
|
|
|
69
|
-
<Checkbox
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
>
|
|
73
|
-
I accept the terms and conditions
|
|
74
|
-
</Checkbox>
|
|
69
|
+
<Checkbox checked={accepted} onChange={(e) => setAccepted(e.target.checked)}>
|
|
70
|
+
I accept the terms and conditions
|
|
71
|
+
</Checkbox>;
|
|
75
72
|
```
|
|
76
73
|
|
|
77
74
|
### Checkbox with error
|
|
@@ -81,41 +78,37 @@ const [agreed, setAgreed] = useState(false);
|
|
|
81
78
|
const [error, setError] = useState("");
|
|
82
79
|
|
|
83
80
|
<Checkbox
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
checked={agreed}
|
|
82
|
+
onChange={(e) => {
|
|
83
|
+
setAgreed(e.target.checked);
|
|
84
|
+
if (e.target.checked) setError("");
|
|
85
|
+
}}
|
|
86
|
+
error={error}
|
|
90
87
|
>
|
|
91
|
-
|
|
92
|
-
</Checkbox
|
|
88
|
+
I agree to the privacy policy
|
|
89
|
+
</Checkbox>;
|
|
93
90
|
```
|
|
94
91
|
|
|
95
92
|
### Task list
|
|
96
93
|
|
|
97
94
|
```tsx
|
|
98
95
|
const [tasks, setTasks] = useState([
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
{ id: 1, text: "Write release notes", done: false },
|
|
97
|
+
{ id: 2, text: "Merge pull request", done: true },
|
|
101
98
|
]);
|
|
102
99
|
|
|
103
100
|
<div className="flex flex-col gap-sm">
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
{task.text}
|
|
116
|
-
</Checkbox>
|
|
117
|
-
))}
|
|
118
|
-
</div>
|
|
101
|
+
{tasks.map((task) => (
|
|
102
|
+
<Checkbox
|
|
103
|
+
key={task.id}
|
|
104
|
+
checked={task.done}
|
|
105
|
+
onChange={() => setTasks((prev) => prev.map((t) => (t.id === task.id ? { ...t, done: !t.done } : t)))}
|
|
106
|
+
asTask
|
|
107
|
+
>
|
|
108
|
+
{task.text}
|
|
109
|
+
</Checkbox>
|
|
110
|
+
))}
|
|
111
|
+
</div>;
|
|
119
112
|
```
|
|
120
113
|
|
|
121
114
|
### Loading state
|
|
@@ -125,41 +118,43 @@ const [loading, setLoading] = useState(false);
|
|
|
125
118
|
const [subscribed, setSubscribed] = useState(false);
|
|
126
119
|
|
|
127
120
|
const handleChange = async (checked: boolean) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
setLoading(true);
|
|
122
|
+
await updateSubscription(checked);
|
|
123
|
+
setSubscribed(checked);
|
|
124
|
+
setLoading(false);
|
|
132
125
|
};
|
|
133
126
|
|
|
134
|
-
<Checkbox
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
loading={loading}
|
|
138
|
-
>
|
|
139
|
-
Subscribe to newsletter
|
|
140
|
-
</Checkbox>
|
|
127
|
+
<Checkbox checked={subscribed} onChange={(e) => handleChange(e.target.checked)} loading={loading}>
|
|
128
|
+
Subscribe to newsletter
|
|
129
|
+
</Checkbox>;
|
|
141
130
|
```
|
|
142
131
|
|
|
143
132
|
### Notification preferences form
|
|
144
133
|
|
|
145
134
|
```tsx
|
|
146
135
|
function PreferencesForm() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
136
|
+
const [prefs, setPrefs] = useState({
|
|
137
|
+
email: false,
|
|
138
|
+
push: true,
|
|
139
|
+
sms: false,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const toggle = (key: keyof typeof prefs) => (e: React.ChangeEvent<HTMLInputElement>) =>
|
|
143
|
+
setPrefs((prev) => ({ ...prev, [key]: e.target.checked }));
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<form className="flex flex-col gap-sm">
|
|
147
|
+
<Checkbox checked={prefs.email} onChange={toggle("email")}>
|
|
148
|
+
Email notifications
|
|
149
|
+
</Checkbox>
|
|
150
|
+
<Checkbox checked={prefs.push} onChange={toggle("push")}>
|
|
151
|
+
Push notifications
|
|
152
|
+
</Checkbox>
|
|
153
|
+
<Checkbox checked={prefs.sms} onChange={toggle("sms")}>
|
|
154
|
+
SMS notifications
|
|
155
|
+
</Checkbox>
|
|
156
|
+
</form>
|
|
157
|
+
);
|
|
163
158
|
}
|
|
164
159
|
```
|
|
165
160
|
|