@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,270 @@
|
|
|
1
|
+
{
|
|
2
|
+
"passportVersion": "1.0.0",
|
|
3
|
+
"identity": {
|
|
4
|
+
"component": "Progress",
|
|
5
|
+
"folder": "progress",
|
|
6
|
+
"exports": [
|
|
7
|
+
"CircularProgress",
|
|
8
|
+
"Progress"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"source": {
|
|
12
|
+
"libraryVersion": "2.4.0",
|
|
13
|
+
"files": [
|
|
14
|
+
"core/index.ts",
|
|
15
|
+
"core/progress.ts",
|
|
16
|
+
"core/types.ts",
|
|
17
|
+
"index.ts",
|
|
18
|
+
"react/CircularProgress.tsx",
|
|
19
|
+
"react/Progress.tsx",
|
|
20
|
+
"react/locale.ts",
|
|
21
|
+
"react/props.ts"
|
|
22
|
+
],
|
|
23
|
+
"sourceHash": "sha256:40c85cf81b5ca8cc4f3332db2839f669c189b257bb1e660b4f6b67ade3bb6409"
|
|
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
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "className",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"typeText": "string | undefined",
|
|
58
|
+
"required": false,
|
|
59
|
+
"origin": "derived"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "classNames",
|
|
63
|
+
"type": "other",
|
|
64
|
+
"typeText": "Partial<Record<ProgressSlot, string>> | undefined",
|
|
65
|
+
"required": false,
|
|
66
|
+
"origin": "derived"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "hidden",
|
|
70
|
+
"type": "boolean",
|
|
71
|
+
"typeText": "boolean | undefined",
|
|
72
|
+
"required": false,
|
|
73
|
+
"origin": "inherited"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "id",
|
|
77
|
+
"type": "string",
|
|
78
|
+
"typeText": "string | undefined",
|
|
79
|
+
"required": false,
|
|
80
|
+
"origin": "inherited"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "label",
|
|
84
|
+
"type": "other",
|
|
85
|
+
"typeText": "ReactNode",
|
|
86
|
+
"required": false,
|
|
87
|
+
"origin": "derived",
|
|
88
|
+
"description": "Names the bar. Shown above it, and used as the accessible name.",
|
|
89
|
+
"descriptionOrigin": "jsdoc"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "localeText",
|
|
93
|
+
"type": "other",
|
|
94
|
+
"typeText": "Partial<ProgressLocaleText> | undefined",
|
|
95
|
+
"required": false,
|
|
96
|
+
"origin": "derived"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "max",
|
|
100
|
+
"type": "number",
|
|
101
|
+
"typeText": "number | undefined",
|
|
102
|
+
"required": false,
|
|
103
|
+
"default": 100,
|
|
104
|
+
"origin": "derived",
|
|
105
|
+
"description": "What `value` is measured against. Default 100.",
|
|
106
|
+
"descriptionOrigin": "jsdoc"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "ref",
|
|
110
|
+
"type": "other",
|
|
111
|
+
"typeText": "Ref<HTMLDivElement> | undefined",
|
|
112
|
+
"required": false,
|
|
113
|
+
"origin": "derived"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "showValue",
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"typeText": "boolean | undefined",
|
|
119
|
+
"required": false,
|
|
120
|
+
"default": false,
|
|
121
|
+
"origin": "derived",
|
|
122
|
+
"description": "Show the percentage beside the label.",
|
|
123
|
+
"descriptionOrigin": "jsdoc"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "size",
|
|
127
|
+
"type": "enum",
|
|
128
|
+
"values": [
|
|
129
|
+
"lg",
|
|
130
|
+
"md",
|
|
131
|
+
"sm"
|
|
132
|
+
],
|
|
133
|
+
"typeText": "ProgressSize | undefined",
|
|
134
|
+
"required": false,
|
|
135
|
+
"default": "md",
|
|
136
|
+
"origin": "derived",
|
|
137
|
+
"description": "Default `md`.",
|
|
138
|
+
"descriptionOrigin": "jsdoc"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "style",
|
|
142
|
+
"type": "other",
|
|
143
|
+
"typeText": "CSSProperties | undefined",
|
|
144
|
+
"required": false,
|
|
145
|
+
"origin": "derived"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "tabIndex",
|
|
149
|
+
"type": "number",
|
|
150
|
+
"typeText": "number | undefined",
|
|
151
|
+
"required": false,
|
|
152
|
+
"origin": "inherited"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "thickness",
|
|
156
|
+
"type": "number",
|
|
157
|
+
"typeText": "number | undefined",
|
|
158
|
+
"required": false,
|
|
159
|
+
"default": 4,
|
|
160
|
+
"origin": "derived",
|
|
161
|
+
"description": "Ring thickness in pixels. Default 4.",
|
|
162
|
+
"descriptionOrigin": "jsdoc"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "title",
|
|
166
|
+
"type": "string",
|
|
167
|
+
"typeText": "string | undefined",
|
|
168
|
+
"required": false,
|
|
169
|
+
"origin": "inherited"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "value",
|
|
173
|
+
"type": "number",
|
|
174
|
+
"typeText": "number | null | undefined",
|
|
175
|
+
"required": false,
|
|
176
|
+
"default": null,
|
|
177
|
+
"origin": "derived",
|
|
178
|
+
"description": "How far along. `null` means the length is not known yet.",
|
|
179
|
+
"descriptionOrigin": "jsdoc"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "valueText",
|
|
183
|
+
"type": "other",
|
|
184
|
+
"typeText": "ReactNode",
|
|
185
|
+
"required": false,
|
|
186
|
+
"origin": "derived",
|
|
187
|
+
"description": "Replace what is shown and read, e.g. \"3.2 MB of 8 MB\".",
|
|
188
|
+
"descriptionOrigin": "jsdoc"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "variant",
|
|
192
|
+
"type": "enum",
|
|
193
|
+
"values": [
|
|
194
|
+
"accent",
|
|
195
|
+
"danger",
|
|
196
|
+
"success",
|
|
197
|
+
"warning"
|
|
198
|
+
],
|
|
199
|
+
"typeText": "ProgressVariant | undefined",
|
|
200
|
+
"required": false,
|
|
201
|
+
"default": "accent",
|
|
202
|
+
"origin": "derived",
|
|
203
|
+
"description": "Default `accent`.",
|
|
204
|
+
"descriptionOrigin": "jsdoc"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"inherits": [
|
|
208
|
+
{
|
|
209
|
+
"from": "HTMLAttributes<HTMLDivElement>",
|
|
210
|
+
"omitted": [
|
|
211
|
+
"role"
|
|
212
|
+
],
|
|
213
|
+
"passthrough": true
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"events": [],
|
|
217
|
+
"slots": [
|
|
218
|
+
"root",
|
|
219
|
+
"header",
|
|
220
|
+
"label",
|
|
221
|
+
"value",
|
|
222
|
+
"track",
|
|
223
|
+
"bar",
|
|
224
|
+
"svg"
|
|
225
|
+
],
|
|
226
|
+
"states": [
|
|
227
|
+
{
|
|
228
|
+
"attr": "data-indeterminate"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"attr": "data-size",
|
|
232
|
+
"values": [
|
|
233
|
+
"lg",
|
|
234
|
+
"sm"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"attr": "data-theme",
|
|
239
|
+
"values": [
|
|
240
|
+
"dark",
|
|
241
|
+
"light"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"attr": "data-variant",
|
|
246
|
+
"values": [
|
|
247
|
+
"danger",
|
|
248
|
+
"success",
|
|
249
|
+
"warning"
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"accessibility": {
|
|
254
|
+
"supplied": [],
|
|
255
|
+
"required": []
|
|
256
|
+
},
|
|
257
|
+
"composition": {},
|
|
258
|
+
"operations": {},
|
|
259
|
+
"intentDomains": [],
|
|
260
|
+
"safeMutations": {},
|
|
261
|
+
"examples": [],
|
|
262
|
+
"coverage": {
|
|
263
|
+
"propsTotal": 21,
|
|
264
|
+
"propsDescribed": 8,
|
|
265
|
+
"describedPct": 38,
|
|
266
|
+
"authoredSections": [
|
|
267
|
+
"accessibility"
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useId, useMemo, type CSSProperties, type ReactNode, type Ref } from "react";
|
|
4
|
+
import { describeProgress } from "../core/progress";
|
|
5
|
+
import type { ProgressLocaleText, ProgressVariant } from "../core/types";
|
|
6
|
+
import { defaultProgressText } from "./locale";
|
|
7
|
+
import { cx, type CircularProgressSlot } from "./props";
|
|
8
|
+
|
|
9
|
+
export interface CircularProgressProps {
|
|
10
|
+
value?: number | null;
|
|
11
|
+
max?: number;
|
|
12
|
+
/** Diameter in pixels. Default 44. */
|
|
13
|
+
size?: number;
|
|
14
|
+
/** Ring thickness in pixels. Default 4. */
|
|
15
|
+
thickness?: number;
|
|
16
|
+
variant?: ProgressVariant;
|
|
17
|
+
/** Names the ring for assistive technology. */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Print the percentage in the middle, or your own node. */
|
|
20
|
+
showValue?: boolean;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
classNames?: Partial<Record<CircularProgressSlot, string>>;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
localeText?: Partial<ProgressLocaleText>;
|
|
26
|
+
ref?: Ref<HTMLDivElement>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The same progress as a ring, for a tile or a table cell where a bar would be
|
|
31
|
+
* too wide.
|
|
32
|
+
*
|
|
33
|
+
* The arc is one circle with a dashed stroke: the dash is the whole
|
|
34
|
+
* circumference, and the gap moves it — no arc paths, no trigonometry, and it
|
|
35
|
+
* scales with `size` without redrawing anything.
|
|
36
|
+
*/
|
|
37
|
+
export function CircularProgress(props: CircularProgressProps) {
|
|
38
|
+
const {
|
|
39
|
+
ref,
|
|
40
|
+
value = null,
|
|
41
|
+
max = 100,
|
|
42
|
+
size = 44,
|
|
43
|
+
thickness = 4,
|
|
44
|
+
variant = "accent",
|
|
45
|
+
label,
|
|
46
|
+
showValue = false,
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
classNames,
|
|
50
|
+
style,
|
|
51
|
+
localeText,
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
const id = useId();
|
|
55
|
+
const text = useMemo(() => ({ ...defaultProgressText, ...localeText }), [localeText]);
|
|
56
|
+
const state = describeProgress(value, max);
|
|
57
|
+
|
|
58
|
+
const radius = (size - thickness) / 2;
|
|
59
|
+
const circumference = 2 * Math.PI * radius;
|
|
60
|
+
// An indeterminate ring shows a quarter arc that spins; a determinate one
|
|
61
|
+
// shows its fraction.
|
|
62
|
+
const filled = state.indeterminate ? 0.25 : state.fraction;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={cx("pr-circle", classNames?.root, className)}
|
|
68
|
+
style={{ ...style, width: size, height: size }}
|
|
69
|
+
data-variant={variant}
|
|
70
|
+
data-indeterminate={state.indeterminate || undefined}
|
|
71
|
+
role="progressbar"
|
|
72
|
+
aria-valuenow={state.indeterminate ? undefined : state.value ?? undefined}
|
|
73
|
+
aria-valuemin={state.indeterminate ? undefined : 0}
|
|
74
|
+
aria-valuemax={state.indeterminate ? undefined : max}
|
|
75
|
+
aria-valuetext={state.indeterminate ? undefined : text.valueText(state.percent)}
|
|
76
|
+
aria-label={label ?? text.label}
|
|
77
|
+
>
|
|
78
|
+
<svg className={cx("pr-svg", classNames?.svg)} viewBox={`0 0 ${size} ${size}`} aria-hidden="true">
|
|
79
|
+
<circle
|
|
80
|
+
className={cx("pr-circle-track", classNames?.track)}
|
|
81
|
+
cx={size / 2}
|
|
82
|
+
cy={size / 2}
|
|
83
|
+
r={radius}
|
|
84
|
+
fill="none"
|
|
85
|
+
strokeWidth={thickness}
|
|
86
|
+
/>
|
|
87
|
+
<circle
|
|
88
|
+
className={cx("pr-circle-bar", classNames?.bar)}
|
|
89
|
+
cx={size / 2}
|
|
90
|
+
cy={size / 2}
|
|
91
|
+
r={radius}
|
|
92
|
+
fill="none"
|
|
93
|
+
strokeWidth={thickness}
|
|
94
|
+
strokeLinecap="round"
|
|
95
|
+
strokeDasharray={circumference}
|
|
96
|
+
strokeDashoffset={circumference * (1 - filled)}
|
|
97
|
+
/>
|
|
98
|
+
</svg>
|
|
99
|
+
{(showValue || children) && (
|
|
100
|
+
<span className={cx("pr-circle-label", classNames?.label)} aria-hidden="true" id={`${id}-label`}>
|
|
101
|
+
{children ?? (state.indeterminate ? "" : `${state.percent}%`)}
|
|
102
|
+
</span>
|
|
103
|
+
)}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useId,
|
|
5
|
+
useMemo,
|
|
6
|
+
type CSSProperties,
|
|
7
|
+
type HTMLAttributes,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
type Ref,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { describeProgress } from "../core/progress";
|
|
12
|
+
import type { ProgressLocaleText, ProgressSize, ProgressVariant } from "../core/types";
|
|
13
|
+
import { defaultProgressText } from "./locale";
|
|
14
|
+
import { cx, type ProgressSlot } from "./props";
|
|
15
|
+
|
|
16
|
+
export interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, "role"> {
|
|
17
|
+
/** How far along. `null` means the length is not known yet. */
|
|
18
|
+
value?: number | null;
|
|
19
|
+
/** What `value` is measured against. Default 100. */
|
|
20
|
+
max?: number;
|
|
21
|
+
/** Names the bar. Shown above it, and used as the accessible name. */
|
|
22
|
+
label?: ReactNode;
|
|
23
|
+
/** Show the percentage beside the label. */
|
|
24
|
+
showValue?: boolean;
|
|
25
|
+
/** Replace what is shown and read, e.g. "3.2 MB of 8 MB". */
|
|
26
|
+
valueText?: ReactNode;
|
|
27
|
+
/** Default `accent`. */
|
|
28
|
+
variant?: ProgressVariant;
|
|
29
|
+
/** Default `md`. */
|
|
30
|
+
size?: ProgressSize;
|
|
31
|
+
classNames?: Partial<Record<ProgressSlot, string>>;
|
|
32
|
+
localeText?: Partial<ProgressLocaleText>;
|
|
33
|
+
ref?: Ref<HTMLDivElement>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A bar for something with a known end: an upload, an import, a quota.
|
|
38
|
+
*
|
|
39
|
+
* Use a **Spinner** when there is nothing to measure and nothing to say about
|
|
40
|
+
* how long it will take. A progress bar that spends its life indeterminate is
|
|
41
|
+
* a spinner drawn as a promise it cannot keep.
|
|
42
|
+
*/
|
|
43
|
+
export function Progress(props: ProgressProps) {
|
|
44
|
+
const {
|
|
45
|
+
ref,
|
|
46
|
+
value = null,
|
|
47
|
+
max = 100,
|
|
48
|
+
label,
|
|
49
|
+
showValue = false,
|
|
50
|
+
valueText,
|
|
51
|
+
variant = "accent",
|
|
52
|
+
size = "md",
|
|
53
|
+
className,
|
|
54
|
+
classNames,
|
|
55
|
+
style,
|
|
56
|
+
localeText,
|
|
57
|
+
id: idProp,
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
...rest
|
|
60
|
+
} = props;
|
|
61
|
+
|
|
62
|
+
const reactId = useId();
|
|
63
|
+
const id = idProp ?? reactId;
|
|
64
|
+
const text = useMemo(() => ({ ...defaultProgressText, ...localeText }), [localeText]);
|
|
65
|
+
const state = describeProgress(value, max);
|
|
66
|
+
const shown = valueText ?? (state.indeterminate ? text.working : text.valueText(state.percent));
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
{...rest}
|
|
71
|
+
ref={ref}
|
|
72
|
+
id={id}
|
|
73
|
+
className={cx("pr-root", classNames?.root, className)}
|
|
74
|
+
style={style}
|
|
75
|
+
data-variant={variant}
|
|
76
|
+
data-size={size}
|
|
77
|
+
data-indeterminate={state.indeterminate || undefined}
|
|
78
|
+
>
|
|
79
|
+
{(label || showValue) && (
|
|
80
|
+
<div className={cx("pr-header", classNames?.header)}>
|
|
81
|
+
{label && (
|
|
82
|
+
<span id={`${id}-label`} className={cx("pr-label", classNames?.label)}>
|
|
83
|
+
{label}
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
{showValue && <span className={cx("pr-value", classNames?.value)}>{shown}</span>}
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
<div
|
|
91
|
+
className={cx("pr-track", classNames?.track)}
|
|
92
|
+
role="progressbar"
|
|
93
|
+
// No aria-valuenow at all while the length is unknown: that is what
|
|
94
|
+
// tells a screen reader to say "busy" rather than to read out a zero.
|
|
95
|
+
aria-valuenow={state.indeterminate ? undefined : state.value ?? undefined}
|
|
96
|
+
aria-valuemin={state.indeterminate ? undefined : 0}
|
|
97
|
+
aria-valuemax={state.indeterminate ? undefined : max}
|
|
98
|
+
aria-valuetext={state.indeterminate ? undefined : typeof shown === "string" ? shown : undefined}
|
|
99
|
+
// The visible label names the bar when there is one, so the name and
|
|
100
|
+
// what is on screen can never drift apart.
|
|
101
|
+
aria-labelledby={label ? `${id}-label` : undefined}
|
|
102
|
+
aria-label={label ? undefined : (ariaLabel ?? text.label)}
|
|
103
|
+
>
|
|
104
|
+
<div
|
|
105
|
+
className={cx("pr-bar", classNames?.bar)}
|
|
106
|
+
// Drawn from the unrounded fraction, so the bar does not reach the
|
|
107
|
+
// end while the last of the work is still going.
|
|
108
|
+
style={{ "--pr-fraction": state.fraction } as CSSProperties}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ProgressSlot = "root" | "header" | "label" | "value" | "track" | "bar";
|
|
2
|
+
|
|
3
|
+
export type CircularProgressSlot = "root" | "svg" | "track" | "bar" | "label";
|
|
4
|
+
|
|
5
|
+
// Shared with every other component, so class handling cannot drift.
|
|
6
|
+
export { cx } from "../../shared/core/cx";
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Progress and CircularProgress styles.
|
|
3
|
+
*
|
|
4
|
+
* The bar is drawn from --pr-fraction (0 to 1) rather than a width in percent,
|
|
5
|
+
* so the same number drives the bar, the ring and any transition. Tokens read
|
|
6
|
+
* the shared --gbs-* variables when they are set on an ancestor (set them on
|
|
7
|
+
* :root to theme every component at once). Rules are unlayered: they beat a
|
|
8
|
+
* framework reset on specificity, and lose to anything you pass through
|
|
9
|
+
* `className`. With Tailwind v4, import this file after the framework and
|
|
10
|
+
* inside its components layer - see the README.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
.pr-root,
|
|
14
|
+
.pr-circle {
|
|
15
|
+
--pr-fg: var(--gbs-fg, var(--dg-fg, light-dark(#18181b, #f4f4f5)));
|
|
16
|
+
--pr-muted: var(--gbs-muted, var(--dg-muted, light-dark(#71717a, #a1a1aa)));
|
|
17
|
+
--pr-track: var(--gbs-subtle, light-dark(#e4e4e7, #27272a));
|
|
18
|
+
--pr-accent: var(--gbs-accent, var(--dg-accent, light-dark(#2563eb, #60a5fa)));
|
|
19
|
+
--pr-success: var(--gbs-success, light-dark(#15803d, #4ade80));
|
|
20
|
+
--pr-warning: var(--gbs-warning, light-dark(#b45309, #fbbf24));
|
|
21
|
+
--pr-danger: var(--gbs-danger, var(--dg-danger, light-dark(#dc2626, #f87171)));
|
|
22
|
+
--pr-font-size: var(--gbs-font-size, var(--dg-font-size, 13px));
|
|
23
|
+
--pr-height: 8px;
|
|
24
|
+
--pr-duration: 240ms;
|
|
25
|
+
--pr-bar: var(--pr-accent);
|
|
26
|
+
|
|
27
|
+
color-scheme: inherit;
|
|
28
|
+
font-size: var(--pr-font-size);
|
|
29
|
+
color: var(--pr-fg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:where(.dark, [data-theme="dark"]) :is(.pr-root, .pr-circle) {
|
|
33
|
+
color-scheme: dark;
|
|
34
|
+
}
|
|
35
|
+
:where(.light, [data-theme="light"]) :is(.pr-root, .pr-circle) {
|
|
36
|
+
color-scheme: light;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where(.pr-root, .pr-circle) *,
|
|
40
|
+
:where(.pr-root, .pr-circle) *::before,
|
|
41
|
+
:where(.pr-root, .pr-circle) *::after {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pr-root[data-variant="success"],
|
|
46
|
+
.pr-circle[data-variant="success"] {
|
|
47
|
+
--pr-bar: var(--pr-success);
|
|
48
|
+
}
|
|
49
|
+
.pr-root[data-variant="warning"],
|
|
50
|
+
.pr-circle[data-variant="warning"] {
|
|
51
|
+
--pr-bar: var(--pr-warning);
|
|
52
|
+
}
|
|
53
|
+
.pr-root[data-variant="danger"],
|
|
54
|
+
.pr-circle[data-variant="danger"] {
|
|
55
|
+
--pr-bar: var(--pr-danger);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ------------------------------------------------------------------ bar */
|
|
59
|
+
|
|
60
|
+
.pr-root {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 6px;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
.pr-root[data-size="sm"] {
|
|
67
|
+
--pr-height: 4px;
|
|
68
|
+
--pr-font-size: 12px;
|
|
69
|
+
}
|
|
70
|
+
.pr-root[data-size="lg"] {
|
|
71
|
+
--pr-height: 12px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pr-header {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: baseline;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
gap: 12px;
|
|
79
|
+
min-width: 0;
|
|
80
|
+
}
|
|
81
|
+
.pr-label {
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
font-weight: 500;
|
|
84
|
+
text-overflow: ellipsis;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
}
|
|
87
|
+
.pr-value {
|
|
88
|
+
flex: none;
|
|
89
|
+
color: var(--pr-muted);
|
|
90
|
+
font-variant-numeric: tabular-nums;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pr-track {
|
|
94
|
+
position: relative;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: var(--pr-height);
|
|
97
|
+
border-radius: 999px;
|
|
98
|
+
background: var(--pr-track);
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.pr-bar {
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
border-radius: inherit;
|
|
106
|
+
background: var(--pr-bar);
|
|
107
|
+
/* `scaleX` from the origin: the compositor handles it, so a bar that ticks
|
|
108
|
+
up every few milliseconds costs nothing in layout. */
|
|
109
|
+
transform-origin: left center;
|
|
110
|
+
scale: var(--pr-fraction, 0) 1;
|
|
111
|
+
transition: scale var(--pr-duration) ease;
|
|
112
|
+
}
|
|
113
|
+
.pr-root:dir(rtl) .pr-bar {
|
|
114
|
+
transform-origin: right center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* With no length to show, a short bar sweeps the track instead. */
|
|
118
|
+
.pr-root[data-indeterminate] .pr-bar {
|
|
119
|
+
width: 35%;
|
|
120
|
+
scale: 1 1;
|
|
121
|
+
animation: pr-sweep 1.3s ease-in-out infinite;
|
|
122
|
+
}
|
|
123
|
+
@keyframes pr-sweep {
|
|
124
|
+
from {
|
|
125
|
+
translate: -100%;
|
|
126
|
+
}
|
|
127
|
+
to {
|
|
128
|
+
translate: 300%;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ----------------------------------------------------------------- ring */
|
|
133
|
+
|
|
134
|
+
.pr-circle {
|
|
135
|
+
position: relative;
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
flex: none;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
vertical-align: middle;
|
|
141
|
+
}
|
|
142
|
+
.pr-svg {
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 100%;
|
|
145
|
+
/* Zero is at three o'clock in SVG; a progress ring starts at the top. */
|
|
146
|
+
rotate: -90deg;
|
|
147
|
+
}
|
|
148
|
+
.pr-circle-track {
|
|
149
|
+
stroke: var(--pr-track);
|
|
150
|
+
}
|
|
151
|
+
.pr-circle-bar {
|
|
152
|
+
stroke: var(--pr-bar);
|
|
153
|
+
transition: stroke-dashoffset var(--pr-duration) ease;
|
|
154
|
+
}
|
|
155
|
+
.pr-circle[data-indeterminate] .pr-svg {
|
|
156
|
+
animation: pr-spin 1s linear infinite;
|
|
157
|
+
}
|
|
158
|
+
@keyframes pr-spin {
|
|
159
|
+
from {
|
|
160
|
+
rotate: -90deg;
|
|
161
|
+
}
|
|
162
|
+
to {
|
|
163
|
+
rotate: 270deg;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.pr-circle-label {
|
|
168
|
+
position: absolute;
|
|
169
|
+
font-size: calc(var(--pr-font-size) - 1px);
|
|
170
|
+
font-variant-numeric: tabular-nums;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
line-height: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@media (prefers-reduced-motion: reduce) {
|
|
176
|
+
.pr-bar,
|
|
177
|
+
.pr-circle-bar {
|
|
178
|
+
transition: none;
|
|
179
|
+
}
|
|
180
|
+
/* Movement that repeats forever is what reduced motion is about, but a
|
|
181
|
+
stopped indeterminate bar would look broken — so it slows instead. */
|
|
182
|
+
.pr-root[data-indeterminate] .pr-bar {
|
|
183
|
+
animation-duration: 3s;
|
|
184
|
+
}
|
|
185
|
+
.pr-circle[data-indeterminate] .pr-svg {
|
|
186
|
+
animation-duration: 2.5s;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@media (forced-colors: active) {
|
|
191
|
+
.pr-track {
|
|
192
|
+
border: 1px solid CanvasText;
|
|
193
|
+
}
|
|
194
|
+
.pr-bar {
|
|
195
|
+
background: Highlight;
|
|
196
|
+
}
|
|
197
|
+
.pr-circle-bar {
|
|
198
|
+
stroke: Highlight;
|
|
199
|
+
}
|
|
200
|
+
}
|