@optimum-intelligence/opti-ui 0.7.5 → 0.8.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/CHANGELOG.md +77 -0
- package/README.md +24 -11
- 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 +19 -7
- package/dist/components/app-shell/AppShell.js +329 -303
- package/dist/components/app-shell/AppShell.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 +8 -2
- package/dist/components/combobox/Combobox.js +182 -202
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +23 -11
- package/dist/components/data-table/DataTable.js +148 -88
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableContent.js +1 -1
- package/dist/components/data-table/DataTableFilters.d.ts +56 -4
- package/dist/components/data-table/DataTableFilters.js +492 -77
- package/dist/components/data-table/DataTableFilters.js.map +1 -1
- package/dist/components/data-table/types.d.ts +13 -2
- package/dist/components/data-table/useDataTable.d.ts +1 -1
- package/dist/components/data-table/useDataTable.js +251 -229
- 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/Map.d.ts +29 -3
- package/dist/components/map/Map.js +332 -160
- package/dist/components/map/Map.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/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/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 +393 -59
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -3
- package/dist/labels/Labels.d.ts +85 -0
- package/dist/labels/Labels.js +92 -0
- package/dist/labels/Labels.js.map +1 -0
- package/dist/llms-full.txt +231 -45
- package/dist/llms.txt +10 -4
- package/dist/opti-ui.css +212 -18
- 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,28 @@ import { createTheme } from '@optimum-intelligence/opti-ui';
|
|
|
76
76
|
|
|
77
77
|
Signature: `createTheme(...themes: Theme[])`
|
|
78
78
|
|
|
79
|
+
## LabelsProvider
|
|
80
|
+
|
|
81
|
+
component · Theme
|
|
82
|
+
|
|
83
|
+
Replaces the library's built-in English texts (button names, placeholders, table and calendar texts) for
|
|
84
|
+
everything inside it, so an app translates them once instead of per component.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { LabelsProvider } from '@optimum-intelligence/opti-ui';
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<LabelsProvider labels={{ close: 'Bezárás', selectPlaceholder: 'Válasszon…', dataTable: { search: 'Keresés…' } }}>
|
|
92
|
+
<App />
|
|
93
|
+
</LabelsProvider>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| Prop | Type | Default | Description |
|
|
97
|
+
| --- | --- | --- | --- |
|
|
98
|
+
| `labels` | `Partial<Labels>` | | Texts to replace. Nested providers override only what they pass; props on a component still win. |
|
|
99
|
+
| `children?` | `React.ReactNode` | | The subtree that uses these texts. |
|
|
100
|
+
|
|
79
101
|
## seriesColor
|
|
80
102
|
|
|
81
103
|
function · Theme
|
|
@@ -109,7 +131,7 @@ import { ThemeProvider } from '@optimum-intelligence/opti-ui';
|
|
|
109
131
|
| --- | --- | --- | --- |
|
|
110
132
|
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the provider's root element. |
|
|
111
133
|
| `theme?` | `Theme` | | Token overrides applied to this subtree. |
|
|
112
|
-
| `mode?` | `'light' \| 'dark'` | | Color mode for this subtree. |
|
|
134
|
+
| `mode?` | `'light' \| 'dark' \| 'system'` | | Color mode for this subtree; `system` follows the OS. Left out, the subtree inherits its ancestor's mode. |
|
|
113
135
|
|
|
114
136
|
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
115
137
|
|
|
@@ -125,6 +147,18 @@ import { themeToStyle } from '@optimum-intelligence/opti-ui';
|
|
|
125
147
|
|
|
126
148
|
Signature: `themeToStyle(theme: Theme \| undefined)`
|
|
127
149
|
|
|
150
|
+
## useLabels
|
|
151
|
+
|
|
152
|
+
hook · Theme
|
|
153
|
+
|
|
154
|
+
The texts from the nearest `LabelsProvider`, with English defaults for the rest.
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { useLabels } from '@optimum-intelligence/opti-ui';
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Signature: `useLabels()`
|
|
161
|
+
|
|
128
162
|
# Forms
|
|
129
163
|
|
|
130
164
|
## Calendar
|
|
@@ -203,8 +237,9 @@ import { Combobox } from '@optimum-intelligence/opti-ui';
|
|
|
203
237
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
204
238
|
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
205
239
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
240
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
206
241
|
| `placeholder?` | `string` | | Placeholder shown while nothing is typed or selected. |
|
|
207
|
-
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when the filter matches nothing. |
|
|
242
|
+
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when the filter matches nothing. Set app-wide with `LabelsProvider` (`noResults`). |
|
|
208
243
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
209
244
|
| `hideClear?` | `boolean` | | Hide the clear button. |
|
|
210
245
|
| `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 +376,7 @@ import { DateRangePicker } from '@optimum-intelligence/opti-ui';
|
|
|
341
376
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
342
377
|
| `required?` | `boolean` | | Marks the field required and adds the required indicator to the label. |
|
|
343
378
|
| `disabled?` | `boolean` | | Disables the field. |
|
|
344
|
-
| `placeholder?` | `React.ReactNode` |
|
|
379
|
+
| `placeholder?` | `React.ReactNode` | | Text shown while no date is selected. Defaults to the `selectDate…` label of the picker's `labels`. |
|
|
345
380
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
346
381
|
| `open?` | `boolean` | | Whether the calendar popover is open (controlled). |
|
|
347
382
|
| `defaultOpen?` | `boolean` | | Initial popover state when uncontrolled. |
|
|
@@ -349,7 +384,7 @@ import { DateRangePicker } from '@optimum-intelligence/opti-ui';
|
|
|
349
384
|
| `id?` | `string` | | Id of the trigger button. Generated when omitted. |
|
|
350
385
|
| `className?` | `string` | | Class name for the trigger button. |
|
|
351
386
|
| `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. |
|
|
387
|
+
| `contentProps?` | `Omit<PopoverContentProps, 'children'>` | | Props for the popover content. Not used on phones, where the calendar opens in a bottom sheet. |
|
|
353
388
|
| `value?` | `DateRange \| null` | | Selected days as ISO dates; both ends are inclusive. |
|
|
354
389
|
| `defaultValue?` | `DateRange \| null` | `null` | Initially selected range when uncontrolled. |
|
|
355
390
|
| `onValueChange?` | `(value: DateRange \| null) => void` | | Called with the new range, or `null` when cleared. |
|
|
@@ -566,6 +601,34 @@ import { formatFileSize } from '@optimum-intelligence/opti-ui';
|
|
|
566
601
|
|
|
567
602
|
Signature: `formatFileSize(bytes: number, locale?: string)`
|
|
568
603
|
|
|
604
|
+
## FormField
|
|
605
|
+
|
|
606
|
+
component · Forms
|
|
607
|
+
|
|
608
|
+
Label, control, description and error in one: the shell every labelled control (`TextField`, `Select`,
|
|
609
|
+
`Combobox`, `NumberField`) is built on. Use it to give your own control the same layout and wiring.
|
|
610
|
+
|
|
611
|
+
```tsx
|
|
612
|
+
import { FormField } from '@optimum-intelligence/opti-ui';
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
```tsx
|
|
616
|
+
<FormField label="Plate" description="As on the registration." error={errors.plate} required>
|
|
617
|
+
<Input name="plate" required />
|
|
618
|
+
</FormField>
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
| Prop | Type | Default | Description |
|
|
622
|
+
| --- | --- | --- | --- |
|
|
623
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
624
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
625
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
626
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
627
|
+
| `name?` | `string` | | Field name, used by `Form` to match server-side errors to this field. |
|
|
628
|
+
| `disabled?` | `boolean` | | Disables the field and the control inside it. |
|
|
629
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
630
|
+
| `children?` | `React.ReactNode` | | The control: `Input`, `Select.Root`, `NumberField`, a custom control… |
|
|
631
|
+
|
|
569
632
|
## Input
|
|
570
633
|
|
|
571
634
|
component · Forms
|
|
@@ -599,11 +662,12 @@ import { NumberField } from '@optimum-intelligence/opti-ui';
|
|
|
599
662
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
600
663
|
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
601
664
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
665
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
602
666
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
603
667
|
| `placeholder?` | `string` | | Placeholder shown while empty. |
|
|
604
668
|
| `hideStepper?` | `boolean` | | Hide the − / + stepper buttons. |
|
|
605
|
-
| `decrementLabel?` | `string` | `'Decrease'` | Accessible name of the − button. |
|
|
606
|
-
| `incrementLabel?` | `string` | `'Increase'` | Accessible name of the + button. |
|
|
669
|
+
| `decrementLabel?` | `string` | `'Decrease'` | Accessible name of the − button. Set app-wide with `LabelsProvider` (`decrease`). |
|
|
670
|
+
| `incrementLabel?` | `string` | `'Increase'` | Accessible name of the + button. Set app-wide with `LabelsProvider` (`increase`). |
|
|
607
671
|
|
|
608
672
|
Also accepts all props of: `BaseNumberField.Root.Props`.
|
|
609
673
|
|
|
@@ -624,9 +688,14 @@ import { PasswordField } from '@optimum-intelligence/opti-ui';
|
|
|
624
688
|
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
625
689
|
| `defaultVisible?` | `boolean` | | Initial visibility when uncontrolled. |
|
|
626
690
|
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
627
|
-
| `toggleLabel?` | `string` |
|
|
691
|
+
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. Set app-wide with `LabelsProvider` (`showPassword`). |
|
|
692
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
693
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
694
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
695
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
696
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
628
697
|
|
|
629
|
-
Also accepts all props of: `Omit<BaseInput.Props, 'size'
|
|
698
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
630
699
|
|
|
631
700
|
## PasswordInput
|
|
632
701
|
|
|
@@ -645,7 +714,7 @@ import { PasswordInput } from '@optimum-intelligence/opti-ui';
|
|
|
645
714
|
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
646
715
|
| `defaultVisible?` | `boolean` | `false` | Initial visibility when uncontrolled. |
|
|
647
716
|
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
648
|
-
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. |
|
|
717
|
+
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. Set app-wide with `LabelsProvider` (`showPassword`). |
|
|
649
718
|
|
|
650
719
|
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
651
720
|
|
|
@@ -714,7 +783,7 @@ import { SearchInput } from '@optimum-intelligence/opti-ui';
|
|
|
714
783
|
| `value?` | `string` | | Current text (controlled). |
|
|
715
784
|
| `defaultValue?` | `string` | `''` | Initial text when uncontrolled. |
|
|
716
785
|
| `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. |
|
|
786
|
+
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. Set app-wide with `LabelsProvider` (`clearSearch`). |
|
|
718
787
|
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
719
788
|
|
|
720
789
|
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
@@ -737,7 +806,8 @@ import { Select } from '@optimum-intelligence/opti-ui';
|
|
|
737
806
|
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
738
807
|
| `description?` | `React.ReactNode` | | Help text under the trigger. |
|
|
739
808
|
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
740
|
-
| `
|
|
809
|
+
| `fieldProps?` | `FormFieldProps['fieldProps']` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
810
|
+
| `placeholder?` | `React.ReactNode` | `'Select…'` | Text shown while nothing is selected. Set app-wide with `LabelsProvider` (`selectPlaceholder`). |
|
|
741
811
|
| `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
812
|
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
743
813
|
| `triggerProps?` | `Omit<SelectTriggerProps, 'size' \| 'placeholder'>` | | Props passed to the trigger button (className, style, aria-*). |
|
|
@@ -751,6 +821,12 @@ Base UI `Select.Root` re-exported unchanged. See https://base-ui.com/react/compo
|
|
|
751
821
|
|
|
752
822
|
### Select.Label
|
|
753
823
|
|
|
824
|
+
| Prop | Type | Default | Description |
|
|
825
|
+
| --- | --- | --- | --- |
|
|
826
|
+
| `required?` | `boolean` | | Appends a required marker. |
|
|
827
|
+
|
|
828
|
+
Also accepts all props of: `BaseSelect.Label.Props`.
|
|
829
|
+
|
|
754
830
|
### Select.Trigger
|
|
755
831
|
|
|
756
832
|
The select button. Renders the value and chevron unless children are given.
|
|
@@ -852,8 +928,13 @@ import { TextareaField } from '@optimum-intelligence/opti-ui';
|
|
|
852
928
|
| --- | --- | --- | --- |
|
|
853
929
|
| `ref?` | `React.Ref<HTMLTextAreaElement>` | | Ref to the `<textarea>`. |
|
|
854
930
|
| `autoResize?` | `boolean` | | Grow with content up to `maxRows` (uses CSS field-sizing where supported). |
|
|
931
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
932
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
933
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
934
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
935
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
855
936
|
|
|
856
|
-
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
937
|
+
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement>`.
|
|
857
938
|
|
|
858
939
|
## TextField
|
|
859
940
|
|
|
@@ -870,8 +951,13 @@ import { TextField } from '@optimum-intelligence/opti-ui';
|
|
|
870
951
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
871
952
|
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
872
953
|
| `endAdornment?` | `React.ReactNode` | | Icon, text or button rendered inside the box, after the value. |
|
|
954
|
+
| `label?` | `React.ReactNode` | | Visible label above the control. |
|
|
955
|
+
| `description?` | `React.ReactNode` | | Help text under the control. |
|
|
956
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid and the message shows under the control. |
|
|
957
|
+
| `required?` | `boolean` | | Adds the required marker to the label. Pass `required` to the control as well, so the browser checks it. |
|
|
958
|
+
| `fieldProps?` | `Omit<React.ComponentProps<typeof FieldRoot>, 'children'>` | | Props for the wrapping `Field.Root` (className, validate, validationMode…). |
|
|
873
959
|
|
|
874
|
-
Also accepts all props of: `Omit<BaseInput.Props, 'size'
|
|
960
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
875
961
|
|
|
876
962
|
## useDateConfig
|
|
877
963
|
|
|
@@ -929,8 +1015,8 @@ import { AppShell } from '@optimum-intelligence/opti-ui';
|
|
|
929
1015
|
| `mobileBrand?` | `React.ReactNode` | | Brand shown in the mobile top bar. |
|
|
930
1016
|
| `mobileActions?` | `React.ReactNode` | | Extra content on the right of the mobile top bar. |
|
|
931
1017
|
| `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. |
|
|
1018
|
+
| `menuLabel?` | `string` | `'Open navigation'` | Accessible name of the button that opens the navigation drawer on small screens. Set app-wide with `LabelsProvider` (`openNavigation`). |
|
|
1019
|
+
| `moreLabel?` | `string` | `'More'` | Label of the tab-bar slot that opens the navigation drawer. Set app-wide with `LabelsProvider` (`more`). |
|
|
934
1020
|
| `moreTabPosition?` | `'start' \| 'end'` | `'start'` | Whether the "More" slot comes before or after the pinned items in the tab bar. |
|
|
935
1021
|
| `mainProps?` | `React.HTMLAttributes<HTMLElement>` | | Props for the scrolling `<main>` element. |
|
|
936
1022
|
|
|
@@ -1075,8 +1161,8 @@ import { Navbar } from '@optimum-intelligence/opti-ui';
|
|
|
1075
1161
|
| `defaultCollapsed?` | `boolean` | `false` | Initial collapsed state when uncontrolled. |
|
|
1076
1162
|
| `onCollapsedChange?` | `(collapsed: boolean) => void` | | Called when the user collapses or expands the navbar. |
|
|
1077
1163
|
| `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. |
|
|
1164
|
+
| `collapseLabel?` | `string` | `'Collapse'` | Accessible names for the icon-only toggle. Set app-wide with `LabelsProvider` (`collapseNavbar`). |
|
|
1165
|
+
| `expandLabel?` | `string` | `'Expand'` | Accessible name of the toggle while collapsed. Set app-wide with `LabelsProvider` (`expandNavbar`). |
|
|
1080
1166
|
|
|
1081
1167
|
Also accepts all props of: `useRender.ComponentProps<'nav', NavbarState>`.
|
|
1082
1168
|
|
|
@@ -1217,7 +1303,7 @@ import { PageHeader } from '@optimum-intelligence/opti-ui';
|
|
|
1217
1303
|
| `eyebrow?` | `React.ReactNode` | | Small label above the title. |
|
|
1218
1304
|
| `title` | `React.ReactNode` | | Page title, rendered as the page `<h1>`. |
|
|
1219
1305
|
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1220
|
-
| `actions?` | `React.ReactNode` | | Buttons or controls
|
|
1306
|
+
| `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
1307
|
|
|
1222
1308
|
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLElement>, 'title'>`.
|
|
1223
1309
|
|
|
@@ -1735,7 +1821,7 @@ import { ConfirmDialog } from '@optimum-intelligence/opti-ui';
|
|
|
1735
1821
|
| `description?` | `React.ReactNode` | | What happens when confirmed. |
|
|
1736
1822
|
| `children?` | `React.ReactNode` | | Extra content between the description and the buttons. |
|
|
1737
1823
|
| `confirmLabel` | `React.ReactNode` | | Text of the confirm button. |
|
|
1738
|
-
| `cancelLabel?` | `React.ReactNode` | `'Cancel'` | Text of the cancel button. |
|
|
1824
|
+
| `cancelLabel?` | `React.ReactNode` | `'Cancel'` | Text of the cancel button. Set app-wide with `LabelsProvider` (`cancel`). |
|
|
1739
1825
|
| `onConfirm` | `() => void` | | Called by the confirm button. The dialog stays open; close it when the action succeeds. |
|
|
1740
1826
|
| `destructive?` | `boolean` | `false` | Red confirm button, for actions that delete or cannot be undone. |
|
|
1741
1827
|
| `pending?` | `boolean` | `false` | The action is running: the confirm button spins and the dialog cannot be closed. |
|
|
@@ -1781,7 +1867,7 @@ Base UI `Dialog.Trigger` re-exported unchanged. See https://base-ui.com/react/co
|
|
|
1781
1867
|
| `size?` | `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | `'md'` | Width of a centered dialog, or of a sheet. |
|
|
1782
1868
|
| `placement?` | `'center' \| 'right' \| 'left' \| 'bottom'` | `'center'` | `center` modal, or a sheet docked to an edge. |
|
|
1783
1869
|
| `showClose?` | `boolean` | `true` | Render the corner close button. |
|
|
1784
|
-
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. |
|
|
1870
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`). |
|
|
1785
1871
|
| `backdropBlur?` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | How strongly the page behind the dialog is blurred. Override the radius with `--oui-backdrop-blur`. |
|
|
1786
1872
|
| `backdropProps?` | `BaseDialog.Backdrop.Props` | | Props for the backdrop behind the dialog. |
|
|
1787
1873
|
| `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 +1919,18 @@ import { Drawer } from '@optimum-intelligence/opti-ui';
|
|
|
1833
1919
|
| `onOpenChange?` | `(open: boolean) => void` | | Called when the drawer opens or closes. |
|
|
1834
1920
|
| `onOpenChangeComplete?` | `(open: boolean) => void` | | Called once the open or close transition has finished, e.g. to unmount the drawer after it slid out. |
|
|
1835
1921
|
| `trigger?` | `React.ReactElement` | | Element that opens the drawer, e.g. `<Button>Details</Button>`. Omit when `open` is controlled. |
|
|
1836
|
-
| `title
|
|
1922
|
+
| `title?` | `React.ReactNode` | | Header title; also the drawer's accessible name. Needed unless `header` replaces the built-in header. |
|
|
1837
1923
|
| `eyebrow?` | `React.ReactNode` | | Small label above the title, e.g. the record type. |
|
|
1838
1924
|
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1839
1925
|
| `actions?` | `React.ReactNode` | | Header content next to the close button (edit, delete, a menu…). |
|
|
1926
|
+
| `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
1927
|
| `footer?` | `React.ReactNode` | | Pinned to the bottom, for form buttons. |
|
|
1841
1928
|
| `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
1929
|
| `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
1930
|
| `dismissible?` | `boolean` | `true` | Set to `false` to block Esc, outside clicks and the close button, e.g. while a form inside is saving. |
|
|
1844
1931
|
| `modal?` | `boolean` | `true` | `false` leaves the page behind interactive and drops the backdrop. |
|
|
1845
1932
|
| `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. |
|
|
1933
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. Set app-wide with `LabelsProvider` (`close`). |
|
|
1847
1934
|
| `className?` | `string` | | Class name for the drawer panel. |
|
|
1848
1935
|
| `bodyProps?` | `React.HTMLAttributes<HTMLDivElement>` | | Props for the scrolling content area. |
|
|
1849
1936
|
| `children?` | `React.ReactNode` | | Drawer body content. |
|
|
@@ -1923,6 +2010,7 @@ component · Overlays
|
|
|
1923
2010
|
|
|
1924
2011
|
Mount once near the app root. Then call `useToast()` anywhere below, or pass
|
|
1925
2012
|
a `toastManager` from `createToastManager()` to trigger toasts outside React.
|
|
2013
|
+
Bottom toasts sit `--oui-toast-offset-bottom` above the screen edge; AppShell sets it for its mobile tab bar.
|
|
1926
2014
|
|
|
1927
2015
|
```tsx
|
|
1928
2016
|
import { ToastProvider } from '@optimum-intelligence/opti-ui';
|
|
@@ -1986,7 +2074,8 @@ Also accepts all props of: `BaseTooltip.Popup.Props`.
|
|
|
1986
2074
|
|
|
1987
2075
|
hook · Overlays
|
|
1988
2076
|
|
|
1989
|
-
Toast API with tone shortcuts: `toast.success({ title })`.
|
|
2077
|
+
Toast API with tone shortcuts: `toast.success({ title })`. `data` takes a custom `icon` and `content`
|
|
2078
|
+
(`ToastData`), and `toast.promise()` shows a loading toast that turns into success or error.
|
|
1990
2079
|
|
|
1991
2080
|
```tsx
|
|
1992
2081
|
import { useToast } from '@optimum-intelligence/opti-ui';
|
|
@@ -1994,6 +2083,12 @@ import { useToast } from '@optimum-intelligence/opti-ui';
|
|
|
1994
2083
|
|
|
1995
2084
|
Signature: `useToast()`
|
|
1996
2085
|
|
|
2086
|
+
```tsx
|
|
2087
|
+
const toast = useToast();
|
|
2088
|
+
toast.success({ title: 'Route saved', data: { content: <Link href="/routes/12">Open route</Link> } });
|
|
2089
|
+
toast.promise(save(), { loading: 'Saving…', success: 'Saved', error: 'Could not save' });
|
|
2090
|
+
```
|
|
2091
|
+
|
|
1997
2092
|
# Disclosure & navigation
|
|
1998
2093
|
|
|
1999
2094
|
## Accordion
|
|
@@ -2198,7 +2293,7 @@ import { Alert } from '@optimum-intelligence/opti-ui';
|
|
|
2198
2293
|
| `icon?` | `React.ReactNode \| false` | | Custom icon, or `false` to hide it. |
|
|
2199
2294
|
| `actions?` | `React.ReactNode` | | Buttons rendered after the message. |
|
|
2200
2295
|
| `onDismiss?` | `() => void` | | Shows a dismiss button. |
|
|
2201
|
-
| `dismissLabel?` | `string` | `'Dismiss'` | Accessible name of the dismiss button. |
|
|
2296
|
+
| `dismissLabel?` | `string` | `'Dismiss'` | Accessible name of the dismiss button. Set app-wide with `LabelsProvider` (`dismiss`). |
|
|
2202
2297
|
|
|
2203
2298
|
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>`.
|
|
2204
2299
|
|
|
@@ -2275,10 +2370,13 @@ uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` /
|
|
|
2275
2370
|
|
|
2276
2371
|
For another layout, create the table with `useDataTable` and compose the
|
|
2277
2372
|
parts: `DataTable.Root`, `DataTable.Toolbar`, `DataTable.Controls` (the
|
|
2278
|
-
toolbar's left column), `DataTable.Search`,
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
`DataTable.
|
|
2373
|
+
toolbar's left column), `DataTable.Search`, `DataTable.Filters` (`quick`
|
|
2374
|
+
picks the toolbar filters), `DataTable.Filter`, `DataTable.FilterPanel`
|
|
2375
|
+
(the "Filters" button and panel for the other filters),
|
|
2376
|
+
`DataTable.ActiveFilters` (their tags), `DataTable.FilterSheet` (the phone
|
|
2377
|
+
filter button and sheet), `DataTable.ClearFilters`, `DataTable.Actions`,
|
|
2378
|
+
`DataTable.Loading`, `DataTable.Summary`, `DataTable.Content`,
|
|
2379
|
+
`DataTable.Pagination`.
|
|
2282
2380
|
|
|
2283
2381
|
On phones (below 640px) columns with `priority: 'low'` are hidden, and
|
|
2284
2382
|
`stickyFirstColumn` keeps each row's name in view while the rest scrolls.
|
|
@@ -2299,7 +2397,7 @@ import { DataTable } from '@optimum-intelligence/opti-ui';
|
|
|
2299
2397
|
| `pageSizeOptions?` | `number[]` | | Choices in the rows-per-page select. |
|
|
2300
2398
|
| `controlSize?` | `'sm' \| 'md'` | | Size of the search box and the filters. |
|
|
2301
2399
|
| `toolbar?` | `React.ReactNode \| ((context: DataTableToolbarContext<T>) => React.ReactNode)` | | Extra toolbar content (add, bulk actions…). A function receives the processed rows. |
|
|
2302
|
-
| `showToolbar?` | `boolean` | `true` | `false` drops the search, filters,
|
|
2400
|
+
| `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, the `quick` filters, a "Filters (n)" button whose panel holds the other filters, and a clear button on the left; the loading spinner, `toolbar` content 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 or rows are selected. Below 640px the toolbar is one line: the search, a "Filters (n)" button whose bottom sheet holds every filter and the `toolbar` content, and export. |
|
|
2303
2401
|
| `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
2402
|
| `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
2403
|
| `className?` | `string` | | Class name for the table's root element. |
|
|
@@ -2333,7 +2431,7 @@ Search box of the table. Typing applies after the table's `searchDebounce`; clea
|
|
|
2333
2431
|
| Prop | Type | Default | Description |
|
|
2334
2432
|
| --- | --- | --- | --- |
|
|
2335
2433
|
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
2336
|
-
| `clearLabel?` | `string` |
|
|
2434
|
+
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. Set app-wide with `LabelsProvider` (`clearSearch`). |
|
|
2337
2435
|
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
2338
2436
|
| `className?` | `string` | | Class name for the search box. |
|
|
2339
2437
|
|
|
@@ -2341,13 +2439,14 @@ Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
|
2341
2439
|
|
|
2342
2440
|
### DataTable.Filters
|
|
2343
2441
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2442
|
+
The filters of the table, in a wrapping row. Children are added after the filters. Selects and date
|
|
2443
|
+
ranges in the row have a fixed width (`--oui-data-table-filter-width`), so picking a value moves nothing.
|
|
2346
2444
|
|
|
2347
2445
|
| Prop | Type | Default | Description |
|
|
2348
2446
|
| --- | --- | --- | --- |
|
|
2349
2447
|
| `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
|
|
2448
|
+
| `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. |
|
|
2449
|
+
| `quick?` | `boolean` | | `true` renders only the quick filters, `false` only the others. Left out, every filter. |
|
|
2351
2450
|
|
|
2352
2451
|
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2353
2452
|
|
|
@@ -2372,13 +2471,65 @@ is set, so nothing moves when one is) and a button that closes the sheet on the
|
|
|
2372
2471
|
| `size?` | `'sm' \| 'md'` | `'md'` | Height of the filter button; the filters in the sheet are full size. |
|
|
2373
2472
|
| `children?` | `React.ReactNode` | | Extra content placed under the filters (add, bulk actions…). |
|
|
2374
2473
|
|
|
2474
|
+
### DataTable.FilterPanel
|
|
2475
|
+
|
|
2476
|
+
"Filters (n)" button that opens a panel holding every filter that is not `quick`, one per row. Filters
|
|
2477
|
+
apply as they change; the footer clears them or closes the panel on the result count. Renders nothing
|
|
2478
|
+
when every filter is quick.
|
|
2479
|
+
|
|
2480
|
+
```tsx
|
|
2481
|
+
<DataTable.Root table={table}>
|
|
2482
|
+
<DataTable.Toolbar>
|
|
2483
|
+
<DataTable.Controls>
|
|
2484
|
+
<DataTable.Search />
|
|
2485
|
+
<DataTable.Filters quick />
|
|
2486
|
+
<DataTable.FilterPanel />
|
|
2487
|
+
<DataTable.ClearFilters keepSpace />
|
|
2488
|
+
</DataTable.Controls>
|
|
2489
|
+
</DataTable.Toolbar>
|
|
2490
|
+
<DataTable.ActiveFilters />
|
|
2491
|
+
<DataTable.Content />
|
|
2492
|
+
</DataTable.Root>
|
|
2493
|
+
```
|
|
2494
|
+
|
|
2495
|
+
| Prop | Type | Default | Description |
|
|
2496
|
+
| --- | --- | --- | --- |
|
|
2497
|
+
| `size?` | `'sm' \| 'md'` | | Height of the button; the filters in the panel are full size. |
|
|
2498
|
+
| `open?` | `boolean` | | Whether the panel is open. Set it with `onOpenChange` to open the panel from elsewhere. |
|
|
2499
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the panel opens or closes. |
|
|
2500
|
+
| `className?` | `string` | | Class name for the button. |
|
|
2501
|
+
|
|
2502
|
+
### DataTable.ActiveFilters
|
|
2503
|
+
|
|
2504
|
+
Removable tags for the active filters that are not `quick` (those show their value in the toolbar).
|
|
2505
|
+
Renders nothing while none is set.
|
|
2506
|
+
|
|
2507
|
+
| Prop | Type | Default | Description |
|
|
2508
|
+
| --- | --- | --- | --- |
|
|
2509
|
+
| `onEdit?` | `(id: string) => void` | | Called with the filter id when a tag's text is clicked; the default toolbar opens the filter panel. |
|
|
2510
|
+
|
|
2511
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2512
|
+
|
|
2375
2513
|
### DataTable.Actions
|
|
2376
2514
|
|
|
2377
2515
|
Styled `<div>` (`.oui-data-table__actions`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
2378
2516
|
|
|
2517
|
+
### DataTable.ClearFilters
|
|
2518
|
+
|
|
2519
|
+
Button that clears every filter. Place it after the filters with `keepSpace`, so nothing shifts when it appears.
|
|
2520
|
+
|
|
2521
|
+
| Prop | Type | Default | Description |
|
|
2522
|
+
| --- | --- | --- | --- |
|
|
2523
|
+
| `className?` | `string` | | Class name for the button. |
|
|
2524
|
+
| `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. |
|
|
2525
|
+
|
|
2526
|
+
### DataTable.Loading
|
|
2527
|
+
|
|
2528
|
+
Spinner while the table loads. It keeps its space while idle, so nothing moves when it shows.
|
|
2529
|
+
|
|
2379
2530
|
### DataTable.Summary
|
|
2380
2531
|
|
|
2381
|
-
Row count, or the number of selected rows
|
|
2532
|
+
Row count, or the number of selected rows. The default table shows it in the footer.
|
|
2382
2533
|
|
|
2383
2534
|
### DataTable.Content
|
|
2384
2535
|
|
|
@@ -2563,7 +2714,7 @@ import { Spinner } from '@optimum-intelligence/opti-ui';
|
|
|
2563
2714
|
| --- | --- | --- | --- |
|
|
2564
2715
|
| `ref?` | `React.Ref<HTMLSpanElement>` | | Ref to the spinner element. |
|
|
2565
2716
|
| `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. |
|
|
2717
|
+
| `label?` | `string \| null` | `'Loading'` | Accessible label. Set to `null` when a parent already announces loading. Set app-wide with `LabelsProvider` (`loading`). |
|
|
2567
2718
|
|
|
2568
2719
|
Also accepts all props of: `React.HTMLAttributes<HTMLSpanElement>`.
|
|
2569
2720
|
|
|
@@ -2826,6 +2977,16 @@ import { matchesQuery } from '@optimum-intelligence/opti-ui';
|
|
|
2826
2977
|
|
|
2827
2978
|
Signature: `matchesQuery(text: unknown, query: string)`
|
|
2828
2979
|
|
|
2980
|
+
## NARROW_SCREEN
|
|
2981
|
+
|
|
2982
|
+
constant · Icons & utilities
|
|
2983
|
+
|
|
2984
|
+
Media query for phones, which get their own layout at and below 640px. Pass it to `useMediaQuery`.
|
|
2985
|
+
|
|
2986
|
+
```tsx
|
|
2987
|
+
import { NARROW_SCREEN } from '@optimum-intelligence/opti-ui';
|
|
2988
|
+
```
|
|
2989
|
+
|
|
2829
2990
|
## normalizeText
|
|
2830
2991
|
|
|
2831
2992
|
function · Icons & utilities
|
|
@@ -2838,6 +2999,32 @@ import { normalizeText } from '@optimum-intelligence/opti-ui';
|
|
|
2838
2999
|
|
|
2839
3000
|
Signature: `normalizeText(value: unknown)`
|
|
2840
3001
|
|
|
3002
|
+
## SHELL_COLLAPSED
|
|
3003
|
+
|
|
3004
|
+
constant · Icons & utilities
|
|
3005
|
+
|
|
3006
|
+
Media query for screens where `AppShell` moves its navbar into a drawer and shows the tab bar (900px and below).
|
|
3007
|
+
|
|
3008
|
+
```tsx
|
|
3009
|
+
import { SHELL_COLLAPSED } from '@optimum-intelligence/opti-ui';
|
|
3010
|
+
```
|
|
3011
|
+
|
|
3012
|
+
## useMediaQuery
|
|
3013
|
+
|
|
3014
|
+
hook · Icons & utilities
|
|
3015
|
+
|
|
3016
|
+
Whether a media query matches, following changes. `false` during server rendering.
|
|
3017
|
+
|
|
3018
|
+
```tsx
|
|
3019
|
+
import { useMediaQuery } from '@optimum-intelligence/opti-ui';
|
|
3020
|
+
```
|
|
3021
|
+
|
|
3022
|
+
Signature: `useMediaQuery(query: string)`
|
|
3023
|
+
|
|
3024
|
+
```tsx
|
|
3025
|
+
const phone = useMediaQuery(NARROW_SCREEN);
|
|
3026
|
+
```
|
|
3027
|
+
|
|
2841
3028
|
## usePortalContainer
|
|
2842
3029
|
|
|
2843
3030
|
hook · Icons & utilities
|
|
@@ -2973,21 +3160,20 @@ hovered areas get a heavier outline.
|
|
|
2973
3160
|
### Map.Points
|
|
2974
3161
|
|
|
2975
3162
|
Many simple points (sensors, stops, events) as one circle layer. Items with a `label` get it drawn in
|
|
2976
|
-
the circle by a symbol layer on the same source, so thousands of numbered stops
|
|
2977
|
-
dozen styled pins with HTML
|
|
3163
|
+
the circle by a symbol layer on the same source from `labelMinZoom` on, so thousands of numbered stops
|
|
3164
|
+
stay fast. With `cluster`, dense areas become count bubbles. For a few dozen styled pins with HTML
|
|
3165
|
+
content, use `Map.Marker` instead.
|
|
2978
3166
|
|
|
2979
3167
|
```tsx
|
|
2980
|
-
//
|
|
2981
|
-
<Map.Points
|
|
2982
|
-
items={trucks.flatMap((truck, t) =>
|
|
2983
|
-
truck.stops.map((stop, i) => ({ id: stop.id, coordinates: stop.position, colorIndex: t, label: i + 1 })),
|
|
2984
|
-
)}
|
|
2985
|
-
/>
|
|
3168
|
+
// A fleet's stops over two months, merged into count bubbles at low zoom.
|
|
3169
|
+
<Map.Points items={stops} cluster={{ radius: 40 }} onItemClick={(stop) => setPicked(stop)} />
|
|
2986
3170
|
```
|
|
2987
3171
|
|
|
2988
3172
|
| Prop | Type | Default | Description |
|
|
2989
3173
|
| --- | --- | --- | --- |
|
|
2990
3174
|
| `items` | `MapPointItem[]` | | Points to draw, all in one GeoJSON source and one circle layer. |
|
|
3175
|
+
| `labelMinZoom?` | `number` | `12` | Zoom from which item `label`s are drawn. Below it labelled points render as plain dots and MapLibre skips the label layer, so wide views stay readable and pan as fast as unlabelled points. `0` always shows labels. |
|
|
3176
|
+
| `cluster?` | `boolean \| MapClusterOptions` | `false` | Merges nearby points into count bubbles that split as you zoom in, using MapLibre's built-in clustering; a click on a bubble zooms to where it splits. `true` uses a 50 px radius up to zoom 14. Bubbles are not items, so they never reach `onItemClick` or `onItemHover`, and a selected point inside one is not highlighted until it splits. The counts need a style with a `glyphs` URL, like `label`. |
|
|
2991
3177
|
| `selectedIds?` | `string[]` | | Ids of selected points. While it is not empty, other points fade to `--oui-map-dim-opacity`. |
|
|
2992
3178
|
| `onItemClick?` | `(item: MapPointItem, event: MapLayerMouseEvent) => void` | | Called with the clicked point. |
|
|
2993
3179
|
| `onItemHover?` | `(item: MapPointItem \| null, event: MapLayerMouseEvent) => void` | | Called with the point under the pointer, and with `null` when the pointer leaves it. |
|
|
@@ -3126,7 +3312,7 @@ hook · Maps
|
|
|
3126
3312
|
|
|
3127
3313
|
Resolves `--oui-*` colour tokens to `rgba()` strings inside `element`, for MapLibre paint properties,
|
|
3128
3314
|
which accept no `var()` or `color-mix()`. It re-reads them when `data-oui-theme`, `class` or `style`
|
|
3129
|
-
changes on the element or an ancestor (theme switches, `ThemeProvider`).
|
|
3315
|
+
changes on the element or an ancestor (theme switches, `ThemeProvider`), and when the OS colour scheme changes.
|
|
3130
3316
|
`Map.Root` calls it for you; use it for your own `Source`/`Layer` children.
|
|
3131
3317
|
|
|
3132
3318
|
```tsx
|
package/dist/llms.txt
CHANGED
|
@@ -38,9 +38,11 @@ so the components work in Next.js App Router.
|
|
|
38
38
|
## Theme
|
|
39
39
|
|
|
40
40
|
- `createTheme` — Builds a theme from a base, applying overrides on top.
|
|
41
|
+
- `LabelsProvider` — Replaces the library's built-in English texts (button names, placeholders, table and calendar texts) for everything inside it, so an app translates them once instead of per component.
|
|
41
42
|
- `seriesColor` — Colour for the `index`-th data series: `var(--oui-color-chart-N)`, cycling through the eight chart tokens. Use it for chart series, legend swatches and map routes so the same index gets the same hue everywhere, in light and dark mode.
|
|
42
43
|
- `ThemeProvider` — Scopes a theme to its children. Popups opened inside are portalled into the provider so they pick up the same tokens.
|
|
43
44
|
- `themeToStyle` — Converts a theme object into CSS custom properties for a `style` prop.
|
|
45
|
+
- `useLabels` — The texts from the nearest `LabelsProvider`, with English defaults for the rest.
|
|
44
46
|
|
|
45
47
|
## Forms
|
|
46
48
|
|
|
@@ -60,6 +62,7 @@ so the components work in Next.js App Router.
|
|
|
60
62
|
- `Form` — Form with Base UI validation wiring and vertical field spacing.
|
|
61
63
|
- `formatDate` — Formats a date or date-time the way the date pickers show it: ISO-style (`2026-03-09 14:30`) on a 24-hour clock by default, or with a custom `format`. Instants (`"2026-03-09T13:30:00Z"`) are shown in `timeZone`. Returns `""` for an invalid value.
|
|
62
64
|
- `formatFileSize` — `1536` → `"1.5 KB"`.
|
|
65
|
+
- `FormField` — Label, control, description and error in one: the shell every labelled control (`TextField`, `Select`, `Combobox`, `NumberField`) is built on. Use it to give your own control the same layout and wiring.
|
|
63
66
|
- `Input` — Text input, optionally with `startAdornment` / `endAdornment` inside the box. Use `TextField` for a labelled one.
|
|
64
67
|
- `NumberField` — Numeric input with stepper buttons, locale formatting and keyboard stepping.
|
|
65
68
|
- `PasswordField` — Labelled password input with description and error message.
|
|
@@ -129,9 +132,9 @@ so the components work in Next.js App Router.
|
|
|
129
132
|
- `Drawer` — Side panel for inspecting or editing a record without leaving the page: pinned header, scrolling body, optional pinned footer. `side="bottom"` makes it a bottom sheet, for filters and actions on phones. For a free-form sheet use `Dialog.Content` with `placement`.
|
|
130
133
|
- `Popover` — Floating panel anchored to a trigger, for small forms, filters and details. (parts: Root, Trigger, Content, Title, Description, Close)
|
|
131
134
|
- `PreviewCard` — Card that appears when a link is hovered or focused, previewing what is behind it. `PreviewCard.Trigger` is the link itself. Keep the content supplementary: touch users never see it. (parts: Root, Trigger, Content)
|
|
132
|
-
- `ToastProvider` — Mount once near the app root. Then call `useToast()` anywhere below, or pass a `toastManager` from `createToastManager()` to trigger toasts outside React.
|
|
135
|
+
- `ToastProvider` — Mount once near the app root. Then call `useToast()` anywhere below, or pass a `toastManager` from `createToastManager()` to trigger toasts outside React. Bottom toasts sit `--oui-toast-offset-bottom` above the screen edge; AppShell sets it for its mobile tab bar.
|
|
133
136
|
- `Tooltip` — `<Tooltip content="Export"><IconButton … /></Tooltip>`. Wrap the app in `Tooltip.Provider` so adjacent tooltips open instantly. (parts: Provider, Root, Trigger, Content)
|
|
134
|
-
- `useToast` — Toast API with tone shortcuts: `toast.success({ title })`.
|
|
137
|
+
- `useToast` — Toast API with tone shortcuts: `toast.success({ title })`. `data` takes a custom `icon` and `content` (`ToastData`), and `toast.promise()` shows a loading toast that turns into success or error.
|
|
135
138
|
|
|
136
139
|
## Disclosure & navigation
|
|
137
140
|
|
|
@@ -150,7 +153,7 @@ so the components work in Next.js App Router.
|
|
|
150
153
|
- `Avatar` — User or entity picture with initials fallback.
|
|
151
154
|
- `AvatarGroup` — Overlapping row of `Avatar` children, with an optional "+N" overflow counter.
|
|
152
155
|
- `Badge` — Small status label.
|
|
153
|
-
- `DataTable` — `<DataTable data={…} columns={…} />` renders a complete table with search, filters, sorting, pagination, row selection, row actions and inline editing; columns declare what they take part in. Every piece of state works uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` / `selection`), and with `mode="server"` the same state drives an API. (parts: Root, Toolbar, Controls, Search, Filters, Filter, FilterSheet, Actions, Summary, Content, Pagination)
|
|
156
|
+
- `DataTable` — `<DataTable data={…} columns={…} />` renders a complete table with search, filters, sorting, pagination, row selection, row actions and inline editing; columns declare what they take part in. Every piece of state works uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` / `selection`), and with `mode="server"` the same state drives an API. (parts: Root, Toolbar, Controls, Search, Filters, Filter, FilterSheet, FilterPanel, ActiveFilters, Actions, ClearFilters, Loading, Summary, Content, Pagination)
|
|
154
157
|
- `DescriptionItem` — One label and value pair inside a `DescriptionList`.
|
|
155
158
|
- `DescriptionList` — Label and value pairs, such as a record's details. Holds `DescriptionItem`s.
|
|
156
159
|
- `EmptyState` — Placeholder for empty lists, searches without results and first-run screens.
|
|
@@ -176,7 +179,10 @@ so the components work in Next.js App Router.
|
|
|
176
179
|
- `cx` — Joins truthy class names.
|
|
177
180
|
- `Icons` — Small built-in stroke icon set. Every icon renders an `<svg>` that follows the font size and `currentColor`.
|
|
178
181
|
- `matchesQuery` — True when every whitespace-separated term of `query` occurs in `text`. An empty query matches.
|
|
182
|
+
- `NARROW_SCREEN` — Media query for phones, which get their own layout at and below 640px. Pass it to `useMediaQuery`.
|
|
179
183
|
- `normalizeText` — Lower-cases and strips diacritics, so "gyor" matches "Győr".
|
|
184
|
+
- `SHELL_COLLAPSED` — Media query for screens where `AppShell` moves its navbar into a drawer and shows the tab bar (900px and below).
|
|
185
|
+
- `useMediaQuery` — Whether a media query matches, following changes. `false` during server rendering.
|
|
180
186
|
- `usePortalContainer` — Returns the element popups should portal into: the nearest `ThemeProvider`, or `undefined` for the document body. Pass it as `container` when building a custom portalled popup.
|
|
181
187
|
- `withClass` — Prepends a library class to a Base UI `className` prop, preserving the function form so consumers can still derive classes from component state.
|
|
182
188
|
|
|
@@ -184,4 +190,4 @@ so the components work in Next.js App Router.
|
|
|
184
190
|
|
|
185
191
|
- `Map` — Map components on MapLibre, from `@optimum-intelligence/opti-ui/map`. `Map.Root` holds the map; inside it, `Map.Areas`, `Map.Routes` and `Map.Points` draw arrays of items as single GeoJSON layers, `Map.Marker` adds HTML pins, `Map.Popup` and `Map.Tooltip` show content at a position, and `Map.Overlay` floats `Map.Legend`, `Map.BaseLayerSwitch` or cards over a corner. (parts: Root, Routes, Areas, Points, Marker, Popup, Tooltip, Overlay, Legend, BaseLayerSwitch)
|
|
186
192
|
- `rasterStyle` — Builds a MapLibre style from a raster tile URL template (`{z}`, `{x}`, `{y}`), for `MapBaseLayer.style`. The style gets a `glyphs` URL (OpenFreeMap's font server by default) so `Map.Points` labels can render; pass your own `glyphs` URL to use another font server.
|
|
187
|
-
- `useResolvedColors` — Resolves `--oui-*` colour tokens to `rgba()` strings inside `element`, for MapLibre paint properties, which accept no `var()` or `color-mix()`. It re-reads them when `data-oui-theme`, `class` or `style` changes on the element or an ancestor (theme switches, `ThemeProvider`). `Map.Root` calls it for you; use it for your own `Source`/`Layer` children.
|
|
193
|
+
- `useResolvedColors` — Resolves `--oui-*` colour tokens to `rgba()` strings inside `element`, for MapLibre paint properties, which accept no `var()` or `color-mix()`. It re-reads them when `data-oui-theme`, `class` or `style` changes on the element or an ancestor (theme switches, `ThemeProvider`), and when the OS colour scheme changes. `Map.Root` calls it for you; use it for your own `Source`/`Layer` children.
|