@grampro/kit 0.0.0-stage → 2.4.0
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/.gbs/skills/gbs-components/SKILL.md +190 -0
- package/.gbs/skills/gbs-components/references/accessibility.md +102 -0
- package/.gbs/skills/gbs-components/references/data-display.md +185 -0
- package/.gbs/skills/gbs-components/references/data-grid.md +116 -0
- package/.gbs/skills/gbs-components/references/forms.md +202 -0
- package/.gbs/skills/gbs-components/references/install.md +211 -0
- package/.gbs/skills/gbs-components/references/overlays.md +206 -0
- package/.gbs/skills/gbs-components/references/pickers.md +83 -0
- package/.gbs/skills/gbs-components/references/styling.md +246 -0
- package/.gbs/skills/gbs-components/references/toaster.md +57 -0
- package/CHANGELOG.md +139 -0
- package/LICENSE +15 -0
- package/README.md +193 -2
- package/index.cjs +1370 -0
- package/package.json +74 -4
- package/schema/passport-v1.schema.json +204 -0
- package/source/components/accordion/README.md +45 -0
- package/source/components/accordion/core/index.ts +2 -0
- package/source/components/accordion/core/open.ts +56 -0
- package/source/components/accordion/core/types.ts +17 -0
- package/source/components/accordion/index.ts +8 -0
- package/source/components/accordion/passport.json +259 -0
- package/source/components/accordion/react/Accordion.tsx +133 -0
- package/source/components/accordion/react/AccordionItem.tsx +120 -0
- package/source/components/accordion/react/context.ts +20 -0
- package/source/components/accordion/react/props.ts +13 -0
- package/source/components/accordion/styles.css +207 -0
- package/source/components/alert/README.md +39 -0
- package/source/components/alert/core/index.ts +2 -0
- package/source/components/alert/core/live.ts +25 -0
- package/source/components/alert/core/types.ts +7 -0
- package/source/components/alert/index.ts +5 -0
- package/source/components/alert/passport.json +250 -0
- package/source/components/alert/react/Alert.tsx +113 -0
- package/source/components/alert/react/icons.tsx +21 -0
- package/source/components/alert/react/locale.ts +5 -0
- package/source/components/alert/react/props.ts +11 -0
- package/source/components/alert/styles.css +154 -0
- package/source/components/avatar/core/identity.ts +103 -0
- package/source/components/avatar/core/index.ts +2 -0
- package/source/components/avatar/core/types.ts +12 -0
- package/source/components/avatar/index.ts +7 -0
- package/source/components/avatar/passport.json +294 -0
- package/source/components/avatar/react/Avatar.tsx +118 -0
- package/source/components/avatar/react/AvatarGroup.tsx +74 -0
- package/source/components/avatar/react/locale.ts +11 -0
- package/source/components/avatar/react/props.ts +6 -0
- package/source/components/avatar/styles.css +225 -0
- package/source/components/badge/README.md +37 -0
- package/source/components/badge/core/count.ts +37 -0
- package/source/components/badge/core/index.ts +2 -0
- package/source/components/badge/core/types.ts +11 -0
- package/source/components/badge/index.ts +7 -0
- package/source/components/badge/passport.json +332 -0
- package/source/components/badge/react/Badge.tsx +89 -0
- package/source/components/badge/react/Tag.tsx +82 -0
- package/source/components/badge/react/locale.ts +5 -0
- package/source/components/badge/react/props.ts +6 -0
- package/source/components/badge/styles.css +203 -0
- package/source/components/breadcrumb/README.md +34 -0
- package/source/components/breadcrumb/core/index.ts +4 -0
- package/source/components/breadcrumb/core/trail.ts +42 -0
- package/source/components/breadcrumb/core/types.ts +20 -0
- package/source/components/breadcrumb/index.ts +5 -0
- package/source/components/breadcrumb/passport.json +243 -0
- package/source/components/breadcrumb/react/Breadcrumb.tsx +177 -0
- package/source/components/breadcrumb/react/locale.ts +6 -0
- package/source/components/breadcrumb/react/props.ts +14 -0
- package/source/components/breadcrumb/styles.css +138 -0
- package/source/components/button/README.md +32 -0
- package/source/components/button/core/index.ts +3 -0
- package/source/components/button/core/state.ts +16 -0
- package/source/components/button/core/types.ts +28 -0
- package/source/components/button/index.ts +5 -0
- package/source/components/button/passport.json +402 -0
- package/source/components/button/passport.manual.json +31 -0
- package/source/components/button/react/Button.tsx +173 -0
- package/source/components/button/react/locale.ts +5 -0
- package/source/components/button/react/props.ts +23 -0
- package/source/components/button/styles.css +232 -0
- package/source/components/card/README.md +60 -0
- package/source/components/card/core/index.ts +4 -0
- package/source/components/card/core/trend.ts +32 -0
- package/source/components/card/core/types.ts +5 -0
- package/source/components/card/index.ts +5 -0
- package/source/components/card/passport.json +337 -0
- package/source/components/card/react/Card.tsx +133 -0
- package/source/components/card/react/Stat.tsx +127 -0
- package/source/components/card/react/props.ts +4 -0
- package/source/components/card/styles.css +230 -0
- package/source/components/checkbox/README.md +36 -0
- package/source/components/checkbox/core/group.ts +30 -0
- package/source/components/checkbox/core/index.ts +3 -0
- package/source/components/checkbox/core/types.ts +17 -0
- package/source/components/checkbox/index.ts +9 -0
- package/source/components/checkbox/passport.json +456 -0
- package/source/components/checkbox/react/Checkbox.tsx +147 -0
- package/source/components/checkbox/react/CheckboxGroup.tsx +149 -0
- package/source/components/checkbox/react/context.ts +16 -0
- package/source/components/checkbox/react/locale.ts +5 -0
- package/source/components/checkbox/react/props.ts +6 -0
- package/source/components/checkbox/styles.css +211 -0
- package/source/components/combobox/README.md +170 -0
- package/source/components/combobox/core/filter.ts +155 -0
- package/source/components/combobox/core/index.ts +16 -0
- package/source/components/combobox/core/types.ts +48 -0
- package/source/components/combobox/core/virtual.ts +67 -0
- package/source/components/combobox/index.ts +13 -0
- package/source/components/combobox/passport.json +456 -0
- package/source/components/combobox/react/Listbox.tsx +310 -0
- package/source/components/combobox/react/MultiSelect.tsx +265 -0
- package/source/components/combobox/react/Popover.tsx +38 -0
- package/source/components/combobox/react/Select.tsx +200 -0
- package/source/components/combobox/react/icons.tsx +11 -0
- package/source/components/combobox/react/locale.ts +16 -0
- package/source/components/combobox/react/props.ts +88 -0
- package/source/components/combobox/react/useCombobox.ts +409 -0
- package/source/components/combobox/styles.css +419 -0
- package/source/components/data-grid/README.md +233 -0
- package/source/components/data-grid/agent/coerce.ts +368 -0
- package/source/components/data-grid/agent/contract.ts +410 -0
- package/source/components/data-grid/agent/dataset.ts +92 -0
- package/source/components/data-grid/agent/engine.ts +470 -0
- package/source/components/data-grid/agent/executors.ts +155 -0
- package/source/components/data-grid/agent/index.ts +79 -0
- package/source/components/data-grid/agent/intent.ts +324 -0
- package/source/components/data-grid/agent/operations.ts +335 -0
- package/source/components/data-grid/agent/validate.ts +630 -0
- package/source/components/data-grid/agent/webmcp.ts +107 -0
- package/source/components/data-grid/core/columnHelper.ts +21 -0
- package/source/components/data-grid/core/columns.ts +288 -0
- package/source/components/data-grid/core/filtering.ts +237 -0
- package/source/components/data-grid/core/grid.ts +638 -0
- package/source/components/data-grid/core/index.ts +14 -0
- package/source/components/data-grid/core/rows.ts +64 -0
- package/source/components/data-grid/core/sorting.ts +133 -0
- package/source/components/data-grid/core/state.ts +82 -0
- package/source/components/data-grid/core/store.ts +52 -0
- package/source/components/data-grid/core/types.ts +302 -0
- package/source/components/data-grid/core/values.ts +98 -0
- package/source/components/data-grid/core/virtual.ts +85 -0
- package/source/components/data-grid/export/csv.ts +32 -0
- package/source/components/data-grid/export/download.ts +12 -0
- package/source/components/data-grid/export/pdf-font.ts +139 -0
- package/source/components/data-grid/export/pdf-writer.ts +113 -0
- package/source/components/data-grid/export/pdf.ts +379 -0
- package/source/components/data-grid/export/table.ts +73 -0
- package/source/components/data-grid/export/xlsx.ts +145 -0
- package/source/components/data-grid/export/zip.ts +87 -0
- package/source/components/data-grid/index.ts +14 -0
- package/source/components/data-grid/passport.json +1051 -0
- package/source/components/data-grid/passport.manual.json +255 -0
- package/source/components/data-grid/react/AskGrid.tsx +164 -0
- package/source/components/data-grid/react/Cell.tsx +282 -0
- package/source/components/data-grid/react/ColumnMenu.tsx +135 -0
- package/source/components/data-grid/react/DataGrid.tsx +335 -0
- package/source/components/data-grid/react/FilterForm.tsx +142 -0
- package/source/components/data-grid/react/HeaderRow.tsx +332 -0
- package/source/components/data-grid/react/Pagination.tsx +107 -0
- package/source/components/data-grid/react/Popover.tsx +35 -0
- package/source/components/data-grid/react/Row.tsx +85 -0
- package/source/components/data-grid/react/Toolbar.tsx +267 -0
- package/source/components/data-grid/react/Viewport.tsx +167 -0
- package/source/components/data-grid/react/context.ts +57 -0
- package/source/components/data-grid/react/hooks.ts +83 -0
- package/source/components/data-grid/react/icons.tsx +45 -0
- package/source/components/data-grid/react/keyboard.ts +110 -0
- package/source/components/data-grid/react/locale.ts +130 -0
- package/source/components/data-grid/styles.css +874 -0
- package/source/components/date-picker/README.md +141 -0
- package/source/components/date-picker/core/calendar.ts +266 -0
- package/source/components/date-picker/core/format.ts +170 -0
- package/source/components/date-picker/core/index.ts +41 -0
- package/source/components/date-picker/core/today.ts +72 -0
- package/source/components/date-picker/core/types.ts +68 -0
- package/source/components/date-picker/index.ts +16 -0
- package/source/components/date-picker/passport.json +407 -0
- package/source/components/date-picker/react/Calendar.tsx +160 -0
- package/source/components/date-picker/react/CalendarPanel.tsx +170 -0
- package/source/components/date-picker/react/DatePicker.tsx +249 -0
- package/source/components/date-picker/react/DateRangePicker.tsx +291 -0
- package/source/components/date-picker/react/MonthYearPanels.tsx +123 -0
- package/source/components/date-picker/react/Popover.tsx +45 -0
- package/source/components/date-picker/react/icons.tsx +15 -0
- package/source/components/date-picker/react/locale.ts +23 -0
- package/source/components/date-picker/react/props.ts +76 -0
- package/source/components/date-picker/react/useDatePicker.ts +557 -0
- package/source/components/date-picker/styles.css +445 -0
- package/source/components/dialog/README.md +39 -0
- package/source/components/dialog/core/api.ts +34 -0
- package/source/components/dialog/core/dialog.ts +11 -0
- package/source/components/dialog/core/index.ts +7 -0
- package/source/components/dialog/core/store.ts +81 -0
- package/source/components/dialog/core/types.ts +59 -0
- package/source/components/dialog/index.ts +7 -0
- package/source/components/dialog/passport.json +344 -0
- package/source/components/dialog/react/Dialog.tsx +279 -0
- package/source/components/dialog/react/DialogHost.tsx +45 -0
- package/source/components/dialog/react/icons.tsx +20 -0
- package/source/components/dialog/react/locale.ts +8 -0
- package/source/components/dialog/react/props.ts +13 -0
- package/source/components/dialog/styles.css +280 -0
- package/source/components/file-uploader/README.md +99 -0
- package/source/components/file-uploader/core/format.ts +79 -0
- package/source/components/file-uploader/core/index.ts +26 -0
- package/source/components/file-uploader/core/store.ts +432 -0
- package/source/components/file-uploader/core/transport.ts +154 -0
- package/source/components/file-uploader/core/types.ts +126 -0
- package/source/components/file-uploader/core/validate.ts +83 -0
- package/source/components/file-uploader/index.ts +7 -0
- package/source/components/file-uploader/passport.json +518 -0
- package/source/components/file-uploader/react/FileRow.tsx +268 -0
- package/source/components/file-uploader/react/FileUploader.tsx +511 -0
- package/source/components/file-uploader/react/icons.tsx +60 -0
- package/source/components/file-uploader/react/locale.ts +33 -0
- package/source/components/file-uploader/react/props.ts +31 -0
- package/source/components/file-uploader/react/useFileUploader.ts +32 -0
- package/source/components/file-uploader/styles.css +394 -0
- package/source/components/input/README.md +44 -0
- package/source/components/input/core/count.ts +5 -0
- package/source/components/input/core/index.ts +11 -0
- package/source/components/input/core/otp.ts +64 -0
- package/source/components/input/core/types.ts +14 -0
- package/source/components/input/index.ts +8 -0
- package/source/components/input/passport.json +536 -0
- package/source/components/input/react/Input.tsx +219 -0
- package/source/components/input/react/OtpInput.tsx +256 -0
- package/source/components/input/react/dom.ts +10 -0
- package/source/components/input/react/icons.tsx +17 -0
- package/source/components/input/react/locale.ts +9 -0
- package/source/components/input/react/props.ts +6 -0
- package/source/components/input/styles.css +295 -0
- package/source/components/menu/README.md +68 -0
- package/source/components/menu/core/index.ts +11 -0
- package/source/components/menu/core/navigation.ts +84 -0
- package/source/components/menu/core/types.ts +32 -0
- package/source/components/menu/index.ts +19 -0
- package/source/components/menu/passport.json +322 -0
- package/source/components/menu/react/Menu.tsx +371 -0
- package/source/components/menu/react/context.ts +31 -0
- package/source/components/menu/react/items.tsx +268 -0
- package/source/components/menu/react/locale.ts +6 -0
- package/source/components/menu/react/props.ts +4 -0
- package/source/components/menu/react/useMenuKeys.ts +124 -0
- package/source/components/menu/styles.css +224 -0
- package/source/components/modal/README.md +51 -0
- package/source/components/modal/core/dismiss.ts +29 -0
- package/source/components/modal/core/index.ts +3 -0
- package/source/components/modal/core/types.ts +27 -0
- package/source/components/modal/index.ts +5 -0
- package/source/components/modal/passport.json +289 -0
- package/source/components/modal/react/Modal.tsx +242 -0
- package/source/components/modal/react/icons.tsx +1 -0
- package/source/components/modal/react/locale.ts +5 -0
- package/source/components/modal/react/props.ts +17 -0
- package/source/components/modal/styles.css +241 -0
- package/source/components/number-input/README.md +53 -0
- package/source/components/number-input/core/format.ts +37 -0
- package/source/components/number-input/core/index.ts +4 -0
- package/source/components/number-input/core/parse.ts +118 -0
- package/source/components/number-input/core/step.ts +73 -0
- package/source/components/number-input/core/types.ts +32 -0
- package/source/components/number-input/index.ts +5 -0
- package/source/components/number-input/passport.json +541 -0
- package/source/components/number-input/react/NumberInput.tsx +465 -0
- package/source/components/number-input/react/icons.tsx +17 -0
- package/source/components/number-input/react/locale.ts +7 -0
- package/source/components/number-input/react/props.ts +11 -0
- package/source/components/number-input/styles.css +230 -0
- package/source/components/popover/README.md +44 -0
- package/source/components/popover/core/index.ts +2 -0
- package/source/components/popover/core/types.ts +12 -0
- package/source/components/popover/index.ts +4 -0
- package/source/components/popover/passport.json +238 -0
- package/source/components/popover/react/Popover.tsx +202 -0
- package/source/components/popover/react/locale.ts +5 -0
- package/source/components/popover/react/props.ts +4 -0
- package/source/components/popover/styles.css +148 -0
- package/source/components/progress/README.md +38 -0
- package/source/components/progress/core/index.ts +2 -0
- package/source/components/progress/core/progress.ts +40 -0
- package/source/components/progress/core/types.ts +23 -0
- package/source/components/progress/index.ts +7 -0
- package/source/components/progress/passport.json +270 -0
- package/source/components/progress/react/CircularProgress.tsx +106 -0
- package/source/components/progress/react/Progress.tsx +113 -0
- package/source/components/progress/react/locale.ts +7 -0
- package/source/components/progress/react/props.ts +6 -0
- package/source/components/progress/styles.css +200 -0
- package/source/components/radio-group/README.md +58 -0
- package/source/components/radio-group/core/group.ts +36 -0
- package/source/components/radio-group/core/index.ts +2 -0
- package/source/components/radio-group/core/types.ts +20 -0
- package/source/components/radio-group/index.ts +9 -0
- package/source/components/radio-group/passport.json +477 -0
- package/source/components/radio-group/react/Radio.tsx +144 -0
- package/source/components/radio-group/react/RadioGroup.tsx +179 -0
- package/source/components/radio-group/react/context.ts +18 -0
- package/source/components/radio-group/react/locale.ts +5 -0
- package/source/components/radio-group/react/props.ts +12 -0
- package/source/components/radio-group/styles.css +269 -0
- package/source/components/shared/README.md +54 -0
- package/source/components/shared/core/agent/adapter.ts +65 -0
- package/source/components/shared/core/agent/history.ts +120 -0
- package/source/components/shared/core/agent/index.ts +46 -0
- package/source/components/shared/core/agent/numbers.ts +217 -0
- package/source/components/shared/core/agent/schema.ts +180 -0
- package/source/components/shared/core/agent/types.ts +169 -0
- package/source/components/shared/core/agent/webmcp.ts +328 -0
- package/source/components/shared/core/cx.ts +9 -0
- package/source/components/shared/core/field.ts +35 -0
- package/source/components/shared/core/position.ts +124 -0
- package/source/components/shared/core/text.ts +14 -0
- package/source/components/shared/index.ts +17 -0
- package/source/components/shared/react/GramproAIProvider.tsx +50 -0
- package/source/components/shared/react/Popover.tsx +189 -0
- package/source/components/shared/react/icons.tsx +74 -0
- package/source/components/shared/react/useAskAgent.ts +217 -0
- package/source/components/shared/react/useControllableState.ts +42 -0
- package/source/components/shared/styles.css +79 -0
- package/source/components/shared/version.json +4 -0
- package/source/components/shared/version.ts +6 -0
- package/source/components/skeleton/README.md +58 -0
- package/source/components/skeleton/core/index.ts +3 -0
- package/source/components/skeleton/core/lines.ts +25 -0
- package/source/components/skeleton/core/types.ts +5 -0
- package/source/components/skeleton/index.ts +5 -0
- package/source/components/skeleton/passport.json +251 -0
- package/source/components/skeleton/react/Empty.tsx +51 -0
- package/source/components/skeleton/react/Skeleton.tsx +92 -0
- package/source/components/skeleton/react/props.ts +4 -0
- package/source/components/skeleton/styles.css +185 -0
- package/source/components/spinner/README.md +29 -0
- package/source/components/spinner/core/index.ts +3 -0
- package/source/components/spinner/core/types.ts +28 -0
- package/source/components/spinner/core/visibility.ts +34 -0
- package/source/components/spinner/index.ts +6 -0
- package/source/components/spinner/passport.json +245 -0
- package/source/components/spinner/react/Spinner.tsx +96 -0
- package/source/components/spinner/react/locale.ts +5 -0
- package/source/components/spinner/react/props.ts +4 -0
- package/source/components/spinner/react/useDelayedLoading.ts +39 -0
- package/source/components/spinner/styles.css +173 -0
- package/source/components/switch/README.md +46 -0
- package/source/components/switch/core/index.ts +2 -0
- package/source/components/switch/core/toggle.ts +54 -0
- package/source/components/switch/core/types.ts +9 -0
- package/source/components/switch/index.ts +5 -0
- package/source/components/switch/passport.json +421 -0
- package/source/components/switch/react/Switch.tsx +219 -0
- package/source/components/switch/react/locale.ts +5 -0
- package/source/components/switch/react/props.ts +12 -0
- package/source/components/switch/styles.css +227 -0
- package/source/components/tabs/README.md +32 -0
- package/source/components/tabs/core/index.ts +3 -0
- package/source/components/tabs/core/navigation.ts +54 -0
- package/source/components/tabs/core/types.ts +16 -0
- package/source/components/tabs/index.ts +5 -0
- package/source/components/tabs/passport.json +315 -0
- package/source/components/tabs/react/Tabs.tsx +306 -0
- package/source/components/tabs/react/context.ts +21 -0
- package/source/components/tabs/styles.css +263 -0
- package/source/components/textarea/README.md +39 -0
- package/source/components/textarea/core/count.ts +5 -0
- package/source/components/textarea/core/index.ts +4 -0
- package/source/components/textarea/core/size.ts +23 -0
- package/source/components/textarea/core/types.ts +17 -0
- package/source/components/textarea/index.ts +5 -0
- package/source/components/textarea/passport.json +382 -0
- package/source/components/textarea/react/Textarea.tsx +208 -0
- package/source/components/textarea/react/locale.ts +5 -0
- package/source/components/textarea/react/props.ts +4 -0
- package/source/components/textarea/styles.css +158 -0
- package/source/components/toaster/README.md +128 -0
- package/source/components/toaster/core/api.ts +87 -0
- package/source/components/toaster/core/index.ts +14 -0
- package/source/components/toaster/core/store.ts +211 -0
- package/source/components/toaster/core/toast.ts +12 -0
- package/source/components/toaster/core/types.ts +78 -0
- package/source/components/toaster/index.ts +6 -0
- package/source/components/toaster/passport.json +221 -0
- package/source/components/toaster/react/ToastItem.tsx +164 -0
- package/source/components/toaster/react/Toaster.tsx +187 -0
- package/source/components/toaster/react/icons.tsx +23 -0
- package/source/components/toaster/react/locale.ts +6 -0
- package/source/components/toaster/react/props.ts +15 -0
- package/source/components/toaster/react/useToasts.ts +11 -0
- package/source/components/toaster/styles.css +282 -0
- package/source/components/tooltip/README.md +43 -0
- package/source/components/tooltip/core/index.ts +4 -0
- package/source/components/tooltip/core/types.ts +4 -0
- package/source/components/tooltip/core/visibility.ts +34 -0
- package/source/components/tooltip/index.ts +3 -0
- package/source/components/tooltip/passport.json +170 -0
- package/source/components/tooltip/react/Tooltip.tsx +196 -0
- package/source/components/tooltip/react/props.ts +4 -0
- package/source/components/tooltip/styles.css +71 -0
- package/source/fallback/index.tsx +11 -0
- package/source/globalStyle.ts +74 -0
- package/source/hooks/SelectionHooks/type.ts +4 -0
- package/source/hooks/SelectionHooks/useClickOutside.ts +22 -0
- package/source/hooks/SelectionHooks/useMultiSelectState.ts +64 -0
- package/source/hooks/SelectionHooks/useSelectData.ts +58 -0
- package/source/hooks/SelectionHooks/useSelectState.ts +36 -0
- package/source/icon/Icon.tsx +102 -0
- package/source/icon/iconPaths.ts +206 -0
- package/source/legacy-components/bargraph/index.tsx +95 -0
- package/source/legacy-components/bargraph/type.ts +12 -0
- package/source/legacy-components/breadcrumb/index.tsx +66 -0
- package/source/legacy-components/breadcrumb/types.ts +10 -0
- package/source/legacy-components/button/index.tsx +42 -0
- package/source/legacy-components/card/index.tsx +31 -0
- package/source/legacy-components/checkbox/index.tsx +25 -0
- package/source/legacy-components/contextmenu/ContextMenu.tsx +87 -0
- package/source/legacy-components/contextmenu/ContextMenuItem.tsx +30 -0
- package/source/legacy-components/contextmenu/index.ts +2 -0
- package/source/legacy-components/contextmenu/types.ts +19 -0
- package/source/legacy-components/darkmode/index.tsx +55 -0
- package/source/legacy-components/datagrid/context/GridContext.tsx +215 -0
- package/source/legacy-components/datagrid/createTemplate.tsx +82 -0
- package/source/legacy-components/datagrid/hooks/index.ts +6 -0
- package/source/legacy-components/datagrid/hooks/useColumns.ts +33 -0
- package/source/legacy-components/datagrid/hooks/useDataSource.ts +54 -0
- package/source/legacy-components/datagrid/hooks/useFiltering.ts +169 -0
- package/source/legacy-components/datagrid/hooks/usePagination.ts +112 -0
- package/source/legacy-components/datagrid/hooks/useRowSelection.ts +48 -0
- package/source/legacy-components/datagrid/hooks/useSearch.ts +90 -0
- package/source/legacy-components/datagrid/index.tsx +28 -0
- package/source/legacy-components/datagrid/layout/FilterPopup.tsx +92 -0
- package/source/legacy-components/datagrid/layout/GridBody.tsx +184 -0
- package/source/legacy-components/datagrid/layout/GridPagination.tsx +119 -0
- package/source/legacy-components/datagrid/layout/GridToolbar.tsx +109 -0
- package/source/legacy-components/datagrid/layout/index.tsx +68 -0
- package/source/legacy-components/datagrid/type.ts +198 -0
- package/source/legacy-components/datepicker/index.tsx +365 -0
- package/source/legacy-components/datepicker/types.ts +12 -0
- package/source/legacy-components/dialog/index.tsx +44 -0
- package/source/legacy-components/dialog/types.ts +12 -0
- package/source/legacy-components/formrenderer/componentHandles/CheckBoxHandles.tsx +80 -0
- package/source/legacy-components/formrenderer/componentHandles/DatePickerHandles.tsx +93 -0
- package/source/legacy-components/formrenderer/componentHandles/InputHandles.tsx +106 -0
- package/source/legacy-components/formrenderer/componentHandles/MultiHandles.tsx +93 -0
- package/source/legacy-components/formrenderer/componentHandles/SelectHandles.tsx +95 -0
- package/source/legacy-components/formrenderer/helperFunctions.ts +72 -0
- package/source/legacy-components/formrenderer/index.tsx +93 -0
- package/source/legacy-components/formrenderer/types.ts +127 -0
- package/source/legacy-components/input/index.tsx +142 -0
- package/source/legacy-components/input/types.ts +10 -0
- package/source/legacy-components/materialInput/index.tsx +138 -0
- package/source/legacy-components/materialInput/types.ts +16 -0
- package/source/legacy-components/modal/index.tsx +152 -0
- package/source/legacy-components/modal/types.ts +19 -0
- package/source/legacy-components/multiselect/PortalDropDown.tsx +44 -0
- package/source/legacy-components/multiselect/index.tsx +269 -0
- package/source/legacy-components/multiselect/types.ts +26 -0
- package/source/legacy-components/navbar/AuthSection.tsx +98 -0
- package/source/legacy-components/navbar/MobileToggle.tsx +31 -0
- package/source/legacy-components/navbar/NavItemComponent.tsx +119 -0
- package/source/legacy-components/navbar/SearchBar.tsx +55 -0
- package/source/legacy-components/navbar/helperFunctions.ts +27 -0
- package/source/legacy-components/navbar/index.tsx +156 -0
- package/source/legacy-components/navbar/types.ts +69 -0
- package/source/legacy-components/select/PortalDropDown.tsx +59 -0
- package/source/legacy-components/select/index.tsx +249 -0
- package/source/legacy-components/select/types.ts +29 -0
- package/source/legacy-components/sidebar/components/MenuItem.tsx +101 -0
- package/source/legacy-components/sidebar/components/MenuSection.tsx +34 -0
- package/source/legacy-components/sidebar/components/SidebarFooter.tsx +50 -0
- package/source/legacy-components/sidebar/components/SidebarLogo.tsx +24 -0
- package/source/legacy-components/sidebar/components/SidebarMenu.tsx +29 -0
- package/source/legacy-components/sidebar/components/UserProfile.tsx +31 -0
- package/source/legacy-components/sidebar/hooks/useSidebarState.ts +41 -0
- package/source/legacy-components/sidebar/index.tsx +77 -0
- package/source/legacy-components/sidebar/type.ts +42 -0
- package/source/legacy-components/spinner/Stroke.tsx +89 -0
- package/source/legacy-components/spinner/index.tsx +54 -0
- package/source/legacy-components/spinner/types.ts +9 -0
- package/source/legacy-components/tabs/index.tsx +71 -0
- package/source/legacy-components/tabs/types.ts +16 -0
- package/source/legacy-components/textarea/index.tsx +123 -0
- package/source/legacy-components/textarea/types.ts +15 -0
- package/source/legacy-components/toast/ToastComponent.tsx +101 -0
- package/source/legacy-components/toast/ToastIcon.tsx +61 -0
- package/source/legacy-components/toast/index.tsx +42 -0
- package/source/legacy-components/toast/toastStore.ts +42 -0
- package/source/legacy-components/toast/types.ts +18 -0
- package/source/legacy-components/toast/useToast.ts +12 -0
- package/source/legacy-components/uploader/ProgressAnimation.tsx +50 -0
- package/source/legacy-components/uploader/UploadedFilePreview.tsx +130 -0
- package/source/legacy-components/uploader/index.tsx +311 -0
- package/source/legacy-components/uploader/types.ts +30 -0
- package/source/legacy-components/uploader/uploaderIcon.tsx +72 -0
- package/source/legacy-components/uploader/uploaderService.ts +134 -0
- package/source/legacy-components/useUploader/useUploader.tsx +310 -0
- package/source/legacy-components/usepaginateddata/usePaginatedData.ts +174 -0
- package/source/theme.ts +40 -0
- package/source/utils.ts +10 -0
- package/tools/env.cjs +61 -0
- package/tools/passport/cli.cjs +79 -0
- package/tools/passport/extract.cjs +493 -0
- package/tools/passport/index.cjs +185 -0
- package/tools/passport/merge.cjs +131 -0
- package/tools/passport/policy.cjs +65 -0
- package/tools/passport/validate.cjs +277 -0
- package/tools/ts-require.cjs +79 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useId, useMemo, type CSSProperties, type ReactNode } from "react";
|
|
4
|
+
import { useControllableState } from "../../shared/react/useControllableState";
|
|
5
|
+
import { describeField } from "../../shared/core/field";
|
|
6
|
+
import { groupState, toggleAll, toggleValue } from "../core/group";
|
|
7
|
+
import type { CheckboxLocaleText, CheckboxOption, CheckboxSize } from "../core/types";
|
|
8
|
+
import { Checkbox } from "./Checkbox";
|
|
9
|
+
import { CheckboxGroupContext, type CheckboxGroupContextValue } from "./context";
|
|
10
|
+
import { defaultCheckboxText } from "./locale";
|
|
11
|
+
import { cx, type CheckboxGroupSlot } from "./props";
|
|
12
|
+
|
|
13
|
+
export interface CheckboxGroupProps {
|
|
14
|
+
/** Checked values (controlled). */
|
|
15
|
+
value?: string[];
|
|
16
|
+
defaultValue?: string[];
|
|
17
|
+
onValueChange?(values: string[]): void;
|
|
18
|
+
/** Render these options, or pass `<Checkbox value="…">` children. */
|
|
19
|
+
options?: readonly CheckboxOption[];
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The group's name, shown as its legend. */
|
|
22
|
+
label?: ReactNode;
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
error?: ReactNode;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Form field name for every checkbox in the group. */
|
|
28
|
+
name?: string;
|
|
29
|
+
size?: CheckboxSize;
|
|
30
|
+
/** Default `vertical`. */
|
|
31
|
+
orientation?: "vertical" | "horizontal";
|
|
32
|
+
/** With `options`, a parent box that checks or clears them all. `true` uses the default label. */
|
|
33
|
+
selectAll?: boolean | ReactNode;
|
|
34
|
+
id?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
classNames?: Partial<Record<CheckboxGroupSlot, string>>;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
localeText?: Partial<CheckboxLocaleText>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A labelled set of checkboxes sharing one array of values. */
|
|
42
|
+
export function CheckboxGroup(props: CheckboxGroupProps) {
|
|
43
|
+
const {
|
|
44
|
+
value,
|
|
45
|
+
defaultValue,
|
|
46
|
+
onValueChange,
|
|
47
|
+
options,
|
|
48
|
+
children,
|
|
49
|
+
label,
|
|
50
|
+
description,
|
|
51
|
+
error,
|
|
52
|
+
required = false,
|
|
53
|
+
disabled = false,
|
|
54
|
+
name,
|
|
55
|
+
size,
|
|
56
|
+
orientation = "vertical",
|
|
57
|
+
selectAll,
|
|
58
|
+
id: idProp,
|
|
59
|
+
className,
|
|
60
|
+
classNames,
|
|
61
|
+
style,
|
|
62
|
+
localeText,
|
|
63
|
+
} = props;
|
|
64
|
+
|
|
65
|
+
const reactId = useId();
|
|
66
|
+
const id = idProp ?? reactId;
|
|
67
|
+
const text = useMemo(() => ({ ...defaultCheckboxText, ...localeText }), [localeText]);
|
|
68
|
+
const [values, setValues] = useControllableState<string[]>(value, defaultValue ?? []);
|
|
69
|
+
|
|
70
|
+
const context = useMemo<CheckboxGroupContextValue>(() => {
|
|
71
|
+
const commit = (next: string[]) => {
|
|
72
|
+
setValues(next);
|
|
73
|
+
onValueChange?.(next);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
values,
|
|
77
|
+
toggle: (item, checked) => commit(toggleValue(values, item, checked)),
|
|
78
|
+
name,
|
|
79
|
+
disabled,
|
|
80
|
+
invalid: Boolean(error),
|
|
81
|
+
size,
|
|
82
|
+
};
|
|
83
|
+
}, [values, setValues, onValueChange, name, disabled, error, size]);
|
|
84
|
+
|
|
85
|
+
const showSelectAll = Boolean(selectAll) && options !== undefined && options.length > 0;
|
|
86
|
+
const describedBy = describeField(id, { description, error });
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<fieldset
|
|
90
|
+
id={id}
|
|
91
|
+
className={cx("ck-group", classNames?.root, className)}
|
|
92
|
+
style={style}
|
|
93
|
+
// A disabled fieldset disables every control inside it natively.
|
|
94
|
+
disabled={disabled}
|
|
95
|
+
aria-describedby={describedBy}
|
|
96
|
+
data-orientation={orientation}
|
|
97
|
+
data-select-all={showSelectAll || undefined}
|
|
98
|
+
data-invalid={error ? "" : undefined}
|
|
99
|
+
>
|
|
100
|
+
{label && (
|
|
101
|
+
<legend className={cx("ck-legend", classNames?.legend)} data-required={required || undefined}>
|
|
102
|
+
{label}
|
|
103
|
+
</legend>
|
|
104
|
+
)}
|
|
105
|
+
{description && (
|
|
106
|
+
<span id={`${id}-description`} className={cx("ck-description", classNames?.description)}>
|
|
107
|
+
{description}
|
|
108
|
+
</span>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{showSelectAll && (
|
|
112
|
+
<Checkbox
|
|
113
|
+
className="ck-select-all"
|
|
114
|
+
label={selectAll === true ? text.selectAll : selectAll}
|
|
115
|
+
size={size}
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
checked={groupState(values, options)}
|
|
118
|
+
onCheckedChange={() => {
|
|
119
|
+
const next = toggleAll(values, options);
|
|
120
|
+
setValues(next);
|
|
121
|
+
onValueChange?.(next);
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
<CheckboxGroupContext value={context}>
|
|
127
|
+
<div className={cx("ck-items", classNames?.items)}>
|
|
128
|
+
{options
|
|
129
|
+
? options.map((option) => (
|
|
130
|
+
<Checkbox
|
|
131
|
+
key={option.value}
|
|
132
|
+
value={option.value}
|
|
133
|
+
label={option.label}
|
|
134
|
+
description={option.description}
|
|
135
|
+
disabled={option.disabled}
|
|
136
|
+
/>
|
|
137
|
+
))
|
|
138
|
+
: children}
|
|
139
|
+
</div>
|
|
140
|
+
</CheckboxGroupContext>
|
|
141
|
+
|
|
142
|
+
{error && (
|
|
143
|
+
<span id={`${id}-error`} className={cx("ck-error", classNames?.error)} role="alert">
|
|
144
|
+
{error}
|
|
145
|
+
</span>
|
|
146
|
+
)}
|
|
147
|
+
</fieldset>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
import type { CheckboxSize } from "../core/types";
|
|
5
|
+
|
|
6
|
+
export interface CheckboxGroupContextValue {
|
|
7
|
+
values: readonly string[];
|
|
8
|
+
toggle(value: string, checked: boolean): void;
|
|
9
|
+
name?: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
invalid: boolean;
|
|
12
|
+
size?: CheckboxSize;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Lets each Checkbox inside a CheckboxGroup read and change the group's values. */
|
|
16
|
+
export const CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type CheckboxSlot = "root" | "control" | "input" | "label" | "description" | "error";
|
|
2
|
+
|
|
3
|
+
export type CheckboxGroupSlot = "root" | "legend" | "description" | "items" | "error";
|
|
4
|
+
|
|
5
|
+
// Shared with every other component, so class handling cannot drift.
|
|
6
|
+
export { cx } from "../../shared/core/cx";
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Checkbox and CheckboxGroup styles.
|
|
3
|
+
*
|
|
4
|
+
* The box is the native <input> with `appearance: none`, so it keeps native
|
|
5
|
+
* behavior. Tokens read the shared --gbs-* variables when they are set on an
|
|
6
|
+
* ancestor (set them on :root to theme every component at once). Rules are
|
|
7
|
+
* unlayered: they beat a framework reset on specificity, and lose to anything
|
|
8
|
+
* you pass through `className`. With Tailwind v4, import this file after the
|
|
9
|
+
* framework and inside its components layer - see the README.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.ck-root,
|
|
13
|
+
.ck-group {
|
|
14
|
+
--ck-fg: var(--gbs-fg, var(--dg-fg, light-dark(#18181b, #f4f4f5)));
|
|
15
|
+
--ck-muted: var(--gbs-muted, var(--dg-muted, light-dark(#71717a, #a1a1aa)));
|
|
16
|
+
--ck-border: var(--gbs-border-control, light-dark(#a1a1aa, #52525b));
|
|
17
|
+
--ck-input-bg: var(--gbs-input-bg, var(--dg-input-bg, light-dark(#ffffff, #121216)));
|
|
18
|
+
--ck-accent: var(--gbs-accent, var(--dg-accent, light-dark(#2563eb, #60a5fa)));
|
|
19
|
+
--ck-accent-fg: var(--gbs-accent-fg, var(--dg-accent-fg, light-dark(#ffffff, #0b1220)));
|
|
20
|
+
--ck-focus: var(--gbs-focus, var(--dg-focus, light-dark(#2563eb, #60a5fa)));
|
|
21
|
+
--ck-danger: var(--gbs-danger, var(--dg-danger, light-dark(#dc2626, #f87171)));
|
|
22
|
+
--ck-font-size: var(--gbs-font-size, var(--dg-font-size, 13px));
|
|
23
|
+
--ck-size: 16px;
|
|
24
|
+
--ck-radius: 4px;
|
|
25
|
+
|
|
26
|
+
color-scheme: inherit;
|
|
27
|
+
font-size: var(--ck-font-size);
|
|
28
|
+
line-height: 1.4;
|
|
29
|
+
color: var(--ck-fg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:where(.dark, [data-theme="dark"]) :is(.ck-root, .ck-group) {
|
|
33
|
+
color-scheme: dark;
|
|
34
|
+
}
|
|
35
|
+
:where(.light, [data-theme="light"]) :is(.ck-root, .ck-group) {
|
|
36
|
+
color-scheme: light;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where(.ck-root, .ck-group) *,
|
|
40
|
+
:where(.ck-root, .ck-group) *::before,
|
|
41
|
+
:where(.ck-root, .ck-group) *::after {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ck-root {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
}
|
|
51
|
+
.ck-root[data-size="sm"] {
|
|
52
|
+
--ck-size: 14px;
|
|
53
|
+
--ck-font-size: 12px;
|
|
54
|
+
}
|
|
55
|
+
.ck-root[data-size="lg"] {
|
|
56
|
+
--ck-size: 20px;
|
|
57
|
+
--ck-font-size: 14px;
|
|
58
|
+
--ck-radius: 5px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* ---------------------------------------------------------------- box */
|
|
62
|
+
|
|
63
|
+
.ck-control {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: grid;
|
|
66
|
+
flex: none;
|
|
67
|
+
width: var(--ck-size);
|
|
68
|
+
height: var(--ck-size);
|
|
69
|
+
/* Center the box on the first line of the label. */
|
|
70
|
+
margin-top: calc((1.4em - var(--ck-size)) / 2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ck-input {
|
|
74
|
+
grid-area: 1 / 1;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
margin: 0;
|
|
78
|
+
appearance: none;
|
|
79
|
+
border: 1.5px solid var(--ck-border);
|
|
80
|
+
border-radius: var(--ck-radius);
|
|
81
|
+
background: var(--ck-input-bg);
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
transition:
|
|
84
|
+
background-color 120ms ease,
|
|
85
|
+
border-color 120ms ease;
|
|
86
|
+
}
|
|
87
|
+
.ck-input:hover:not(:disabled) {
|
|
88
|
+
border-color: color-mix(in oklab, var(--ck-border), var(--ck-fg) 35%);
|
|
89
|
+
}
|
|
90
|
+
.ck-input:focus-visible {
|
|
91
|
+
outline: 2px solid var(--ck-focus);
|
|
92
|
+
outline-offset: 2px;
|
|
93
|
+
}
|
|
94
|
+
.ck-input:is(:checked, :indeterminate) {
|
|
95
|
+
border-color: var(--ck-accent);
|
|
96
|
+
background: var(--ck-accent);
|
|
97
|
+
}
|
|
98
|
+
.ck-root[data-invalid] .ck-input:not(:checked, :indeterminate) {
|
|
99
|
+
border-color: var(--ck-danger);
|
|
100
|
+
}
|
|
101
|
+
.ck-input:disabled {
|
|
102
|
+
opacity: 0.5;
|
|
103
|
+
cursor: not-allowed;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ck-icon {
|
|
107
|
+
grid-area: 1 / 1;
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
fill: none;
|
|
111
|
+
stroke: var(--ck-accent-fg);
|
|
112
|
+
stroke-width: 2;
|
|
113
|
+
stroke-linecap: round;
|
|
114
|
+
stroke-linejoin: round;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
.ck-check {
|
|
118
|
+
stroke-dasharray: 1;
|
|
119
|
+
stroke-dashoffset: 1;
|
|
120
|
+
transition: stroke-dashoffset 160ms ease;
|
|
121
|
+
}
|
|
122
|
+
.ck-dash {
|
|
123
|
+
opacity: 0;
|
|
124
|
+
}
|
|
125
|
+
.ck-input:checked:not(:indeterminate) + .ck-icon .ck-check {
|
|
126
|
+
stroke-dashoffset: 0;
|
|
127
|
+
}
|
|
128
|
+
.ck-input:indeterminate + .ck-icon .ck-dash {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* --------------------------------------------------------------- text */
|
|
133
|
+
|
|
134
|
+
.ck-text {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
gap: 1px;
|
|
138
|
+
min-width: 0;
|
|
139
|
+
}
|
|
140
|
+
.ck-label {
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
}
|
|
143
|
+
.ck-root[data-disabled] .ck-label {
|
|
144
|
+
color: var(--ck-muted);
|
|
145
|
+
cursor: not-allowed;
|
|
146
|
+
}
|
|
147
|
+
.ck-label[data-required]::after,
|
|
148
|
+
.ck-legend[data-required]::after {
|
|
149
|
+
content: " *";
|
|
150
|
+
color: var(--ck-danger);
|
|
151
|
+
}
|
|
152
|
+
.ck-description {
|
|
153
|
+
color: var(--ck-muted);
|
|
154
|
+
font-size: 0.92em;
|
|
155
|
+
}
|
|
156
|
+
.ck-error {
|
|
157
|
+
color: var(--ck-danger);
|
|
158
|
+
font-size: 0.92em;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* -------------------------------------------------------------- group */
|
|
162
|
+
|
|
163
|
+
.ck-group {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
gap: 8px;
|
|
167
|
+
min-width: 0;
|
|
168
|
+
margin: 0;
|
|
169
|
+
padding: 0;
|
|
170
|
+
border: 0;
|
|
171
|
+
}
|
|
172
|
+
.ck-legend {
|
|
173
|
+
/* A floated legend joins the flex gap like any other child. */
|
|
174
|
+
float: left;
|
|
175
|
+
width: 100%;
|
|
176
|
+
margin-bottom: 2px;
|
|
177
|
+
padding: 0;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
}
|
|
180
|
+
.ck-legend + * {
|
|
181
|
+
clear: both;
|
|
182
|
+
}
|
|
183
|
+
.ck-items {
|
|
184
|
+
display: flex;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
gap: 8px;
|
|
187
|
+
}
|
|
188
|
+
.ck-group[data-orientation="horizontal"] .ck-items {
|
|
189
|
+
flex-flow: row wrap;
|
|
190
|
+
gap: 8px 20px;
|
|
191
|
+
}
|
|
192
|
+
.ck-group[data-select-all] .ck-items {
|
|
193
|
+
padding-inline-start: calc(var(--ck-size) + 8px);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@media (prefers-reduced-motion: reduce) {
|
|
197
|
+
.ck-input,
|
|
198
|
+
.ck-check {
|
|
199
|
+
transition: none;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@media (forced-colors: active) {
|
|
204
|
+
.ck-input:is(:checked, :indeterminate) {
|
|
205
|
+
background: Highlight;
|
|
206
|
+
border-color: Highlight;
|
|
207
|
+
}
|
|
208
|
+
.ck-icon {
|
|
209
|
+
stroke: HighlightText;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Combobox: Select and MultiSelect
|
|
2
|
+
|
|
3
|
+
Two value pickers with option search, built on one engine and styled to match
|
|
4
|
+
the DataGrid. No runtime dependencies besides React 19.
|
|
5
|
+
|
|
6
|
+
- **`<Select>`** — one value.
|
|
7
|
+
- **`<MultiSelect>`** — many values, shown as tags.
|
|
8
|
+
|
|
9
|
+
Both support client or server options, grouping, descriptions, disabled
|
|
10
|
+
options, virtualization for long lists, creating new options, forms, full
|
|
11
|
+
keyboard control, dark mode and right-to-left layouts.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { MultiSelect, Select } from "@/components/combobox";
|
|
17
|
+
import "@/components/combobox/styles.css";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The stylesheet reads the shared `--gbs-*` variables when you set them on
|
|
21
|
+
`:root`, so every component in the library shares one theme, and falls back to
|
|
22
|
+
the same default palette otherwise.
|
|
23
|
+
|
|
24
|
+
## Basic usage
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
const countries = [
|
|
28
|
+
{ value: "in", label: "India", group: "Asia" },
|
|
29
|
+
{ value: "de", label: "Germany", group: "Europe", description: "Berlin" },
|
|
30
|
+
{ value: "mx", label: "Mexico", group: "Americas", disabled: true },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const [country, setCountry] = useState<string | null>(null);
|
|
34
|
+
|
|
35
|
+
<Select label="Country" options={countries} value={country} onChange={setCountry} />;
|
|
36
|
+
|
|
37
|
+
const [tags, setTags] = useState<string[]>([]);
|
|
38
|
+
<MultiSelect label="Tags" options={tagOptions} value={tags} onChange={setTags} max={5} />;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Both are controlled with `value` + `onChange`, or uncontrolled with
|
|
42
|
+
`defaultValue`. `onChange` also receives the full option objects:
|
|
43
|
+
`onChange={(value, option) => …}` (single) and `(values, options) => …` (multi).
|
|
44
|
+
|
|
45
|
+
## Options
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
interface ComboboxOption<V = string> {
|
|
49
|
+
value: V; // string or number
|
|
50
|
+
label: string;
|
|
51
|
+
description?: string; // second line
|
|
52
|
+
group?: string; // heading; groups appear in first-seen order
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
icon?: ReactNode;
|
|
55
|
+
keywords?: string[]; // extra search terms
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Search matches the label (and highlights it), the description and keywords.
|
|
60
|
+
|
|
61
|
+
## Props
|
|
62
|
+
|
|
63
|
+
Shared by both components:
|
|
64
|
+
|
|
65
|
+
| Prop | Type | Default | Description |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| `options` | `ComboboxOption<V>[]` | required | Options to show. |
|
|
68
|
+
| `mode` | `"client"` \| `"server"` | `"client"` | `server` skips local filtering; `options` are the current results. |
|
|
69
|
+
| `loading` | `boolean` | `false` | Shows a spinner; keeps current options visible. |
|
|
70
|
+
| `onSearchChange` | `(search: string) => void` | — | Search text; debounced in server mode, and fired on open. |
|
|
71
|
+
| `searchDebounce` | `number` | `250` | Debounce in milliseconds (server mode). |
|
|
72
|
+
| `searchable` | `boolean` | `true` | Show the search box. When `false`, typing jumps to a matching option. |
|
|
73
|
+
| `hasMore` / `onLoadMore` | `boolean` / `() => void` | — | Paging: called when the list nears its end, plus a "Load more" button. |
|
|
74
|
+
| `filterFn` | `(option, search) => boolean` | — | Replaces the built-in matching (client mode). |
|
|
75
|
+
| `renderOption` | `(option, { selected, active }) => ReactNode` | — | Custom option content. |
|
|
76
|
+
| `allowCreate` / `onCreate` | `boolean` / `(label: string) => void` | — | Offers "Create …" when nothing matches. |
|
|
77
|
+
| `label`, `description`, `error` | `ReactNode` | — | Field label, hint and error message. `error` also marks the control invalid. |
|
|
78
|
+
| `placeholder` | `string` | `"Select…"` | Shown when nothing is selected. |
|
|
79
|
+
| `required`, `disabled` | `boolean` | `false` | Field states. |
|
|
80
|
+
| `clearable` | `boolean` | `true` | Show the clear button. |
|
|
81
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `"md"` | Control height and font size. |
|
|
82
|
+
| `name` | `string` | — | Posts hidden inputs for forms (one per value). |
|
|
83
|
+
| `maxHeight` | `number` | `280` | Max height of the list. |
|
|
84
|
+
| `virtualize` | `boolean` \| `number` | `true` | Virtualizes above 80 options; pass a number to change the threshold. |
|
|
85
|
+
| `emptyMessage` | `ReactNode` | "No options found" | Shown when nothing matches. |
|
|
86
|
+
| `className`, `classNames`, `style` | — | — | Styling hooks. Slots: `root`, `label`, `control`, `value`, `tag`, `popover`, `search`, `list`, `option`, `footer`. |
|
|
87
|
+
| `localeText` | `Partial<ComboboxLocaleText>` | English | Overrides UI text. |
|
|
88
|
+
| `onOpenChange` | `(open: boolean) => void` | — | Fires when the list opens or closes. |
|
|
89
|
+
| `ref` | `Ref<ComboboxHandle<V>>` | — | `open()`, `close()`, `toggle()`, `focus()`, `clear()`, `getValue()`, `getSelectedOptions()`. |
|
|
90
|
+
|
|
91
|
+
`Select` adds `value` / `defaultValue` (`V | null`) and `closeOnSelect`
|
|
92
|
+
(default `true`). `MultiSelect` adds `value` / `defaultValue` (`V[]`), `max`,
|
|
93
|
+
`maxVisibleTags` (default 3), `showSelectAll` (default `true`) and
|
|
94
|
+
`closeOnSelect` (default `false`).
|
|
95
|
+
|
|
96
|
+
## Server options
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
const [search, setSearch] = useState("");
|
|
100
|
+
const [page, setPage] = useState(0);
|
|
101
|
+
const { data, isFetching } = useQuery({
|
|
102
|
+
queryKey: ["people", search, page],
|
|
103
|
+
queryFn: ({ signal }) => fetchPeople({ search, page, signal }),
|
|
104
|
+
placeholderData: keepPreviousData,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
<MultiSelect
|
|
108
|
+
mode="server"
|
|
109
|
+
options={data?.options ?? []}
|
|
110
|
+
hasMore={data?.hasMore}
|
|
111
|
+
loading={isFetching}
|
|
112
|
+
onSearchChange={(term) => { setPage(0); setSearch(term); }}
|
|
113
|
+
onLoadMore={() => setPage((p) => p + 1)}
|
|
114
|
+
value={selected}
|
|
115
|
+
onChange={setSelected}
|
|
116
|
+
/>;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- `onSearchChange` fires once when the list opens (so you can load a first page)
|
|
120
|
+
and then debounced as the user types.
|
|
121
|
+
- Labels of chosen options are remembered, so tags stay readable after the
|
|
122
|
+
results change. If you set `value` from outside before the matching options
|
|
123
|
+
have loaded, the raw value is shown until they arrive.
|
|
124
|
+
|
|
125
|
+
## Keyboard
|
|
126
|
+
|
|
127
|
+
| Keys | Action |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| **Enter**, **Space**, **↓**, **↑** | Open the list. |
|
|
130
|
+
| **↓** / **↑** | Move between options (disabled options are skipped). |
|
|
131
|
+
| **Home** / **End** | First / last option. |
|
|
132
|
+
| **Page Down** / **Page Up** | Move ten options. |
|
|
133
|
+
| **Enter** | Choose the highlighted option, or create. |
|
|
134
|
+
| **Escape** | Close and return focus to the control. |
|
|
135
|
+
| **Tab** | Close and move to the next field. |
|
|
136
|
+
| **Backspace** | MultiSelect: remove the last tag (when the search box is empty). |
|
|
137
|
+
| typing | Types into the search box, or jumps to a matching option when `searchable={false}`. |
|
|
138
|
+
|
|
139
|
+
The control is a `role="combobox"` that owns a `role="listbox"`; the active
|
|
140
|
+
option is tracked with `aria-activedescendant`, so focus stays in the search
|
|
141
|
+
box. The list renders in the top layer through the native Popover API, so it is
|
|
142
|
+
never clipped by a scrolling parent (including inside a DataGrid cell).
|
|
143
|
+
|
|
144
|
+
## Theming
|
|
145
|
+
|
|
146
|
+
Override `--cb-*` variables (they default to the grid's `--dg-*`):
|
|
147
|
+
|
|
148
|
+
```css
|
|
149
|
+
.cb-root { --cb-accent: #7c3aed; --cb-radius: 12px; }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
State attributes for styling: `data-state="open"`, `data-size`, `data-invalid`,
|
|
153
|
+
`data-disabled` on the root and control; `data-active`, `data-selected`,
|
|
154
|
+
`data-disabled` on options.
|
|
155
|
+
|
|
156
|
+
## Headless use
|
|
157
|
+
|
|
158
|
+
`useCombobox()` holds the whole engine (filtering, active option, keyboard,
|
|
159
|
+
selection, search requests) and is exported if you want to build a different UI
|
|
160
|
+
on top. The framework-free helpers — `filterOptions`, `buildListItems`,
|
|
161
|
+
`nextEnabledIndex`, `toggleValue`, `measureItems`, `getVisibleRange` — are
|
|
162
|
+
exported from `@/components/combobox/core` and can also run on a server.
|
|
163
|
+
|
|
164
|
+
## Known limits
|
|
165
|
+
|
|
166
|
+
- Option rows have a fixed height per `size` (taller when any option has a
|
|
167
|
+
description), because the list is virtualized.
|
|
168
|
+
- No async "load option by value": pass options that include the selected
|
|
169
|
+
values, or select them through the UI at least once.
|
|
170
|
+
- Tree or multi-level options are not supported.
|