@grampro/kit 0.0.0-stage → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +173 -0
- package/LICENSE +15 -0
- package/README.md +193 -2
- package/index.cjs +1410 -0
- package/package.json +77 -6
- 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,445 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* DatePicker styles (DatePicker and DateRangePicker).
|
|
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
|
+
.dp-root {
|
|
13
|
+
--dp-bg: var(--gbs-bg, var(--dg-bg, light-dark(#ffffff, #0b0b0e)));
|
|
14
|
+
--dp-fg: var(--gbs-fg, var(--dg-fg, light-dark(#18181b, #f4f4f5)));
|
|
15
|
+
--dp-muted: var(--gbs-muted, var(--dg-muted, light-dark(#71717a, #a1a1aa)));
|
|
16
|
+
--dp-border: var(--gbs-border, var(--dg-border, light-dark(#e4e4e7, #27272a)));
|
|
17
|
+
--dp-hover: var(--gbs-hover, var(--dg-hover, light-dark(#f4f4f5, #1f1f23)));
|
|
18
|
+
--dp-input-bg: var(--gbs-input-bg, var(--dg-input-bg, light-dark(#ffffff, #121216)));
|
|
19
|
+
--dp-accent: var(--gbs-accent, var(--dg-accent, light-dark(#2563eb, #60a5fa)));
|
|
20
|
+
--dp-accent-fg: var(--gbs-accent-fg, var(--dg-accent-fg, light-dark(#ffffff, #0b1220)));
|
|
21
|
+
--dp-accent-soft: var(--gbs-accent-soft, var(--dg-accent-soft, light-dark(#eff6ff, #172554)));
|
|
22
|
+
--dp-accent-strong: var(--gbs-accent-strong, var(--dg-accent-strong, light-dark(#1d4ed8, #bfdbfe)));
|
|
23
|
+
--dp-focus: var(--gbs-focus, var(--dg-focus, light-dark(#2563eb, #60a5fa)));
|
|
24
|
+
--dp-danger: var(--gbs-danger, var(--dg-danger, light-dark(#dc2626, #f87171)));
|
|
25
|
+
--dp-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
|
+
--dp-radius: var(--gbs-radius, var(--dg-radius, 8px));
|
|
27
|
+
--dp-font-size: var(--gbs-font-size, var(--dg-font-size, 13px));
|
|
28
|
+
--dp-height: 36px;
|
|
29
|
+
--dp-px: 10px;
|
|
30
|
+
--dp-day-size: 34px;
|
|
31
|
+
|
|
32
|
+
color-scheme: inherit;
|
|
33
|
+
position: relative;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 4px;
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
font-size: var(--dp-font-size);
|
|
40
|
+
line-height: 1.4;
|
|
41
|
+
color: var(--dp-fg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:where(.dark, [data-theme="dark"]) .dp-root {
|
|
45
|
+
color-scheme: dark;
|
|
46
|
+
}
|
|
47
|
+
:where(.light, [data-theme="light"]) .dp-root {
|
|
48
|
+
color-scheme: light;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:where(.dp-root, .dp-popover) *,
|
|
52
|
+
:where(.dp-root, .dp-popover) *::before,
|
|
53
|
+
:where(.dp-root, .dp-popover) *::after {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dp-root[data-size="sm"] {
|
|
58
|
+
--dp-height: 30px;
|
|
59
|
+
--dp-font-size: 12px;
|
|
60
|
+
--dp-px: 8px;
|
|
61
|
+
--dp-day-size: 30px;
|
|
62
|
+
}
|
|
63
|
+
.dp-root[data-size="lg"] {
|
|
64
|
+
--dp-height: 44px;
|
|
65
|
+
--dp-font-size: 14px;
|
|
66
|
+
--dp-px: 12px;
|
|
67
|
+
--dp-day-size: 38px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dp-label {
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
}
|
|
73
|
+
.dp-label[data-required]::after {
|
|
74
|
+
content: " *";
|
|
75
|
+
color: var(--dp-danger);
|
|
76
|
+
}
|
|
77
|
+
.dp-description {
|
|
78
|
+
color: var(--dp-muted);
|
|
79
|
+
font-size: 0.92em;
|
|
80
|
+
}
|
|
81
|
+
.dp-error {
|
|
82
|
+
color: var(--dp-danger);
|
|
83
|
+
font-size: 0.92em;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* --------------------------------------------------------------- field */
|
|
87
|
+
|
|
88
|
+
.dp-control {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
gap: 4px;
|
|
92
|
+
width: 100%;
|
|
93
|
+
min-height: var(--dp-height);
|
|
94
|
+
padding: 2px var(--dp-px);
|
|
95
|
+
border: 1px solid var(--dp-border);
|
|
96
|
+
border-radius: var(--dp-radius);
|
|
97
|
+
background: var(--dp-input-bg);
|
|
98
|
+
}
|
|
99
|
+
.dp-control:hover:not([data-disabled]) {
|
|
100
|
+
border-color: color-mix(in oklab, var(--dp-border), var(--dp-fg) 25%);
|
|
101
|
+
}
|
|
102
|
+
.dp-control:focus-within,
|
|
103
|
+
.dp-root[data-state="open"] .dp-control {
|
|
104
|
+
outline: 2px solid var(--dp-focus);
|
|
105
|
+
outline-offset: -1px;
|
|
106
|
+
}
|
|
107
|
+
.dp-control[data-invalid] {
|
|
108
|
+
border-color: var(--dp-danger);
|
|
109
|
+
}
|
|
110
|
+
.dp-control[data-invalid]:focus-within,
|
|
111
|
+
.dp-root[data-invalid][data-state="open"] .dp-control {
|
|
112
|
+
outline-color: var(--dp-danger);
|
|
113
|
+
}
|
|
114
|
+
.dp-control[data-disabled] {
|
|
115
|
+
opacity: 0.55;
|
|
116
|
+
}
|
|
117
|
+
.dp-control[data-disabled] .dp-input {
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dp-input {
|
|
122
|
+
flex: 1 1 auto;
|
|
123
|
+
width: 100%;
|
|
124
|
+
min-width: 0;
|
|
125
|
+
padding: 0;
|
|
126
|
+
border: 0;
|
|
127
|
+
outline: 0;
|
|
128
|
+
background: transparent;
|
|
129
|
+
color: inherit;
|
|
130
|
+
font: inherit;
|
|
131
|
+
}
|
|
132
|
+
.dp-input::placeholder {
|
|
133
|
+
color: var(--dp-muted);
|
|
134
|
+
}
|
|
135
|
+
.dp-input:read-only {
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
}
|
|
138
|
+
.dp-separator {
|
|
139
|
+
flex: none;
|
|
140
|
+
color: var(--dp-muted);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.dp-actions {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex: none;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 2px;
|
|
148
|
+
color: var(--dp-muted);
|
|
149
|
+
}
|
|
150
|
+
.dp-icon-button {
|
|
151
|
+
display: inline-grid;
|
|
152
|
+
place-items: center;
|
|
153
|
+
width: 26px;
|
|
154
|
+
height: 26px;
|
|
155
|
+
padding: 0;
|
|
156
|
+
border: 0;
|
|
157
|
+
border-radius: 6px;
|
|
158
|
+
background: transparent;
|
|
159
|
+
color: inherit;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
}
|
|
162
|
+
.dp-icon-button:hover:not(:disabled) {
|
|
163
|
+
background: var(--dp-hover);
|
|
164
|
+
color: var(--dp-fg);
|
|
165
|
+
}
|
|
166
|
+
.dp-icon-button:focus-visible {
|
|
167
|
+
outline: 2px solid var(--dp-focus);
|
|
168
|
+
outline-offset: 1px;
|
|
169
|
+
}
|
|
170
|
+
.dp-icon-button:disabled {
|
|
171
|
+
opacity: 0.4;
|
|
172
|
+
cursor: default;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* ------------------------------------------------------------- popover */
|
|
176
|
+
|
|
177
|
+
.dp-popover {
|
|
178
|
+
position: fixed;
|
|
179
|
+
inset: auto;
|
|
180
|
+
margin: 0;
|
|
181
|
+
padding: 0;
|
|
182
|
+
overflow: visible;
|
|
183
|
+
border: 1px solid var(--dp-border);
|
|
184
|
+
border-radius: var(--dp-radius);
|
|
185
|
+
background: var(--dp-bg);
|
|
186
|
+
color: var(--dp-fg);
|
|
187
|
+
box-shadow: var(--dp-shadow);
|
|
188
|
+
font-size: var(--dp-font-size);
|
|
189
|
+
}
|
|
190
|
+
.dp-panel-root {
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: stretch;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.dp-presets {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
gap: 2px;
|
|
199
|
+
padding: 8px;
|
|
200
|
+
border-inline-end: 1px solid var(--dp-border);
|
|
201
|
+
}
|
|
202
|
+
.dp-preset {
|
|
203
|
+
padding: 6px 10px;
|
|
204
|
+
border: 0;
|
|
205
|
+
border-radius: 6px;
|
|
206
|
+
background: transparent;
|
|
207
|
+
color: inherit;
|
|
208
|
+
font: inherit;
|
|
209
|
+
text-align: start;
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
}
|
|
213
|
+
.dp-preset:hover {
|
|
214
|
+
background: var(--dp-hover);
|
|
215
|
+
}
|
|
216
|
+
.dp-preset:focus-visible {
|
|
217
|
+
outline: 2px solid var(--dp-focus);
|
|
218
|
+
outline-offset: -2px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.dp-calendar {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
padding: 8px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.dp-nav {
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: space-between;
|
|
231
|
+
gap: 4px;
|
|
232
|
+
padding-bottom: 4px;
|
|
233
|
+
}
|
|
234
|
+
/* "Previous" points the reading-back way in both directions. */
|
|
235
|
+
[dir="rtl"] .dp-nav-step svg {
|
|
236
|
+
transform: scaleX(-1);
|
|
237
|
+
}
|
|
238
|
+
.dp-nav-title {
|
|
239
|
+
display: inline-flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
gap: 4px;
|
|
242
|
+
padding: 4px 8px;
|
|
243
|
+
border: 0;
|
|
244
|
+
border-radius: 6px;
|
|
245
|
+
background: transparent;
|
|
246
|
+
color: inherit;
|
|
247
|
+
font: inherit;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
}
|
|
251
|
+
.dp-nav-title:hover {
|
|
252
|
+
background: var(--dp-hover);
|
|
253
|
+
}
|
|
254
|
+
.dp-nav-title:focus-visible {
|
|
255
|
+
outline: 2px solid var(--dp-focus);
|
|
256
|
+
outline-offset: -2px;
|
|
257
|
+
}
|
|
258
|
+
.dp-nav-chevron {
|
|
259
|
+
color: var(--dp-muted);
|
|
260
|
+
transition: transform 120ms ease;
|
|
261
|
+
}
|
|
262
|
+
.dp-nav-title[aria-expanded="true"] .dp-nav-chevron {
|
|
263
|
+
transform: rotate(180deg);
|
|
264
|
+
}
|
|
265
|
+
@media (prefers-reduced-motion: reduce) {
|
|
266
|
+
.dp-nav-chevron {
|
|
267
|
+
transition: none;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* ---------------------------------------------------------- month grid */
|
|
272
|
+
|
|
273
|
+
.dp-months {
|
|
274
|
+
display: flex;
|
|
275
|
+
gap: 16px;
|
|
276
|
+
}
|
|
277
|
+
.dp-month-caption {
|
|
278
|
+
padding-bottom: 4px;
|
|
279
|
+
color: var(--dp-muted);
|
|
280
|
+
font-weight: 600;
|
|
281
|
+
text-align: center;
|
|
282
|
+
}
|
|
283
|
+
.dp-grid {
|
|
284
|
+
border-collapse: collapse;
|
|
285
|
+
table-layout: fixed;
|
|
286
|
+
}
|
|
287
|
+
.dp-weekday,
|
|
288
|
+
.dp-week-number {
|
|
289
|
+
width: var(--dp-day-size);
|
|
290
|
+
padding: 4px 0;
|
|
291
|
+
color: var(--dp-muted);
|
|
292
|
+
font-size: 0.85em;
|
|
293
|
+
font-weight: 600;
|
|
294
|
+
text-align: center;
|
|
295
|
+
}
|
|
296
|
+
.dp-week-number {
|
|
297
|
+
width: 28px;
|
|
298
|
+
border-inline-end: 1px solid var(--dp-border);
|
|
299
|
+
font-weight: 400;
|
|
300
|
+
}
|
|
301
|
+
.dp-week-number abbr {
|
|
302
|
+
text-decoration: none;
|
|
303
|
+
}
|
|
304
|
+
.dp-cell {
|
|
305
|
+
padding: 1px 0;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.dp-day {
|
|
309
|
+
display: grid;
|
|
310
|
+
place-items: center;
|
|
311
|
+
width: var(--dp-day-size);
|
|
312
|
+
height: var(--dp-day-size);
|
|
313
|
+
padding: 0;
|
|
314
|
+
border: 0;
|
|
315
|
+
border-radius: 6px;
|
|
316
|
+
background: transparent;
|
|
317
|
+
color: inherit;
|
|
318
|
+
font: inherit;
|
|
319
|
+
font-variant-numeric: tabular-nums;
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
}
|
|
322
|
+
.dp-day:hover:not(:disabled) {
|
|
323
|
+
background: var(--dp-hover);
|
|
324
|
+
}
|
|
325
|
+
.dp-day:focus-visible {
|
|
326
|
+
outline: 2px solid var(--dp-focus);
|
|
327
|
+
outline-offset: -2px;
|
|
328
|
+
}
|
|
329
|
+
.dp-day[data-outside] {
|
|
330
|
+
color: var(--dp-muted);
|
|
331
|
+
opacity: 0.6;
|
|
332
|
+
}
|
|
333
|
+
.dp-day[data-today] {
|
|
334
|
+
font-weight: 700;
|
|
335
|
+
box-shadow: inset 0 0 0 1px var(--dp-accent);
|
|
336
|
+
}
|
|
337
|
+
.dp-day[data-selected] {
|
|
338
|
+
background: var(--dp-accent);
|
|
339
|
+
color: var(--dp-accent-fg);
|
|
340
|
+
font-weight: 600;
|
|
341
|
+
}
|
|
342
|
+
.dp-day[data-selected]:hover {
|
|
343
|
+
background: var(--dp-accent);
|
|
344
|
+
}
|
|
345
|
+
.dp-day:disabled {
|
|
346
|
+
opacity: 0.35;
|
|
347
|
+
cursor: not-allowed;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* The band spans the cell, so a range reads as one continuous stripe. */
|
|
351
|
+
.dp-cell[data-in-range] {
|
|
352
|
+
background: var(--dp-accent-soft);
|
|
353
|
+
}
|
|
354
|
+
.dp-cell[data-range-start] {
|
|
355
|
+
border-start-start-radius: 6px;
|
|
356
|
+
border-end-start-radius: 6px;
|
|
357
|
+
}
|
|
358
|
+
.dp-cell[data-range-end] {
|
|
359
|
+
border-start-end-radius: 6px;
|
|
360
|
+
border-end-end-radius: 6px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* --------------------------------------------------- month/year panels */
|
|
364
|
+
|
|
365
|
+
.dp-panel {
|
|
366
|
+
display: grid;
|
|
367
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
368
|
+
gap: 4px;
|
|
369
|
+
padding: 4px 0;
|
|
370
|
+
}
|
|
371
|
+
.dp-panel-item {
|
|
372
|
+
padding: 8px 6px;
|
|
373
|
+
border: 0;
|
|
374
|
+
border-radius: 6px;
|
|
375
|
+
background: transparent;
|
|
376
|
+
color: inherit;
|
|
377
|
+
font: inherit;
|
|
378
|
+
cursor: pointer;
|
|
379
|
+
}
|
|
380
|
+
.dp-panel-item:hover:not(:disabled) {
|
|
381
|
+
background: var(--dp-hover);
|
|
382
|
+
}
|
|
383
|
+
.dp-panel-item:focus-visible {
|
|
384
|
+
outline: 2px solid var(--dp-focus);
|
|
385
|
+
outline-offset: -2px;
|
|
386
|
+
}
|
|
387
|
+
.dp-panel-item[data-selected] {
|
|
388
|
+
background: var(--dp-accent);
|
|
389
|
+
color: var(--dp-accent-fg);
|
|
390
|
+
font-weight: 600;
|
|
391
|
+
}
|
|
392
|
+
.dp-panel-item:disabled {
|
|
393
|
+
opacity: 0.35;
|
|
394
|
+
cursor: not-allowed;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.dp-footer {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: center;
|
|
400
|
+
justify-content: space-between;
|
|
401
|
+
gap: 8px;
|
|
402
|
+
margin-top: 4px;
|
|
403
|
+
padding-top: 6px;
|
|
404
|
+
border-top: 1px solid var(--dp-border);
|
|
405
|
+
}
|
|
406
|
+
.dp-link-button {
|
|
407
|
+
padding: 4px 6px;
|
|
408
|
+
border: 0;
|
|
409
|
+
border-radius: 4px;
|
|
410
|
+
background: none;
|
|
411
|
+
color: var(--dp-accent);
|
|
412
|
+
font: inherit;
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
}
|
|
415
|
+
.dp-link-button:hover {
|
|
416
|
+
background: var(--dp-hover);
|
|
417
|
+
}
|
|
418
|
+
.dp-link-button:focus-visible {
|
|
419
|
+
outline: 2px solid var(--dp-focus);
|
|
420
|
+
outline-offset: -2px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.dp-sr-only {
|
|
424
|
+
position: absolute;
|
|
425
|
+
width: 1px;
|
|
426
|
+
height: 1px;
|
|
427
|
+
margin: -1px;
|
|
428
|
+
padding: 0;
|
|
429
|
+
overflow: hidden;
|
|
430
|
+
clip-path: inset(50%);
|
|
431
|
+
white-space: nowrap;
|
|
432
|
+
border: 0;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
@media (forced-colors: active) {
|
|
436
|
+
.dp-day[data-selected],
|
|
437
|
+
.dp-panel-item[data-selected] {
|
|
438
|
+
background: Highlight;
|
|
439
|
+
color: HighlightText;
|
|
440
|
+
}
|
|
441
|
+
.dp-cell[data-in-range] {
|
|
442
|
+
background: Highlight;
|
|
443
|
+
forced-color-adjust: none;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
Alert, confirm and prompt dialogs for React 19 that you can `await`, styled to
|
|
4
|
+
match the rest of the library. No runtime dependencies besides React.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { dialog, DialogHost } from "@/components/dialog";
|
|
10
|
+
import "@/components/dialog/styles.css";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Mount `<DialogHost />` once near the root, then:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
if (await dialog.confirm({ title: "Delete 3 invoices?", intent: "danger", confirmLabel: "Delete" })) {
|
|
17
|
+
await deleteInvoices();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const name = await dialog.prompt({ title: "Rename", defaultValue: "report.pdf", required: true });
|
|
21
|
+
await dialog.alert("Export finished");
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- `alert` resolves when closed; `confirm` resolves `true`/`false`; `prompt` resolves the text or `null`.
|
|
25
|
+
- `onConfirm` may be async: the dialog shows progress, and if it throws, shows the error and stays open.
|
|
26
|
+
- Requests queue and show one at a time. Where there is no document (a server render) they resolve as canceled.
|
|
27
|
+
- `<Dialog open onClose>` is the same dialog as a regular controlled component.
|
|
28
|
+
|
|
29
|
+
## Options
|
|
30
|
+
|
|
31
|
+
`title`, `description`, `intent` (`default` `info` `success` `warning` `danger`),
|
|
32
|
+
`icon`, `confirmLabel`, `cancelLabel`, `dismissible`, `size` (`sm` `md`),
|
|
33
|
+
`onConfirm`. Prompt adds `defaultValue`, `placeholder`, `inputLabel`, `inputType`,
|
|
34
|
+
`required` and `validate`.
|
|
35
|
+
|
|
36
|
+
## Headless use
|
|
37
|
+
|
|
38
|
+
`createDialogStore()` and `createDialogApi(store)` build separate instances; pass
|
|
39
|
+
the store to `<DialogHost store={store} />`. The core has no React imports.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DialogStore } from "./store";
|
|
2
|
+
import type { AlertOptions, ConfirmOptions, PromptOptions } from "./types";
|
|
3
|
+
|
|
4
|
+
export interface DialogApi {
|
|
5
|
+
/** Resolves when the user presses OK (or dismisses it). */
|
|
6
|
+
alert(options: AlertOptions | string): Promise<void>;
|
|
7
|
+
/** Resolves `true` on Confirm, `false` on Cancel, Escape or a backdrop click. */
|
|
8
|
+
confirm(options: ConfirmOptions | string): Promise<boolean>;
|
|
9
|
+
/** Resolves with the entered text, or `null` when canceled. */
|
|
10
|
+
prompt(options: PromptOptions | string): Promise<string | null>;
|
|
11
|
+
dismissAll(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The `dialog` API for a store. `canShow` lets the default instance answer
|
|
16
|
+
* right away where nobody could see a dialog, such as during a server render.
|
|
17
|
+
*/
|
|
18
|
+
export function createDialogApi(store: DialogStore, canShow: () => boolean = () => true): DialogApi {
|
|
19
|
+
return {
|
|
20
|
+
alert(options) {
|
|
21
|
+
if (!canShow()) return Promise.resolve();
|
|
22
|
+
return store.open("alert", typeof options === "string" ? { title: options } : options);
|
|
23
|
+
},
|
|
24
|
+
confirm(options) {
|
|
25
|
+
if (!canShow()) return Promise.resolve(false);
|
|
26
|
+
return store.open("confirm", typeof options === "string" ? { title: options } : options);
|
|
27
|
+
},
|
|
28
|
+
prompt(options) {
|
|
29
|
+
if (!canShow()) return Promise.resolve(null);
|
|
30
|
+
return store.open("prompt", typeof options === "string" ? { title: options } : options);
|
|
31
|
+
},
|
|
32
|
+
dismissAll: () => store.dismissAll(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createDialogApi } from "./api";
|
|
2
|
+
import { createDialogStore } from "./store";
|
|
3
|
+
|
|
4
|
+
/** The store behind `dialog`, and behind any `<DialogHost />` without a `store` prop. */
|
|
5
|
+
export const dialogStore = createDialogStore();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Ask the user something from anywhere and `await` the answer. Where there is
|
|
9
|
+
* no document (a server render), calls settle at once as a cancel.
|
|
10
|
+
*/
|
|
11
|
+
export const dialog = createDialogApi(dialogStore, () => typeof document !== "undefined");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Framework-free: the dialog queue and the promise API run without React.
|
|
2
|
+
export { createDialogApi } from "./api";
|
|
3
|
+
export type { DialogApi } from "./api";
|
|
4
|
+
export { createDialogStore, resultFor } from "./store";
|
|
5
|
+
export type { DialogStore } from "./store";
|
|
6
|
+
export { dialog, dialogStore } from "./dialog";
|
|
7
|
+
export type * from "./types";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AlertOptions,
|
|
3
|
+
ConfirmOptions,
|
|
4
|
+
DialogKind,
|
|
5
|
+
DialogRequest,
|
|
6
|
+
DialogSnapshot,
|
|
7
|
+
PromptOptions,
|
|
8
|
+
} from "./types";
|
|
9
|
+
|
|
10
|
+
export interface DialogStore {
|
|
11
|
+
subscribe(listener: () => void): () => void;
|
|
12
|
+
getSnapshot(): DialogSnapshot;
|
|
13
|
+
getServerSnapshot(): DialogSnapshot;
|
|
14
|
+
open(kind: "alert", options: AlertOptions): Promise<void>;
|
|
15
|
+
open(kind: "confirm", options: ConfirmOptions): Promise<boolean>;
|
|
16
|
+
open(kind: "prompt", options: PromptOptions): Promise<string | null>;
|
|
17
|
+
/** Closes a request and settles its promise. */
|
|
18
|
+
resolve(id: string, confirmed: boolean, value?: string): void;
|
|
19
|
+
/** Cancels every open and waiting dialog. */
|
|
20
|
+
dismissAll(): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const EMPTY: DialogSnapshot = { queue: [] };
|
|
24
|
+
|
|
25
|
+
/** What each kind's promise resolves with. */
|
|
26
|
+
export function resultFor(kind: DialogKind, confirmed: boolean, value = ""): boolean | string | null | undefined {
|
|
27
|
+
if (kind === "confirm") return confirmed;
|
|
28
|
+
if (kind === "prompt") return confirmed ? value : null;
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A queue of dialogs, one on screen at a time, with no React. Each request is a
|
|
34
|
+
* promise that settles when the user answers, so callers can simply `await` it.
|
|
35
|
+
*/
|
|
36
|
+
export function createDialogStore(): DialogStore {
|
|
37
|
+
let snapshot: DialogSnapshot = EMPTY;
|
|
38
|
+
let counter = 0;
|
|
39
|
+
const listeners = new Set<() => void>();
|
|
40
|
+
const settlers = new Map<string, (result: unknown) => void>();
|
|
41
|
+
|
|
42
|
+
function commit(queue: readonly DialogRequest[]) {
|
|
43
|
+
snapshot = { queue };
|
|
44
|
+
for (const listener of listeners) listener();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function open(kind: DialogKind, options: AlertOptions | ConfirmOptions | PromptOptions) {
|
|
48
|
+
const id = `dialog-${++counter}`;
|
|
49
|
+
return new Promise<unknown>((resolve) => {
|
|
50
|
+
settlers.set(id, resolve);
|
|
51
|
+
commit([...snapshot.queue, { id, kind, options } as DialogRequest]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function resolve(id: string, confirmed: boolean, value?: string) {
|
|
56
|
+
const request = snapshot.queue.find((item) => item.id === id);
|
|
57
|
+
const settle = settlers.get(id);
|
|
58
|
+
if (!request || !settle) return;
|
|
59
|
+
settlers.delete(id);
|
|
60
|
+
commit(snapshot.queue.filter((item) => item.id !== id));
|
|
61
|
+
settle(resultFor(request.kind, confirmed, value));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function dismissAll() {
|
|
65
|
+
for (const request of snapshot.queue) resolve(request.id, false);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
subscribe(listener) {
|
|
70
|
+
listeners.add(listener);
|
|
71
|
+
return () => {
|
|
72
|
+
listeners.delete(listener);
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
getSnapshot: () => snapshot,
|
|
76
|
+
getServerSnapshot: () => EMPTY,
|
|
77
|
+
open: open as DialogStore["open"],
|
|
78
|
+
resolve,
|
|
79
|
+
dismissAll,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type DialogKind = "alert" | "confirm" | "prompt";
|
|
4
|
+
export type DialogIntent = "default" | "info" | "success" | "warning" | "danger";
|
|
5
|
+
export type DialogSize = "sm" | "md";
|
|
6
|
+
|
|
7
|
+
export interface DialogBaseOptions {
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** Sets the icon and the confirm button's color. `danger` also focuses Cancel first. */
|
|
11
|
+
intent?: DialogIntent;
|
|
12
|
+
/** Replaces the intent's icon; `null` hides it. */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
confirmLabel?: ReactNode;
|
|
15
|
+
/** Escape and a backdrop click count as Cancel. Default true. */
|
|
16
|
+
dismissible?: boolean;
|
|
17
|
+
size?: DialogSize;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AlertOptions extends DialogBaseOptions {
|
|
21
|
+
/** Runs on OK. The dialog waits while it runs and shows its error if it throws. */
|
|
22
|
+
onConfirm?(): void | Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ConfirmOptions extends DialogBaseOptions {
|
|
26
|
+
cancelLabel?: ReactNode;
|
|
27
|
+
/** Runs on Confirm. The dialog waits while it runs and shows its error if it throws. */
|
|
28
|
+
onConfirm?(): void | Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PromptOptions extends DialogBaseOptions {
|
|
32
|
+
cancelLabel?: ReactNode;
|
|
33
|
+
defaultValue?: string;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
inputLabel?: ReactNode;
|
|
36
|
+
inputType?: "text" | "email" | "password" | "number" | "url" | "tel";
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/** Return a message to block confirming. */
|
|
39
|
+
validate?(value: string): string | null | undefined;
|
|
40
|
+
/** Runs with the value on Confirm. The dialog waits while it runs and shows its error if it throws. */
|
|
41
|
+
onConfirm?(value: string): void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type DialogRequest =
|
|
45
|
+
| { id: string; kind: "alert"; options: AlertOptions }
|
|
46
|
+
| { id: string; kind: "confirm"; options: ConfirmOptions }
|
|
47
|
+
| { id: string; kind: "prompt"; options: PromptOptions };
|
|
48
|
+
|
|
49
|
+
export interface DialogSnapshot {
|
|
50
|
+
/** The first request is on screen; the rest wait their turn. */
|
|
51
|
+
queue: readonly DialogRequest[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface DialogLocaleText {
|
|
55
|
+
ok: string;
|
|
56
|
+
confirm: string;
|
|
57
|
+
cancel: string;
|
|
58
|
+
required: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Dialog } from "./react/Dialog";
|
|
2
|
+
export type { DialogAction, DialogProps } from "./react/Dialog";
|
|
3
|
+
export { DialogHost } from "./react/DialogHost";
|
|
4
|
+
export type { DialogHostProps } from "./react/DialogHost";
|
|
5
|
+
export { defaultDialogText } from "./react/locale";
|
|
6
|
+
export type { DialogSlot } from "./react/props";
|
|
7
|
+
export * from "./core";
|