@optimum-intelligence/opti-ui 0.7.6 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -0
- package/README.md +20 -10
- package/dist/components/alert/Alert.d.ts +5 -2
- package/dist/components/alert/Alert.js +67 -65
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/app-shell/AppShell.d.ts +25 -8
- package/dist/components/app-shell/AppShell.js +428 -397
- package/dist/components/app-shell/AppShell.js.map +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +6 -1
- package/dist/components/breadcrumbs/Breadcrumbs.js +42 -40
- package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/calendar/Calendar.js +140 -136
- package/dist/components/calendar/Calendar.js.map +1 -1
- package/dist/components/combobox/Combobox.d.ts +9 -3
- package/dist/components/combobox/Combobox.js +220 -231
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +13 -4
- package/dist/components/command-palette/CommandPalette.js +91 -89
- package/dist/components/command-palette/CommandPalette.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +51 -17
- package/dist/components/data-table/DataTable.js +489 -278
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableContent.d.ts +7 -1
- package/dist/components/data-table/DataTableContent.js +247 -211
- package/dist/components/data-table/DataTableContent.js.map +1 -1
- package/dist/components/data-table/DataTableFilters.d.ts +56 -4
- package/dist/components/data-table/DataTableFilters.js +493 -77
- package/dist/components/data-table/DataTableFilters.js.map +1 -1
- package/dist/components/data-table/layout.d.ts +5 -0
- package/dist/components/data-table/layout.js +23 -1
- package/dist/components/data-table/layout.js.map +1 -1
- package/dist/components/data-table/types.d.ts +35 -2
- package/dist/components/data-table/useDataTable.d.ts +1 -1
- package/dist/components/data-table/useDataTable.js +386 -332
- package/dist/components/data-table/useDataTable.js.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.js +148 -140
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/date-picker/DateRangePicker.d.ts +2 -0
- package/dist/components/date-picker/DateRangePicker.js +171 -164
- package/dist/components/date-picker/DateRangePicker.js.map +1 -1
- package/dist/components/date-picker/PickerField.d.ts +6 -3
- package/dist/components/date-picker/PickerField.js +166 -159
- package/dist/components/date-picker/PickerField.js.map +1 -1
- package/dist/components/dialog/ConfirmDialog.d.ts +5 -2
- package/dist/components/dialog/ConfirmDialog.js +79 -77
- package/dist/components/dialog/ConfirmDialog.js.map +1 -1
- package/dist/components/dialog/Dialog.d.ts +5 -2
- package/dist/components/dialog/Dialog.js +65 -63
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/drawer/Drawer.d.ts +13 -4
- package/dist/components/drawer/Drawer.js +122 -164
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/field/Field.d.ts +38 -9
- package/dist/components/field/Field.js +66 -1
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/file-upload/FileUpload.js +2 -0
- package/dist/components/file-upload/FileUpload.js.map +1 -1
- package/dist/components/input/Input.d.ts +9 -16
- package/dist/components/input/Input.js +124 -206
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/map/colors.d.ts +2 -2
- package/dist/components/map/colors.js +12 -3
- package/dist/components/map/colors.js.map +1 -1
- package/dist/components/number-field/NumberField.d.ts +12 -3
- package/dist/components/number-field/NumberField.js +109 -130
- package/dist/components/number-field/NumberField.js.map +1 -1
- package/dist/components/pagination/Pagination.js +135 -186
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/progress/Progress.d.ts +2 -1
- package/dist/components/progress/Progress.js.map +1 -1
- package/dist/components/search-input/SearchInput.d.ts +5 -2
- package/dist/components/search-input/SearchInput.js +47 -45
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/select/Select.d.ts +13 -3
- package/dist/components/select/Select.js +144 -139
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/spinner/Spinner.d.ts +6 -2
- package/dist/components/spinner/Spinner.js +42 -40
- package/dist/components/spinner/Spinner.js.map +1 -1
- package/dist/components/stat-card/StatCard.d.ts +7 -2
- package/dist/components/stat-card/StatCard.js +1 -1
- package/dist/components/stat-card/StatCard.js.map +1 -1
- package/dist/components/stepper/Stepper.js +44 -40
- package/dist/components/stepper/Stepper.js.map +1 -1
- package/dist/components/toast/Toast.d.ts +17 -1
- package/dist/components/toast/Toast.js +65 -33
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components.json +475 -68
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +12 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -4
- package/dist/labels/Labels.d.ts +93 -0
- package/dist/labels/Labels.js +96 -0
- package/dist/labels/Labels.js.map +1 -0
- package/dist/labels/hu.d.ts +17 -0
- package/dist/labels/hu.js +124 -0
- package/dist/labels/hu.js.map +1 -0
- package/dist/llms-full.txt +274 -48
- package/dist/llms.txt +11 -4
- package/dist/opti-ui.css +370 -47
- package/dist/theme/ThemeProvider.d.ts +8 -4
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/utils/media.d.ts +9 -2
- package/dist/utils/media.js +10 -3
- package/dist/utils/media.js.map +1 -1
- package/package.json +5 -2
package/dist/llms-full.txt
CHANGED
|
@@ -45,7 +45,7 @@ Start with the simplest option that does what you need:
|
|
|
45
45
|
|
|
46
46
|
2. **Scoped themes.** `<ThemeProvider theme={{ 'color-accent': '#1f8fd6' }} mode="dark">` applies tokens to a
|
|
47
47
|
subtree. Popups opened inside are portalled into the provider, so they inherit the same theme. For
|
|
48
|
-
dark mode across the whole app, set `data-oui-theme="dark"` on `<html
|
|
48
|
+
dark mode across the whole app, set `data-oui-theme="dark"` on `<html>`, or `"system"` to follow the OS.
|
|
49
49
|
3. **Component variables.** Use these per instance or globally, e.g. `--oui-button-radius`,
|
|
50
50
|
`--oui-button-height`, `--oui-input-height`, `--oui-card-padding`, `--oui-card-radius`,
|
|
51
51
|
`--oui-dialog-width`, `--oui-navbar-width`, `--oui-navbar-collapsed-width`, `--oui-switch-width`, `--oui-progress-height`.
|
|
@@ -76,6 +76,46 @@ import { createTheme } from '@optimum-intelligence/opti-ui';
|
|
|
76
76
|
|
|
77
77
|
Signature: `createTheme(...themes: Theme[])`
|
|
78
78
|
|
|
79
|
+
## huLabels
|
|
80
|
+
|
|
81
|
+
constant · Theme
|
|
82
|
+
|
|
83
|
+
Hungarian texts for every built-in label of the library, in the formal register (magázás). Pass it to
|
|
84
|
+
`LabelsProvider` once at the app root; spread it to change single texts. Dates also need `locale="hu"` (or
|
|
85
|
+
`DateConfigProvider`) for month and weekday names. Map texts are separate: see `MapLabels`.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { huLabels } from '@optimum-intelligence/opti-ui';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<LabelsProvider labels={{ ...huLabels, dataTable: { ...huLabels.dataTable, count: (n) => `${n} jármű` } }}>
|
|
93
|
+
<App />
|
|
94
|
+
</LabelsProvider>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## LabelsProvider
|
|
98
|
+
|
|
99
|
+
component · Theme
|
|
100
|
+
|
|
101
|
+
Replaces the library's built-in English texts (button names, placeholders, table and calendar texts) for
|
|
102
|
+
everything inside it, so an app translates them once instead of per component.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { LabelsProvider } from '@optimum-intelligence/opti-ui';
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<LabelsProvider labels={{ close: 'Bezárás', selectPlaceholder: 'Válasszon…', dataTable: { search: 'Keresés…' } }}>
|
|
110
|
+
<App />
|
|
111
|
+
</LabelsProvider>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Prop | Type | Default | Description |
|
|
115
|
+
| --- | --- | --- | --- |
|
|
116
|
+
| `labels` | `Partial<Labels>` | | Texts to replace. Nested providers override only what they pass; props on a component still win. |
|
|
117
|
+
| `children?` | `React.ReactNode` | | The subtree that uses these texts. |
|
|
118
|
+
|
|
79
119
|
## seriesColor
|
|
80
120
|
|
|
81
121
|
function · Theme
|
|
@@ -109,7 +149,7 @@ import { ThemeProvider } from '@optimum-intelligence/opti-ui';
|
|
|
109
149
|
| --- | --- | --- | --- |
|
|
110
150
|
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the provider's root element. |
|
|
111
151
|
| `theme?` | `Theme` | | Token overrides applied to this subtree. |
|
|
112
|
-
| `mode?` | `'light' \| 'dark'` | | Color mode for this subtree. |
|
|
152
|
+
| `mode?` | `'light' \| 'dark' \| 'system'` | | Color mode for this subtree; `system` follows the OS. Left out, the subtree inherits its ancestor's mode. |
|
|
113
153
|
|
|
114
154
|
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
115
155
|
|
|
@@ -125,6 +165,18 @@ import { themeToStyle } from '@optimum-intelligence/opti-ui';
|
|
|
125
165
|
|
|
126
166
|
Signature: `themeToStyle(theme: Theme \| undefined)`
|
|
127
167
|
|
|
168
|
+
## useLabels
|
|
169
|
+
|
|
170
|
+
hook · Theme
|
|
171
|
+
|
|
172
|
+
The texts from the nearest `LabelsProvider`, with English defaults for the rest.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { useLabels } from '@optimum-intelligence/opti-ui';
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Signature: `useLabels()`
|
|
179
|
+
|
|
128
180
|
# Forms
|
|
129
181
|
|
|
130
182
|
## Calendar
|
|
@@ -203,8 +255,9 @@ import { Combobox } from '@optimum-intelligence/opti-ui';
|
|
|
203
255
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
204
256
|
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
205
257
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
258
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
206
259
|
| `placeholder?` | `string` | | Placeholder shown while nothing is typed or selected. |
|
|
207
|
-
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when the filter matches nothing. |
|
|
260
|
+
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when the filter matches nothing. Set app-wide with `LabelsProvider` (`noResults`). |
|
|
208
261
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
209
262
|
| `hideClear?` | `boolean` | | Hide the clear button. |
|
|
210
263
|
| `maxChips?` | `number` | | With `multiple`, show at most this many chips and a `+N` chip for the rest, keeping the field on one line (long labels are truncated). Leave unset to wrap all chips onto new lines. |
|
|
@@ -341,7 +394,7 @@ import { DateRangePicker } from '@optimum-intelligence/opti-ui';
|
|
|
341
394
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
342
395
|
| `required?` | `boolean` | | Marks the field required and adds the required indicator to the label. |
|
|
343
396
|
| `disabled?` | `boolean` | | Disables the field. |
|
|
344
|
-
| `placeholder?` | `React.ReactNode` |
|
|
397
|
+
| `placeholder?` | `React.ReactNode` | | Text shown while no date is selected. Defaults to the `selectDate…` label of the picker's `labels`. |
|
|
345
398
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
346
399
|
| `open?` | `boolean` | | Whether the calendar popover is open (controlled). |
|
|
347
400
|
| `defaultOpen?` | `boolean` | | Initial popover state when uncontrolled. |
|
|
@@ -349,7 +402,7 @@ import { DateRangePicker } from '@optimum-intelligence/opti-ui';
|
|
|
349
402
|
| `id?` | `string` | | Id of the trigger button. Generated when omitted. |
|
|
350
403
|
| `className?` | `string` | | Class name for the trigger button. |
|
|
351
404
|
| `triggerProps?` | `Omit<React.ComponentProps<typeof BasePopover.Trigger>, 'children' \| 'disabled' \| 'id'>` | | Props for the trigger button (aria-*, data-*, onBlur…). |
|
|
352
|
-
| `contentProps?` | `Omit<PopoverContentProps, 'children'>` | | Props for the popover content. |
|
|
405
|
+
| `contentProps?` | `Omit<PopoverContentProps, 'children'>` | | Props for the popover content. Not used on phones, where the calendar opens in a bottom sheet. |
|
|
353
406
|
| `value?` | `DateRange \| null` | | Selected days as ISO dates; both ends are inclusive. |
|
|
354
407
|
| `defaultValue?` | `DateRange \| null` | `null` | Initially selected range when uncontrolled. |
|
|
355
408
|
| `onValueChange?` | `(value: DateRange \| null) => void` | | Called with the new range, or `null` when cleared. |
|
|
@@ -566,6 +619,34 @@ import { formatFileSize } from '@optimum-intelligence/opti-ui';
|
|
|
566
619
|
|
|
567
620
|
Signature: `formatFileSize(bytes: number, locale?: string)`
|
|
568
621
|
|
|
622
|
+
## FormField
|
|
623
|
+
|
|
624
|
+
component · Forms
|
|
625
|
+
|
|
626
|
+
Label, control, description and error in one: the shell every labelled control (`TextField`, `Select`,
|
|
627
|
+
`Combobox`, `NumberField`) is built on. Use it to give your own control the same layout and wiring.
|
|
628
|
+
|
|
629
|
+
```tsx
|
|
630
|
+
import { FormField } from '@optimum-intelligence/opti-ui';
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
```tsx
|
|
634
|
+
<FormField label="Plate" description="As on the registration." error={errors.plate} required>
|
|
635
|
+
<Input name="plate" required />
|
|
636
|
+
</FormField>
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
| Prop | Type | Default | Description |
|
|
640
|
+
| --- | --- | --- | --- |
|
|
641
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
642
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
643
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
644
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
645
|
+
| `name?` | `string` | | Field name, used by `Form` to match server-side errors to this field. |
|
|
646
|
+
| `disabled?` | `boolean` | | Disables the field and the control inside it. |
|
|
647
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
648
|
+
| `children?` | `React.ReactNode` | | The control: `Input`, `Select.Root`, `NumberField`, a custom control… |
|
|
649
|
+
|
|
569
650
|
## Input
|
|
570
651
|
|
|
571
652
|
component · Forms
|
|
@@ -599,11 +680,12 @@ import { NumberField } from '@optimum-intelligence/opti-ui';
|
|
|
599
680
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
600
681
|
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
601
682
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
683
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
602
684
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
603
685
|
| `placeholder?` | `string` | | Placeholder shown while empty. |
|
|
604
686
|
| `hideStepper?` | `boolean` | | Hide the − / + stepper buttons. |
|
|
605
|
-
| `decrementLabel?` | `string` | `'Decrease'` | Accessible name of the − button. |
|
|
606
|
-
| `incrementLabel?` | `string` | `'Increase'` | Accessible name of the + button. |
|
|
687
|
+
| `decrementLabel?` | `string` | `'Decrease'` | Accessible name of the − button. Set app-wide with `LabelsProvider` (`decrease`). |
|
|
688
|
+
| `incrementLabel?` | `string` | `'Increase'` | Accessible name of the + button. Set app-wide with `LabelsProvider` (`increase`). |
|
|
607
689
|
|
|
608
690
|
Also accepts all props of: `BaseNumberField.Root.Props`.
|
|
609
691
|
|
|
@@ -624,9 +706,14 @@ import { PasswordField } from '@optimum-intelligence/opti-ui';
|
|
|
624
706
|
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
625
707
|
| `defaultVisible?` | `boolean` | | Initial visibility when uncontrolled. |
|
|
626
708
|
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
627
|
-
| `toggleLabel?` | `string` |
|
|
709
|
+
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. Set app-wide with `LabelsProvider` (`showPassword`). |
|
|
710
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
711
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
712
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
713
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
714
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
628
715
|
|
|
629
|
-
Also accepts all props of: `Omit<BaseInput.Props, 'size'
|
|
716
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
630
717
|
|
|
631
718
|
## PasswordInput
|
|
632
719
|
|
|
@@ -645,7 +732,7 @@ import { PasswordInput } from '@optimum-intelligence/opti-ui';
|
|
|
645
732
|
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
646
733
|
| `defaultVisible?` | `boolean` | `false` | Initial visibility when uncontrolled. |
|
|
647
734
|
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
648
|
-
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. |
|
|
735
|
+
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. Set app-wide with `LabelsProvider` (`showPassword`). |
|
|
649
736
|
|
|
650
737
|
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
651
738
|
|
|
@@ -714,7 +801,7 @@ import { SearchInput } from '@optimum-intelligence/opti-ui';
|
|
|
714
801
|
| `value?` | `string` | | Current text (controlled). |
|
|
715
802
|
| `defaultValue?` | `string` | `''` | Initial text when uncontrolled. |
|
|
716
803
|
| `onValueChange?` | `(value: string) => void` | | Called with the new text on typing and with `''` on clear. |
|
|
717
|
-
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. |
|
|
804
|
+
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. Set app-wide with `LabelsProvider` (`clearSearch`). |
|
|
718
805
|
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
719
806
|
|
|
720
807
|
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
@@ -737,7 +824,8 @@ import { Select } from '@optimum-intelligence/opti-ui';
|
|
|
737
824
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
738
825
|
| `description?` | `React.ReactNode` | | Help text under the trigger. |
|
|
739
826
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
740
|
-
| `
|
|
827
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
828
|
+
| `placeholder?` | `React.ReactNode` | `'Select…'` | Text shown while nothing is selected. Set app-wide with `LabelsProvider` (`selectPlaceholder`). |
|
|
741
829
|
| `allLabel?` | `React.ReactNode` | | Adds a first option for "no choice", such as "All" in a filter. Choosing it reports `null`, and it shows while the value is `null`. |
|
|
742
830
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
743
831
|
| `triggerProps?` | `Omit<SelectTriggerProps, 'size' \| 'placeholder'>` | | Props passed to the trigger button (className, style, aria-*). |
|
|
@@ -751,6 +839,12 @@ Base UI `Select.Root` re-exported unchanged. See https://base-ui.com/react/compo
|
|
|
751
839
|
|
|
752
840
|
### Select.Label
|
|
753
841
|
|
|
842
|
+
| Prop | Type | Default | Description |
|
|
843
|
+
| --- | --- | --- | --- |
|
|
844
|
+
| `required?` | `boolean` | | Appends a required marker. |
|
|
845
|
+
|
|
846
|
+
Also accepts all props of: `BaseSelect.Label.Props`.
|
|
847
|
+
|
|
754
848
|
### Select.Trigger
|
|
755
849
|
|
|
756
850
|
The select button. Renders the value and chevron unless children are given.
|
|
@@ -852,8 +946,13 @@ import { TextareaField } from '@optimum-intelligence/opti-ui';
|
|
|
852
946
|
| --- | --- | --- | --- |
|
|
853
947
|
| `ref?` | `React.Ref<HTMLTextAreaElement>` | | Ref to the `<textarea>`. |
|
|
854
948
|
| `autoResize?` | `boolean` | | Grow with content up to `maxRows` (uses CSS field-sizing where supported). |
|
|
949
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
950
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
951
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
952
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
953
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
855
954
|
|
|
856
|
-
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
955
|
+
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement>`.
|
|
857
956
|
|
|
858
957
|
## TextField
|
|
859
958
|
|
|
@@ -870,8 +969,13 @@ import { TextField } from '@optimum-intelligence/opti-ui';
|
|
|
870
969
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
871
970
|
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
872
971
|
| `endAdornment?` | `React.ReactNode` | | Icon, text or button rendered inside the box, after the value. |
|
|
972
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
973
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
974
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
975
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
976
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
873
977
|
|
|
874
|
-
Also accepts all props of: `Omit<BaseInput.Props, 'size'
|
|
978
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
875
979
|
|
|
876
980
|
## useDateConfig
|
|
877
981
|
|
|
@@ -929,8 +1033,8 @@ import { AppShell } from '@optimum-intelligence/opti-ui';
|
|
|
929
1033
|
| `mobileBrand?` | `React.ReactNode` | | Brand shown in the mobile top bar. |
|
|
930
1034
|
| `mobileActions?` | `React.ReactNode` | | Extra content on the right of the mobile top bar. |
|
|
931
1035
|
| `mobileNavPosition?` | `'bottom' \| 'top'` | `'bottom'` | Where small screens show the tab bar of pinned `NavbarItem`s: below or above the main area. Both look the same; the "More" slot (see `moreTabPosition`) opens the navbar drawer. The top bar with `mobileBrand` and `mobileActions` only appears when one of them is set. Without pinned items, a top bar with a menu button is shown instead. |
|
|
932
|
-
| `menuLabel?` | `string` | `'Open navigation'` | Accessible name of the button that opens the navigation drawer on small screens. |
|
|
933
|
-
| `moreLabel?` | `string` | `'More'` | Label of the tab-bar slot that opens the navigation drawer. |
|
|
1036
|
+
| `menuLabel?` | `string` | `'Open navigation'` | Accessible name of the button that opens the navigation drawer on small screens. Set app-wide with `LabelsProvider` (`openNavigation`). |
|
|
1037
|
+
| `moreLabel?` | `string` | `'More'` | Label of the tab-bar slot that opens the navigation drawer. Set app-wide with `LabelsProvider` (`more`). |
|
|
934
1038
|
| `moreTabPosition?` | `'start' \| 'end'` | `'start'` | Whether the "More" slot comes before or after the pinned items in the tab bar. |
|
|
935
1039
|
| `mainProps?` | `React.HTMLAttributes<HTMLElement>` | | Props for the scrolling `<main>` element. |
|
|
936
1040
|
|
|
@@ -1075,8 +1179,8 @@ import { Navbar } from '@optimum-intelligence/opti-ui';
|
|
|
1075
1179
|
| `defaultCollapsed?` | `boolean` | `false` | Initial collapsed state when uncontrolled. |
|
|
1076
1180
|
| `onCollapsedChange?` | `(collapsed: boolean) => void` | | Called when the user collapses or expands the navbar. |
|
|
1077
1181
|
| `expandOnHover?` | `boolean` | `true` | Temporarily opens a collapsed navbar while the mouse is over it. Defaults to `true`. |
|
|
1078
|
-
| `collapseLabel?` | `string` | `'Collapse'` | Accessible names for the icon-only toggle. |
|
|
1079
|
-
| `expandLabel?` | `string` | `'Expand'` | Accessible name of the toggle while collapsed. |
|
|
1182
|
+
| `collapseLabel?` | `string` | `'Collapse'` | Accessible names for the icon-only toggle. Set app-wide with `LabelsProvider` (`collapseNavbar`). |
|
|
1183
|
+
| `expandLabel?` | `string` | `'Expand'` | Accessible name of the toggle while collapsed. Set app-wide with `LabelsProvider` (`expandNavbar`). |
|
|
1080
1184
|
|
|
1081
1185
|
Also accepts all props of: `useRender.ComponentProps<'nav', NavbarState>`.
|
|
1082
1186
|
|
|
@@ -1173,6 +1277,7 @@ import { NavbarItem } from '@optimum-intelligence/opti-ui';
|
|
|
1173
1277
|
| `active?` | `boolean` | `false` | Marks the current page (sets aria-current). Also opens the surrounding `NavbarGroup`. |
|
|
1174
1278
|
| `badge?` | `React.ReactNode` | | Trailing content such as a count badge. |
|
|
1175
1279
|
| `pinned?` | `boolean` | `false` | Also shows the item in the `AppShell` mobile tab bar (icon and label). Pin up to four items; the first four in navbar order are used. Has no effect outside an `AppShell`. |
|
|
1280
|
+
| `tabLabel?` | `React.ReactNode` | | Shorter label for the mobile tab bar, where long labels are cut short (e.g. "Vehicles" for "Vehicle register"). The full label stays in the navbar and becomes the tab's tooltip. Only used with `pinned`. |
|
|
1176
1281
|
|
|
1177
1282
|
Also accepts all props of: `useRender.ComponentProps<'a', NavbarItemState>`.
|
|
1178
1283
|
|
|
@@ -1217,7 +1322,7 @@ import { PageHeader } from '@optimum-intelligence/opti-ui';
|
|
|
1217
1322
|
| `eyebrow?` | `React.ReactNode` | | Small label above the title. |
|
|
1218
1323
|
| `title` | `React.ReactNode` | | Page title, rendered as the page `<h1>`. |
|
|
1219
1324
|
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1220
|
-
| `actions?` | `React.ReactNode` | | Buttons or controls
|
|
1325
|
+
| `actions?` | `React.ReactNode` | | Buttons or controls on the title's row, at the right; they wrap below the title when the row is too narrow. |
|
|
1221
1326
|
|
|
1222
1327
|
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLElement>, 'title'>`.
|
|
1223
1328
|
|
|
@@ -1291,7 +1396,7 @@ import { StatCard } from '@optimum-intelligence/opti-ui';
|
|
|
1291
1396
|
| `unit?` | `React.ReactNode` | | Unit beside the value, e.g. "kWh" or "orders". |
|
|
1292
1397
|
| `delta?` | `React.ReactNode` | | Change indicator, e.g. "+12.4%". |
|
|
1293
1398
|
| `trend?` | `'up' \| 'down' \| 'flat'` | | Arrow direction shown next to `delta`. |
|
|
1294
|
-
| `tone?` | `'
|
|
1399
|
+
| `tone?` | `'success' \| 'danger' \| 'neutral' \| 'positive' \| 'negative'` | | Colour of the delta: whether the change is good (`success`) or bad (`danger`), which the direction alone does not say. Defaults to `success` for `up`, `danger` for `down`. `positive` and `negative` still work but are deprecated. |
|
|
1295
1400
|
| `hint?` | `React.ReactNode` | | Supporting text under the value. |
|
|
1296
1401
|
| `icon?` | `React.ReactNode` | | Icon tile shown in the top-right corner. Hidden below 640px, where the tile is compact. |
|
|
1297
1402
|
| `loading?` | `boolean` | | Replaces the value with a skeleton while data loads. |
|
|
@@ -1688,9 +1793,9 @@ import { CommandPalette } from '@optimum-intelligence/opti-ui';
|
|
|
1688
1793
|
| `maxResults?` | `number` | `50` | Cap on rendered results. |
|
|
1689
1794
|
| `hotkey?` | `string \| false` | `'k'` | Key that toggles the palette together with Ctrl / ⌘. `false` disables the shortcut. |
|
|
1690
1795
|
| `keepOpenOnSelect?` | `boolean` | | Keep the palette open after choosing an item. |
|
|
1691
|
-
| `title?` | `string` | `'Command palette'` | Accessible name of the dialog. |
|
|
1692
|
-
| `placeholder?` | `string` | `'Search…'` | Placeholder of the search input. |
|
|
1693
|
-
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when nothing matches. |
|
|
1796
|
+
| `title?` | `string` | `'Command palette'` | Accessible name of the dialog. Set app-wide with `LabelsProvider` (`commandPalette`). |
|
|
1797
|
+
| `placeholder?` | `string` | `'Search…'` | Placeholder and accessible name of the search input. Set app-wide with `LabelsProvider` (`commandSearch`). |
|
|
1798
|
+
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when nothing matches. Set app-wide with `LabelsProvider` (`noResults`). |
|
|
1694
1799
|
| `loading?` | `boolean` | | Show a spinner in the search row while results load. |
|
|
1695
1800
|
| `footer?` | `React.ReactNode` | | Content below the results (key hints, a retry button…). |
|
|
1696
1801
|
| `className?` | `string` | | Class name for the palette popup. |
|
|
@@ -1735,7 +1840,7 @@ import { ConfirmDialog } from '@optimum-intelligence/opti-ui';
|
|
|
1735
1840
|
| `description?` | `React.ReactNode` | | What happens when confirmed. |
|
|
1736
1841
|
| `children?` | `React.ReactNode` | | Extra content between the description and the buttons. |
|
|
1737
1842
|
| `confirmLabel` | `React.ReactNode` | | Text of the confirm button. |
|
|
1738
|
-
| `cancelLabel?` | `React.ReactNode` | `'Cancel'` | Text of the cancel button. |
|
|
1843
|
+
| `cancelLabel?` | `React.ReactNode` | `'Cancel'` | Text of the cancel button. Set app-wide with `LabelsProvider` (`cancel`). |
|
|
1739
1844
|
| `onConfirm` | `() => void` | | Called by the confirm button. The dialog stays open; close it when the action succeeds. |
|
|
1740
1845
|
| `destructive?` | `boolean` | `false` | Red confirm button, for actions that delete or cannot be undone. |
|
|
1741
1846
|
| `pending?` | `boolean` | `false` | The action is running: the confirm button spins and the dialog cannot be closed. |
|
|
@@ -1781,7 +1886,7 @@ Base UI `Dialog.Trigger` re-exported unchanged. See https://base-ui.com/react/co
|
|
|
1781
1886
|
| `size?` | `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | `'md'` | Width of a centered dialog, or of a sheet. |
|
|
1782
1887
|
| `placement?` | `'center' \| 'right' \| 'left' \| 'bottom'` | `'center'` | `center` modal, or a sheet docked to an edge. |
|
|
1783
1888
|
| `showClose?` | `boolean` | `true` | Render the corner close button. |
|
|
1784
|
-
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. |
|
|
1889
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`). |
|
|
1785
1890
|
| `backdropBlur?` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. |
|
|
1786
1891
|
| `backdropProps?` | `BaseDialog.Backdrop.Props` | | Props for the backdrop behind the dialog. |
|
|
1787
1892
|
| `nestedBackdrop?` | `boolean` | `false` | Blur the dialog or drawer this one opens from. Nested dialogs otherwise show no backdrop, so the parent stays sharp behind them. |
|
|
@@ -1833,17 +1938,18 @@ import { Drawer } from '@optimum-intelligence/opti-ui';
|
|
|
1833
1938
|
| `onOpenChange?` | `(open: boolean) => void` | | Called when the drawer opens or closes. |
|
|
1834
1939
|
| `onOpenChangeComplete?` | `(open: boolean) => void` | | Called once the open or close transition has finished, e.g. to unmount the drawer after it slid out. |
|
|
1835
1940
|
| `trigger?` | `React.ReactElement` | | Element that opens the drawer, e.g. `<Button>Details</Button>`. Omit when `open` is controlled. |
|
|
1836
|
-
| `title
|
|
1941
|
+
| `title?` | `React.ReactNode` | | Header title; also the drawer's accessible name. Needed unless `header` replaces the built-in header. |
|
|
1837
1942
|
| `eyebrow?` | `React.ReactNode` | | Small label above the title, e.g. the record type. |
|
|
1838
1943
|
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1839
1944
|
| `actions?` | `React.ReactNode` | | Header content next to the close button (edit, delete, a menu…). |
|
|
1945
|
+
| `header?` | `React.ReactNode` | | Replaces the built-in header (eyebrow, title, description, actions and close button) inside the pinned header bar; `null` drops the bar. Put a `Dialog.Title` in it so the drawer keeps an accessible name; `Dialog.Close` closes it. |
|
|
1840
1946
|
| `footer?` | `React.ReactNode` | | Pinned to the bottom, for form buttons. |
|
|
1841
1947
|
| `side?` | `'right' \| 'left' \| 'bottom'` | `'right'` | Edge the drawer slides in from. A `bottom` sheet is full width, as tall as its content, up to 85% of the screen. |
|
|
1842
1948
|
| `size?` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Width of a side drawer: sm 24rem, md 32rem (default), lg 48rem, xl 60rem. Override with `--oui-drawer-width`. Ignored by `bottom`. |
|
|
1843
1949
|
| `dismissible?` | `boolean` | `true` | Set to `false` to block Esc, outside clicks and the close button, e.g. while a form inside is saving. |
|
|
1844
1950
|
| `modal?` | `boolean` | `true` | `false` leaves the page behind interactive and drops the backdrop. |
|
|
1845
1951
|
| `backdropBlur?` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | How strongly the page behind a modal drawer is blurred. Override the radius with `--oui-backdrop-blur`. |
|
|
1846
|
-
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. |
|
|
1952
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`). |
|
|
1847
1953
|
| `className?` | `string` | | Class name for the drawer panel. |
|
|
1848
1954
|
| `bodyProps?` | `React.HTMLAttributes<HTMLDivElement>` | | Props for the scrolling content area. |
|
|
1849
1955
|
| `children?` | `React.ReactNode` | | Drawer body content. |
|
|
@@ -1923,6 +2029,7 @@ component · Overlays
|
|
|
1923
2029
|
|
|
1924
2030
|
Mount once near the app root. Then call `useToast()` anywhere below, or pass
|
|
1925
2031
|
a `toastManager` from `createToastManager()` to trigger toasts outside React.
|
|
2032
|
+
Bottom toasts sit `--oui-toast-offset-bottom` above the screen edge; AppShell sets it for its mobile tab bar.
|
|
1926
2033
|
|
|
1927
2034
|
```tsx
|
|
1928
2035
|
import { ToastProvider } from '@optimum-intelligence/opti-ui';
|
|
@@ -1986,7 +2093,8 @@ Also accepts all props of: `BaseTooltip.Popup.Props`.
|
|
|
1986
2093
|
|
|
1987
2094
|
hook · Overlays
|
|
1988
2095
|
|
|
1989
|
-
Toast API with tone shortcuts: `toast.success({ title })`.
|
|
2096
|
+
Toast API with tone shortcuts: `toast.success({ title })`. `data` takes a custom `icon` and `content`
|
|
2097
|
+
(`ToastData`), and `toast.promise()` shows a loading toast that turns into success or error.
|
|
1990
2098
|
|
|
1991
2099
|
```tsx
|
|
1992
2100
|
import { useToast } from '@optimum-intelligence/opti-ui';
|
|
@@ -1994,6 +2102,12 @@ import { useToast } from '@optimum-intelligence/opti-ui';
|
|
|
1994
2102
|
|
|
1995
2103
|
Signature: `useToast()`
|
|
1996
2104
|
|
|
2105
|
+
```tsx
|
|
2106
|
+
const toast = useToast();
|
|
2107
|
+
toast.success({ title: 'Route saved', data: { content: <Link href="/routes/12">Open route</Link> } });
|
|
2108
|
+
toast.promise(save(), { loading: 'Saving…', success: 'Saved', error: 'Could not save' });
|
|
2109
|
+
```
|
|
2110
|
+
|
|
1997
2111
|
# Disclosure & navigation
|
|
1998
2112
|
|
|
1999
2113
|
## Accordion
|
|
@@ -2062,6 +2176,7 @@ import { Breadcrumbs } from '@optimum-intelligence/opti-ui';
|
|
|
2062
2176
|
| --- | --- | --- | --- |
|
|
2063
2177
|
| `ref?` | `React.Ref<HTMLElement>` | | Ref to the `<nav>` element. |
|
|
2064
2178
|
| `separator?` | `React.ReactNode` | | Shown between items. Defaults to a chevron. |
|
|
2179
|
+
| `aria-label?` | `string` | `'Breadcrumb'` | Accessible name of the `<nav>`. Set app-wide with `LabelsProvider` (`breadcrumbs`). |
|
|
2065
2180
|
|
|
2066
2181
|
Also accepts all props of: `React.HTMLAttributes<HTMLElement>`.
|
|
2067
2182
|
|
|
@@ -2198,7 +2313,7 @@ import { Alert } from '@optimum-intelligence/opti-ui';
|
|
|
2198
2313
|
| `icon?` | `React.ReactNode \| false` | | Custom icon, or `false` to hide it. |
|
|
2199
2314
|
| `actions?` | `React.ReactNode` | | Buttons rendered after the message. |
|
|
2200
2315
|
| `onDismiss?` | `() => void` | | Shows a dismiss button. |
|
|
2201
|
-
| `dismissLabel?` | `string` | `'Dismiss'` | Accessible name of the dismiss button. |
|
|
2316
|
+
| `dismissLabel?` | `string` | `'Dismiss'` | Accessible name of the dismiss button. Set app-wide with `LabelsProvider` (`dismiss`). |
|
|
2202
2317
|
|
|
2203
2318
|
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>`.
|
|
2204
2319
|
|
|
@@ -2275,10 +2390,14 @@ uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` /
|
|
|
2275
2390
|
|
|
2276
2391
|
For another layout, create the table with `useDataTable` and compose the
|
|
2277
2392
|
parts: `DataTable.Root`, `DataTable.Toolbar`, `DataTable.Controls` (the
|
|
2278
|
-
toolbar's left column), `DataTable.Search`,
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
`DataTable.
|
|
2393
|
+
toolbar's left column), `DataTable.Search`, `DataTable.Filters` (`quick`
|
|
2394
|
+
picks the toolbar filters), `DataTable.Filter`, `DataTable.FilterPanel`
|
|
2395
|
+
(the "Filters" button and panel for the other filters),
|
|
2396
|
+
`DataTable.ActiveFilters` (their tags), `DataTable.FilterSheet` (the phone
|
|
2397
|
+
filter button and sheet), `DataTable.ClearFilters`, `DataTable.Actions`,
|
|
2398
|
+
`DataTable.ColumnsMenu`,
|
|
2399
|
+
`DataTable.Loading`, `DataTable.Summary`, `DataTable.Content`,
|
|
2400
|
+
`DataTable.Pagination`.
|
|
2282
2401
|
|
|
2283
2402
|
On phones (below 640px) columns with `priority: 'low'` are hidden, and
|
|
2284
2403
|
`stickyFirstColumn` keeps each row's name in view while the rest scrolls.
|
|
@@ -2298,8 +2417,10 @@ import { DataTable } from '@optimum-intelligence/opti-ui';
|
|
|
2298
2417
|
| `tableProps?` | `Omit<TableProps, 'children'>` | | Props for the underlying `Table` (className, wrapperProps, aria-*). |
|
|
2299
2418
|
| `pageSizeOptions?` | `number[]` | | Choices in the rows-per-page select. |
|
|
2300
2419
|
| `controlSize?` | `'sm' \| 'md'` | | Size of the search box and the filters. |
|
|
2301
|
-
| `toolbar?` | `React.ReactNode \| ((context: DataTableToolbarContext<T>) => React.ReactNode)` | | Extra toolbar content (add,
|
|
2302
|
-
| `
|
|
2420
|
+
| `toolbar?` | `React.ReactNode \| ((context: DataTableToolbarContext<T>) => React.ReactNode)` | | Extra toolbar content (add, import…). A function receives the processed rows. |
|
|
2421
|
+
| `bulkActions?` | `(context: DataTableToolbarContext<T>) => React.ReactNode` | | Actions on the selected rows. While rows are selected, the header row shows their count, a clear button and these actions in place of the column names. Needs `onSelectionChange`. |
|
|
2422
|
+
| `columnsMenu?` | `boolean` | `false` | Adds an icon button whose menu shows and hides columns (`DataTable.ColumnsMenu`). |
|
|
2423
|
+
| `showToolbar?` | `boolean` | `true` | `false` drops the search, filters, row count and toolbar content: rows only, for short tables under their own heading. The toolbar holds the search, a "Filters (n)" button whose panel holds the filters that are not `quick`, the `quick` filters and a clear button on the left; the loading spinner, `toolbar` content, columns menu and export on the right. Active filters from the panel show as tags under it. The row count sits in the footer: the pagination's range, or a count when the table is not paginated. Below 640px the toolbar is one line: the search, a filter icon button whose bottom sheet holds every filter and the `toolbar` content, and export. |
|
|
2303
2424
|
| `exportName?` | `string` | | Adds an icon-only export button (named by `labels.export`, also its tooltip) that saves the filtered, sorted rows as `<exportName>.csv`. Columns choose their text with `exportValue`. |
|
|
2304
2425
|
| `fill?` | `boolean` | `false` | Grow to fill the height of a flex column container (a page, or a `Card` whose content holds the table); only the rows scroll. `maxHeight` still caps it. |
|
|
2305
2426
|
| `className?` | `string` | | Class name for the table's root element. |
|
|
@@ -2333,7 +2454,7 @@ Search box of the table. Typing applies after the table's `searchDebounce`; clea
|
|
|
2333
2454
|
| Prop | Type | Default | Description |
|
|
2334
2455
|
| --- | --- | --- | --- |
|
|
2335
2456
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
2336
|
-
| `clearLabel?` | `string` |
|
|
2457
|
+
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. Set app-wide with `LabelsProvider` (`clearSearch`). |
|
|
2337
2458
|
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
2338
2459
|
| `className?` | `string` | | Class name for the search box. |
|
|
2339
2460
|
|
|
@@ -2341,13 +2462,14 @@ Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
|
2341
2462
|
|
|
2342
2463
|
### DataTable.Filters
|
|
2343
2464
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2465
|
+
The filters of the table, in a wrapping row. Children are added after the filters. Selects and date
|
|
2466
|
+
ranges in the row have a fixed width (`--oui-data-table-filter-width`), so picking a value moves nothing.
|
|
2346
2467
|
|
|
2347
2468
|
| Prop | Type | Default | Description |
|
|
2348
2469
|
| --- | --- | --- | --- |
|
|
2349
2470
|
| `size?` | `'sm' \| 'md'` | | Control height of every filter. |
|
|
2350
|
-
| `stacked?` | `boolean` | | One filter per row at full width, chip rows and date ranges under their name: the layout of the filter
|
|
2471
|
+
| `stacked?` | `boolean` | | One filter per row at full width, chip rows and date ranges under their name: the layout of the filter panel and the phone sheet. |
|
|
2472
|
+
| `quick?` | `boolean` | | `true` renders only the quick filters, `false` only the others. Left out, every filter. |
|
|
2351
2473
|
|
|
2352
2474
|
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2353
2475
|
|
|
@@ -2363,22 +2485,86 @@ The control of one filter: a dropdown, a toggle chip, a row of chips or a date r
|
|
|
2363
2485
|
|
|
2364
2486
|
### DataTable.FilterSheet
|
|
2365
2487
|
|
|
2366
|
-
The phone toolbar's
|
|
2367
|
-
|
|
2368
|
-
|
|
2488
|
+
The phone toolbar's filter button: an icon with the number of active filters, so the search next to it
|
|
2489
|
+
keeps the width. It opens a bottom sheet holding every filter and the `children`. Filters apply as they
|
|
2490
|
+
change. The footer keeps a clear button (disabled while no filter is set, so nothing moves when one is)
|
|
2491
|
+
and a button that closes the sheet on the result count.
|
|
2369
2492
|
|
|
2370
2493
|
| Prop | Type | Default | Description |
|
|
2371
2494
|
| --- | --- | --- | --- |
|
|
2372
2495
|
| `size?` | `'sm' \| 'md'` | `'md'` | Height of the filter button; the filters in the sheet are full size. |
|
|
2373
2496
|
| `children?` | `React.ReactNode` | | Extra content placed under the filters (add, bulk actions…). |
|
|
2374
2497
|
|
|
2498
|
+
### DataTable.FilterPanel
|
|
2499
|
+
|
|
2500
|
+
"Filters (n)" button that opens a panel holding every filter that is not `quick`, one per row. Filters
|
|
2501
|
+
apply as they change; the footer clears them or closes the panel on the result count. Renders nothing
|
|
2502
|
+
when every filter is quick.
|
|
2503
|
+
|
|
2504
|
+
```tsx
|
|
2505
|
+
<DataTable.Root table={table}>
|
|
2506
|
+
<DataTable.Toolbar>
|
|
2507
|
+
<DataTable.Controls>
|
|
2508
|
+
<DataTable.Search />
|
|
2509
|
+
<DataTable.FilterPanel />
|
|
2510
|
+
<DataTable.Filters quick />
|
|
2511
|
+
<DataTable.ClearFilters keepSpace />
|
|
2512
|
+
</DataTable.Controls>
|
|
2513
|
+
</DataTable.Toolbar>
|
|
2514
|
+
<DataTable.ActiveFilters />
|
|
2515
|
+
<DataTable.Content />
|
|
2516
|
+
</DataTable.Root>
|
|
2517
|
+
```
|
|
2518
|
+
|
|
2519
|
+
| Prop | Type | Default | Description |
|
|
2520
|
+
| --- | --- | --- | --- |
|
|
2521
|
+
| `size?` | `'sm' \| 'md'` | | Height of the button; the filters in the panel are full size. |
|
|
2522
|
+
| `open?` | `boolean` | | Whether the panel is open. Set it with `onOpenChange` to open the panel from elsewhere. |
|
|
2523
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the panel opens or closes. |
|
|
2524
|
+
| `className?` | `string` | | Class name for the button. |
|
|
2525
|
+
|
|
2526
|
+
### DataTable.ActiveFilters
|
|
2527
|
+
|
|
2528
|
+
Removable tags for the active filters that are not `quick` (those show their value in the toolbar).
|
|
2529
|
+
Renders nothing while none is set.
|
|
2530
|
+
|
|
2531
|
+
| Prop | Type | Default | Description |
|
|
2532
|
+
| --- | --- | --- | --- |
|
|
2533
|
+
| `onEdit?` | `(id: string) => void` | | Called with the filter id when a tag's text is clicked; the default toolbar opens the filter panel. |
|
|
2534
|
+
|
|
2535
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2536
|
+
|
|
2375
2537
|
### DataTable.Actions
|
|
2376
2538
|
|
|
2377
2539
|
Styled `<div>` (`.oui-data-table__actions`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
2378
2540
|
|
|
2541
|
+
### DataTable.ClearFilters
|
|
2542
|
+
|
|
2543
|
+
Button that clears every filter. Place it after the filters with `keepSpace`, so nothing shifts when it appears.
|
|
2544
|
+
|
|
2545
|
+
| Prop | Type | Default | Description |
|
|
2546
|
+
| --- | --- | --- | --- |
|
|
2547
|
+
| `className?` | `string` | | Class name for the button. |
|
|
2548
|
+
| `keepSpace?` | `boolean` | | While no filter is set, hide the button but keep its space, so the controls around it never move. Without it the button renders nothing then. |
|
|
2549
|
+
|
|
2550
|
+
### DataTable.ColumnsMenu
|
|
2551
|
+
|
|
2552
|
+
Icon button with a menu of checkboxes that show or hide columns. Columns with `hidden` or
|
|
2553
|
+
`hideable: false` are not listed. The choice is in `table.hiddenColumns`; keep it across visits with
|
|
2554
|
+
`hiddenColumns` and `onHiddenColumnsChange`.
|
|
2555
|
+
|
|
2556
|
+
| Prop | Type | Default | Description |
|
|
2557
|
+
| --- | --- | --- | --- |
|
|
2558
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Height of the button. |
|
|
2559
|
+
| `className?` | `string` | | Class name for the button. |
|
|
2560
|
+
|
|
2561
|
+
### DataTable.Loading
|
|
2562
|
+
|
|
2563
|
+
Spinner while the table loads. It keeps its space while idle, so nothing moves when it shows.
|
|
2564
|
+
|
|
2379
2565
|
### DataTable.Summary
|
|
2380
2566
|
|
|
2381
|
-
Row count, or the number of selected rows
|
|
2567
|
+
Row count, or the number of selected rows. The default table shows it in the footer.
|
|
2382
2568
|
|
|
2383
2569
|
### DataTable.Content
|
|
2384
2570
|
|
|
@@ -2392,6 +2578,7 @@ The table itself, with its loading, empty and error states.
|
|
|
2392
2578
|
| `onEndReached?` | `() => void` | | Called when the rows are scrolled near their end, once per row count: load and append the next rows. Needs `maxHeight` or `virtualized`. |
|
|
2393
2579
|
| `stickyFirstColumn?` | `boolean` | | Keeps the first column (and the selection checkboxes) in place while the table scrolls sideways, so each row stays identifiable on narrow screens. |
|
|
2394
2580
|
| `empty?` | `React.ReactNode` | | Replaces the default empty state. |
|
|
2581
|
+
| `selectionActions?` | `React.ReactNode` | | Actions on the selected rows (delete, export, assign…). While rows are selected, the header row shows their count, a button that clears the selection and these actions in place of the column names, at the header's height, so the rows do not move. Buttons in it are made header-sized. |
|
|
2395
2582
|
| `tableProps?` | `Omit<TableProps, 'children'>` | | Props for the underlying `Table` (className, wrapperProps, aria-*). |
|
|
2396
2583
|
|
|
2397
2584
|
Also accepts all props of: `Pick<TableProps, 'density' \| 'striped' \| 'stickyHeader'>`.
|
|
@@ -2488,7 +2675,7 @@ import { Meter } from '@optimum-intelligence/opti-ui';
|
|
|
2488
2675
|
| --- | --- | --- | --- |
|
|
2489
2676
|
| `label?` | `React.ReactNode` | | Label above the bar. |
|
|
2490
2677
|
| `showValue?` | `boolean` | `true` | Show the formatted value next to the label. Defaults to `true`. |
|
|
2491
|
-
| `tone?` | `'accent' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2678
|
+
| `tone?` | `'accent' \| 'info' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2492
2679
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Bar thickness. |
|
|
2493
2680
|
|
|
2494
2681
|
Also accepts all props of: `BaseMeter.Root.Props`.
|
|
@@ -2507,7 +2694,7 @@ import { Progress } from '@optimum-intelligence/opti-ui';
|
|
|
2507
2694
|
| --- | --- | --- | --- |
|
|
2508
2695
|
| `label?` | `React.ReactNode` | | Label above the bar. |
|
|
2509
2696
|
| `showValue?` | `boolean` | | Show the formatted value next to the label. |
|
|
2510
|
-
| `tone?` | `'accent' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2697
|
+
| `tone?` | `'accent' \| 'info' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2511
2698
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Bar thickness. |
|
|
2512
2699
|
|
|
2513
2700
|
Also accepts all props of: `BaseProgress.Root.Props`.
|
|
@@ -2563,7 +2750,7 @@ import { Spinner } from '@optimum-intelligence/opti-ui';
|
|
|
2563
2750
|
| --- | --- | --- | --- |
|
|
2564
2751
|
| `ref?` | `React.Ref<HTMLSpanElement>` | | Ref to the spinner element. |
|
|
2565
2752
|
| `size?` | `number \| string` | | Diameter, e.g. `1rem` or `24`. Defaults to `1.25em`. |
|
|
2566
|
-
| `label?` | `string \| null` | `'Loading'` | Accessible label. Set to `null` when a parent already announces loading. |
|
|
2753
|
+
| `label?` | `string \| null` | `'Loading'` | Accessible label. Set to `null` when a parent already announces loading. Set app-wide with `LabelsProvider` (`loading`). |
|
|
2567
2754
|
|
|
2568
2755
|
Also accepts all props of: `React.HTMLAttributes<HTMLSpanElement>`.
|
|
2569
2756
|
|
|
@@ -2763,6 +2950,9 @@ import { useDataTable } from '@optimum-intelligence/opti-ui';
|
|
|
2763
2950
|
| `onPageSizeChange?` | `(pageSize: number) => void` | | Called when the rows per page change. |
|
|
2764
2951
|
| `selection?` | `string[]` | | Selected row ids. Passing `onSelectionChange` adds the checkbox column. Select-all covers every filtered row, or in server mode the current page. |
|
|
2765
2952
|
| `onSelectionChange?` | `(selection: string[]) => void` | | Called with the selected row ids. |
|
|
2953
|
+
| `hiddenColumns?` | `string[]` | | Ids of the columns hidden from the columns menu (controlled). Columns with `hidden` stay hidden regardless. |
|
|
2954
|
+
| `defaultHiddenColumns?` | `string[]` | | Initial hidden column ids when uncontrolled. |
|
|
2955
|
+
| `onHiddenColumnsChange?` | `(hiddenColumns: string[]) => void` | | Called with the hidden column ids when one is shown or hidden; store them to keep the choice. |
|
|
2766
2956
|
| `onRowClick?` | `(row: T) => void` | | Makes rows clickable and keyboard-activatable (Enter). |
|
|
2767
2957
|
| `rowLabel?` | `(row: T) => string` | | Accessible name of a row, used by row selection and clickable rows. |
|
|
2768
2958
|
| `rowActions?` | `(row: T) => DataTableRowAction[] \| React.ReactNode` | | Trailing cell of each row: icon buttons, or any content (a menu, a link). |
|
|
@@ -2808,7 +2998,7 @@ Small built-in stroke icon set. Every icon renders an `<svg>` that follows the f
|
|
|
2808
2998
|
import { ArrowDownIcon } from '@optimum-intelligence/opti-ui';
|
|
2809
2999
|
```
|
|
2810
3000
|
|
|
2811
|
-
Icons: `ArrowDownIcon`, `ArrowUpIcon`, `CalendarIcon`, `CheckIcon`, `ChevronDownIcon`, `ChevronLeftIcon`, `ChevronRightIcon`, `ChevronUpIcon`, `ChevronsLeftIcon`, `ChevronsRightIcon`, `ChevronsUpDownIcon`, `CircleCheckIcon`, `CircleIcon`, `CircleXIcon`, `ClockIcon`, `DownloadIcon`, `ExternalLinkIcon`, `EyeIcon`, `EyeOffIcon`, `FileIcon`, `FilterIcon`, `InfoIcon`, `LayersIcon`, `MenuIcon`, `MinusIcon`, `MoreHorizontalIcon`, `PencilIcon`, `PlusIcon`, `SearchIcon`, `TrashIcon`, `TrendingDownIcon`, `TrendingUpIcon`, `TriangleAlertIcon`, `UploadIcon`, `XIcon`
|
|
3001
|
+
Icons: `ArrowDownIcon`, `ArrowUpIcon`, `CalendarIcon`, `CheckIcon`, `ChevronDownIcon`, `ChevronLeftIcon`, `ChevronRightIcon`, `ChevronUpIcon`, `ChevronsLeftIcon`, `ChevronsRightIcon`, `ChevronsUpDownIcon`, `CircleCheckIcon`, `CircleIcon`, `CircleXIcon`, `ClockIcon`, `ColumnsIcon`, `DownloadIcon`, `ExternalLinkIcon`, `EyeIcon`, `EyeOffIcon`, `FileIcon`, `FilterIcon`, `InfoIcon`, `LayersIcon`, `MenuIcon`, `MinusIcon`, `MoreHorizontalIcon`, `PencilIcon`, `PlusIcon`, `SearchIcon`, `TrashIcon`, `TrendingDownIcon`, `TrendingUpIcon`, `TriangleAlertIcon`, `UploadIcon`, `XIcon`
|
|
2812
3002
|
|
|
2813
3003
|
| Prop | Type | Default | Description |
|
|
2814
3004
|
| --- | --- | --- | --- |
|
|
@@ -2826,6 +3016,16 @@ import { matchesQuery } from '@optimum-intelligence/opti-ui';
|
|
|
2826
3016
|
|
|
2827
3017
|
Signature: `matchesQuery(text: unknown, query: string)`
|
|
2828
3018
|
|
|
3019
|
+
## NARROW_SCREEN
|
|
3020
|
+
|
|
3021
|
+
constant · Icons & utilities
|
|
3022
|
+
|
|
3023
|
+
Media query for phones, which get their own layout at and below 640px. Pass it to `useMediaQuery`.
|
|
3024
|
+
|
|
3025
|
+
```tsx
|
|
3026
|
+
import { NARROW_SCREEN } from '@optimum-intelligence/opti-ui';
|
|
3027
|
+
```
|
|
3028
|
+
|
|
2829
3029
|
## normalizeText
|
|
2830
3030
|
|
|
2831
3031
|
function · Icons & utilities
|
|
@@ -2838,6 +3038,32 @@ import { normalizeText } from '@optimum-intelligence/opti-ui';
|
|
|
2838
3038
|
|
|
2839
3039
|
Signature: `normalizeText(value: unknown)`
|
|
2840
3040
|
|
|
3041
|
+
## SHELL_COLLAPSED
|
|
3042
|
+
|
|
3043
|
+
constant · Icons & utilities
|
|
3044
|
+
|
|
3045
|
+
Media query for screens where `AppShell` moves its navbar into a drawer and shows the tab bar (900px and below).
|
|
3046
|
+
|
|
3047
|
+
```tsx
|
|
3048
|
+
import { SHELL_COLLAPSED } from '@optimum-intelligence/opti-ui';
|
|
3049
|
+
```
|
|
3050
|
+
|
|
3051
|
+
## useMediaQuery
|
|
3052
|
+
|
|
3053
|
+
hook · Icons & utilities
|
|
3054
|
+
|
|
3055
|
+
Whether a media query matches, following changes. `false` during server rendering.
|
|
3056
|
+
|
|
3057
|
+
```tsx
|
|
3058
|
+
import { useMediaQuery } from '@optimum-intelligence/opti-ui';
|
|
3059
|
+
```
|
|
3060
|
+
|
|
3061
|
+
Signature: `useMediaQuery(query: string)`
|
|
3062
|
+
|
|
3063
|
+
```tsx
|
|
3064
|
+
const phone = useMediaQuery(NARROW_SCREEN);
|
|
3065
|
+
```
|
|
3066
|
+
|
|
2841
3067
|
## usePortalContainer
|
|
2842
3068
|
|
|
2843
3069
|
hook · Icons & utilities
|
|
@@ -3125,7 +3351,7 @@ hook · Maps
|
|
|
3125
3351
|
|
|
3126
3352
|
Resolves `--oui-*` colour tokens to `rgba()` strings inside `element`, for MapLibre paint properties,
|
|
3127
3353
|
which accept no `var()` or `color-mix()`. It re-reads them when `data-oui-theme`, `class` or `style`
|
|
3128
|
-
changes on the element or an ancestor (theme switches, `ThemeProvider`).
|
|
3354
|
+
changes on the element or an ancestor (theme switches, `ThemeProvider`), and when the OS colour scheme changes.
|
|
3129
3355
|
`Map.Root` calls it for you; use it for your own `Source`/`Layer` children.
|
|
3130
3356
|
|
|
3131
3357
|
```tsx
|