@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,294 @@
|
|
|
1
|
+
{
|
|
2
|
+
"passportVersion": "1.0.0",
|
|
3
|
+
"identity": {
|
|
4
|
+
"component": "Avatar",
|
|
5
|
+
"folder": "avatar",
|
|
6
|
+
"exports": [
|
|
7
|
+
"Avatar",
|
|
8
|
+
"AvatarGroup"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"source": {
|
|
12
|
+
"libraryVersion": "2.4.0",
|
|
13
|
+
"files": [
|
|
14
|
+
"core/identity.ts",
|
|
15
|
+
"core/index.ts",
|
|
16
|
+
"core/types.ts",
|
|
17
|
+
"index.ts",
|
|
18
|
+
"react/Avatar.tsx",
|
|
19
|
+
"react/AvatarGroup.tsx",
|
|
20
|
+
"react/locale.ts",
|
|
21
|
+
"react/props.ts"
|
|
22
|
+
],
|
|
23
|
+
"sourceHash": "sha256:b77d7514edf27df52d7bad888ae4ae24cac924a9f748dcce72ae8a92256ab54a"
|
|
24
|
+
},
|
|
25
|
+
"props": [
|
|
26
|
+
{
|
|
27
|
+
"name": "aria-describedby",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"typeText": "string | undefined",
|
|
30
|
+
"required": false,
|
|
31
|
+
"origin": "inherited"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "aria-label",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"typeText": "string | undefined",
|
|
37
|
+
"required": false,
|
|
38
|
+
"origin": "inherited"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "aria-labelledby",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"typeText": "string | undefined",
|
|
44
|
+
"required": false,
|
|
45
|
+
"origin": "inherited"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "children",
|
|
49
|
+
"type": "other",
|
|
50
|
+
"typeText": "ReactNode",
|
|
51
|
+
"required": false,
|
|
52
|
+
"origin": "derived",
|
|
53
|
+
"description": "An icon or anything else to show instead of initials.",
|
|
54
|
+
"descriptionOrigin": "jsdoc"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "className",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"typeText": "string | undefined",
|
|
60
|
+
"required": false,
|
|
61
|
+
"origin": "derived"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "classNames",
|
|
65
|
+
"type": "other",
|
|
66
|
+
"typeText": "Partial<Record<AvatarSlot, string>> | undefined",
|
|
67
|
+
"required": false,
|
|
68
|
+
"origin": "derived"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "decorative",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"typeText": "boolean | undefined",
|
|
74
|
+
"required": false,
|
|
75
|
+
"default": false,
|
|
76
|
+
"origin": "derived",
|
|
77
|
+
"description": "Marks the avatar as decoration, for a name printed next to it.",
|
|
78
|
+
"descriptionOrigin": "jsdoc"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "hidden",
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"typeText": "boolean | undefined",
|
|
84
|
+
"required": false,
|
|
85
|
+
"origin": "inherited"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "id",
|
|
89
|
+
"type": "string",
|
|
90
|
+
"typeText": "string | undefined",
|
|
91
|
+
"required": false,
|
|
92
|
+
"origin": "inherited"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "initials",
|
|
96
|
+
"type": "string",
|
|
97
|
+
"typeText": "string | undefined",
|
|
98
|
+
"required": false,
|
|
99
|
+
"origin": "derived",
|
|
100
|
+
"description": "Overrides the text derived from `name`.",
|
|
101
|
+
"descriptionOrigin": "jsdoc"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "label",
|
|
105
|
+
"type": "string",
|
|
106
|
+
"typeText": "string | undefined",
|
|
107
|
+
"required": false,
|
|
108
|
+
"origin": "derived",
|
|
109
|
+
"description": "Names the set, e.g. \"Assigned to\". A list of faces with no name says nothing.",
|
|
110
|
+
"descriptionOrigin": "jsdoc"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "localeText",
|
|
114
|
+
"type": "other",
|
|
115
|
+
"typeText": "Partial<AvatarLocaleText> | undefined",
|
|
116
|
+
"required": false,
|
|
117
|
+
"origin": "derived"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "max",
|
|
121
|
+
"type": "number",
|
|
122
|
+
"typeText": "number | undefined",
|
|
123
|
+
"required": false,
|
|
124
|
+
"default": 4,
|
|
125
|
+
"origin": "derived",
|
|
126
|
+
"description": "How many slots there are, the overflow bubble included. Default 4.",
|
|
127
|
+
"descriptionOrigin": "jsdoc"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "name",
|
|
131
|
+
"type": "string",
|
|
132
|
+
"typeText": "string | undefined",
|
|
133
|
+
"required": false,
|
|
134
|
+
"default": "",
|
|
135
|
+
"origin": "derived",
|
|
136
|
+
"description": "The person or thing. Used for the alternative text, for the initials and\nfor the colour, so the same person is always the same colour.",
|
|
137
|
+
"descriptionOrigin": "jsdoc"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "ref",
|
|
141
|
+
"type": "other",
|
|
142
|
+
"typeText": "Ref<HTMLSpanElement> | undefined",
|
|
143
|
+
"required": false,
|
|
144
|
+
"origin": "derived"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "role",
|
|
148
|
+
"type": "other",
|
|
149
|
+
"typeText": "AriaRole | undefined",
|
|
150
|
+
"required": false,
|
|
151
|
+
"origin": "inherited"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "shape",
|
|
155
|
+
"type": "enum",
|
|
156
|
+
"values": [
|
|
157
|
+
"circle",
|
|
158
|
+
"square"
|
|
159
|
+
],
|
|
160
|
+
"typeText": "AvatarShape | undefined",
|
|
161
|
+
"required": false,
|
|
162
|
+
"default": "circle",
|
|
163
|
+
"origin": "derived",
|
|
164
|
+
"description": "Default `circle`.",
|
|
165
|
+
"descriptionOrigin": "jsdoc"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "size",
|
|
169
|
+
"type": "enum",
|
|
170
|
+
"values": [
|
|
171
|
+
"lg",
|
|
172
|
+
"md",
|
|
173
|
+
"sm",
|
|
174
|
+
"xl",
|
|
175
|
+
"xs"
|
|
176
|
+
],
|
|
177
|
+
"typeText": "AvatarSize | undefined",
|
|
178
|
+
"required": false,
|
|
179
|
+
"default": "md",
|
|
180
|
+
"origin": "derived",
|
|
181
|
+
"description": "Default `md` (32px).",
|
|
182
|
+
"descriptionOrigin": "jsdoc"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "src",
|
|
186
|
+
"type": "string",
|
|
187
|
+
"typeText": "string | undefined",
|
|
188
|
+
"required": false,
|
|
189
|
+
"origin": "derived"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "status",
|
|
193
|
+
"type": "enum",
|
|
194
|
+
"values": [
|
|
195
|
+
"away",
|
|
196
|
+
"busy",
|
|
197
|
+
"offline",
|
|
198
|
+
"online"
|
|
199
|
+
],
|
|
200
|
+
"typeText": "AvatarStatus | undefined",
|
|
201
|
+
"required": false,
|
|
202
|
+
"origin": "derived",
|
|
203
|
+
"description": "A presence dot in the corner.",
|
|
204
|
+
"descriptionOrigin": "jsdoc"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "style",
|
|
208
|
+
"type": "other",
|
|
209
|
+
"typeText": "CSSProperties | undefined",
|
|
210
|
+
"required": false,
|
|
211
|
+
"origin": "derived"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "tabIndex",
|
|
215
|
+
"type": "number",
|
|
216
|
+
"typeText": "number | undefined",
|
|
217
|
+
"required": false,
|
|
218
|
+
"origin": "inherited"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "title",
|
|
222
|
+
"type": "string",
|
|
223
|
+
"typeText": "string | undefined",
|
|
224
|
+
"required": false,
|
|
225
|
+
"origin": "inherited"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"inherits": [
|
|
229
|
+
{
|
|
230
|
+
"from": "HTMLAttributes<HTMLSpanElement>",
|
|
231
|
+
"omitted": [
|
|
232
|
+
"children"
|
|
233
|
+
],
|
|
234
|
+
"passthrough": true
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"events": [],
|
|
238
|
+
"slots": [
|
|
239
|
+
"root",
|
|
240
|
+
"image",
|
|
241
|
+
"fallback",
|
|
242
|
+
"status",
|
|
243
|
+
"overflow"
|
|
244
|
+
],
|
|
245
|
+
"states": [
|
|
246
|
+
{
|
|
247
|
+
"attr": "data-shape",
|
|
248
|
+
"values": [
|
|
249
|
+
"square"
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"attr": "data-size",
|
|
254
|
+
"values": [
|
|
255
|
+
"lg",
|
|
256
|
+
"sm",
|
|
257
|
+
"xl",
|
|
258
|
+
"xs"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"attr": "data-status",
|
|
263
|
+
"values": [
|
|
264
|
+
"away",
|
|
265
|
+
"busy",
|
|
266
|
+
"online"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"attr": "data-theme",
|
|
271
|
+
"values": [
|
|
272
|
+
"dark",
|
|
273
|
+
"light"
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"accessibility": {
|
|
278
|
+
"supplied": [],
|
|
279
|
+
"required": []
|
|
280
|
+
},
|
|
281
|
+
"composition": {},
|
|
282
|
+
"operations": {},
|
|
283
|
+
"intentDomains": [],
|
|
284
|
+
"safeMutations": {},
|
|
285
|
+
"examples": [],
|
|
286
|
+
"coverage": {
|
|
287
|
+
"propsTotal": 23,
|
|
288
|
+
"propsDescribed": 9,
|
|
289
|
+
"describedPct": 39,
|
|
290
|
+
"authoredSections": [
|
|
291
|
+
"accessibility"
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useMemo,
|
|
5
|
+
useState,
|
|
6
|
+
type CSSProperties,
|
|
7
|
+
type HTMLAttributes,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
type Ref,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { colorIndex, initials as toInitials } from "../core/identity";
|
|
12
|
+
import type { AvatarLocaleText, AvatarShape, AvatarSize, AvatarStatus } from "../core/types";
|
|
13
|
+
import { defaultAvatarText } from "./locale";
|
|
14
|
+
import { cx, type AvatarSlot } from "./props";
|
|
15
|
+
|
|
16
|
+
/** Hues spread around the wheel; the fill and text are mixed from one of these. */
|
|
17
|
+
const PALETTE = 8;
|
|
18
|
+
|
|
19
|
+
export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
20
|
+
/**
|
|
21
|
+
* The person or thing. Used for the alternative text, for the initials and
|
|
22
|
+
* for the colour, so the same person is always the same colour.
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
src?: string;
|
|
26
|
+
/** Overrides the text derived from `name`. */
|
|
27
|
+
initials?: string;
|
|
28
|
+
/** An icon or anything else to show instead of initials. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
/** Default `md` (32px). */
|
|
31
|
+
size?: AvatarSize;
|
|
32
|
+
/** Default `circle`. */
|
|
33
|
+
shape?: AvatarShape;
|
|
34
|
+
/** A presence dot in the corner. */
|
|
35
|
+
status?: AvatarStatus;
|
|
36
|
+
/** Marks the avatar as decoration, for a name printed next to it. */
|
|
37
|
+
decorative?: boolean;
|
|
38
|
+
className?: string;
|
|
39
|
+
classNames?: Partial<Record<AvatarSlot, string>>;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
localeText?: Partial<AvatarLocaleText>;
|
|
42
|
+
ref?: Ref<HTMLSpanElement>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A person in a small square or circle: their picture, or the letters of their
|
|
47
|
+
* name on a colour derived from it.
|
|
48
|
+
*
|
|
49
|
+
* An image that fails to load falls back to the initials rather than leaving a
|
|
50
|
+
* broken frame — which happens more than it should with avatar URLs that have
|
|
51
|
+
* expired or come from a third party.
|
|
52
|
+
*/
|
|
53
|
+
export function Avatar(props: AvatarProps) {
|
|
54
|
+
const {
|
|
55
|
+
ref,
|
|
56
|
+
name = "",
|
|
57
|
+
src,
|
|
58
|
+
initials: initialsProp,
|
|
59
|
+
children,
|
|
60
|
+
size = "md",
|
|
61
|
+
shape = "circle",
|
|
62
|
+
status,
|
|
63
|
+
decorative = false,
|
|
64
|
+
className,
|
|
65
|
+
classNames,
|
|
66
|
+
style,
|
|
67
|
+
localeText,
|
|
68
|
+
...rest
|
|
69
|
+
} = props;
|
|
70
|
+
|
|
71
|
+
const text = useMemo(() => ({ ...defaultAvatarText, ...localeText }), [localeText]);
|
|
72
|
+
const [failed, setFailed] = useState(false);
|
|
73
|
+
const letters = initialsProp ?? toInitials(name);
|
|
74
|
+
const showImage = Boolean(src) && !failed;
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<span
|
|
78
|
+
{...rest}
|
|
79
|
+
ref={ref}
|
|
80
|
+
className={cx("av-root", classNames?.root, className)}
|
|
81
|
+
style={{ ...style, "--av-hue-index": colorIndex(name || letters, PALETTE) } as CSSProperties}
|
|
82
|
+
data-size={size}
|
|
83
|
+
data-shape={shape}
|
|
84
|
+
data-status={status}
|
|
85
|
+
// Decoration when the name is printed beside it; otherwise the name is
|
|
86
|
+
// the alternative text, and there is no point repeating it.
|
|
87
|
+
role={decorative ? "presentation" : "img"}
|
|
88
|
+
aria-label={decorative ? undefined : name || undefined}
|
|
89
|
+
aria-hidden={decorative && !name ? "true" : undefined}
|
|
90
|
+
>
|
|
91
|
+
{showImage ? (
|
|
92
|
+
<img
|
|
93
|
+
className={cx("av-image", classNames?.image)}
|
|
94
|
+
src={src}
|
|
95
|
+
alt=""
|
|
96
|
+
loading="lazy"
|
|
97
|
+
decoding="async"
|
|
98
|
+
onError={() => setFailed(true)}
|
|
99
|
+
/>
|
|
100
|
+
) : (
|
|
101
|
+
<span className={cx("av-fallback", classNames?.fallback)} aria-hidden="true">
|
|
102
|
+
{children ?? letters}
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
{status && (
|
|
107
|
+
<span
|
|
108
|
+
className={cx("av-status", classNames?.status)}
|
|
109
|
+
data-status={status}
|
|
110
|
+
// The dot is a fact about the person, so it is named rather than
|
|
111
|
+
// hidden — colour on its own tells a colour-blind user nothing.
|
|
112
|
+
role="img"
|
|
113
|
+
aria-label={text.status[status]}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
</span>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Children, useMemo, type CSSProperties, type ReactNode, type Ref } from "react";
|
|
4
|
+
import { splitGroup } from "../core/identity";
|
|
5
|
+
import type { AvatarLocaleText, AvatarShape, AvatarSize } from "../core/types";
|
|
6
|
+
import { defaultAvatarText } from "./locale";
|
|
7
|
+
import { cx, type AvatarGroupSlot } from "./props";
|
|
8
|
+
|
|
9
|
+
export interface AvatarGroupProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** How many slots there are, the overflow bubble included. Default 4. */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** Applied to the group; each Avatar keeps its own if it sets one. */
|
|
14
|
+
size?: AvatarSize;
|
|
15
|
+
shape?: AvatarShape;
|
|
16
|
+
/** Names the set, e.g. "Assigned to". A list of faces with no name says nothing. */
|
|
17
|
+
label?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
classNames?: Partial<Record<AvatarGroupSlot, string>>;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
localeText?: Partial<AvatarLocaleText>;
|
|
22
|
+
ref?: Ref<HTMLDivElement>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Overlapping avatars with a "+3" at the end.
|
|
27
|
+
*
|
|
28
|
+
* The overflow bubble takes one of the `max` slots, so five people with
|
|
29
|
+
* `max={4}` show three faces and a "+2" — the alternative, four faces and a
|
|
30
|
+
* "+2", is five slots wide and quietly breaks a layout built for four.
|
|
31
|
+
*/
|
|
32
|
+
export function AvatarGroup(props: AvatarGroupProps) {
|
|
33
|
+
const {
|
|
34
|
+
ref,
|
|
35
|
+
children,
|
|
36
|
+
max = 4,
|
|
37
|
+
size,
|
|
38
|
+
shape,
|
|
39
|
+
label,
|
|
40
|
+
className,
|
|
41
|
+
classNames,
|
|
42
|
+
style,
|
|
43
|
+
localeText,
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
const text = useMemo(() => ({ ...defaultAvatarText, ...localeText }), [localeText]);
|
|
47
|
+
const items = Children.toArray(children);
|
|
48
|
+
const { shown, overflow } = splitGroup(items, max);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cx("av-group", classNames?.root, className)}
|
|
54
|
+
style={style}
|
|
55
|
+
data-size={size}
|
|
56
|
+
data-shape={shape}
|
|
57
|
+
role="group"
|
|
58
|
+
aria-label={label}
|
|
59
|
+
>
|
|
60
|
+
{shown}
|
|
61
|
+
{overflow > 0 && (
|
|
62
|
+
<span
|
|
63
|
+
className={cx("av-overflow", classNames?.overflow)}
|
|
64
|
+
data-size={size}
|
|
65
|
+
data-shape={shape}
|
|
66
|
+
role="img"
|
|
67
|
+
aria-label={text.more(overflow)}
|
|
68
|
+
>
|
|
69
|
+
+{overflow}
|
|
70
|
+
</span>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|