@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,419 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Combobox styles (Select and MultiSelect).
|
|
3
|
+
*
|
|
4
|
+
* Tokens read the shared --gbs-* variables when they are set on an ancestor
|
|
5
|
+
* (set them on :root to theme every component at once) and fall back to the
|
|
6
|
+
* same default palette otherwise. Rules are unlayered: they beat a framework
|
|
7
|
+
* reset on specificity, and lose to anything you pass through `className`.
|
|
8
|
+
* With Tailwind v4, import this file after the framework and inside its
|
|
9
|
+
* components layer - see the README.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.cb-root {
|
|
13
|
+
--cb-bg: var(--gbs-bg, var(--dg-bg, light-dark(#ffffff, #0b0b0e)));
|
|
14
|
+
--cb-fg: var(--gbs-fg, var(--dg-fg, light-dark(#18181b, #f4f4f5)));
|
|
15
|
+
--cb-muted: var(--gbs-muted, var(--dg-muted, light-dark(#71717a, #a1a1aa)));
|
|
16
|
+
--cb-border: var(--gbs-border, var(--dg-border, light-dark(#e4e4e7, #27272a)));
|
|
17
|
+
--cb-hover: var(--gbs-hover, var(--dg-hover, light-dark(#f4f4f5, #1f1f23)));
|
|
18
|
+
--cb-input-bg: var(--gbs-input-bg, var(--dg-input-bg, light-dark(#ffffff, #121216)));
|
|
19
|
+
--cb-accent: var(--gbs-accent, var(--dg-accent, light-dark(#2563eb, #60a5fa)));
|
|
20
|
+
--cb-accent-fg: var(--gbs-accent-fg, var(--dg-accent-fg, light-dark(#ffffff, #0b1220)));
|
|
21
|
+
--cb-accent-soft: var(--gbs-accent-soft, var(--dg-accent-soft, light-dark(#eff6ff, #172554)));
|
|
22
|
+
--cb-accent-strong: var(--gbs-accent-strong, var(--dg-accent-strong, light-dark(#1d4ed8, #bfdbfe)));
|
|
23
|
+
--cb-focus: var(--gbs-focus, var(--dg-focus, light-dark(#2563eb, #60a5fa)));
|
|
24
|
+
--cb-danger: var(--gbs-danger, var(--dg-danger, light-dark(#dc2626, #f87171)));
|
|
25
|
+
--cb-shadow: var(--gbs-shadow, var(--dg-shadow, 0 10px 30px -8px light-dark(rgb(0 0 0 / 0.18), rgb(0 0 0 / 0.6))));
|
|
26
|
+
--cb-radius: var(--gbs-radius, var(--dg-radius, 8px));
|
|
27
|
+
--cb-font-size: var(--gbs-font-size, var(--dg-font-size, 13px));
|
|
28
|
+
--cb-height: 36px;
|
|
29
|
+
--cb-px: 10px;
|
|
30
|
+
|
|
31
|
+
color-scheme: inherit;
|
|
32
|
+
position: relative;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
font-size: var(--cb-font-size);
|
|
39
|
+
line-height: 1.4;
|
|
40
|
+
color: var(--cb-fg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:where(.dark, [data-theme="dark"]) .cb-root {
|
|
44
|
+
color-scheme: dark;
|
|
45
|
+
}
|
|
46
|
+
:where(.light, [data-theme="light"]) .cb-root {
|
|
47
|
+
color-scheme: light;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where(.cb-root, .cb-popover) *,
|
|
51
|
+
:where(.cb-root, .cb-popover) *::before,
|
|
52
|
+
:where(.cb-root, .cb-popover) *::after {
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.cb-root[data-size="sm"] {
|
|
57
|
+
--cb-height: 30px;
|
|
58
|
+
--cb-font-size: 12px;
|
|
59
|
+
--cb-px: 8px;
|
|
60
|
+
}
|
|
61
|
+
.cb-root[data-size="lg"] {
|
|
62
|
+
--cb-height: 44px;
|
|
63
|
+
--cb-font-size: 14px;
|
|
64
|
+
--cb-px: 12px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.cb-label {
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
}
|
|
70
|
+
.cb-label[data-required]::after {
|
|
71
|
+
content: " *";
|
|
72
|
+
color: var(--cb-danger);
|
|
73
|
+
}
|
|
74
|
+
.cb-description {
|
|
75
|
+
color: var(--cb-muted);
|
|
76
|
+
font-size: 0.92em;
|
|
77
|
+
}
|
|
78
|
+
.cb-error {
|
|
79
|
+
color: var(--cb-danger);
|
|
80
|
+
font-size: 0.92em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* -------------------------------------------------------------- trigger */
|
|
84
|
+
|
|
85
|
+
.cb-control {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 6px;
|
|
89
|
+
width: 100%;
|
|
90
|
+
min-height: var(--cb-height);
|
|
91
|
+
padding: 3px var(--cb-px);
|
|
92
|
+
border: 1px solid var(--cb-border);
|
|
93
|
+
border-radius: var(--cb-radius);
|
|
94
|
+
background: var(--cb-input-bg);
|
|
95
|
+
color: inherit;
|
|
96
|
+
font: inherit;
|
|
97
|
+
text-align: start;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
.cb-control:hover:not([data-disabled]) {
|
|
101
|
+
border-color: color-mix(in oklab, var(--cb-border), var(--cb-fg) 25%);
|
|
102
|
+
}
|
|
103
|
+
.cb-control:focus-visible,
|
|
104
|
+
.cb-root[data-state="open"] .cb-control {
|
|
105
|
+
outline: 2px solid var(--cb-focus);
|
|
106
|
+
outline-offset: -1px;
|
|
107
|
+
}
|
|
108
|
+
.cb-control[data-invalid] {
|
|
109
|
+
border-color: var(--cb-danger);
|
|
110
|
+
}
|
|
111
|
+
.cb-control[data-invalid]:focus-visible,
|
|
112
|
+
.cb-root[data-invalid][data-state="open"] .cb-control {
|
|
113
|
+
outline-color: var(--cb-danger);
|
|
114
|
+
}
|
|
115
|
+
.cb-control[data-disabled] {
|
|
116
|
+
opacity: 0.55;
|
|
117
|
+
cursor: not-allowed;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.cb-value {
|
|
121
|
+
flex: 1 1 auto;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
127
|
+
.cb-placeholder {
|
|
128
|
+
color: var(--cb-muted);
|
|
129
|
+
}
|
|
130
|
+
.cb-value-icon {
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
margin-inline-end: 6px;
|
|
133
|
+
vertical-align: -2px;
|
|
134
|
+
color: var(--cb-muted);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.cb-tags {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
flex-wrap: wrap;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 4px;
|
|
143
|
+
min-width: 0;
|
|
144
|
+
}
|
|
145
|
+
.cb-tag {
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 2px;
|
|
149
|
+
max-width: 100%;
|
|
150
|
+
padding-inline: 8px 3px;
|
|
151
|
+
border-radius: 999px;
|
|
152
|
+
background: var(--cb-accent-soft);
|
|
153
|
+
color: var(--cb-accent-strong);
|
|
154
|
+
font-size: 0.92em;
|
|
155
|
+
line-height: 20px;
|
|
156
|
+
}
|
|
157
|
+
.cb-tag-label {
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
text-overflow: ellipsis;
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
}
|
|
162
|
+
.cb-tag-remove {
|
|
163
|
+
display: inline-grid;
|
|
164
|
+
place-items: center;
|
|
165
|
+
width: 16px;
|
|
166
|
+
height: 16px;
|
|
167
|
+
padding: 0;
|
|
168
|
+
border: 0;
|
|
169
|
+
border-radius: 50%;
|
|
170
|
+
background: transparent;
|
|
171
|
+
color: inherit;
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
}
|
|
174
|
+
.cb-tag-remove:hover {
|
|
175
|
+
background: color-mix(in oklab, var(--cb-accent-strong), transparent 85%);
|
|
176
|
+
}
|
|
177
|
+
.cb-tag-overflow {
|
|
178
|
+
color: var(--cb-muted);
|
|
179
|
+
font-size: 0.92em;
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.cb-actions {
|
|
184
|
+
display: flex;
|
|
185
|
+
flex: none;
|
|
186
|
+
align-items: center;
|
|
187
|
+
gap: 2px;
|
|
188
|
+
color: var(--cb-muted);
|
|
189
|
+
}
|
|
190
|
+
.cb-icon-button {
|
|
191
|
+
display: inline-grid;
|
|
192
|
+
place-items: center;
|
|
193
|
+
width: 22px;
|
|
194
|
+
height: 22px;
|
|
195
|
+
padding: 0;
|
|
196
|
+
border: 0;
|
|
197
|
+
border-radius: 4px;
|
|
198
|
+
background: transparent;
|
|
199
|
+
color: inherit;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
}
|
|
202
|
+
.cb-icon-button:hover {
|
|
203
|
+
background: var(--cb-hover);
|
|
204
|
+
color: var(--cb-fg);
|
|
205
|
+
}
|
|
206
|
+
.cb-icon-button:focus-visible {
|
|
207
|
+
outline: 2px solid var(--cb-focus);
|
|
208
|
+
outline-offset: 1px;
|
|
209
|
+
}
|
|
210
|
+
.cb-chevron {
|
|
211
|
+
transition: transform 120ms ease;
|
|
212
|
+
}
|
|
213
|
+
.cb-root[data-state="open"] .cb-chevron {
|
|
214
|
+
transform: rotate(180deg);
|
|
215
|
+
}
|
|
216
|
+
@media (prefers-reduced-motion: reduce) {
|
|
217
|
+
.cb-chevron {
|
|
218
|
+
transition: none;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* -------------------------------------------------------------- popover */
|
|
223
|
+
|
|
224
|
+
.cb-popover {
|
|
225
|
+
position: fixed;
|
|
226
|
+
inset: auto;
|
|
227
|
+
margin: 0;
|
|
228
|
+
padding: 0;
|
|
229
|
+
overflow: hidden;
|
|
230
|
+
border: 1px solid var(--cb-border);
|
|
231
|
+
border-radius: var(--cb-radius);
|
|
232
|
+
background: var(--cb-bg);
|
|
233
|
+
color: var(--cb-fg);
|
|
234
|
+
box-shadow: var(--cb-shadow);
|
|
235
|
+
font-size: var(--cb-font-size);
|
|
236
|
+
}
|
|
237
|
+
.cb-search {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
gap: 6px;
|
|
241
|
+
padding: 6px 10px;
|
|
242
|
+
border-bottom: 1px solid var(--cb-border);
|
|
243
|
+
color: var(--cb-muted);
|
|
244
|
+
}
|
|
245
|
+
.cb-search input {
|
|
246
|
+
width: 100%;
|
|
247
|
+
min-width: 0;
|
|
248
|
+
border: 0;
|
|
249
|
+
outline: 0;
|
|
250
|
+
background: transparent;
|
|
251
|
+
color: var(--cb-fg);
|
|
252
|
+
font: inherit;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.cb-list {
|
|
256
|
+
position: relative;
|
|
257
|
+
overflow: auto;
|
|
258
|
+
overscroll-behavior: contain;
|
|
259
|
+
padding: 4px;
|
|
260
|
+
outline: none;
|
|
261
|
+
scrollbar-width: var(--gbs-scrollbar-width, thin);
|
|
262
|
+
scrollbar-color: var(--gbs-scrollbar-thumb, light-dark(#c4c4ca, #3f3f46))
|
|
263
|
+
var(--gbs-scrollbar-track, transparent);
|
|
264
|
+
}
|
|
265
|
+
.cb-list:focus-visible {
|
|
266
|
+
outline: 2px solid var(--cb-focus);
|
|
267
|
+
outline-offset: -2px;
|
|
268
|
+
}
|
|
269
|
+
.cb-list[data-virtual] .cb-item,
|
|
270
|
+
.cb-list[data-virtual] .cb-group {
|
|
271
|
+
position: absolute;
|
|
272
|
+
inset-inline: 4px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.cb-group {
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
padding: 6px 8px 2px;
|
|
279
|
+
color: var(--cb-muted);
|
|
280
|
+
font-size: 0.85em;
|
|
281
|
+
font-weight: 600;
|
|
282
|
+
letter-spacing: 0.04em;
|
|
283
|
+
text-transform: uppercase;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.cb-item {
|
|
287
|
+
display: flex;
|
|
288
|
+
align-items: center;
|
|
289
|
+
gap: 8px;
|
|
290
|
+
width: 100%;
|
|
291
|
+
padding: 6px 8px;
|
|
292
|
+
border: 0;
|
|
293
|
+
border-radius: 6px;
|
|
294
|
+
background: transparent;
|
|
295
|
+
color: inherit;
|
|
296
|
+
font: inherit;
|
|
297
|
+
text-align: start;
|
|
298
|
+
cursor: pointer;
|
|
299
|
+
}
|
|
300
|
+
.cb-item[data-active] {
|
|
301
|
+
background: var(--cb-hover);
|
|
302
|
+
}
|
|
303
|
+
.cb-item[data-selected] {
|
|
304
|
+
color: var(--cb-accent-strong);
|
|
305
|
+
font-weight: 500;
|
|
306
|
+
}
|
|
307
|
+
.cb-item[data-disabled] {
|
|
308
|
+
opacity: 0.45;
|
|
309
|
+
cursor: not-allowed;
|
|
310
|
+
}
|
|
311
|
+
.cb-item-check {
|
|
312
|
+
flex: none;
|
|
313
|
+
width: 16px;
|
|
314
|
+
color: var(--cb-accent);
|
|
315
|
+
opacity: 0;
|
|
316
|
+
}
|
|
317
|
+
.cb-item[data-selected] .cb-item-check {
|
|
318
|
+
opacity: 1;
|
|
319
|
+
}
|
|
320
|
+
.cb-item-icon {
|
|
321
|
+
flex: none;
|
|
322
|
+
display: inline-flex;
|
|
323
|
+
color: var(--cb-muted);
|
|
324
|
+
}
|
|
325
|
+
.cb-item-body {
|
|
326
|
+
flex: 1 1 auto;
|
|
327
|
+
min-width: 0;
|
|
328
|
+
}
|
|
329
|
+
.cb-item-label {
|
|
330
|
+
overflow: hidden;
|
|
331
|
+
text-overflow: ellipsis;
|
|
332
|
+
white-space: nowrap;
|
|
333
|
+
}
|
|
334
|
+
.cb-item-description {
|
|
335
|
+
overflow: hidden;
|
|
336
|
+
color: var(--cb-muted);
|
|
337
|
+
font-size: 0.9em;
|
|
338
|
+
text-overflow: ellipsis;
|
|
339
|
+
white-space: nowrap;
|
|
340
|
+
}
|
|
341
|
+
.cb-mark {
|
|
342
|
+
background: color-mix(in oklab, var(--cb-accent), transparent 82%);
|
|
343
|
+
border-radius: 2px;
|
|
344
|
+
color: inherit;
|
|
345
|
+
font-weight: 600;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.cb-empty,
|
|
349
|
+
.cb-status {
|
|
350
|
+
display: flex;
|
|
351
|
+
align-items: center;
|
|
352
|
+
justify-content: center;
|
|
353
|
+
gap: 8px;
|
|
354
|
+
padding: 16px 8px;
|
|
355
|
+
color: var(--cb-muted);
|
|
356
|
+
}
|
|
357
|
+
.cb-footer {
|
|
358
|
+
display: flex;
|
|
359
|
+
align-items: center;
|
|
360
|
+
justify-content: space-between;
|
|
361
|
+
gap: 8px;
|
|
362
|
+
padding: 4px 6px;
|
|
363
|
+
border-top: 1px solid var(--cb-border);
|
|
364
|
+
}
|
|
365
|
+
.cb-link-button {
|
|
366
|
+
padding: 4px 6px;
|
|
367
|
+
border: 0;
|
|
368
|
+
border-radius: 4px;
|
|
369
|
+
background: none;
|
|
370
|
+
color: var(--cb-accent);
|
|
371
|
+
font: inherit;
|
|
372
|
+
cursor: pointer;
|
|
373
|
+
}
|
|
374
|
+
.cb-link-button:hover {
|
|
375
|
+
background: var(--cb-hover);
|
|
376
|
+
}
|
|
377
|
+
.cb-link-button:disabled {
|
|
378
|
+
opacity: 0.5;
|
|
379
|
+
cursor: default;
|
|
380
|
+
}
|
|
381
|
+
.cb-footer-count {
|
|
382
|
+
color: var(--cb-muted);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.cb-spinner {
|
|
386
|
+
animation: cb-spin 0.7s linear infinite;
|
|
387
|
+
}
|
|
388
|
+
@keyframes cb-spin {
|
|
389
|
+
to {
|
|
390
|
+
transform: rotate(360deg);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
@media (prefers-reduced-motion: reduce) {
|
|
394
|
+
.cb-spinner {
|
|
395
|
+
animation-duration: 2s;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.cb-sr-only {
|
|
400
|
+
position: absolute;
|
|
401
|
+
width: 1px;
|
|
402
|
+
height: 1px;
|
|
403
|
+
margin: -1px;
|
|
404
|
+
padding: 0;
|
|
405
|
+
overflow: hidden;
|
|
406
|
+
clip-path: inset(50%);
|
|
407
|
+
white-space: nowrap;
|
|
408
|
+
border: 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@media (forced-colors: active) {
|
|
412
|
+
.cb-item[data-active] {
|
|
413
|
+
outline: 1px solid Highlight;
|
|
414
|
+
}
|
|
415
|
+
.cb-mark {
|
|
416
|
+
background: Highlight;
|
|
417
|
+
color: HighlightText;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# DataGrid
|
|
2
|
+
|
|
3
|
+
A virtualized data grid for React 19 with no runtime dependencies besides React.
|
|
4
|
+
Works in Vite/SPA apps and in the Next.js App Router.
|
|
5
|
+
|
|
6
|
+
- **Fast by design:** rows and columns are virtualized; state lives in an
|
|
7
|
+
external store with per-row subscriptions, so selecting a row or moving focus
|
|
8
|
+
re-renders only the rows involved; column resizing rewrites CSS variables
|
|
9
|
+
without rendering; filtering and sorting run at low priority via
|
|
10
|
+
`useDeferredValue`.
|
|
11
|
+
- **Features:** typed columns, multi-column sort, typed column filters, global
|
|
12
|
+
search, pagination, row selection (single, multiple, shift-range), column
|
|
13
|
+
resize / reorder (drag or menu) / pin / hide, inline editing with validation and
|
|
14
|
+
async saves, CSV / Excel / PDF export, clipboard copy, density, i18n, RTL, dark
|
|
15
|
+
mode, WAI-ARIA grid keyboard navigation.
|
|
16
|
+
- **Client or server mode:** let the grid sort/filter/paginate, or receive a
|
|
17
|
+
query and fetch pages yourself.
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Import the stylesheet once (e.g. in your root CSS or layout):
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@import "../component-lib/data-grid/styles.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or from JS: `import "component-lib/data-grid/styles.css";`
|
|
28
|
+
|
|
29
|
+
## Basic usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { createColumnHelper, DataGrid } from "component-lib/data-grid";
|
|
33
|
+
|
|
34
|
+
interface Employee { id: number; name: string; salary: number; startDate: string; active: boolean }
|
|
35
|
+
|
|
36
|
+
const col = createColumnHelper<Employee>();
|
|
37
|
+
|
|
38
|
+
// Define columns outside the component (or memoize them).
|
|
39
|
+
const columns = [
|
|
40
|
+
col.field("id", { header: "ID", type: "number", width: 80, pin: "left" }),
|
|
41
|
+
col.field("name", { width: 200 }),
|
|
42
|
+
col.field("salary", { type: "number", format: (v) => `$${v.toLocaleString()}` }),
|
|
43
|
+
col.field("startDate", { type: "date" }),
|
|
44
|
+
col.field("active", { type: "boolean" }),
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export function Employees({ data }: { data: Employee[] }) {
|
|
48
|
+
return <DataGrid data={data} columns={columns} getRowId="id" enableRowSelection height={600} />;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`createColumnHelper` infers the value type for `cell`, `format`, `validate` and
|
|
53
|
+
`sortFn`. Plain `ColumnDef<T>[]` objects work too.
|
|
54
|
+
|
|
55
|
+
### Stable inputs
|
|
56
|
+
|
|
57
|
+
The grid memoizes on the identity of `data`, `columns` and `getRowId`. Keep
|
|
58
|
+
them stable: define columns at module level or with `useMemo`, and pass
|
|
59
|
+
`getRowId` as a property name (`getRowId="id"`). With React Compiler enabled,
|
|
60
|
+
inline values are memoized for you.
|
|
61
|
+
|
|
62
|
+
## Columns
|
|
63
|
+
|
|
64
|
+
| Option | Purpose |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `field` / `accessor` / `id` | Where the value comes from. Display-only columns need just `id` and `cell`. |
|
|
67
|
+
| `header`, `width`, `minWidth`, `maxWidth`, `align` | Presentation. |
|
|
68
|
+
| `type` | `string` (default), `number`, `date`, `boolean`. Drives filter operators, sorting, alignment, editors and Excel cell types. |
|
|
69
|
+
| `options` | `{ label, value }[]` for enum columns: "is any of" filter, select editor, label display. |
|
|
70
|
+
| `format(value, row)` | Display text. Also used by search, CSV, PDF and copy. |
|
|
71
|
+
| `cell(ctx)` | Custom renderer. Clicks on buttons/inputs inside cells don't trigger `onRowClick`. |
|
|
72
|
+
| `pin`, `hidden` | Initial pin side / visibility. |
|
|
73
|
+
| `sortable`, `filterable`, `resizable`, `reorderable`, `pinnable`, `hideable`, `searchable` | Per-column feature switches (default `true`). |
|
|
74
|
+
| `sortFn`, `filterFn` | Custom comparison / matching. |
|
|
75
|
+
| `editable`, `editor`, `validate` | Inline editing (below). |
|
|
76
|
+
| `exportable`, `exportValue(row)` | Export control. |
|
|
77
|
+
| `headerClassName`, `cellClassName` | Styling hooks. |
|
|
78
|
+
|
|
79
|
+
## Server mode
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
const [query, setQuery] = useState<GridQuery>(initialQuery);
|
|
83
|
+
const { data, isFetching } = useQuery({ queryKey: ["orders", query], queryFn: () => fetchOrders(query) });
|
|
84
|
+
|
|
85
|
+
<DataGrid
|
|
86
|
+
mode="server"
|
|
87
|
+
data={data?.rows ?? []}
|
|
88
|
+
rowCount={data?.total ?? 0}
|
|
89
|
+
loading={isFetching}
|
|
90
|
+
columns={columns}
|
|
91
|
+
initialState={initialQuery}
|
|
92
|
+
onQueryChange={setQuery}
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`onQueryChange` receives `{ sorting, filters, globalFilter, pagination }`
|
|
97
|
+
whenever one of them changes. Changing filters, search or sorting resets to the
|
|
98
|
+
first page. The previous rows stay visible while `loading`.
|
|
99
|
+
|
|
100
|
+
The framework-free core (`component-lib/data-grid/core`) exports `filterRows`,
|
|
101
|
+
`sortRows` and `paginate`, so a Node or Next.js route handler can apply exactly
|
|
102
|
+
the same semantics on the server.
|
|
103
|
+
|
|
104
|
+
## State
|
|
105
|
+
|
|
106
|
+
All grid state can be controlled or left internal:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
interface GridState {
|
|
110
|
+
sorting; filters; globalFilter; pagination; rowSelection;
|
|
111
|
+
columnOrder; columnVisibility; columnSizing; columnPinning; density;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- `initialState` seeds internal state.
|
|
116
|
+
- `state` controls any subset of keys; the grid then calls `onStateChange(next, prev)`
|
|
117
|
+
instead of updating those keys itself.
|
|
118
|
+
- Example: persist column layout with
|
|
119
|
+
`onStateChange={(s) => save(pick(s, ["columnOrder", "columnSizing", "columnPinning", "columnVisibility"]))}`.
|
|
120
|
+
|
|
121
|
+
## Editing
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
col.field("salary", {
|
|
125
|
+
type: "number",
|
|
126
|
+
editable: (row) => !row.locked,
|
|
127
|
+
validate: (v) => (v < 0 ? "Must be positive" : null),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
<DataGrid onCellEdit={async ({ rowId, columnId, value }) => { await save(rowId, columnId, value); }} />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Start editing with double-click, Enter or F2. Enter commits and moves down,
|
|
134
|
+
Tab commits and moves right, and Escape cancels. The grid never mutates `data`:
|
|
135
|
+
update it in `onCellEdit`. If `onCellEdit` returns a promise, the cell shows the
|
|
136
|
+
pending value until it settles, and a rejection marks the cell invalid.
|
|
137
|
+
Custom editors: `editor: (props) => <MyInput value={props.value} onChange={props.onChange} onBlur={() => props.commit()} />`.
|
|
138
|
+
|
|
139
|
+
## Imperative API
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
const api = useRef<GridApi<Employee>>(null);
|
|
143
|
+
<DataGrid ref={api} ... />
|
|
144
|
+
|
|
145
|
+
api.current?.setFilter("status", { operator: "in", value: ["active"] });
|
|
146
|
+
api.current?.exportExcel({ scope: "selected", fileName: "people" });
|
|
147
|
+
api.current?.focusCell(0, "name");
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Methods include `toggleSort`, `setSorting`, `setFilter`, `clearFilters`,
|
|
151
|
+
`setGlobalFilter`, `setPageIndex`, `setPageSize`, `toggleRowSelected`,
|
|
152
|
+
`toggleAllRowsSelected`, `getSelectedRows`, `setColumnVisibility`,
|
|
153
|
+
`setColumnWidth`, `pinColumn`, `moveColumn`, `resetColumns`, `scrollToRow`,
|
|
154
|
+
`focusCell`, `startEditing`, `getRows`, `exportCsv`, `exportExcel`, `exportPdf`,
|
|
155
|
+
`print` and `copyToClipboard`.
|
|
156
|
+
|
|
157
|
+
## Export
|
|
158
|
+
|
|
159
|
+
Export code is split into chunks loaded on first use.
|
|
160
|
+
|
|
161
|
+
| Format | Notes |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| CSV | UTF-8 with BOM (opens correctly in Excel). Cells starting with `= + - @` are prefixed with `'` to prevent formula injection. |
|
|
164
|
+
| Excel | Real `.xlsx`: typed numbers, booleans and dates, bold frozen header, auto-filter, column widths. Written without a library. |
|
|
165
|
+
| PDF | Writes a real `.pdf` and downloads it: chosen paper size and orientation, a repeated header row, page numbers and your own header/footer bands. Uses the standard PDF fonts, so text must be Latin-1. |
|
|
166
|
+
| Print | `api.print()` opens the browser's print dialog instead, for paper or for text the standard fonts cannot encode. |
|
|
167
|
+
|
|
168
|
+
Scopes: `filtered` (default), `all`, `selected`, `page`, or pass `rows`, e.g. a
|
|
169
|
+
full result set fetched from the server.
|
|
170
|
+
|
|
171
|
+
## Keyboard
|
|
172
|
+
|
|
173
|
+
| Keys | Action |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| Arrows, Home/End, Ctrl+Home/End, PageUp/PageDown | Move between cells (header row included). |
|
|
176
|
+
| Enter (header) | Sort; Shift+Enter adds to the sort. |
|
|
177
|
+
| Alt+↓ or the Menu key (header) | Open the column menu. |
|
|
178
|
+
| Enter / F2 | Edit the cell, or focus the widget inside a custom cell. |
|
|
179
|
+
| Space | Toggle row selection (Shift for a range). |
|
|
180
|
+
| Ctrl/Cmd+A | Select all rows. |
|
|
181
|
+
| Ctrl/Cmd+C | Copy selected rows (TSV) or the active cell. |
|
|
182
|
+
| Escape | Cancel editing / leave a widget inside a cell. |
|
|
183
|
+
|
|
184
|
+
## Theming
|
|
185
|
+
|
|
186
|
+
Styles live in `@layer components`, so Tailwind utilities passed via
|
|
187
|
+
`classNames` / `className` win. Override the `--dg-*` variables for a theme:
|
|
188
|
+
|
|
189
|
+
```css
|
|
190
|
+
.dg-root { --dg-accent: #7c3aed; --dg-radius: 12px; --dg-font-size: 14px; }
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Colors follow the page's `color-scheme`. A `.dark` or `[data-theme="dark"]`
|
|
194
|
+
ancestor forces a scheme. State is exposed as attributes for styling:
|
|
195
|
+
`data-selected`, `data-active`, `data-editing`, `data-pinned`, `data-density`,
|
|
196
|
+
and `aria-sort` on header cells.
|
|
197
|
+
|
|
198
|
+
Slots for `classNames`: `root`, `toolbar`, `viewport`, `header`, `headerCell`,
|
|
199
|
+
`row`, `cell`, `pagination`.
|
|
200
|
+
|
|
201
|
+
## Next.js
|
|
202
|
+
|
|
203
|
+
Components carry `"use client"`; import `DataGrid` from a Server Component and
|
|
204
|
+
pass serializable props (`data`, `initialState`). Column definitions contain
|
|
205
|
+
functions, so define them in a client module. For server mode, fetch in a
|
|
206
|
+
Server Component or Route Handler using `core` functions, and sync the query to
|
|
207
|
+
the URL (e.g. with `nuqs`) through `state` + `onQueryChange`.
|
|
208
|
+
|
|
209
|
+
## Known limits
|
|
210
|
+
|
|
211
|
+
- Rows have a fixed height (per density or `rowHeight`); variable-height rows are not supported.
|
|
212
|
+
- Updates from the grid's store render synchronously; heavy client-side filtering is
|
|
213
|
+
deferred with `useDeferredValue`, but a single filter pass over very large data
|
|
214
|
+
(1M+ rows) still runs on the main thread. For that scale, use server mode or a worker.
|
|
215
|
+
- Row grouping, tree data and pivoting are not implemented.
|
|
216
|
+
|
|
217
|
+
## Migrating from `component-lib/datagrid`
|
|
218
|
+
|
|
219
|
+
| Old prop | New |
|
|
220
|
+
| --- | --- |
|
|
221
|
+
| `dataSource` (array) | `data` |
|
|
222
|
+
| `dataSource` (URL string) | Fetch in your app; pass `data` (the grid no longer fetches). |
|
|
223
|
+
| `lazy` + `pageSettings.totalCount` | `mode="server"` + `rowCount` |
|
|
224
|
+
| `pageSettings.pageNumber` / `pageSize` | `initialState={{ pagination: { pageIndex: 0, pageSize } }}` |
|
|
225
|
+
| `enableSearch`, `enableExcelExport`, `enablePdfExport` | `toolbar={{ search, export }}` |
|
|
226
|
+
| `selectAll`, `onSelectRow` | `enableRowSelection`, `onStateChange` / `api.getSelectedRows()` |
|
|
227
|
+
| `rowChange` / `onRowClick` | `onRowClick` |
|
|
228
|
+
| `pageStatus` / `onPageChange`, `onFilterChange`, `onSearchChange` | `onQueryChange` |
|
|
229
|
+
| `initialFilters`, `initialSearchParam` | `initialState={{ filters, globalFilter }}` |
|
|
230
|
+
| `isFetching` | `loading` |
|
|
231
|
+
| `column.headerText`, `column.template` | `header`, `cell` |
|
|
232
|
+
| `grid*Class` props | `classNames` slots |
|
|
233
|
+
| `ref.goToPage(n)` etc. | `ref.setPageIndex(n)` and the API above |
|