@grampro/kit 0.0.0-stage → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gbs/skills/gbs-components/SKILL.md +190 -0
- package/.gbs/skills/gbs-components/references/accessibility.md +102 -0
- package/.gbs/skills/gbs-components/references/data-display.md +185 -0
- package/.gbs/skills/gbs-components/references/data-grid.md +116 -0
- package/.gbs/skills/gbs-components/references/forms.md +202 -0
- package/.gbs/skills/gbs-components/references/install.md +211 -0
- package/.gbs/skills/gbs-components/references/overlays.md +206 -0
- package/.gbs/skills/gbs-components/references/pickers.md +83 -0
- package/.gbs/skills/gbs-components/references/styling.md +246 -0
- package/.gbs/skills/gbs-components/references/toaster.md +57 -0
- package/CHANGELOG.md +173 -0
- package/LICENSE +15 -0
- package/README.md +193 -2
- package/index.cjs +1410 -0
- package/package.json +77 -6
- package/schema/passport-v1.schema.json +204 -0
- package/source/components/accordion/README.md +45 -0
- package/source/components/accordion/core/index.ts +2 -0
- package/source/components/accordion/core/open.ts +56 -0
- package/source/components/accordion/core/types.ts +17 -0
- package/source/components/accordion/index.ts +8 -0
- package/source/components/accordion/passport.json +259 -0
- package/source/components/accordion/react/Accordion.tsx +133 -0
- package/source/components/accordion/react/AccordionItem.tsx +120 -0
- package/source/components/accordion/react/context.ts +20 -0
- package/source/components/accordion/react/props.ts +13 -0
- package/source/components/accordion/styles.css +207 -0
- package/source/components/alert/README.md +39 -0
- package/source/components/alert/core/index.ts +2 -0
- package/source/components/alert/core/live.ts +25 -0
- package/source/components/alert/core/types.ts +7 -0
- package/source/components/alert/index.ts +5 -0
- package/source/components/alert/passport.json +250 -0
- package/source/components/alert/react/Alert.tsx +113 -0
- package/source/components/alert/react/icons.tsx +21 -0
- package/source/components/alert/react/locale.ts +5 -0
- package/source/components/alert/react/props.ts +11 -0
- package/source/components/alert/styles.css +154 -0
- package/source/components/avatar/core/identity.ts +103 -0
- package/source/components/avatar/core/index.ts +2 -0
- package/source/components/avatar/core/types.ts +12 -0
- package/source/components/avatar/index.ts +7 -0
- package/source/components/avatar/passport.json +294 -0
- package/source/components/avatar/react/Avatar.tsx +118 -0
- package/source/components/avatar/react/AvatarGroup.tsx +74 -0
- package/source/components/avatar/react/locale.ts +11 -0
- package/source/components/avatar/react/props.ts +6 -0
- package/source/components/avatar/styles.css +225 -0
- package/source/components/badge/README.md +37 -0
- package/source/components/badge/core/count.ts +37 -0
- package/source/components/badge/core/index.ts +2 -0
- package/source/components/badge/core/types.ts +11 -0
- package/source/components/badge/index.ts +7 -0
- package/source/components/badge/passport.json +332 -0
- package/source/components/badge/react/Badge.tsx +89 -0
- package/source/components/badge/react/Tag.tsx +82 -0
- package/source/components/badge/react/locale.ts +5 -0
- package/source/components/badge/react/props.ts +6 -0
- package/source/components/badge/styles.css +203 -0
- package/source/components/breadcrumb/README.md +34 -0
- package/source/components/breadcrumb/core/index.ts +4 -0
- package/source/components/breadcrumb/core/trail.ts +42 -0
- package/source/components/breadcrumb/core/types.ts +20 -0
- package/source/components/breadcrumb/index.ts +5 -0
- package/source/components/breadcrumb/passport.json +243 -0
- package/source/components/breadcrumb/react/Breadcrumb.tsx +177 -0
- package/source/components/breadcrumb/react/locale.ts +6 -0
- package/source/components/breadcrumb/react/props.ts +14 -0
- package/source/components/breadcrumb/styles.css +138 -0
- package/source/components/button/README.md +32 -0
- package/source/components/button/core/index.ts +3 -0
- package/source/components/button/core/state.ts +16 -0
- package/source/components/button/core/types.ts +28 -0
- package/source/components/button/index.ts +5 -0
- package/source/components/button/passport.json +402 -0
- package/source/components/button/passport.manual.json +31 -0
- package/source/components/button/react/Button.tsx +173 -0
- package/source/components/button/react/locale.ts +5 -0
- package/source/components/button/react/props.ts +23 -0
- package/source/components/button/styles.css +232 -0
- package/source/components/card/README.md +60 -0
- package/source/components/card/core/index.ts +4 -0
- package/source/components/card/core/trend.ts +32 -0
- package/source/components/card/core/types.ts +5 -0
- package/source/components/card/index.ts +5 -0
- package/source/components/card/passport.json +337 -0
- package/source/components/card/react/Card.tsx +133 -0
- package/source/components/card/react/Stat.tsx +127 -0
- package/source/components/card/react/props.ts +4 -0
- package/source/components/card/styles.css +230 -0
- package/source/components/checkbox/README.md +36 -0
- package/source/components/checkbox/core/group.ts +30 -0
- package/source/components/checkbox/core/index.ts +3 -0
- package/source/components/checkbox/core/types.ts +17 -0
- package/source/components/checkbox/index.ts +9 -0
- package/source/components/checkbox/passport.json +456 -0
- package/source/components/checkbox/react/Checkbox.tsx +147 -0
- package/source/components/checkbox/react/CheckboxGroup.tsx +149 -0
- package/source/components/checkbox/react/context.ts +16 -0
- package/source/components/checkbox/react/locale.ts +5 -0
- package/source/components/checkbox/react/props.ts +6 -0
- package/source/components/checkbox/styles.css +211 -0
- package/source/components/combobox/README.md +170 -0
- package/source/components/combobox/core/filter.ts +155 -0
- package/source/components/combobox/core/index.ts +16 -0
- package/source/components/combobox/core/types.ts +48 -0
- package/source/components/combobox/core/virtual.ts +67 -0
- package/source/components/combobox/index.ts +13 -0
- package/source/components/combobox/passport.json +456 -0
- package/source/components/combobox/react/Listbox.tsx +310 -0
- package/source/components/combobox/react/MultiSelect.tsx +265 -0
- package/source/components/combobox/react/Popover.tsx +38 -0
- package/source/components/combobox/react/Select.tsx +200 -0
- package/source/components/combobox/react/icons.tsx +11 -0
- package/source/components/combobox/react/locale.ts +16 -0
- package/source/components/combobox/react/props.ts +88 -0
- package/source/components/combobox/react/useCombobox.ts +409 -0
- package/source/components/combobox/styles.css +419 -0
- package/source/components/data-grid/README.md +233 -0
- package/source/components/data-grid/agent/coerce.ts +368 -0
- package/source/components/data-grid/agent/contract.ts +410 -0
- package/source/components/data-grid/agent/dataset.ts +92 -0
- package/source/components/data-grid/agent/engine.ts +470 -0
- package/source/components/data-grid/agent/executors.ts +155 -0
- package/source/components/data-grid/agent/index.ts +79 -0
- package/source/components/data-grid/agent/intent.ts +324 -0
- package/source/components/data-grid/agent/operations.ts +335 -0
- package/source/components/data-grid/agent/validate.ts +630 -0
- package/source/components/data-grid/agent/webmcp.ts +107 -0
- package/source/components/data-grid/core/columnHelper.ts +21 -0
- package/source/components/data-grid/core/columns.ts +288 -0
- package/source/components/data-grid/core/filtering.ts +237 -0
- package/source/components/data-grid/core/grid.ts +638 -0
- package/source/components/data-grid/core/index.ts +14 -0
- package/source/components/data-grid/core/rows.ts +64 -0
- package/source/components/data-grid/core/sorting.ts +133 -0
- package/source/components/data-grid/core/state.ts +82 -0
- package/source/components/data-grid/core/store.ts +52 -0
- package/source/components/data-grid/core/types.ts +302 -0
- package/source/components/data-grid/core/values.ts +98 -0
- package/source/components/data-grid/core/virtual.ts +85 -0
- package/source/components/data-grid/export/csv.ts +32 -0
- package/source/components/data-grid/export/download.ts +12 -0
- package/source/components/data-grid/export/pdf-font.ts +139 -0
- package/source/components/data-grid/export/pdf-writer.ts +113 -0
- package/source/components/data-grid/export/pdf.ts +379 -0
- package/source/components/data-grid/export/table.ts +73 -0
- package/source/components/data-grid/export/xlsx.ts +145 -0
- package/source/components/data-grid/export/zip.ts +87 -0
- package/source/components/data-grid/index.ts +14 -0
- package/source/components/data-grid/passport.json +1051 -0
- package/source/components/data-grid/passport.manual.json +255 -0
- package/source/components/data-grid/react/AskGrid.tsx +164 -0
- package/source/components/data-grid/react/Cell.tsx +282 -0
- package/source/components/data-grid/react/ColumnMenu.tsx +135 -0
- package/source/components/data-grid/react/DataGrid.tsx +335 -0
- package/source/components/data-grid/react/FilterForm.tsx +142 -0
- package/source/components/data-grid/react/HeaderRow.tsx +332 -0
- package/source/components/data-grid/react/Pagination.tsx +107 -0
- package/source/components/data-grid/react/Popover.tsx +35 -0
- package/source/components/data-grid/react/Row.tsx +85 -0
- package/source/components/data-grid/react/Toolbar.tsx +267 -0
- package/source/components/data-grid/react/Viewport.tsx +167 -0
- package/source/components/data-grid/react/context.ts +57 -0
- package/source/components/data-grid/react/hooks.ts +83 -0
- package/source/components/data-grid/react/icons.tsx +45 -0
- package/source/components/data-grid/react/keyboard.ts +110 -0
- package/source/components/data-grid/react/locale.ts +130 -0
- package/source/components/data-grid/styles.css +874 -0
- package/source/components/date-picker/README.md +141 -0
- package/source/components/date-picker/core/calendar.ts +266 -0
- package/source/components/date-picker/core/format.ts +170 -0
- package/source/components/date-picker/core/index.ts +41 -0
- package/source/components/date-picker/core/today.ts +72 -0
- package/source/components/date-picker/core/types.ts +68 -0
- package/source/components/date-picker/index.ts +16 -0
- package/source/components/date-picker/passport.json +407 -0
- package/source/components/date-picker/react/Calendar.tsx +160 -0
- package/source/components/date-picker/react/CalendarPanel.tsx +170 -0
- package/source/components/date-picker/react/DatePicker.tsx +249 -0
- package/source/components/date-picker/react/DateRangePicker.tsx +291 -0
- package/source/components/date-picker/react/MonthYearPanels.tsx +123 -0
- package/source/components/date-picker/react/Popover.tsx +45 -0
- package/source/components/date-picker/react/icons.tsx +15 -0
- package/source/components/date-picker/react/locale.ts +23 -0
- package/source/components/date-picker/react/props.ts +76 -0
- package/source/components/date-picker/react/useDatePicker.ts +557 -0
- package/source/components/date-picker/styles.css +445 -0
- package/source/components/dialog/README.md +39 -0
- package/source/components/dialog/core/api.ts +34 -0
- package/source/components/dialog/core/dialog.ts +11 -0
- package/source/components/dialog/core/index.ts +7 -0
- package/source/components/dialog/core/store.ts +81 -0
- package/source/components/dialog/core/types.ts +59 -0
- package/source/components/dialog/index.ts +7 -0
- package/source/components/dialog/passport.json +344 -0
- package/source/components/dialog/react/Dialog.tsx +279 -0
- package/source/components/dialog/react/DialogHost.tsx +45 -0
- package/source/components/dialog/react/icons.tsx +20 -0
- package/source/components/dialog/react/locale.ts +8 -0
- package/source/components/dialog/react/props.ts +13 -0
- package/source/components/dialog/styles.css +280 -0
- package/source/components/file-uploader/README.md +99 -0
- package/source/components/file-uploader/core/format.ts +79 -0
- package/source/components/file-uploader/core/index.ts +26 -0
- package/source/components/file-uploader/core/store.ts +432 -0
- package/source/components/file-uploader/core/transport.ts +154 -0
- package/source/components/file-uploader/core/types.ts +126 -0
- package/source/components/file-uploader/core/validate.ts +83 -0
- package/source/components/file-uploader/index.ts +7 -0
- package/source/components/file-uploader/passport.json +518 -0
- package/source/components/file-uploader/react/FileRow.tsx +268 -0
- package/source/components/file-uploader/react/FileUploader.tsx +511 -0
- package/source/components/file-uploader/react/icons.tsx +60 -0
- package/source/components/file-uploader/react/locale.ts +33 -0
- package/source/components/file-uploader/react/props.ts +31 -0
- package/source/components/file-uploader/react/useFileUploader.ts +32 -0
- package/source/components/file-uploader/styles.css +394 -0
- package/source/components/input/README.md +44 -0
- package/source/components/input/core/count.ts +5 -0
- package/source/components/input/core/index.ts +11 -0
- package/source/components/input/core/otp.ts +64 -0
- package/source/components/input/core/types.ts +14 -0
- package/source/components/input/index.ts +8 -0
- package/source/components/input/passport.json +536 -0
- package/source/components/input/react/Input.tsx +219 -0
- package/source/components/input/react/OtpInput.tsx +256 -0
- package/source/components/input/react/dom.ts +10 -0
- package/source/components/input/react/icons.tsx +17 -0
- package/source/components/input/react/locale.ts +9 -0
- package/source/components/input/react/props.ts +6 -0
- package/source/components/input/styles.css +295 -0
- package/source/components/menu/README.md +68 -0
- package/source/components/menu/core/index.ts +11 -0
- package/source/components/menu/core/navigation.ts +84 -0
- package/source/components/menu/core/types.ts +32 -0
- package/source/components/menu/index.ts +19 -0
- package/source/components/menu/passport.json +322 -0
- package/source/components/menu/react/Menu.tsx +371 -0
- package/source/components/menu/react/context.ts +31 -0
- package/source/components/menu/react/items.tsx +268 -0
- package/source/components/menu/react/locale.ts +6 -0
- package/source/components/menu/react/props.ts +4 -0
- package/source/components/menu/react/useMenuKeys.ts +124 -0
- package/source/components/menu/styles.css +224 -0
- package/source/components/modal/README.md +51 -0
- package/source/components/modal/core/dismiss.ts +29 -0
- package/source/components/modal/core/index.ts +3 -0
- package/source/components/modal/core/types.ts +27 -0
- package/source/components/modal/index.ts +5 -0
- package/source/components/modal/passport.json +289 -0
- package/source/components/modal/react/Modal.tsx +242 -0
- package/source/components/modal/react/icons.tsx +1 -0
- package/source/components/modal/react/locale.ts +5 -0
- package/source/components/modal/react/props.ts +17 -0
- package/source/components/modal/styles.css +241 -0
- package/source/components/number-input/README.md +53 -0
- package/source/components/number-input/core/format.ts +37 -0
- package/source/components/number-input/core/index.ts +4 -0
- package/source/components/number-input/core/parse.ts +118 -0
- package/source/components/number-input/core/step.ts +73 -0
- package/source/components/number-input/core/types.ts +32 -0
- package/source/components/number-input/index.ts +5 -0
- package/source/components/number-input/passport.json +541 -0
- package/source/components/number-input/react/NumberInput.tsx +465 -0
- package/source/components/number-input/react/icons.tsx +17 -0
- package/source/components/number-input/react/locale.ts +7 -0
- package/source/components/number-input/react/props.ts +11 -0
- package/source/components/number-input/styles.css +230 -0
- package/source/components/popover/README.md +44 -0
- package/source/components/popover/core/index.ts +2 -0
- package/source/components/popover/core/types.ts +12 -0
- package/source/components/popover/index.ts +4 -0
- package/source/components/popover/passport.json +238 -0
- package/source/components/popover/react/Popover.tsx +202 -0
- package/source/components/popover/react/locale.ts +5 -0
- package/source/components/popover/react/props.ts +4 -0
- package/source/components/popover/styles.css +148 -0
- package/source/components/progress/README.md +38 -0
- package/source/components/progress/core/index.ts +2 -0
- package/source/components/progress/core/progress.ts +40 -0
- package/source/components/progress/core/types.ts +23 -0
- package/source/components/progress/index.ts +7 -0
- package/source/components/progress/passport.json +270 -0
- package/source/components/progress/react/CircularProgress.tsx +106 -0
- package/source/components/progress/react/Progress.tsx +113 -0
- package/source/components/progress/react/locale.ts +7 -0
- package/source/components/progress/react/props.ts +6 -0
- package/source/components/progress/styles.css +200 -0
- package/source/components/radio-group/README.md +58 -0
- package/source/components/radio-group/core/group.ts +36 -0
- package/source/components/radio-group/core/index.ts +2 -0
- package/source/components/radio-group/core/types.ts +20 -0
- package/source/components/radio-group/index.ts +9 -0
- package/source/components/radio-group/passport.json +477 -0
- package/source/components/radio-group/react/Radio.tsx +144 -0
- package/source/components/radio-group/react/RadioGroup.tsx +179 -0
- package/source/components/radio-group/react/context.ts +18 -0
- package/source/components/radio-group/react/locale.ts +5 -0
- package/source/components/radio-group/react/props.ts +12 -0
- package/source/components/radio-group/styles.css +269 -0
- package/source/components/shared/README.md +54 -0
- package/source/components/shared/core/agent/adapter.ts +65 -0
- package/source/components/shared/core/agent/history.ts +120 -0
- package/source/components/shared/core/agent/index.ts +46 -0
- package/source/components/shared/core/agent/numbers.ts +217 -0
- package/source/components/shared/core/agent/schema.ts +180 -0
- package/source/components/shared/core/agent/types.ts +169 -0
- package/source/components/shared/core/agent/webmcp.ts +328 -0
- package/source/components/shared/core/cx.ts +9 -0
- package/source/components/shared/core/field.ts +35 -0
- package/source/components/shared/core/position.ts +124 -0
- package/source/components/shared/core/text.ts +14 -0
- package/source/components/shared/index.ts +17 -0
- package/source/components/shared/react/GramproAIProvider.tsx +50 -0
- package/source/components/shared/react/Popover.tsx +189 -0
- package/source/components/shared/react/icons.tsx +74 -0
- package/source/components/shared/react/useAskAgent.ts +217 -0
- package/source/components/shared/react/useControllableState.ts +42 -0
- package/source/components/shared/styles.css +79 -0
- package/source/components/shared/version.json +4 -0
- package/source/components/shared/version.ts +6 -0
- package/source/components/skeleton/README.md +58 -0
- package/source/components/skeleton/core/index.ts +3 -0
- package/source/components/skeleton/core/lines.ts +25 -0
- package/source/components/skeleton/core/types.ts +5 -0
- package/source/components/skeleton/index.ts +5 -0
- package/source/components/skeleton/passport.json +251 -0
- package/source/components/skeleton/react/Empty.tsx +51 -0
- package/source/components/skeleton/react/Skeleton.tsx +92 -0
- package/source/components/skeleton/react/props.ts +4 -0
- package/source/components/skeleton/styles.css +185 -0
- package/source/components/spinner/README.md +29 -0
- package/source/components/spinner/core/index.ts +3 -0
- package/source/components/spinner/core/types.ts +28 -0
- package/source/components/spinner/core/visibility.ts +34 -0
- package/source/components/spinner/index.ts +6 -0
- package/source/components/spinner/passport.json +245 -0
- package/source/components/spinner/react/Spinner.tsx +96 -0
- package/source/components/spinner/react/locale.ts +5 -0
- package/source/components/spinner/react/props.ts +4 -0
- package/source/components/spinner/react/useDelayedLoading.ts +39 -0
- package/source/components/spinner/styles.css +173 -0
- package/source/components/switch/README.md +46 -0
- package/source/components/switch/core/index.ts +2 -0
- package/source/components/switch/core/toggle.ts +54 -0
- package/source/components/switch/core/types.ts +9 -0
- package/source/components/switch/index.ts +5 -0
- package/source/components/switch/passport.json +421 -0
- package/source/components/switch/react/Switch.tsx +219 -0
- package/source/components/switch/react/locale.ts +5 -0
- package/source/components/switch/react/props.ts +12 -0
- package/source/components/switch/styles.css +227 -0
- package/source/components/tabs/README.md +32 -0
- package/source/components/tabs/core/index.ts +3 -0
- package/source/components/tabs/core/navigation.ts +54 -0
- package/source/components/tabs/core/types.ts +16 -0
- package/source/components/tabs/index.ts +5 -0
- package/source/components/tabs/passport.json +315 -0
- package/source/components/tabs/react/Tabs.tsx +306 -0
- package/source/components/tabs/react/context.ts +21 -0
- package/source/components/tabs/styles.css +263 -0
- package/source/components/textarea/README.md +39 -0
- package/source/components/textarea/core/count.ts +5 -0
- package/source/components/textarea/core/index.ts +4 -0
- package/source/components/textarea/core/size.ts +23 -0
- package/source/components/textarea/core/types.ts +17 -0
- package/source/components/textarea/index.ts +5 -0
- package/source/components/textarea/passport.json +382 -0
- package/source/components/textarea/react/Textarea.tsx +208 -0
- package/source/components/textarea/react/locale.ts +5 -0
- package/source/components/textarea/react/props.ts +4 -0
- package/source/components/textarea/styles.css +158 -0
- package/source/components/toaster/README.md +128 -0
- package/source/components/toaster/core/api.ts +87 -0
- package/source/components/toaster/core/index.ts +14 -0
- package/source/components/toaster/core/store.ts +211 -0
- package/source/components/toaster/core/toast.ts +12 -0
- package/source/components/toaster/core/types.ts +78 -0
- package/source/components/toaster/index.ts +6 -0
- package/source/components/toaster/passport.json +221 -0
- package/source/components/toaster/react/ToastItem.tsx +164 -0
- package/source/components/toaster/react/Toaster.tsx +187 -0
- package/source/components/toaster/react/icons.tsx +23 -0
- package/source/components/toaster/react/locale.ts +6 -0
- package/source/components/toaster/react/props.ts +15 -0
- package/source/components/toaster/react/useToasts.ts +11 -0
- package/source/components/toaster/styles.css +282 -0
- package/source/components/tooltip/README.md +43 -0
- package/source/components/tooltip/core/index.ts +4 -0
- package/source/components/tooltip/core/types.ts +4 -0
- package/source/components/tooltip/core/visibility.ts +34 -0
- package/source/components/tooltip/index.ts +3 -0
- package/source/components/tooltip/passport.json +170 -0
- package/source/components/tooltip/react/Tooltip.tsx +196 -0
- package/source/components/tooltip/react/props.ts +4 -0
- package/source/components/tooltip/styles.css +71 -0
- package/source/fallback/index.tsx +11 -0
- package/source/globalStyle.ts +74 -0
- package/source/hooks/SelectionHooks/type.ts +4 -0
- package/source/hooks/SelectionHooks/useClickOutside.ts +22 -0
- package/source/hooks/SelectionHooks/useMultiSelectState.ts +64 -0
- package/source/hooks/SelectionHooks/useSelectData.ts +58 -0
- package/source/hooks/SelectionHooks/useSelectState.ts +36 -0
- package/source/icon/Icon.tsx +102 -0
- package/source/icon/iconPaths.ts +206 -0
- package/source/legacy-components/bargraph/index.tsx +95 -0
- package/source/legacy-components/bargraph/type.ts +12 -0
- package/source/legacy-components/breadcrumb/index.tsx +66 -0
- package/source/legacy-components/breadcrumb/types.ts +10 -0
- package/source/legacy-components/button/index.tsx +42 -0
- package/source/legacy-components/card/index.tsx +31 -0
- package/source/legacy-components/checkbox/index.tsx +25 -0
- package/source/legacy-components/contextmenu/ContextMenu.tsx +87 -0
- package/source/legacy-components/contextmenu/ContextMenuItem.tsx +30 -0
- package/source/legacy-components/contextmenu/index.ts +2 -0
- package/source/legacy-components/contextmenu/types.ts +19 -0
- package/source/legacy-components/darkmode/index.tsx +55 -0
- package/source/legacy-components/datagrid/context/GridContext.tsx +215 -0
- package/source/legacy-components/datagrid/createTemplate.tsx +82 -0
- package/source/legacy-components/datagrid/hooks/index.ts +6 -0
- package/source/legacy-components/datagrid/hooks/useColumns.ts +33 -0
- package/source/legacy-components/datagrid/hooks/useDataSource.ts +54 -0
- package/source/legacy-components/datagrid/hooks/useFiltering.ts +169 -0
- package/source/legacy-components/datagrid/hooks/usePagination.ts +112 -0
- package/source/legacy-components/datagrid/hooks/useRowSelection.ts +48 -0
- package/source/legacy-components/datagrid/hooks/useSearch.ts +90 -0
- package/source/legacy-components/datagrid/index.tsx +28 -0
- package/source/legacy-components/datagrid/layout/FilterPopup.tsx +92 -0
- package/source/legacy-components/datagrid/layout/GridBody.tsx +184 -0
- package/source/legacy-components/datagrid/layout/GridPagination.tsx +119 -0
- package/source/legacy-components/datagrid/layout/GridToolbar.tsx +109 -0
- package/source/legacy-components/datagrid/layout/index.tsx +68 -0
- package/source/legacy-components/datagrid/type.ts +198 -0
- package/source/legacy-components/datepicker/index.tsx +365 -0
- package/source/legacy-components/datepicker/types.ts +12 -0
- package/source/legacy-components/dialog/index.tsx +44 -0
- package/source/legacy-components/dialog/types.ts +12 -0
- package/source/legacy-components/formrenderer/componentHandles/CheckBoxHandles.tsx +80 -0
- package/source/legacy-components/formrenderer/componentHandles/DatePickerHandles.tsx +93 -0
- package/source/legacy-components/formrenderer/componentHandles/InputHandles.tsx +106 -0
- package/source/legacy-components/formrenderer/componentHandles/MultiHandles.tsx +93 -0
- package/source/legacy-components/formrenderer/componentHandles/SelectHandles.tsx +95 -0
- package/source/legacy-components/formrenderer/helperFunctions.ts +72 -0
- package/source/legacy-components/formrenderer/index.tsx +93 -0
- package/source/legacy-components/formrenderer/types.ts +127 -0
- package/source/legacy-components/input/index.tsx +142 -0
- package/source/legacy-components/input/types.ts +10 -0
- package/source/legacy-components/materialInput/index.tsx +138 -0
- package/source/legacy-components/materialInput/types.ts +16 -0
- package/source/legacy-components/modal/index.tsx +152 -0
- package/source/legacy-components/modal/types.ts +19 -0
- package/source/legacy-components/multiselect/PortalDropDown.tsx +44 -0
- package/source/legacy-components/multiselect/index.tsx +269 -0
- package/source/legacy-components/multiselect/types.ts +26 -0
- package/source/legacy-components/navbar/AuthSection.tsx +98 -0
- package/source/legacy-components/navbar/MobileToggle.tsx +31 -0
- package/source/legacy-components/navbar/NavItemComponent.tsx +119 -0
- package/source/legacy-components/navbar/SearchBar.tsx +55 -0
- package/source/legacy-components/navbar/helperFunctions.ts +27 -0
- package/source/legacy-components/navbar/index.tsx +156 -0
- package/source/legacy-components/navbar/types.ts +69 -0
- package/source/legacy-components/select/PortalDropDown.tsx +59 -0
- package/source/legacy-components/select/index.tsx +249 -0
- package/source/legacy-components/select/types.ts +29 -0
- package/source/legacy-components/sidebar/components/MenuItem.tsx +101 -0
- package/source/legacy-components/sidebar/components/MenuSection.tsx +34 -0
- package/source/legacy-components/sidebar/components/SidebarFooter.tsx +50 -0
- package/source/legacy-components/sidebar/components/SidebarLogo.tsx +24 -0
- package/source/legacy-components/sidebar/components/SidebarMenu.tsx +29 -0
- package/source/legacy-components/sidebar/components/UserProfile.tsx +31 -0
- package/source/legacy-components/sidebar/hooks/useSidebarState.ts +41 -0
- package/source/legacy-components/sidebar/index.tsx +77 -0
- package/source/legacy-components/sidebar/type.ts +42 -0
- package/source/legacy-components/spinner/Stroke.tsx +89 -0
- package/source/legacy-components/spinner/index.tsx +54 -0
- package/source/legacy-components/spinner/types.ts +9 -0
- package/source/legacy-components/tabs/index.tsx +71 -0
- package/source/legacy-components/tabs/types.ts +16 -0
- package/source/legacy-components/textarea/index.tsx +123 -0
- package/source/legacy-components/textarea/types.ts +15 -0
- package/source/legacy-components/toast/ToastComponent.tsx +101 -0
- package/source/legacy-components/toast/ToastIcon.tsx +61 -0
- package/source/legacy-components/toast/index.tsx +42 -0
- package/source/legacy-components/toast/toastStore.ts +42 -0
- package/source/legacy-components/toast/types.ts +18 -0
- package/source/legacy-components/toast/useToast.ts +12 -0
- package/source/legacy-components/uploader/ProgressAnimation.tsx +50 -0
- package/source/legacy-components/uploader/UploadedFilePreview.tsx +130 -0
- package/source/legacy-components/uploader/index.tsx +311 -0
- package/source/legacy-components/uploader/types.ts +30 -0
- package/source/legacy-components/uploader/uploaderIcon.tsx +72 -0
- package/source/legacy-components/uploader/uploaderService.ts +134 -0
- package/source/legacy-components/useUploader/useUploader.tsx +310 -0
- package/source/legacy-components/usepaginateddata/usePaginatedData.ts +174 -0
- package/source/theme.ts +40 -0
- package/source/utils.ts +10 -0
- package/tools/env.cjs +61 -0
- package/tools/passport/cli.cjs +79 -0
- package/tools/passport/extract.cjs +493 -0
- package/tools/passport/index.cjs +185 -0
- package/tools/passport/merge.cjs +131 -0
- package/tools/passport/policy.cjs +65 -0
- package/tools/passport/validate.cjs +277 -0
- package/tools/ts-require.cjs +79 -0
package/package.json
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@grampro/kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@grampro/kit",
|
|
3
|
+
"version": "2.4.1",
|
|
4
|
+
"description": "GramproKit \u2014 an agent-native UI runtime for React. Copy-in components you own, each publishing a contract that software can read.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.cjs",
|
|
8
|
+
"source",
|
|
9
|
+
".gbs",
|
|
10
|
+
"tools",
|
|
11
|
+
"schema",
|
|
12
|
+
"!tools/eval",
|
|
13
|
+
"!source/**/__tests__",
|
|
14
|
+
"!**/*.test.ts",
|
|
15
|
+
"!**/*.test.tsx",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=17"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"grampro-kit": "index.cjs",
|
|
23
|
+
"gbs-add-block": "index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"prepublishOnly": "npm test && npm run passport:check",
|
|
27
|
+
"version": "npm run passport && git add -A source",
|
|
28
|
+
"test": "pnpm -C playground test",
|
|
29
|
+
"passport": "node tools/passport/cli.cjs",
|
|
30
|
+
"passport:check": "node tools/passport/cli.cjs --check",
|
|
31
|
+
"eval:grid": "node tools/eval/grid/cli.cjs"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"react",
|
|
35
|
+
"react-19",
|
|
36
|
+
"component-library",
|
|
37
|
+
"agent-native",
|
|
38
|
+
"ui-runtime",
|
|
39
|
+
"ai-agents",
|
|
40
|
+
"webmcp",
|
|
41
|
+
"data-grid",
|
|
42
|
+
"copy-in",
|
|
43
|
+
"accessibility"
|
|
44
|
+
],
|
|
45
|
+
"author": "Anandhu Remanan",
|
|
46
|
+
"license": "ISC",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@grampro/headless-helpers": "^1.0.21",
|
|
49
|
+
"fs-extra": "^11.0.4",
|
|
50
|
+
"tailwind-merge": "^3.6.0",
|
|
51
|
+
"yargs": "^17.7.2"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@huggingface/transformers": "^4.3.1",
|
|
55
|
+
"@huggingface/transformers-structured-output": "^4.3.1",
|
|
56
|
+
"@types/fs-extra": "^11.0.4",
|
|
57
|
+
"typescript": "^6.0.3"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-dom": "^19.0.0"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"dompurify": "^3.4.16"
|
|
65
|
+
},
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/gramproindia/kit.git"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://kit.gramproindia.com",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/gramproindia/kit/issues"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://gramprokit.dev/schema/passport/1.json",
|
|
4
|
+
"title": "GramproKit Component Passport v1",
|
|
5
|
+
"description": "Machine-readable contract for one component. Generated from TypeScript source and merged with authored semantics. Published so external tooling can validate without depending on the generator.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["passportVersion", "identity", "source", "props", "events", "slots", "states", "coverage"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"passportVersion": { "const": "1.0.0" },
|
|
11
|
+
|
|
12
|
+
"identity": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"required": ["component", "folder", "exports"],
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"component": { "type": "string", "description": "Primary exported component name." },
|
|
18
|
+
"folder": { "type": "string", "description": "Install folder under component-lib/." },
|
|
19
|
+
"exports": { "type": "array", "items": { "type": "string" } },
|
|
20
|
+
"since": { "type": "string" }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
"source": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": ["libraryVersion", "files", "sourceHash"],
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"description": "Provenance. sourceHash covers file contents only — no timestamps — so regeneration is byte-stable and CI comparison is meaningful.",
|
|
29
|
+
"properties": {
|
|
30
|
+
"libraryVersion": { "type": "string" },
|
|
31
|
+
"files": { "type": "array", "minItems": 1, "items": { "type": "string" } },
|
|
32
|
+
"sourceHash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"purpose": { "type": "string", "description": "Authored. What the component is for." },
|
|
37
|
+
|
|
38
|
+
"props": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": ["name", "type", "required", "origin"],
|
|
43
|
+
"properties": {
|
|
44
|
+
"name": { "type": "string" },
|
|
45
|
+
"type": { "enum": ["string", "number", "boolean", "enum", "function", "other"] },
|
|
46
|
+
"values": { "type": "array", "items": { "type": "string" }, "description": "Present when type is enum." },
|
|
47
|
+
"signature": { "type": "string", "description": "Present when type is function." },
|
|
48
|
+
"typeText": { "type": "string", "description": "The TypeScript type as written." },
|
|
49
|
+
"required": { "type": "boolean" },
|
|
50
|
+
"default": { "description": "Derived from the component's destructuring default, when present." },
|
|
51
|
+
"origin": {
|
|
52
|
+
"enum": ["derived", "inherited", "manual", "local"],
|
|
53
|
+
"description": "derived = this project's source; inherited = a library type (React DOM) confirmed by the TypeChecker; manual/local = added by an overlay."
|
|
54
|
+
},
|
|
55
|
+
"description": { "type": "string" },
|
|
56
|
+
"descriptionOrigin": { "enum": ["jsdoc", "readme", "manual", "local"] },
|
|
57
|
+
"note": { "type": "string", "description": "Authored annotation from propNotes." },
|
|
58
|
+
"deprecated": { "type": ["boolean", "string"] }
|
|
59
|
+
},
|
|
60
|
+
"allOf": [
|
|
61
|
+
{ "if": { "properties": { "type": { "const": "enum" } }, "required": ["type"] },
|
|
62
|
+
"then": { "required": ["values"] } },
|
|
63
|
+
{ "if": { "required": ["description"] },
|
|
64
|
+
"then": { "required": ["descriptionOrigin"] } }
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"inherits": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "External (library) base types. Deliberately NOT flattened: resolving ButtonHTMLAttributes yields hundreds of DOM props and buries the real API. A policy allowlist surfaces the useful ones inline with origin=inherited.",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": ["from"],
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"properties": {
|
|
77
|
+
"from": { "type": "string" },
|
|
78
|
+
"omitted": { "type": "array", "items": { "type": "string" } },
|
|
79
|
+
"passthrough": { "type": "boolean" }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
"events": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": ["name"],
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"properties": {
|
|
91
|
+
"name": { "type": "string" },
|
|
92
|
+
"signature": { "type": "string" },
|
|
93
|
+
"description": { "type": "string" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
"slots": {
|
|
99
|
+
"type": "array",
|
|
100
|
+
"items": { "type": "string" },
|
|
101
|
+
"description": "classNames slot keys, in declaration order."
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
"states": {
|
|
105
|
+
"type": "array",
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"required": ["attr"],
|
|
109
|
+
"additionalProperties": false,
|
|
110
|
+
"properties": {
|
|
111
|
+
"attr": { "type": "string", "pattern": "^data-" },
|
|
112
|
+
"values": { "type": "array", "items": { "type": "string" } }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
"accessibility": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"description": "Authored. What the component supplies versus what the consumer must still provide.",
|
|
120
|
+
"additionalProperties": false,
|
|
121
|
+
"properties": {
|
|
122
|
+
"supplied": { "type": "array", "items": { "type": "string" } },
|
|
123
|
+
"required": { "type": "array", "items": { "type": "string" } }
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
"composition": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"description": "Authored. Structural rules a generator or agent must respect.",
|
|
130
|
+
"properties": {
|
|
131
|
+
"requiresAncestor": { "type": ["string", "null"] },
|
|
132
|
+
"allowedChildren": { "type": "array", "items": { "type": "string" } },
|
|
133
|
+
"mustNotContain": { "type": "array", "items": { "type": "string" } },
|
|
134
|
+
"notes": { "type": "string" }
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
"operations": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"description": "Authoritative, validator-compatible. Only declared where the component genuinely exposes a deterministic operation surface. An operation is never claimed because an AI use case sounds plausible.",
|
|
141
|
+
"additionalProperties": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"required": ["summary", "apiMethod"],
|
|
144
|
+
"properties": {
|
|
145
|
+
"summary": { "type": "string" },
|
|
146
|
+
"apiMethod": { "type": "string", "description": "Method on the component's imperative API." },
|
|
147
|
+
"input": { "type": "object", "description": "JSON Schema fragment for the operation's arguments." },
|
|
148
|
+
"effects": { "type": "array", "items": { "type": "string" } },
|
|
149
|
+
"reversible": { "type": "boolean" },
|
|
150
|
+
"requiresConfirmation": { "type": "boolean" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
"intentDomains": {
|
|
156
|
+
"type": "array",
|
|
157
|
+
"description": "Advisory routing hints only. Never a substitute for operations, and carrying no execution semantics.",
|
|
158
|
+
"items": {
|
|
159
|
+
"enum": ["Query", "Extraction", "TemporalInterpretation", "ActionIntent", "Summarization", "Classification", "Recommendation"]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
"safeMutations": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"description": "Authored. Which props an agent may change without altering behaviour.",
|
|
166
|
+
"additionalProperties": false,
|
|
167
|
+
"properties": {
|
|
168
|
+
"allowed": { "type": "array", "items": { "type": "string" } },
|
|
169
|
+
"forbidden": { "type": "array", "items": { "type": "string" } },
|
|
170
|
+
"rationale": { "type": "string" }
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
"examples": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"items": {
|
|
177
|
+
"oneOf": [
|
|
178
|
+
{ "type": "string" },
|
|
179
|
+
{
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["title", "file"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"title": { "type": "string" },
|
|
184
|
+
"file": { "type": "string" },
|
|
185
|
+
"description": { "type": "string" }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
"coverage": {
|
|
193
|
+
"type": "object",
|
|
194
|
+
"required": ["propsTotal", "propsDescribed", "describedPct"],
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"properties": {
|
|
197
|
+
"propsTotal": { "type": "integer", "minimum": 0 },
|
|
198
|
+
"propsDescribed": { "type": "integer", "minimum": 0 },
|
|
199
|
+
"describedPct": { "type": "integer", "minimum": 0, "maximum": 100 },
|
|
200
|
+
"authoredSections": { "type": "array", "items": { "type": "string" } }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
Sections that open and close, built on native `<details>` and `<summary>`, for
|
|
4
|
+
React 19 and styled to match the rest of the library. No runtime dependencies
|
|
5
|
+
besides React.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Accordion, AccordionItem } from "@/components/accordion";
|
|
9
|
+
import "@/components/accordion/styles.css";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Accordion
|
|
14
|
+
defaultValue={["shipping"]}
|
|
15
|
+
items={[
|
|
16
|
+
{ value: "shipping", title: "Shipping", content: <p>Two to five days.</p> },
|
|
17
|
+
{ value: "returns", title: "Returns", content: <p>Thirty days, no questions.</p> },
|
|
18
|
+
]}
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<Accordion multiple variant="contained">
|
|
22
|
+
<AccordionItem value="one" title="Details" meta={<Badge count={3} />}>
|
|
23
|
+
…
|
|
24
|
+
</AccordionItem>
|
|
25
|
+
</Accordion>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Accordion:** `value` / `defaultValue` / `onValueChange` (string arrays),
|
|
29
|
+
`items` or `<AccordionItem>` children, `multiple`, `collapsible`, `variant`
|
|
30
|
+
(`separated` `contained` `plain`), `size`, `iconPosition`, `classNames`, `ref`.
|
|
31
|
+
|
|
32
|
+
**AccordionItem:** `value`, `title`, `description`, `children`, `meta`, `icon`,
|
|
33
|
+
`disabled`, `classNames` (`root` `header` `title` `description` `icon`
|
|
34
|
+
`content` `body`), `ref` (the `<details>`).
|
|
35
|
+
|
|
36
|
+
The browser owns the disclosure: the header is focusable, Enter and Space work,
|
|
37
|
+
the panel is out of the accessibility tree while closed, and Ctrl+F finds text
|
|
38
|
+
inside a closed panel where the browser supports it. What the component owns is
|
|
39
|
+
the group — which panel is open, and whether the last one may be closed —
|
|
40
|
+
because `<details name>` alone cannot express that and gives no value to store.
|
|
41
|
+
|
|
42
|
+
Opening animates in browsers that have `interpolate-size` and
|
|
43
|
+
`::details-content`, and simply shows and hides everywhere else.
|
|
44
|
+
|
|
45
|
+
`toggleOpen` and `normalizeOpen` are exported from the framework-free `core`.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which panels are open after a header is pressed.
|
|
3
|
+
*
|
|
4
|
+
* Three rules, and every accordion gets at least one of them wrong at some
|
|
5
|
+
* point, which is why they are here rather than spread through the component:
|
|
6
|
+
*
|
|
7
|
+
* `multiple` decides whether opening one closes the others. `collapsible`
|
|
8
|
+
* decides whether the open one can be closed by pressing it again — a
|
|
9
|
+
* non-collapsible accordion always has exactly one panel open, which is what
|
|
10
|
+
* you want when the panels are the whole content of the page and an empty page
|
|
11
|
+
* would be a dead end.
|
|
12
|
+
*
|
|
13
|
+
* Order is kept as panels were opened, so a caller storing the value can tell
|
|
14
|
+
* which one was opened last.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToggleOptions {
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
collapsible?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function toggleOpen(
|
|
22
|
+
open: readonly string[],
|
|
23
|
+
value: string,
|
|
24
|
+
{ multiple = false, collapsible = true }: ToggleOptions = {},
|
|
25
|
+
): string[] {
|
|
26
|
+
const isOpen = open.includes(value);
|
|
27
|
+
|
|
28
|
+
if (!multiple) {
|
|
29
|
+
if (!isOpen) return [value];
|
|
30
|
+
return collapsible ? [] : [value];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!isOpen) return [...open, value];
|
|
34
|
+
// The last panel of a non-collapsible accordion stays put; closing any other
|
|
35
|
+
// one is fine, because something is still open afterwards.
|
|
36
|
+
if (!collapsible && open.length === 1) return [...open];
|
|
37
|
+
return open.filter((item) => item !== value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The starting value, trimmed to what the settings allow.
|
|
42
|
+
*
|
|
43
|
+
* A single accordion given three open panels, or a non-collapsible one given
|
|
44
|
+
* none, would otherwise start in a state it can never return to once the user
|
|
45
|
+
* touches it.
|
|
46
|
+
*/
|
|
47
|
+
export function normalizeOpen(
|
|
48
|
+
open: readonly string[],
|
|
49
|
+
values: readonly string[],
|
|
50
|
+
{ multiple = false, collapsible = true }: ToggleOptions = {},
|
|
51
|
+
): string[] {
|
|
52
|
+
const known = open.filter((value) => values.includes(value));
|
|
53
|
+
const trimmed = multiple ? known : known.slice(0, 1);
|
|
54
|
+
if (trimmed.length === 0 && !collapsible && values.length > 0) return [values[0]];
|
|
55
|
+
return trimmed;
|
|
56
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type AccordionVariant = "separated" | "contained" | "plain";
|
|
4
|
+
|
|
5
|
+
export type AccordionSize = "sm" | "md" | "lg";
|
|
6
|
+
|
|
7
|
+
/** Which side of the header the chevron sits on. */
|
|
8
|
+
export type AccordionIconPosition = "start" | "end";
|
|
9
|
+
|
|
10
|
+
export interface AccordionItemData {
|
|
11
|
+
value: string;
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
/** A second line under the title. */
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
content: ReactNode;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Accordion } from "./react/Accordion";
|
|
2
|
+
export type { AccordionProps } from "./react/Accordion";
|
|
3
|
+
export { AccordionItem } from "./react/AccordionItem";
|
|
4
|
+
export type { AccordionItemProps } from "./react/AccordionItem";
|
|
5
|
+
export { AccordionContext, useAccordionContext } from "./react/context";
|
|
6
|
+
export type { AccordionContextValue } from "./react/context";
|
|
7
|
+
export type { AccordionItemSlot, AccordionSlot } from "./react/props";
|
|
8
|
+
export * from "./core";
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
{
|
|
2
|
+
"passportVersion": "1.0.0",
|
|
3
|
+
"identity": {
|
|
4
|
+
"component": "Accordion",
|
|
5
|
+
"folder": "accordion",
|
|
6
|
+
"exports": [
|
|
7
|
+
"Accordion",
|
|
8
|
+
"AccordionContext",
|
|
9
|
+
"AccordionItem"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"source": {
|
|
13
|
+
"libraryVersion": "2.4.1",
|
|
14
|
+
"files": [
|
|
15
|
+
"core/index.ts",
|
|
16
|
+
"core/open.ts",
|
|
17
|
+
"core/types.ts",
|
|
18
|
+
"index.ts",
|
|
19
|
+
"react/Accordion.tsx",
|
|
20
|
+
"react/AccordionItem.tsx",
|
|
21
|
+
"react/context.ts",
|
|
22
|
+
"react/props.ts"
|
|
23
|
+
],
|
|
24
|
+
"sourceHash": "sha256:cb253f4bd818d48805735b4f44c3a25fc66c3a074239558ccc97de1b4ed948bb"
|
|
25
|
+
},
|
|
26
|
+
"props": [
|
|
27
|
+
{
|
|
28
|
+
"name": "children",
|
|
29
|
+
"type": "other",
|
|
30
|
+
"typeText": "ReactNode",
|
|
31
|
+
"required": false,
|
|
32
|
+
"origin": "derived"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "className",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"typeText": "string | undefined",
|
|
38
|
+
"required": false,
|
|
39
|
+
"origin": "derived"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "classNames",
|
|
43
|
+
"type": "other",
|
|
44
|
+
"typeText": "Partial<Record<'root', string>> | undefined",
|
|
45
|
+
"required": false,
|
|
46
|
+
"origin": "derived"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "collapsible",
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"typeText": "boolean | undefined",
|
|
52
|
+
"required": false,
|
|
53
|
+
"default": true,
|
|
54
|
+
"origin": "derived",
|
|
55
|
+
"description": "Allow the open panel to be closed again. Default true.",
|
|
56
|
+
"descriptionOrigin": "jsdoc"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "defaultValue",
|
|
60
|
+
"type": "other",
|
|
61
|
+
"typeText": "string[] | undefined",
|
|
62
|
+
"required": false,
|
|
63
|
+
"origin": "derived"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "description",
|
|
67
|
+
"type": "other",
|
|
68
|
+
"typeText": "ReactNode",
|
|
69
|
+
"required": false,
|
|
70
|
+
"origin": "derived",
|
|
71
|
+
"description": "A second line under the title.",
|
|
72
|
+
"descriptionOrigin": "jsdoc"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "disabled",
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"typeText": "boolean | undefined",
|
|
78
|
+
"required": false,
|
|
79
|
+
"default": false,
|
|
80
|
+
"origin": "derived"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "icon",
|
|
84
|
+
"type": "other",
|
|
85
|
+
"typeText": "ReactNode",
|
|
86
|
+
"required": false,
|
|
87
|
+
"origin": "derived",
|
|
88
|
+
"description": "Replaces the chevron.",
|
|
89
|
+
"descriptionOrigin": "jsdoc"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "iconPosition",
|
|
93
|
+
"type": "enum",
|
|
94
|
+
"values": [
|
|
95
|
+
"end",
|
|
96
|
+
"start"
|
|
97
|
+
],
|
|
98
|
+
"typeText": "AccordionIconPosition | undefined",
|
|
99
|
+
"required": false,
|
|
100
|
+
"default": "end",
|
|
101
|
+
"origin": "derived",
|
|
102
|
+
"description": "Which side the chevron sits on. Default `end`.",
|
|
103
|
+
"descriptionOrigin": "jsdoc"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "items",
|
|
107
|
+
"type": "other",
|
|
108
|
+
"typeText": "readonly AccordionItemData[] | undefined",
|
|
109
|
+
"required": false,
|
|
110
|
+
"origin": "derived",
|
|
111
|
+
"description": "Render these panels, or pass `<AccordionItem>` children.",
|
|
112
|
+
"descriptionOrigin": "jsdoc"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "meta",
|
|
116
|
+
"type": "other",
|
|
117
|
+
"typeText": "ReactNode",
|
|
118
|
+
"required": false,
|
|
119
|
+
"origin": "derived",
|
|
120
|
+
"description": "Something at the end of the header: a badge, a count.",
|
|
121
|
+
"descriptionOrigin": "jsdoc"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "multiple",
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"typeText": "boolean | undefined",
|
|
127
|
+
"required": false,
|
|
128
|
+
"default": false,
|
|
129
|
+
"origin": "derived",
|
|
130
|
+
"description": "Allow more than one panel open at a time. Default false.",
|
|
131
|
+
"descriptionOrigin": "jsdoc"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "onValueChange",
|
|
135
|
+
"type": "function",
|
|
136
|
+
"signature": "((value: string[]) => void) | undefined",
|
|
137
|
+
"required": false,
|
|
138
|
+
"origin": "derived"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "ref",
|
|
142
|
+
"type": "other",
|
|
143
|
+
"typeText": "Ref<HTMLDivElement> | undefined",
|
|
144
|
+
"required": false,
|
|
145
|
+
"origin": "derived"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "size",
|
|
149
|
+
"type": "enum",
|
|
150
|
+
"values": [
|
|
151
|
+
"lg",
|
|
152
|
+
"md",
|
|
153
|
+
"sm"
|
|
154
|
+
],
|
|
155
|
+
"typeText": "AccordionSize | undefined",
|
|
156
|
+
"required": false,
|
|
157
|
+
"default": "md",
|
|
158
|
+
"origin": "derived",
|
|
159
|
+
"description": "Default `md`.",
|
|
160
|
+
"descriptionOrigin": "jsdoc"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "style",
|
|
164
|
+
"type": "other",
|
|
165
|
+
"typeText": "CSSProperties | undefined",
|
|
166
|
+
"required": false,
|
|
167
|
+
"origin": "derived"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "title",
|
|
171
|
+
"type": "other",
|
|
172
|
+
"typeText": "ReactNode",
|
|
173
|
+
"required": true,
|
|
174
|
+
"origin": "derived"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "value",
|
|
178
|
+
"type": "other",
|
|
179
|
+
"typeText": "string[] | undefined",
|
|
180
|
+
"required": false,
|
|
181
|
+
"origin": "derived",
|
|
182
|
+
"description": "Open panels, by value (controlled).",
|
|
183
|
+
"descriptionOrigin": "jsdoc"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "variant",
|
|
187
|
+
"type": "enum",
|
|
188
|
+
"values": [
|
|
189
|
+
"contained",
|
|
190
|
+
"plain",
|
|
191
|
+
"separated"
|
|
192
|
+
],
|
|
193
|
+
"typeText": "AccordionVariant | undefined",
|
|
194
|
+
"required": false,
|
|
195
|
+
"default": "separated",
|
|
196
|
+
"origin": "derived",
|
|
197
|
+
"description": "Default `separated`.",
|
|
198
|
+
"descriptionOrigin": "jsdoc"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"events": [
|
|
202
|
+
{
|
|
203
|
+
"name": "onValueChange",
|
|
204
|
+
"signature": "((value: string[]) => void) | undefined"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"slots": [
|
|
208
|
+
"root",
|
|
209
|
+
"header",
|
|
210
|
+
"title",
|
|
211
|
+
"description",
|
|
212
|
+
"icon",
|
|
213
|
+
"content",
|
|
214
|
+
"body"
|
|
215
|
+
],
|
|
216
|
+
"states": [
|
|
217
|
+
{
|
|
218
|
+
"attr": "data-disabled"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"attr": "data-size",
|
|
222
|
+
"values": [
|
|
223
|
+
"lg",
|
|
224
|
+
"sm"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"attr": "data-theme",
|
|
229
|
+
"values": [
|
|
230
|
+
"dark",
|
|
231
|
+
"light"
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"attr": "data-variant",
|
|
236
|
+
"values": [
|
|
237
|
+
"contained",
|
|
238
|
+
"plain"
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"accessibility": {
|
|
243
|
+
"supplied": [],
|
|
244
|
+
"required": []
|
|
245
|
+
},
|
|
246
|
+
"composition": {},
|
|
247
|
+
"operations": {},
|
|
248
|
+
"intentDomains": [],
|
|
249
|
+
"safeMutations": {},
|
|
250
|
+
"examples": [],
|
|
251
|
+
"coverage": {
|
|
252
|
+
"propsTotal": 19,
|
|
253
|
+
"propsDescribed": 10,
|
|
254
|
+
"describedPct": 53,
|
|
255
|
+
"authoredSections": [
|
|
256
|
+
"accessibility"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
}
|