@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,250 @@
|
|
|
1
|
+
{
|
|
2
|
+
"passportVersion": "1.0.0",
|
|
3
|
+
"identity": {
|
|
4
|
+
"component": "Alert",
|
|
5
|
+
"folder": "alert",
|
|
6
|
+
"exports": [
|
|
7
|
+
"Alert"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"source": {
|
|
11
|
+
"libraryVersion": "2.4.0",
|
|
12
|
+
"files": [
|
|
13
|
+
"core/index.ts",
|
|
14
|
+
"core/live.ts",
|
|
15
|
+
"core/types.ts",
|
|
16
|
+
"index.ts",
|
|
17
|
+
"react/Alert.tsx",
|
|
18
|
+
"react/icons.tsx",
|
|
19
|
+
"react/locale.ts",
|
|
20
|
+
"react/props.ts"
|
|
21
|
+
],
|
|
22
|
+
"sourceHash": "sha256:fb3baa3da19c07b09a7bebf3c96c8360ce4612c4b882f6dd2f95aa0616b6bead"
|
|
23
|
+
},
|
|
24
|
+
"props": [
|
|
25
|
+
{
|
|
26
|
+
"name": "actions",
|
|
27
|
+
"type": "other",
|
|
28
|
+
"typeText": "ReactNode",
|
|
29
|
+
"required": false,
|
|
30
|
+
"origin": "derived",
|
|
31
|
+
"description": "Buttons under the message: \"Try again\", \"Go to billing\".",
|
|
32
|
+
"descriptionOrigin": "jsdoc"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "aria-describedby",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"typeText": "string | undefined",
|
|
38
|
+
"required": false,
|
|
39
|
+
"origin": "inherited"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "aria-label",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"typeText": "string | undefined",
|
|
45
|
+
"required": false,
|
|
46
|
+
"origin": "inherited"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "aria-labelledby",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"typeText": "string | undefined",
|
|
52
|
+
"required": false,
|
|
53
|
+
"origin": "inherited"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "children",
|
|
57
|
+
"type": "other",
|
|
58
|
+
"typeText": "ReactNode",
|
|
59
|
+
"required": false,
|
|
60
|
+
"origin": "derived"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "className",
|
|
64
|
+
"type": "string",
|
|
65
|
+
"typeText": "string | undefined",
|
|
66
|
+
"required": false,
|
|
67
|
+
"origin": "derived"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "classNames",
|
|
71
|
+
"type": "other",
|
|
72
|
+
"typeText": "Partial<Record<AlertSlot, string>> | undefined",
|
|
73
|
+
"required": false,
|
|
74
|
+
"origin": "derived"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "description",
|
|
78
|
+
"type": "other",
|
|
79
|
+
"typeText": "ReactNode",
|
|
80
|
+
"required": false,
|
|
81
|
+
"origin": "derived",
|
|
82
|
+
"description": "The message. `children` works too, and is the better place for links.",
|
|
83
|
+
"descriptionOrigin": "jsdoc"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "hidden",
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"typeText": "boolean | undefined",
|
|
89
|
+
"required": false,
|
|
90
|
+
"origin": "inherited"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "icon",
|
|
94
|
+
"type": "other",
|
|
95
|
+
"typeText": "ReactNode",
|
|
96
|
+
"required": false,
|
|
97
|
+
"origin": "derived",
|
|
98
|
+
"description": "Replace the variant's glyph, or pass `false` for none.",
|
|
99
|
+
"descriptionOrigin": "jsdoc"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "id",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"typeText": "string | undefined",
|
|
105
|
+
"required": false,
|
|
106
|
+
"origin": "inherited"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "localeText",
|
|
110
|
+
"type": "other",
|
|
111
|
+
"typeText": "Partial<AlertLocaleText> | undefined",
|
|
112
|
+
"required": false,
|
|
113
|
+
"origin": "derived"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "onDismiss",
|
|
117
|
+
"type": "function",
|
|
118
|
+
"signature": "(() => void) | undefined",
|
|
119
|
+
"required": false,
|
|
120
|
+
"origin": "derived",
|
|
121
|
+
"description": "Show a close button. The alert does not hide itself; remove it in the handler.",
|
|
122
|
+
"descriptionOrigin": "jsdoc"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "ref",
|
|
126
|
+
"type": "other",
|
|
127
|
+
"typeText": "Ref<HTMLDivElement> | undefined",
|
|
128
|
+
"required": false,
|
|
129
|
+
"origin": "derived"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "size",
|
|
133
|
+
"type": "enum",
|
|
134
|
+
"values": [
|
|
135
|
+
"md",
|
|
136
|
+
"sm"
|
|
137
|
+
],
|
|
138
|
+
"typeText": "AlertSize | undefined",
|
|
139
|
+
"required": false,
|
|
140
|
+
"default": "md",
|
|
141
|
+
"origin": "derived",
|
|
142
|
+
"description": "Default `md`. `sm` drops the title to one line of text.",
|
|
143
|
+
"descriptionOrigin": "jsdoc"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "style",
|
|
147
|
+
"type": "other",
|
|
148
|
+
"typeText": "CSSProperties | undefined",
|
|
149
|
+
"required": false,
|
|
150
|
+
"origin": "derived"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "tabIndex",
|
|
154
|
+
"type": "number",
|
|
155
|
+
"typeText": "number | undefined",
|
|
156
|
+
"required": false,
|
|
157
|
+
"origin": "inherited"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "title",
|
|
161
|
+
"type": "other",
|
|
162
|
+
"typeText": "ReactNode",
|
|
163
|
+
"required": false,
|
|
164
|
+
"origin": "derived"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "variant",
|
|
168
|
+
"type": "enum",
|
|
169
|
+
"values": [
|
|
170
|
+
"danger",
|
|
171
|
+
"info",
|
|
172
|
+
"neutral",
|
|
173
|
+
"success",
|
|
174
|
+
"warning"
|
|
175
|
+
],
|
|
176
|
+
"typeText": "AlertVariant | undefined",
|
|
177
|
+
"required": false,
|
|
178
|
+
"default": "info",
|
|
179
|
+
"origin": "derived",
|
|
180
|
+
"description": "Default `info`.",
|
|
181
|
+
"descriptionOrigin": "jsdoc"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"inherits": [
|
|
185
|
+
{
|
|
186
|
+
"from": "HTMLAttributes<HTMLDivElement>",
|
|
187
|
+
"omitted": [
|
|
188
|
+
"role",
|
|
189
|
+
"title"
|
|
190
|
+
],
|
|
191
|
+
"passthrough": true
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"events": [
|
|
195
|
+
{
|
|
196
|
+
"name": "onDismiss",
|
|
197
|
+
"signature": "(() => void) | undefined"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"slots": [
|
|
201
|
+
"root",
|
|
202
|
+
"icon",
|
|
203
|
+
"content",
|
|
204
|
+
"title",
|
|
205
|
+
"description",
|
|
206
|
+
"actions",
|
|
207
|
+
"dismiss"
|
|
208
|
+
],
|
|
209
|
+
"states": [
|
|
210
|
+
{
|
|
211
|
+
"attr": "data-size",
|
|
212
|
+
"values": [
|
|
213
|
+
"sm"
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"attr": "data-theme",
|
|
218
|
+
"values": [
|
|
219
|
+
"dark",
|
|
220
|
+
"light"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"attr": "data-variant",
|
|
225
|
+
"values": [
|
|
226
|
+
"danger",
|
|
227
|
+
"neutral",
|
|
228
|
+
"success",
|
|
229
|
+
"warning"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"accessibility": {
|
|
234
|
+
"supplied": [],
|
|
235
|
+
"required": []
|
|
236
|
+
},
|
|
237
|
+
"composition": {},
|
|
238
|
+
"operations": {},
|
|
239
|
+
"intentDomains": [],
|
|
240
|
+
"safeMutations": {},
|
|
241
|
+
"examples": [],
|
|
242
|
+
"coverage": {
|
|
243
|
+
"propsTotal": 19,
|
|
244
|
+
"propsDescribed": 6,
|
|
245
|
+
"describedPct": 32,
|
|
246
|
+
"authoredSections": [
|
|
247
|
+
"accessibility"
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useMemo,
|
|
5
|
+
type CSSProperties,
|
|
6
|
+
type HTMLAttributes,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
type Ref,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { liveness } from "../core/live";
|
|
11
|
+
import type { AlertLocaleText, AlertSize, AlertVariant } from "../core/types";
|
|
12
|
+
import { VARIANT_ICONS, XIcon } from "./icons";
|
|
13
|
+
import { defaultAlertText } from "./locale";
|
|
14
|
+
import { cx, type AlertSlot } from "./props";
|
|
15
|
+
|
|
16
|
+
export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "role"> {
|
|
17
|
+
/** Default `info`. */
|
|
18
|
+
variant?: AlertVariant;
|
|
19
|
+
/** Default `md`. `sm` drops the title to one line of text. */
|
|
20
|
+
size?: AlertSize;
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
/** The message. `children` works too, and is the better place for links. */
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** Replace the variant's glyph, or pass `false` for none. */
|
|
26
|
+
icon?: ReactNode | false;
|
|
27
|
+
/** Buttons under the message: "Try again", "Go to billing". */
|
|
28
|
+
actions?: ReactNode;
|
|
29
|
+
/** Show a close button. The alert does not hide itself; remove it in the handler. */
|
|
30
|
+
onDismiss?(): void;
|
|
31
|
+
className?: string;
|
|
32
|
+
classNames?: Partial<Record<AlertSlot, string>>;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
localeText?: Partial<AlertLocaleText>;
|
|
35
|
+
ref?: Ref<HTMLDivElement>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A message that stays in the page: a trial ending, a read-only record, the
|
|
40
|
+
* summary above a form that failed validation.
|
|
41
|
+
*
|
|
42
|
+
* It is the third of three ways to say something, and the only one that is
|
|
43
|
+
* neither interrupting nor temporary. Use a **Dialog** when the message needs a
|
|
44
|
+
* decision before anything else can happen, a **Toast** to confirm something
|
|
45
|
+
* that has already happened, and an Alert for the state a page or section is
|
|
46
|
+
* in.
|
|
47
|
+
*/
|
|
48
|
+
export function Alert(props: AlertProps) {
|
|
49
|
+
const {
|
|
50
|
+
ref,
|
|
51
|
+
variant = "info",
|
|
52
|
+
size = "md",
|
|
53
|
+
title,
|
|
54
|
+
description,
|
|
55
|
+
children,
|
|
56
|
+
icon,
|
|
57
|
+
actions,
|
|
58
|
+
onDismiss,
|
|
59
|
+
className,
|
|
60
|
+
classNames,
|
|
61
|
+
style,
|
|
62
|
+
localeText,
|
|
63
|
+
...rest
|
|
64
|
+
} = props;
|
|
65
|
+
|
|
66
|
+
const text = useMemo(() => ({ ...defaultAlertText, ...localeText }), [localeText]);
|
|
67
|
+
const { role, live } = liveness(variant);
|
|
68
|
+
const Glyph = VARIANT_ICONS[variant];
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
{...rest}
|
|
73
|
+
ref={ref}
|
|
74
|
+
// Only what appears after the page has loaded is announced; a banner that
|
|
75
|
+
// was there from the start is read in its turn, like any other text.
|
|
76
|
+
role={role}
|
|
77
|
+
aria-live={live}
|
|
78
|
+
className={cx("al-root", classNames?.root, className)}
|
|
79
|
+
style={style}
|
|
80
|
+
data-variant={variant}
|
|
81
|
+
data-size={size}
|
|
82
|
+
>
|
|
83
|
+
{icon !== false && (
|
|
84
|
+
<span className={cx("al-icon", classNames?.icon)} aria-hidden="true">
|
|
85
|
+
{icon ?? <Glyph />}
|
|
86
|
+
</span>
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
<div className={cx("al-content", classNames?.content)}>
|
|
90
|
+
{title && <p className={cx("al-title", classNames?.title)}>{title}</p>}
|
|
91
|
+
{(description || children) && (
|
|
92
|
+
<div className={cx("al-description", classNames?.description)}>
|
|
93
|
+
{description}
|
|
94
|
+
{children}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
{actions && <div className={cx("al-actions", classNames?.actions)}>{actions}</div>}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{onDismiss && (
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
className={cx("al-dismiss", classNames?.dismiss)}
|
|
104
|
+
aria-label={text.dismiss}
|
|
105
|
+
title={text.dismiss}
|
|
106
|
+
onClick={onDismiss}
|
|
107
|
+
>
|
|
108
|
+
<XIcon />
|
|
109
|
+
</button>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertCircleIcon,
|
|
3
|
+
InfoIcon,
|
|
4
|
+
SuccessIcon,
|
|
5
|
+
WarningIcon,
|
|
6
|
+
XIcon as SharedX,
|
|
7
|
+
type IconProps,
|
|
8
|
+
} from "../../shared/react/icons";
|
|
9
|
+
import type { AlertVariant } from "../core/types";
|
|
10
|
+
|
|
11
|
+
/** 14px, to sit in the corner without pulling the eye from the message. */
|
|
12
|
+
export const XIcon = (p: IconProps) => <SharedX width={14} height={14} {...p} />;
|
|
13
|
+
|
|
14
|
+
/** The glyph each variant carries, so colour is never the only signal. */
|
|
15
|
+
export const VARIANT_ICONS: Record<AlertVariant, (props: IconProps) => React.JSX.Element> = {
|
|
16
|
+
info: InfoIcon,
|
|
17
|
+
success: SuccessIcon,
|
|
18
|
+
warning: WarningIcon,
|
|
19
|
+
danger: AlertCircleIcon,
|
|
20
|
+
neutral: InfoIcon,
|
|
21
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Alert styles.
|
|
3
|
+
*
|
|
4
|
+
* A banner that sits in the page, tinted by variant. Tokens read the shared
|
|
5
|
+
* --gbs-* variables when they are set on an ancestor (set them on :root to
|
|
6
|
+
* theme every component at once). 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
|
+
.al-root {
|
|
13
|
+
--al-fg: var(--gbs-fg, var(--dg-fg, light-dark(#18181b, #f4f4f5)));
|
|
14
|
+
--al-muted: var(--gbs-muted, var(--dg-muted, light-dark(#71717a, #a1a1aa)));
|
|
15
|
+
--al-border: var(--gbs-border, var(--dg-border, light-dark(#e4e4e7, #27272a)));
|
|
16
|
+
--al-bg: var(--gbs-bg, var(--dg-bg, light-dark(#ffffff, #0b0b0e)));
|
|
17
|
+
--al-hover: var(--gbs-hover, var(--dg-hover, light-dark(#f4f4f5, #1f1f23)));
|
|
18
|
+
--al-focus: var(--gbs-focus, var(--dg-focus, light-dark(#2563eb, #60a5fa)));
|
|
19
|
+
--al-info: var(--gbs-info, var(--gbs-accent, var(--dg-accent, light-dark(#2563eb, #60a5fa))));
|
|
20
|
+
--al-success: var(--gbs-success, light-dark(#15803d, #4ade80));
|
|
21
|
+
--al-warning: var(--gbs-warning, light-dark(#b45309, #fbbf24));
|
|
22
|
+
--al-danger: var(--gbs-danger, var(--dg-danger, light-dark(#dc2626, #f87171)));
|
|
23
|
+
--al-radius: var(--gbs-radius, var(--dg-radius, 8px));
|
|
24
|
+
--al-font-size: var(--gbs-font-size, var(--dg-font-size, 13px));
|
|
25
|
+
--al-accent: var(--al-info);
|
|
26
|
+
--al-px: 14px;
|
|
27
|
+
--al-py: 12px;
|
|
28
|
+
|
|
29
|
+
color-scheme: inherit;
|
|
30
|
+
position: relative;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: flex-start;
|
|
33
|
+
gap: 10px;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
padding: var(--al-py) var(--al-px);
|
|
36
|
+
/* The bar carries the variant at a glance; the tint alone is too faint to
|
|
37
|
+
read as a signal, and colour is never the only one — there is a glyph. */
|
|
38
|
+
border: 1px solid var(--al-border);
|
|
39
|
+
border-inline-start: 3px solid var(--al-accent);
|
|
40
|
+
border-radius: var(--al-radius);
|
|
41
|
+
background: color-mix(in oklab, var(--al-accent) 7%, var(--al-bg));
|
|
42
|
+
font-size: var(--al-font-size);
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
color: var(--al-fg);
|
|
45
|
+
text-wrap: pretty;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:where(.dark, [data-theme="dark"]) .al-root {
|
|
49
|
+
color-scheme: dark;
|
|
50
|
+
}
|
|
51
|
+
:where(.light, [data-theme="light"]) .al-root {
|
|
52
|
+
color-scheme: light;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:where(.al-root) *,
|
|
56
|
+
:where(.al-root) *::before,
|
|
57
|
+
:where(.al-root) *::after {
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.al-root[data-variant="success"] {
|
|
62
|
+
--al-accent: var(--al-success);
|
|
63
|
+
}
|
|
64
|
+
.al-root[data-variant="warning"] {
|
|
65
|
+
--al-accent: var(--al-warning);
|
|
66
|
+
}
|
|
67
|
+
.al-root[data-variant="danger"] {
|
|
68
|
+
--al-accent: var(--al-danger);
|
|
69
|
+
}
|
|
70
|
+
.al-root[data-variant="neutral"] {
|
|
71
|
+
--al-accent: var(--al-muted);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.al-root[data-size="sm"] {
|
|
75
|
+
--al-px: 10px;
|
|
76
|
+
--al-py: 8px;
|
|
77
|
+
--al-font-size: 12px;
|
|
78
|
+
gap: 8px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.al-icon {
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
flex: none;
|
|
84
|
+
/* Optically centred on the first line of text rather than its box. */
|
|
85
|
+
margin-top: 1px;
|
|
86
|
+
color: var(--al-accent);
|
|
87
|
+
}
|
|
88
|
+
.al-icon > svg {
|
|
89
|
+
width: 16px;
|
|
90
|
+
height: 16px;
|
|
91
|
+
}
|
|
92
|
+
.al-root[data-size="sm"] .al-icon > svg {
|
|
93
|
+
width: 14px;
|
|
94
|
+
height: 14px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.al-content {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex: 1 1 auto;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: 2px;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
}
|
|
104
|
+
.al-title {
|
|
105
|
+
margin: 0;
|
|
106
|
+
font-weight: 600;
|
|
107
|
+
}
|
|
108
|
+
.al-description {
|
|
109
|
+
margin: 0;
|
|
110
|
+
/* Not muted: this is the message, not a hint about one. */
|
|
111
|
+
color: inherit;
|
|
112
|
+
}
|
|
113
|
+
.al-description a {
|
|
114
|
+
color: var(--al-accent);
|
|
115
|
+
text-underline-offset: 2px;
|
|
116
|
+
}
|
|
117
|
+
.al-actions {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 8px;
|
|
122
|
+
margin-top: 8px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.al-dismiss {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
flex: none;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: 22px;
|
|
131
|
+
height: 22px;
|
|
132
|
+
margin: -2px -4px 0 0;
|
|
133
|
+
padding: 0;
|
|
134
|
+
border: 0;
|
|
135
|
+
border-radius: 4px;
|
|
136
|
+
background: none;
|
|
137
|
+
color: var(--al-muted);
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
}
|
|
140
|
+
.al-dismiss:hover {
|
|
141
|
+
background: var(--al-hover);
|
|
142
|
+
color: var(--al-fg);
|
|
143
|
+
}
|
|
144
|
+
.al-dismiss:focus-visible {
|
|
145
|
+
outline: 2px solid var(--al-focus);
|
|
146
|
+
outline-offset: 1px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (forced-colors: active) {
|
|
150
|
+
.al-root {
|
|
151
|
+
border: 1px solid CanvasText;
|
|
152
|
+
border-inline-start-width: 3px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a name into the two things an avatar needs when there is no picture:
|
|
3
|
+
* a couple of letters, and a colour that is always the same for that person.
|
|
4
|
+
*
|
|
5
|
+
* Both are harder than they look, and both are wrong in a way that is hard to
|
|
6
|
+
* notice from an English-speaking desk — which is why they are here, pure and
|
|
7
|
+
* under test, rather than inline in the component.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Names are split on whitespace — `\s` covers the no-break space a copied name
|
|
12
|
+
* often carries — and on the punctuation that joins parts of one.
|
|
13
|
+
*/
|
|
14
|
+
const SEPARATORS = /[\s._\-–—/\\|,]+/u;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Letters from a name: two for a name with parts, one otherwise.
|
|
18
|
+
*
|
|
19
|
+
* `"Ada Lovelace"` gives `AL`, `"ada"` gives `A`, `"ada@example.com"` gives
|
|
20
|
+
* `A` — an email is not a name, so only the part before the `@` is looked at
|
|
21
|
+
* and never the domain.
|
|
22
|
+
*
|
|
23
|
+
* Two deliberate decisions:
|
|
24
|
+
*
|
|
25
|
+
* Characters are taken with `Intl.Segmenter` where it exists, so a name
|
|
26
|
+
* beginning with an emoji, a surrogate pair or a letter carrying a combining
|
|
27
|
+
* mark yields that whole character rather than half of it — `slice(0, 1)` on a
|
|
28
|
+
* string is a byte operation wearing a costume.
|
|
29
|
+
*
|
|
30
|
+
* Scripts without letter case are left alone: uppercasing is meaningless for
|
|
31
|
+
* CJK and can change the character. A Japanese name gives its first character,
|
|
32
|
+
* not a mangled one.
|
|
33
|
+
*/
|
|
34
|
+
export function initials(name: string, max = 2): string {
|
|
35
|
+
const source = name.trim().split("@")[0] ?? "";
|
|
36
|
+
if (source === "") return "";
|
|
37
|
+
|
|
38
|
+
const parts = source.split(SEPARATORS).filter(Boolean);
|
|
39
|
+
if (parts.length === 0) return "";
|
|
40
|
+
|
|
41
|
+
// One part is a single name or a handle: one letter is enough, and taking
|
|
42
|
+
// two from "Madonna" gives "MA", which looks like a mistake.
|
|
43
|
+
const chosen = parts.length === 1 ? [parts[0]] : [parts[0], parts[parts.length - 1]];
|
|
44
|
+
|
|
45
|
+
return chosen
|
|
46
|
+
.slice(0, max)
|
|
47
|
+
.map((part) => firstCharacter(part))
|
|
48
|
+
.join("");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function firstCharacter(part: string): string {
|
|
52
|
+
const character = segmentFirst(part);
|
|
53
|
+
// `toLocaleUpperCase` on a script with no case returns it unchanged, which is
|
|
54
|
+
// the behaviour we want; it is the two-character mappings (ß → SS) that have
|
|
55
|
+
// to be cut back to one.
|
|
56
|
+
const upper = character.toLocaleUpperCase();
|
|
57
|
+
return upper.length > character.length ? character : upper;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let segmenter: Intl.Segmenter | null | undefined;
|
|
61
|
+
|
|
62
|
+
function segmentFirst(text: string): string {
|
|
63
|
+
if (segmenter === undefined) {
|
|
64
|
+
segmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter() : null;
|
|
65
|
+
}
|
|
66
|
+
if (segmenter) {
|
|
67
|
+
for (const { segment } of segmenter.segment(text)) return segment;
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
// Without Segmenter, code points at least keep surrogate pairs whole.
|
|
71
|
+
return Array.from(text)[0] ?? "";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A stable index into a palette, from any string.
|
|
76
|
+
*
|
|
77
|
+
* The same person keeps the same colour on every page and in every session,
|
|
78
|
+
* without anything being stored, because the hash is a pure function of their
|
|
79
|
+
* name. FNV-1a: small, well spread for short strings, and not a security
|
|
80
|
+
* decision — nothing here is a secret.
|
|
81
|
+
*/
|
|
82
|
+
export function colorIndex(seed: string, count: number): number {
|
|
83
|
+
if (count <= 0) return 0;
|
|
84
|
+
let hash = 0x811c9dc5;
|
|
85
|
+
for (let index = 0; index < seed.length; index++) {
|
|
86
|
+
hash ^= seed.charCodeAt(index);
|
|
87
|
+
hash = Math.imul(hash, 0x01000193);
|
|
88
|
+
}
|
|
89
|
+
return Math.abs(hash) % count;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* How an avatar group splits: the faces shown, and how many are left over.
|
|
94
|
+
*
|
|
95
|
+
* The overflow counter takes one of the slots, so showing "+2" out of five
|
|
96
|
+
* faces with `max: 3` means two faces and a counter, not three and a counter.
|
|
97
|
+
*/
|
|
98
|
+
export function splitGroup<T>(items: readonly T[], max: number): { shown: T[]; overflow: number } {
|
|
99
|
+
if (max <= 0) return { shown: [], overflow: items.length };
|
|
100
|
+
if (items.length <= max) return { shown: [...items], overflow: 0 };
|
|
101
|
+
const shown = items.slice(0, max - 1);
|
|
102
|
+
return { shown, overflow: items.length - shown.length };
|
|
103
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
2
|
+
|
|
3
|
+
export type AvatarShape = "circle" | "square";
|
|
4
|
+
|
|
5
|
+
/** Who is on the other side of a presence dot. */
|
|
6
|
+
export type AvatarStatus = "online" | "away" | "busy" | "offline";
|
|
7
|
+
|
|
8
|
+
export interface AvatarLocaleText {
|
|
9
|
+
/** The overflow bubble in a group. */
|
|
10
|
+
more(count: number): string;
|
|
11
|
+
status: Record<AvatarStatus, string>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Avatar } from "./react/Avatar";
|
|
2
|
+
export type { AvatarProps } from "./react/Avatar";
|
|
3
|
+
export { AvatarGroup } from "./react/AvatarGroup";
|
|
4
|
+
export type { AvatarGroupProps } from "./react/AvatarGroup";
|
|
5
|
+
export { defaultAvatarText } from "./react/locale";
|
|
6
|
+
export type { AvatarGroupSlot, AvatarSlot } from "./react/props";
|
|
7
|
+
export * from "./core";
|