@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,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schema/passport-v1.schema.json",
|
|
3
|
+
"component": "DataGrid",
|
|
4
|
+
"purpose": "Display and operate on tabular data. Virtualized; holds its own sort, filter, search, selection, column and pagination state in an external store exposed through GridApi.",
|
|
5
|
+
"intentDomains": ["Query", "ActionIntent", "Extraction"],
|
|
6
|
+
|
|
7
|
+
"$operationsNote": "Mirrors agent/operations.ts, which is what the runtime actually dispatches on. tools/eval/__tests__/corpus.test.ts fails if the two drift. `apiMethod` is present only where one GridApi method performs the operation.",
|
|
8
|
+
|
|
9
|
+
"operations": {
|
|
10
|
+
"search": {
|
|
11
|
+
"summary": "Free-text match across every searchable column.",
|
|
12
|
+
"apiMethod": "setGlobalFilter",
|
|
13
|
+
"input": { "type": "object", "required": ["text"], "properties": { "text": { "type": "string", "maxLength": 200 } } },
|
|
14
|
+
"effects": ["filters visible rows", "resets to page 0"],
|
|
15
|
+
"reversible": true
|
|
16
|
+
},
|
|
17
|
+
"filter": {
|
|
18
|
+
"summary": "Apply a typed filter to one column. Operators are constrained by the column's type.",
|
|
19
|
+
"apiMethod": "setFilter",
|
|
20
|
+
"input": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": ["column", "operator"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"column": { "type": "string", "description": "Column id from the runtime contract." },
|
|
25
|
+
"operator": {
|
|
26
|
+
"enum": ["contains", "notContains", "equals", "notEquals", "startsWith", "endsWith",
|
|
27
|
+
"gt", "gte", "lt", "lte", "between", "before", "after", "in", "isEmpty", "isNotEmpty"]
|
|
28
|
+
},
|
|
29
|
+
"value": {},
|
|
30
|
+
"value2": { "description": "Upper bound; only for the `between` operator." }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"effects": ["filters visible rows", "resets to page 0"],
|
|
34
|
+
"reversible": true
|
|
35
|
+
},
|
|
36
|
+
"clearFilters": {
|
|
37
|
+
"summary": "Remove every column filter and the search text.",
|
|
38
|
+
"apiMethod": "clearFilters",
|
|
39
|
+
"effects": ["restores every row"],
|
|
40
|
+
"reversible": true
|
|
41
|
+
},
|
|
42
|
+
"sort": {
|
|
43
|
+
"summary": "Sort by one column, replacing the current sort unless `append` is set.",
|
|
44
|
+
"apiMethod": "setSorting",
|
|
45
|
+
"input": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["column", "direction"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"column": { "type": "string" },
|
|
50
|
+
"direction": { "enum": ["asc", "desc"] },
|
|
51
|
+
"append": { "type": "boolean", "default": false, "description": "Add to the existing sort instead of replacing it." }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"effects": ["reorders visible rows"],
|
|
55
|
+
"reversible": true
|
|
56
|
+
},
|
|
57
|
+
"clearSort": {
|
|
58
|
+
"summary": "Return to the data's original order.",
|
|
59
|
+
"apiMethod": "setSorting",
|
|
60
|
+
"effects": ["reorders visible rows"],
|
|
61
|
+
"reversible": true
|
|
62
|
+
},
|
|
63
|
+
"selectRows": {
|
|
64
|
+
"summary": "Select or deselect rows by id.",
|
|
65
|
+
"apiMethod": "toggleRowSelected",
|
|
66
|
+
"input": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"required": ["rowIds"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"rowIds": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
|
|
71
|
+
"value": { "type": "boolean", "default": true }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"effects": ["changes rowSelection"],
|
|
75
|
+
"reversible": true
|
|
76
|
+
},
|
|
77
|
+
"selectAll": {
|
|
78
|
+
"summary": "Select, or clear, every row matching the current filters.",
|
|
79
|
+
"apiMethod": "toggleAllRowsSelected",
|
|
80
|
+
"input": { "type": "object", "properties": { "value": { "type": "boolean", "default": true } } },
|
|
81
|
+
"effects": ["changes rowSelection"],
|
|
82
|
+
"reversible": true
|
|
83
|
+
},
|
|
84
|
+
"clearSelection": {
|
|
85
|
+
"summary": "Deselect every row.",
|
|
86
|
+
"apiMethod": "clearSelection",
|
|
87
|
+
"effects": ["changes rowSelection"],
|
|
88
|
+
"reversible": true
|
|
89
|
+
},
|
|
90
|
+
"setColumnVisibility": {
|
|
91
|
+
"summary": "Show or hide one column.",
|
|
92
|
+
"apiMethod": "setColumnVisibility",
|
|
93
|
+
"input": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"required": ["column", "visible"],
|
|
96
|
+
"properties": { "column": { "type": "string" }, "visible": { "type": "boolean" } }
|
|
97
|
+
},
|
|
98
|
+
"effects": ["changes columnVisibility"],
|
|
99
|
+
"reversible": true
|
|
100
|
+
},
|
|
101
|
+
"pinColumn": {
|
|
102
|
+
"summary": "Pin a column to an edge, or unpin it with a null side.",
|
|
103
|
+
"apiMethod": "pinColumn",
|
|
104
|
+
"input": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"required": ["column", "side"],
|
|
107
|
+
"properties": { "column": { "type": "string" }, "side": { "enum": ["left", "right", null] } }
|
|
108
|
+
},
|
|
109
|
+
"effects": ["changes columnPinning"],
|
|
110
|
+
"reversible": true
|
|
111
|
+
},
|
|
112
|
+
"moveColumn": {
|
|
113
|
+
"summary": "Move a column before or after another one.",
|
|
114
|
+
"apiMethod": "moveColumn",
|
|
115
|
+
"input": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"required": ["column", "target", "placement"],
|
|
118
|
+
"properties": {
|
|
119
|
+
"column": { "type": "string" },
|
|
120
|
+
"target": { "type": "string" },
|
|
121
|
+
"placement": { "enum": ["before", "after"] }
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"effects": ["changes columnOrder"],
|
|
125
|
+
"reversible": true
|
|
126
|
+
},
|
|
127
|
+
"setColumnWidth": {
|
|
128
|
+
"summary": "Set a column's width in pixels, or null to restore its default.",
|
|
129
|
+
"apiMethod": "setColumnWidth",
|
|
130
|
+
"input": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"required": ["column", "width"],
|
|
133
|
+
"properties": { "column": { "type": "string" }, "width": { "type": ["integer", "null"], "minimum": 1 } }
|
|
134
|
+
},
|
|
135
|
+
"effects": ["changes columnSizing"],
|
|
136
|
+
"reversible": true
|
|
137
|
+
},
|
|
138
|
+
"resetColumns": {
|
|
139
|
+
"summary": "Restore column order, width, visibility and pinning to their defaults.",
|
|
140
|
+
"apiMethod": "resetColumns",
|
|
141
|
+
"effects": ["changes columnOrder", "changes columnVisibility", "changes columnSizing", "changes columnPinning"],
|
|
142
|
+
"reversible": true
|
|
143
|
+
},
|
|
144
|
+
"setPage": {
|
|
145
|
+
"summary": "Jump to a page, counting from zero.",
|
|
146
|
+
"apiMethod": "setPageIndex",
|
|
147
|
+
"input": { "type": "object", "required": ["index"], "properties": { "index": { "type": "integer", "minimum": 0 } } },
|
|
148
|
+
"effects": ["changes the visible page"],
|
|
149
|
+
"reversible": true
|
|
150
|
+
},
|
|
151
|
+
"setPageSize": {
|
|
152
|
+
"summary": "Change how many rows a page holds.",
|
|
153
|
+
"apiMethod": "setPageSize",
|
|
154
|
+
"input": { "type": "object", "required": ["size"], "properties": { "size": { "type": "integer", "minimum": 1 } } },
|
|
155
|
+
"effects": ["changes the visible page"],
|
|
156
|
+
"reversible": true
|
|
157
|
+
},
|
|
158
|
+
"setDensity": {
|
|
159
|
+
"summary": "Change row height.",
|
|
160
|
+
"apiMethod": "setDensity",
|
|
161
|
+
"input": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"required": ["density"],
|
|
164
|
+
"properties": { "density": { "enum": ["compact", "standard", "comfortable"] } }
|
|
165
|
+
},
|
|
166
|
+
"effects": ["changes row height"],
|
|
167
|
+
"reversible": true
|
|
168
|
+
},
|
|
169
|
+
"export": {
|
|
170
|
+
"summary": "Download the chosen rows as a file.",
|
|
171
|
+
"input": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"required": ["format"],
|
|
174
|
+
"properties": {
|
|
175
|
+
"format": { "enum": ["csv", "excel", "pdf"] },
|
|
176
|
+
"scope": { "enum": ["filtered", "all", "selected", "page"], "default": "filtered" },
|
|
177
|
+
"fileName": { "type": "string", "maxLength": 120 }
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"effects": ["downloads a file"],
|
|
181
|
+
"reversible": false,
|
|
182
|
+
"requiresConfirmation": true,
|
|
183
|
+
"note": "Three formats, three GridApi methods (exportCsv, exportExcel, exportPdf), so no single apiMethod applies."
|
|
184
|
+
},
|
|
185
|
+
"print": {
|
|
186
|
+
"summary": "Open the browser's print dialog with the table laid out for paper.",
|
|
187
|
+
"apiMethod": "print",
|
|
188
|
+
"input": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"scope": { "enum": ["filtered", "all", "selected", "page"], "default": "filtered" },
|
|
192
|
+
"title": { "type": "string", "maxLength": 120 }
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"effects": ["opens the print dialog"],
|
|
196
|
+
"reversible": false,
|
|
197
|
+
"requiresConfirmation": true
|
|
198
|
+
},
|
|
199
|
+
"copy": {
|
|
200
|
+
"summary": "Copy the selected rows to the clipboard as tab-separated text.",
|
|
201
|
+
"apiMethod": "copyToClipboard",
|
|
202
|
+
"effects": ["writes to the clipboard"],
|
|
203
|
+
"reversible": false,
|
|
204
|
+
"requiresConfirmation": true
|
|
205
|
+
},
|
|
206
|
+
"undo": {
|
|
207
|
+
"summary": "Restore the state from before the last operation.",
|
|
208
|
+
"effects": ["restores a previous state"],
|
|
209
|
+
"reversible": false,
|
|
210
|
+
"note": "Performed by the agent runtime's snapshot history, not by GridApi."
|
|
211
|
+
},
|
|
212
|
+
"redo": {
|
|
213
|
+
"summary": "Re-apply the operation that was last undone.",
|
|
214
|
+
"effects": ["restores a later state"],
|
|
215
|
+
"reversible": false,
|
|
216
|
+
"note": "Performed by the agent runtime's snapshot history, not by GridApi."
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
"accessibility": {
|
|
221
|
+
"supplied": [
|
|
222
|
+
"WAI-ARIA grid pattern: role=row/rowgroup, aria-colindex, aria-rowindex",
|
|
223
|
+
"aria-sort on sortable header cells",
|
|
224
|
+
"aria-multiselectable when row selection is enabled",
|
|
225
|
+
"full cell keyboard navigation, including the header row"
|
|
226
|
+
],
|
|
227
|
+
"required": [
|
|
228
|
+
"aria-label on the grid when its purpose is not obvious from the page",
|
|
229
|
+
"a visible heading or caption nearby for screen-reader context"
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
"composition": {
|
|
234
|
+
"notes": "Self-contained. Columns are configuration, not children. Keep `data`, `columns` and `getRowId` referentially stable — the grid memoizes on their identity."
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
"safeMutations": {
|
|
238
|
+
"allowed": ["height", "autoHeight", "rowHeight", "headerHeight", "toolbar", "pageSizeOptions", "emptyState", "locale", "localeText", "aria-label"],
|
|
239
|
+
"forbidden": ["data", "columns", "getRowId", "mode", "state", "onStateChange", "onQueryChange"],
|
|
240
|
+
"rationale": "Presentation is safe to change. `data`/`columns`/`getRowId` are memoization keys — replacing them re-creates the grid model. `mode` and the state callbacks define the client/server contract."
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
"propNotes": {
|
|
244
|
+
"mode": "`client` lets the grid sort, filter and paginate. `server` means `data` is already the current page and the host answers `onQueryChange`.",
|
|
245
|
+
"state": "Makes the grid controlled. Prefer `initialState` unless the host genuinely owns the state."
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
"notImplemented": [
|
|
249
|
+
"grouping — no API, no state field, no operation",
|
|
250
|
+
"aggregation — no API, no state field, no operation",
|
|
251
|
+
"row-level mutation — no add, delete or set-cell API; editing is a UI affordance only",
|
|
252
|
+
"notIn — a column with fixed options filters by membership only; an exclusion must list the complement",
|
|
253
|
+
"multi-value filter on a plain string column — one column holds one filter"
|
|
254
|
+
]
|
|
255
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useId, useRef, useState, type FormEvent, type KeyboardEvent } from "react";
|
|
4
|
+
import { cx } from "../../shared/core/cx";
|
|
5
|
+
import { useAgentAdapter } from "../../shared/react/GramproAIProvider";
|
|
6
|
+
import { useAskAgent, type AskableAgent } from "../../shared/react/useAskAgent";
|
|
7
|
+
import type { GridAgent } from "../agent/engine";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* The box a person types into.
|
|
11
|
+
*
|
|
12
|
+
* It owns no grid semantics. Everything it shows — what happened, what was
|
|
13
|
+
* refused and why, which question to ask back — comes from the validator, in
|
|
14
|
+
* the validator's own words. That matters more than it sounds: a message this
|
|
15
|
+
* component invented would be a second source of truth about what the grid
|
|
16
|
+
* can do, and would drift.
|
|
17
|
+
*
|
|
18
|
+
* Renders nothing at all when no adapter is in scope, so a grid in an
|
|
19
|
+
* application with no AI configured is the grid it has always been.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export interface AskGridProps<T> {
|
|
23
|
+
agent: GridAgent<T> | null;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
suggestions?: readonly string[];
|
|
26
|
+
className?: string;
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const TONE: Record<string, string> = {
|
|
31
|
+
done: "ask-ok",
|
|
32
|
+
clarify: "ask-ask",
|
|
33
|
+
refused: "ask-no",
|
|
34
|
+
error: "ask-err",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function AskGrid<T>({
|
|
38
|
+
agent,
|
|
39
|
+
placeholder,
|
|
40
|
+
suggestions,
|
|
41
|
+
className,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
}: AskGridProps<T>) {
|
|
44
|
+
const context = useAgentAdapter();
|
|
45
|
+
const [text, setText] = useState("");
|
|
46
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
47
|
+
const statusId = useId();
|
|
48
|
+
|
|
49
|
+
const { ask, confirm, reset, outcome, busy, pending } = useAskAgent(
|
|
50
|
+
agent as AskableAgent | null,
|
|
51
|
+
context.adapter,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const submit = useCallback(
|
|
55
|
+
(event: FormEvent) => {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
void ask(text);
|
|
58
|
+
},
|
|
59
|
+
[ask, text],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const onKeyDown = useCallback(
|
|
63
|
+
(event: KeyboardEvent<HTMLInputElement>) => {
|
|
64
|
+
if (event.key === "Escape" && outcome.phase !== "idle") {
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
reset();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[outcome.phase, reset],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const useSuggestion = useCallback(
|
|
73
|
+
(value: string) => {
|
|
74
|
+
setText(value);
|
|
75
|
+
inputRef.current?.focus();
|
|
76
|
+
void ask(value);
|
|
77
|
+
},
|
|
78
|
+
[ask],
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// No adapter configured: the feature is simply not here.
|
|
82
|
+
if (!context.adapter) return null;
|
|
83
|
+
|
|
84
|
+
const hints = suggestions ?? context.suggestions ?? [];
|
|
85
|
+
const showHints = hints.length > 0 && text === "" && outcome.phase === "idle";
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className={cx("ask-root", className)}>
|
|
89
|
+
<form className="ask-form" onSubmit={submit}>
|
|
90
|
+
<input
|
|
91
|
+
ref={inputRef}
|
|
92
|
+
type="text"
|
|
93
|
+
className="ask-input"
|
|
94
|
+
value={text}
|
|
95
|
+
disabled={!agent}
|
|
96
|
+
placeholder={placeholder ?? context.placeholder ?? "Ask about this data…"}
|
|
97
|
+
aria-label={ariaLabel ?? "Ask about this data"}
|
|
98
|
+
aria-describedby={outcome.phase === "idle" ? undefined : statusId}
|
|
99
|
+
aria-busy={busy || undefined}
|
|
100
|
+
onChange={(event) => setText(event.target.value)}
|
|
101
|
+
onKeyDown={onKeyDown}
|
|
102
|
+
/>
|
|
103
|
+
<button type="submit" className="ask-send" disabled={busy || !agent || text.trim() === ""}>
|
|
104
|
+
{busy ? "…" : "Ask"}
|
|
105
|
+
</button>
|
|
106
|
+
</form>
|
|
107
|
+
|
|
108
|
+
{showHints && (
|
|
109
|
+
<div className="ask-hints">
|
|
110
|
+
{hints.map((hint) => (
|
|
111
|
+
<button
|
|
112
|
+
key={hint}
|
|
113
|
+
type="button"
|
|
114
|
+
className="ask-hint"
|
|
115
|
+
onClick={() => useSuggestion(hint)}
|
|
116
|
+
>
|
|
117
|
+
{hint}
|
|
118
|
+
</button>
|
|
119
|
+
))}
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
{outcome.phase !== "idle" && (
|
|
124
|
+
/*
|
|
125
|
+
* `polite`, not `assertive`: the grid itself has already changed, and
|
|
126
|
+
* a screen reader interrupting to repeat it would be noise.
|
|
127
|
+
*/
|
|
128
|
+
<div id={statusId} className={cx("ask-status", TONE[outcome.phase])} role="status" aria-live="polite">
|
|
129
|
+
{outcome.phase === "thinking" ? (
|
|
130
|
+
<span className="ask-thinking">Thinking…</span>
|
|
131
|
+
) : (
|
|
132
|
+
<>
|
|
133
|
+
<span className="ask-message">{outcome.message}</span>
|
|
134
|
+
|
|
135
|
+
{outcome.suggestion && <span className="ask-suggestion">{outcome.suggestion}</span>}
|
|
136
|
+
|
|
137
|
+
{outcome.layer && (
|
|
138
|
+
<span className="ask-layer" title={`Refused by the ${outcome.layer} layer`}>
|
|
139
|
+
{outcome.layer}
|
|
140
|
+
</span>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{outcome.warnings?.map((warning) => (
|
|
144
|
+
<span key={warning} className="ask-warning">
|
|
145
|
+
{warning}
|
|
146
|
+
</span>
|
|
147
|
+
))}
|
|
148
|
+
|
|
149
|
+
{pending !== null && (
|
|
150
|
+
<button type="button" className="ask-confirm" onClick={() => void confirm()}>
|
|
151
|
+
Yes, do it
|
|
152
|
+
</button>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<button type="button" className="ask-dismiss" onClick={reset} aria-label="Dismiss">
|
|
156
|
+
×
|
|
157
|
+
</button>
|
|
158
|
+
</>
|
|
159
|
+
)}
|
|
160
|
+
</div>
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|