@optimum-intelligence/opti-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +19 -0
  2. package/dist/components/accordion/Accordion.d.ts +12 -0
  3. package/dist/components/accordion/Accordion.js +12 -0
  4. package/dist/components/accordion/Accordion.js.map +1 -1
  5. package/dist/components/alert/Alert.d.ts +4 -0
  6. package/dist/components/alert/Alert.js.map +1 -1
  7. package/dist/components/app-shell/AppShell.d.ts +22 -0
  8. package/dist/components/app-shell/AppShell.js +6 -0
  9. package/dist/components/app-shell/AppShell.js.map +1 -1
  10. package/dist/components/avatar/Avatar.d.ts +8 -0
  11. package/dist/components/avatar/Avatar.js +2 -0
  12. package/dist/components/avatar/Avatar.js.map +1 -1
  13. package/dist/components/badge/Badge.d.ts +9 -0
  14. package/dist/components/badge/Badge.js +6 -0
  15. package/dist/components/badge/Badge.js.map +1 -1
  16. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +1 -0
  17. package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -1
  18. package/dist/components/button/Button.d.ts +8 -0
  19. package/dist/components/button/Button.js +6 -0
  20. package/dist/components/button/Button.js.map +1 -1
  21. package/dist/components/calendar/Calendar.d.ts +3 -0
  22. package/dist/components/calendar/Calendar.js.map +1 -1
  23. package/dist/components/card/Card.d.ts +13 -0
  24. package/dist/components/card/Card.js +13 -0
  25. package/dist/components/card/Card.js.map +1 -1
  26. package/dist/components/choice/Choice.d.ts +13 -0
  27. package/dist/components/choice/Choice.js +10 -0
  28. package/dist/components/choice/Choice.js.map +1 -1
  29. package/dist/components/combobox/Combobox.d.ts +12 -0
  30. package/dist/components/combobox/Combobox.js.map +1 -1
  31. package/dist/components/command-palette/CommandPalette.d.ts +10 -0
  32. package/dist/components/command-palette/CommandPalette.js.map +1 -1
  33. package/dist/components/data-table/DataTable.d.ts +4 -0
  34. package/dist/components/data-table/DataTable.js.map +1 -1
  35. package/dist/components/data-table/DataTableContent.d.ts +1 -0
  36. package/dist/components/data-table/DataTableContent.js.map +1 -1
  37. package/dist/components/data-table/DataTableFilters.d.ts +3 -0
  38. package/dist/components/data-table/DataTableFilters.js.map +1 -1
  39. package/dist/components/data-table/types.d.ts +16 -0
  40. package/dist/components/date-picker/DateRangePicker.d.ts +1 -0
  41. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  42. package/dist/components/date-picker/PickerField.d.ts +13 -0
  43. package/dist/components/date-picker/PickerField.js.map +1 -1
  44. package/dist/components/dialog/Dialog.d.ts +5 -0
  45. package/dist/components/dialog/Dialog.js.map +1 -1
  46. package/dist/components/drawer/Drawer.d.ts +10 -0
  47. package/dist/components/drawer/Drawer.js.map +1 -1
  48. package/dist/components/empty-state/EmptyState.d.ts +5 -0
  49. package/dist/components/empty-state/EmptyState.js.map +1 -1
  50. package/dist/components/file-upload/FileUpload.d.ts +21 -0
  51. package/dist/components/file-upload/FileUpload.js.map +1 -1
  52. package/dist/components/input/Input.d.ts +7 -0
  53. package/dist/components/input/Input.js +3 -0
  54. package/dist/components/input/Input.js.map +1 -1
  55. package/dist/components/link/Link.d.ts +1 -0
  56. package/dist/components/link/Link.js.map +1 -1
  57. package/dist/components/menu/Menu.d.ts +6 -0
  58. package/dist/components/menu/Menu.js.map +1 -1
  59. package/dist/components/number-field/NumberField.d.ts +7 -0
  60. package/dist/components/number-field/NumberField.js.map +1 -1
  61. package/dist/components/pagination/Pagination.d.ts +4 -0
  62. package/dist/components/pagination/Pagination.js.map +1 -1
  63. package/dist/components/popover/Popover.d.ts +4 -0
  64. package/dist/components/popover/Popover.js.map +1 -1
  65. package/dist/components/preview-card/PreviewCard.d.ts +4 -0
  66. package/dist/components/preview-card/PreviewCard.js.map +1 -1
  67. package/dist/components/progress/Progress.d.ts +8 -0
  68. package/dist/components/progress/Progress.js.map +1 -1
  69. package/dist/components/scroll-area/ScrollArea.d.ts +1 -0
  70. package/dist/components/scroll-area/ScrollArea.js.map +1 -1
  71. package/dist/components/search-input/SearchInput.d.ts +2 -0
  72. package/dist/components/search-input/SearchInput.js.map +1 -1
  73. package/dist/components/select/Select.d.ts +11 -0
  74. package/dist/components/select/Select.js.map +1 -1
  75. package/dist/components/separator/Separator.d.ts +1 -0
  76. package/dist/components/separator/Separator.js +1 -0
  77. package/dist/components/separator/Separator.js.map +1 -1
  78. package/dist/components/skeleton/Skeleton.d.ts +7 -0
  79. package/dist/components/skeleton/Skeleton.js +1 -0
  80. package/dist/components/skeleton/Skeleton.js.map +1 -1
  81. package/dist/components/slider/Slider.d.ts +1 -0
  82. package/dist/components/slider/Slider.js.map +1 -1
  83. package/dist/components/spinner/Spinner.d.ts +2 -0
  84. package/dist/components/spinner/Spinner.js +1 -0
  85. package/dist/components/spinner/Spinner.js.map +1 -1
  86. package/dist/components/stat-card/StatCard.d.ts +4 -0
  87. package/dist/components/stat-card/StatCard.js.map +1 -1
  88. package/dist/components/stepper/Stepper.d.ts +4 -0
  89. package/dist/components/stepper/Stepper.js.map +1 -1
  90. package/dist/components/table/Table.d.ts +23 -0
  91. package/dist/components/table/Table.js +17 -0
  92. package/dist/components/table/Table.js.map +1 -1
  93. package/dist/components/tabs/Tabs.d.ts +1 -0
  94. package/dist/components/tabs/Tabs.js.map +1 -1
  95. package/dist/components/tag/Tag.d.ts +3 -0
  96. package/dist/components/tag/Tag.js.map +1 -1
  97. package/dist/components/toast/Toast.d.ts +2 -0
  98. package/dist/components/toast/Toast.js.map +1 -1
  99. package/dist/components/toggle/Toggle.d.ts +7 -0
  100. package/dist/components/toggle/Toggle.js +1 -0
  101. package/dist/components/toggle/Toggle.js.map +1 -1
  102. package/dist/components/tooltip/Tooltip.d.ts +8 -0
  103. package/dist/components/tooltip/Tooltip.js.map +1 -1
  104. package/dist/components/typography/Typography.d.ts +5 -0
  105. package/dist/components/typography/Typography.js +2 -0
  106. package/dist/components/typography/Typography.js.map +1 -1
  107. package/dist/components.json +5375 -0
  108. package/dist/llms-full.txt +2590 -0
  109. package/dist/llms.txt +175 -0
  110. package/dist/theme/ThemeProvider.d.ts +1 -0
  111. package/dist/theme/ThemeProvider.js.map +1 -1
  112. package/dist/utils/portal.d.ts +4 -0
  113. package/dist/utils/portal.js +4 -0
  114. package/dist/utils/portal.js.map +1 -1
  115. package/package.json +7 -3
package/dist/llms.txt ADDED
@@ -0,0 +1,175 @@
1
+ # Opti UI (`@optimum-intelligence/opti-ui`)
2
+
3
+ > Optimum's customizable React component library, built on Base UI. React 19, styled with CSS custom properties (`--oui-*`) in cascade layers.
4
+
5
+ ## Read this first
6
+
7
+ - Full API reference (every component, part, prop, type, default): `node_modules/@optimum-intelligence/opti-ui/llms-full.txt`
8
+ - Same data as JSON: `node_modules/@optimum-intelligence/opti-ui/components.json` (also `import manifest from '@optimum-intelligence/opti-ui/components.json'`)
9
+ - Prop types and JSDoc ship in `node_modules/@optimum-intelligence/opti-ui/dist/**/*.d.ts`
10
+
11
+ ## Setup
12
+
13
+ React 19 is a peer dependency; the build is precompiled with React Compiler. `@base-ui/react` is installed with the package.
14
+
15
+ ```tsx
16
+ import '@optimum-intelligence/opti-ui/styles.css';
17
+ import '@optimum-intelligence/opti-ui/fonts.css'; // optional: loads Poppins + Montserrat from Google Fonts
18
+ import { Button, Card, CardTitle, ToastProvider, Tooltip } from '@optimum-intelligence/opti-ui';
19
+
20
+ export function App() {
21
+ return (
22
+ <Tooltip.Provider>
23
+ <ToastProvider>
24
+ <Card>
25
+ <CardTitle>Monthly energy</CardTitle>
26
+ <Button>Export report</Button>
27
+ </Card>
28
+ </ToastProvider>
29
+ </Tooltip.Provider>
30
+ );
31
+ }
32
+ ```
33
+
34
+ Add `class="oui-root"` to `<body>` for the library font, text color and background. Add `oui-isolate`
35
+ to your app root so portalled popups stack above app content. Every module has a `'use client'` banner,
36
+ so the components work in Next.js App Router.
37
+
38
+ ## Theme
39
+
40
+ - `createTheme` — Builds a theme from a base, applying overrides on top.
41
+ - `ThemeProvider` — Scopes a theme to its children. Popups opened inside are portalled into the provider so they pick up the same tokens.
42
+ - `themeToStyle` — Converts a theme object into CSS custom properties for a `style` prop.
43
+
44
+ ## Layout
45
+
46
+ - `AppShell` — Full-height layout with a fixed navbar and an internally scrolling main area. Below 900px the navbar moves into a slide-in drawer. Customize width with `--oui-navbar-width` and `--oui-navbar-collapsed-width`.
47
+ - `Card` — Surface that groups related content. Compose with `CardHeader` (`CardTitle`, `CardDescription`, `CardActions`), `CardContent` and `CardFooter`.
48
+ - `CardActions` — Right-aligned slot inside CardHeader for icon buttons or menus. (parts: displayName)
49
+ - `CardContent` — Styled `<div>` (`.oui-card__content`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
50
+ - `CardDescription` — Styled `<p>` (`.oui-card__description`). Accepts `className`, `style`, the `render` prop and all `<p>` attributes. (parts: displayName)
51
+ - `CardFooter` — Styled `<div>` (`.oui-card__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
52
+ - `CardHeader` — Styled `<div>` (`.oui-card__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
53
+ - `CardTitle` — Styled `<h3>` (`.oui-card__title`). Accepts `className`, `style`, the `render` prop and all `<h3>` attributes. (parts: displayName)
54
+ - `Grid` — Responsive dashboard grid.
55
+ - `Navbar` — Collapsible side navigation. Use inside `AppShell`. Compose with `NavbarHeader` (`NavbarBrand`), `NavbarSection` (`NavbarSectionLabel`, `NavbarItem`) and `NavbarFooter`.
56
+ - `NavbarBrand` — Logo, title and subtitle block for the top of a `Navbar`.
57
+ - `NavbarFooter` — Styled `<div>` (`.oui-navbar__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
58
+ - `NavbarHeader` — Styled `<div>` (`.oui-navbar__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
59
+ - `NavbarItem` — Navigation link. Renders an `<a>`; use `render={<Link to="…" />}` for a router link or `render={<button />}` for an action.
60
+ - `NavbarSection` — Styled `<div>` (`.oui-navbar__section`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
61
+ - `NavbarSectionLabel` — Styled `<div>` (`.oui-navbar__section-label`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes. (parts: displayName)
62
+ - `PageHeader` — Page title block with optional breadcrumbs, eyebrow, description and actions.
63
+ - `ScrollArea` — Scroll container with slim, themed overlay scrollbars. Set a height or max-height.
64
+ - `Separator` — Thin divider line. Set `orientation="vertical"` for a vertical rule.
65
+ - `Stack` — Flex container that spaces its children evenly, in a column or a row.
66
+ - `StatCard` — KPI tile: label, large value, optional unit and trend.
67
+
68
+ ## Typography
69
+
70
+ - `Eyebrow` — Small uppercase label used above titles, in filter bars and table headers.
71
+ - `Heading` — Heading element. `level` sets the tag (`h1`–`h6`) and the default size; `size` overrides only the look.
72
+ - `Link` — Text link. Pass a router link through `render`: `<Link render={<NavLink to="/fleet" />}>`.
73
+ - `Text` — Body text paragraph. Use `render={<span />}` for inline text.
74
+
75
+ ## Actions
76
+
77
+ - `Button` — Action button. Use `render={<a href="…" />}` with `nativeButton={false}` to style a link as a button.
78
+ - `ContextMenu` — Menu opened by right click or long press on `ContextMenu.Trigger`, which wraps the target area. The item parts are the same as `Menu`'s. (parts: Root, Trigger, Content, Item, LinkItem, CheckboxItem, RadioGroup, RadioItem, Group, GroupLabel, Separator, SubmenuRoot, SubmenuTrigger)
79
+ - `IconButton` — Square button for a single icon. Defaults to the compact ghost style.
80
+ - `Menu` — Dropdown menu of actions. Compose `Menu.Root` › `Menu.Trigger` + `Menu.Content` › items. For nested menus use `Menu.SubmenuRoot` › `Menu.SubmenuTrigger` + `Menu.Content`. (parts: Root, Trigger, Content, Item, LinkItem, CheckboxItem, RadioGroup, RadioItem, Group, GroupLabel, Separator, SubmenuRoot, SubmenuTrigger)
81
+ - `SegmentedControl` — Single-choice switcher (e.g. Day / Week / Month). Always keeps one value selected.
82
+ - `Toggle` — Two-state button (bold, pin, favourite…). Inside a ToggleGroup it acts as a segment.
83
+ - `ToggleGroup` — Group of `Toggle` buttons that share selection state (single or multiple).
84
+ - `Toolbar` — Row of controls that is a single tab stop; arrow keys move between them. Other controls join through `render`: `<Toolbar.Button render={<Toggle />} />`, `<Toolbar.Button render={<Menu.Trigger />} />`. (parts: Root, Button, Link, Group, Separator, Input)
85
+
86
+ ## Forms
87
+
88
+ - `Calendar` — Month grid for picking one day. Keyboard: arrows move by day / week, Home / End jump within the week, PageUp / PageDown change month (with Shift: year). The month and year in the title open a list to jump straight to another one.
89
+ - `Checkbox` — Checkbox with optional `label` and `description`. Supports `indeterminate`.
90
+ - `CheckboxGroup` — Manages the checked values of several `Checkbox` children (`value` / `onValueChange`).
91
+ - `Combobox` — Searchable select. `<Combobox items={…} />` covers single and `multiple` (chips) selection; compose the parts for anything custom. (parts: Root, InputGroup, Input, Trigger, Clear, Value, Chips, Chip, Content, List, Item, Empty, Group, GroupLabel, Collection, useFilter)
92
+ - `DatePicker` — Date field with a calendar popover. Values are ISO dates (`"2026-03-09"`), the same format as `<input type="date">`, and are shown the same way.
93
+ - `DateRangePicker` — Date range field with a calendar popover and optional presets. Values are `{ start, end }` ISO dates (`"2026-03-09"`), both inclusive.
94
+ - `DateTimePicker` — Date and time field. Values are local ISO date-times (`"2026-03-09T14:30"`), the same format as `<input type="datetime-local">`, shown as `2026-03-09 14:30:00` on a 24-hour clock whatever the locale.
95
+ - `Dropzone` — Drop target that also opens the file browser on click, Enter or Space.
96
+ - `Field` — Field parts wire up labels, descriptions and validation for any control inside (Input, Select, Checkbox, Switch, NumberField…). (parts: Root, Label, Description, Error, Item, Validity)
97
+ - `Fieldset` — Groups related fields under a legend. (parts: Root, Legend)
98
+ - `FileItem` — One file in a list: name, size, upload progress or error, and a remove button.
99
+ - `FileUpload` — File field: a dropzone plus the list of chosen files. It only collects `File` objects; upload them yourself and report progress through `fileState`.
100
+ - `Form` — Form with Base UI validation wiring and vertical field spacing.
101
+ - `formatDate` — `"2026-03-09"`, or `"2026-03-09 14:30:00"` for a date-time: the same everywhere, on a 24-hour clock.
102
+ - `formatDateLong` — The written form, `"2026. March 9."`, or `"2026. March 9. 14:30"` for a date-time. The order and the 24-hour clock are fixed; `locale` only translates the month name.
103
+ - `formatFileSize` — `1536` → `"1.5 KB"`.
104
+ - `Input` — Text input, optionally with `startAdornment` / `endAdornment` inside the box. Use `TextField` for a labelled one.
105
+ - `NumberField` — Numeric input with stepper buttons, locale formatting and keyboard stepping.
106
+ - `PasswordField` — Labelled password input with description and error message.
107
+ - `PasswordInput` — Password input with a button that reveals the value.
108
+ - `Radio` — Radio button with optional `label` and `description`. Use inside `RadioGroup`; each needs a `value`.
109
+ - `RadioGroup` — Single-choice group for `Radio` children (`value` / `onValueChange`).
110
+ - `RangeCalendar` — Month grid for picking a range of days: the first pick sets one end, the second completes the range (in either order). Same keyboard as Calendar. Disabled days cannot be picked as an end but may fall inside a range.
111
+ - `SearchInput` — Text input with a search icon and a clear button that appears once there is a value.
112
+ - `Select` — `<Select items={…} />` renders a complete labelled select. For full control compose the parts: `Select.Root`, `Select.Trigger`, `Select.Content`, `Select.Item`, `Select.Group`, `Select.GroupLabel`, `Select.Separator`. (parts: Root, Label, Trigger, Value, Content, Item, Group, GroupLabel, Separator)
113
+ - `Slider` — Single value or range (pass an array) slider.
114
+ - `Switch` — On/off switch with optional `label` and `description`.
115
+ - `Textarea` — Multi-line text input. Use `TextareaField` for a labelled one.
116
+ - `TextareaField` — Labelled textarea with description and error message.
117
+ - `TextField` — Labelled input with description and error message.
118
+
119
+ ## Overlays
120
+
121
+ - `AlertDialog` — Confirmation dialog that requires an explicit choice (no outside-click dismissal). (parts: Root, Trigger, Content, Header, Title, Description, Body, Footer, Close)
122
+ - `CommandPalette` — Searchable command menu in a dialog (Ctrl / ⌘ + K) for navigation and quick actions. Keyboard: arrows move, Enter chooses, Esc closes.
123
+ - `createToastManager` — Base UI `Toast.createToastManager` re-exported unchanged. See https://base-ui.com/react/components/toast.
124
+ - `Dialog` — Modal dialog and side sheet. Compose: `Dialog.Root` › `Dialog.Trigger` + `Dialog.Content` › `Dialog.Header` (`Title`, `Description`), `Dialog.Body`, `Dialog.Footer`. Use `render={<Button />}` on `Dialog.Trigger` / `Dialog.Close` to style them as buttons. (parts: Root, Trigger, Content, Header, Title, Description, Body, Footer, Close, createHandle)
125
+ - `Drawer` — Side panel for inspecting or editing a record without leaving the page: pinned header, scrolling body, optional pinned footer. For a free-form sheet use `Dialog.Content` with `placement`.
126
+ - `Popover` — Floating panel anchored to a trigger, for small forms, filters and details. (parts: Root, Trigger, Content, Title, Description, Close)
127
+ - `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)
128
+ - `ToastProvider` — Mount once near the app root. Then call `useToast()` anywhere below, or pass a `toastManager` from `createToastManager()` to trigger toasts outside React.
129
+ - `Tooltip` — `<Tooltip content="Export"><IconButton … /></Tooltip>`. Wrap the app in `Tooltip.Provider` so adjacent tooltips open instantly. (parts: Provider, Root, Trigger, Content)
130
+ - `useToast` — Toast API with tone shortcuts: `toast.success({ title })`.
131
+
132
+ ## Disclosure & navigation
133
+
134
+ - `Accordion` — Expandable sections. Compose `Accordion.Root` › `Accordion.Item` (give each a `value`) › `Accordion.Trigger` + `Accordion.Panel`. Pass `multiple` to `Root` to allow several open at once. (parts: Root, Item, Trigger, Panel)
135
+ - `Breadcrumb` — One step of a breadcrumb trail. Pass a router link through `render`.
136
+ - `Breadcrumbs` — Trail of links to the pages above the current one. Each child becomes one step.
137
+ - `Collapsible` — A single section that shows and hides: advanced options, "show more", filter groups. (parts: Root, Trigger, Panel)
138
+ - `getPageItems` — Page numbers to render, with `'gap'` where pages are skipped.
139
+ - `Pagination` — Controlled page navigation with an optional rows-per-page select.
140
+ - `Stepper` — Progress through an ordered sequence: a wizard, a checkout, a background job's phases.
141
+ - `Tabs` — `Tabs.Root` › `Tabs.List` › `Tabs.Tab`, then one `Tabs.Panel` per value. (parts: Root, List, Tab, Panel)
142
+
143
+ ## Feedback & data display
144
+
145
+ - `Alert` — Inline message for page- or section-level feedback.
146
+ - `Avatar` — User or entity picture with initials fallback.
147
+ - `AvatarGroup` — Overlapping row of `Avatar` children, with an optional "+N" overflow counter.
148
+ - `Badge` — Small status label.
149
+ - `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, Search, Filters, Filter, Actions, Summary, Content, Pagination)
150
+ - `EmptyState` — Placeholder for empty lists, searches without results and first-run screens.
151
+ - `Meter` — A measurement within a known range (quota, capacity, score).
152
+ - `Progress` — Task completion. Pass `value={null}` for an indeterminate bar.
153
+ - `Skeleton` — Pulsing placeholder for content that is still loading.
154
+ - `SkeletonText` — Skeleton placeholder shaped like a paragraph; the last line is shorter.
155
+ - `Spinner` — Indeterminate loading indicator that follows `currentColor`.
156
+ - `Table` — Styled HTML table inside a horizontally scrolling wrapper. Compose with `TableHeader`, `TableBody`, `TableFooter`, `TableRow`, `TableHead`, `TableCell` and `TableCaption`. For search, filters, sorting and pagination use `DataTable` instead.
157
+ - `TableBody` — Styled `<tbody>` (`.oui-table__body`). Accepts `className`, `style`, the `render` prop and all `<tbody>` attributes. (parts: displayName)
158
+ - `TableCaption` — Styled `<caption>` (`.oui-table__caption`). Accepts `className`, `style`, the `render` prop and all `<caption>` attributes. (parts: displayName)
159
+ - `TableCell` — Body cell (`<td>`). `numeric` right-aligns and uses tabular figures.
160
+ - `TableFooter` — Styled `<tfoot>` (`.oui-table__footer`). Accepts `className`, `style`, the `render` prop and all `<tfoot>` attributes. (parts: displayName)
161
+ - `TableHead` — Column header cell (`<th>`), optionally a sort button.
162
+ - `TableHeader` — Styled `<thead>` (`.oui-table__header`). Accepts `className`, `style`, the `render` prop and all `<thead>` attributes. (parts: displayName)
163
+ - `TableRow` — Styled `<tr>` (`.oui-table__row`). Accepts `className`, `style`, the `render` prop and all `<tr>` attributes. (parts: displayName)
164
+ - `Tag` — Label for a value the user can take away again: an active filter, a recipient, a keyword.
165
+ - `useDataTable` — State and row processing of a `DataTable`, without any markup. Pass the result to `DataTable.Root` to lay the parts out yourself, or read `rows`, `filterValues` and the rest to drive something else (an export, a chart).
166
+ - `useDataTableContext` — The table of the surrounding `DataTable.Root`, for building custom parts.
167
+
168
+ ## Icons & utilities
169
+
170
+ - `cx` — Joins truthy class names.
171
+ - `Icons` — Small built-in stroke icon set. Every icon renders an `<svg>` that follows the font size and `currentColor`.
172
+ - `matchesQuery` — True when every whitespace-separated term of `query` occurs in `text`. An empty query matches.
173
+ - `normalizeText` — Lower-cases and strips diacritics, so "gyor" matches "Győr".
174
+ - `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.
175
+ - `withClass` — Prepends a library class to a Base UI `className` prop, preserving the function form so consumers can still derive classes from component state.
@@ -9,6 +9,7 @@ export declare function themeToStyle(theme: Theme | undefined): React.CSSPropert
9
9
  /** Builds a theme from a base, applying overrides on top. */
10
10
  export declare function createTheme(...themes: Theme[]): Theme;
11
11
  export interface ThemeProviderProps extends React.HTMLAttributes<HTMLDivElement> {
12
+ /** Ref to the provider's root element. */
12
13
  ref?: React.Ref<HTMLDivElement>;
13
14
  /** Token overrides applied to this subtree. */
14
15
  theme?: Theme;
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","names":["React","PortalContainerContext","cx","ThemeTokenName","Theme","Partial","Record","ColorMode","themeToStyle","theme","CSSProperties","style","name","value","Object","entries","createTheme","themes","assign","ThemeProviderProps","HTMLAttributes","HTMLDivElement","ref","Ref","mode","ThemeProvider","t0","$","_c","children","className","props","container","setContainer","useState","t1","t2","t3","t4","t5","Symbol","for","t6","_c"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PortalContainerContext } from '../utils/portal';\nimport { cx } from '../utils/cx';\n\n/** Token names without the `--oui-` prefix, e.g. `color-accent` or `radius-card`. */\nexport type ThemeTokenName =\n | `color-${string}`\n | `font-${string}`\n | `radius-${string}`\n | `shadow-${string}`\n | `control-${string}`\n | `duration-${string}`\n | `ease${string}`\n | `z-${string}`\n | `focus-${string}`\n | `${string}-radius`\n | `${string}-height`;\n\n/** A partial set of token overrides. Values are any valid CSS value. */\nexport type Theme = Partial<Record<ThemeTokenName, string>>;\n\nexport type ColorMode = 'light' | 'dark';\n\n/** Converts a theme object into CSS custom properties for a `style` prop. */\nexport function themeToStyle(theme: Theme | undefined): React.CSSProperties {\n const style: Record<string, string> = {};\n if (!theme) return style;\n for (const [name, value] of Object.entries(theme)) {\n if (value != null && value !== '') style[`--oui-${name}`] = value;\n }\n return style as React.CSSProperties;\n}\n\n/** Builds a theme from a base, applying overrides on top. */\nexport function createTheme(...themes: Theme[]): Theme {\n return Object.assign({}, ...themes);\n}\n\nexport interface ThemeProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n ref?: React.Ref<HTMLDivElement>;\n /** Token overrides applied to this subtree. */\n theme?: Theme;\n /** Color mode for this subtree. */\n mode?: ColorMode;\n}\n\n/**\n * Scopes a theme to its children. Popups opened inside are portalled into the\n * provider so they pick up the same tokens.\n */\nexport function ThemeProvider({ theme, mode, className, style, children, ref, ...props }: ThemeProviderProps) {\n const [container, setContainer] = React.useState<HTMLDivElement | null>(null);\n return (\n <div\n ref={ref}\n className={cx('oui-theme', className)}\n data-oui-theme={mode}\n style={{ ...themeToStyle(theme), ...style }}\n {...props}\n >\n <PortalContainerContext value={container}>{children}</PortalContainerContext>\n <div className=\"oui-theme__portal\" ref={setContainer} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAwBA,SAAgBQ,aAAaC,OAA+C;CAC1E,MAAME,QAAgC,CAAC;CACvC,IAAI,CAACF,OAAO,OAAOE;C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AAAhB,SAAAgB,EAAA,QAAAS,IAAA;EAAxBC,KAAA;GAAA,GAAKD;GAAmB,GAAKzB;EAAM;EAACgB,EAAA,MAAAhB;EAAAgB,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAE,YAAAF,EAAA,QAAAK,WAAA;EAG3CM,KAAA,oBAAC,wBAAD;GAA+BN,OAAAA;GAAYH;EAApB,CAAA;EAAsDF,EAAA,MAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,QAAAa,OAAAC,IAAA,2BAAA,GAAA;EAC7EF,KAAA,oBAAA,OAAA;GAAe,WAAA;GAAyBN,KAAAA;EAAY,CAAA;EAAIN,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAH,QAAAG,EAAA,QAAAI,SAAAJ,EAAA,QAAAL,OAAAK,EAAA,QAAAQ,MAAAR,EAAA,QAAAU,MAAAV,EAAA,QAAAW,IAAA;EAR1DI,KAAA,qBAAA,OAAA;GACOpB;GACM,WAAAa;GACKX,kBAAAA;GACT,OAAAa;GAAoC,GACvCN;GALN,UAAA,CAOEO,IACAC,EACI;;EAAAZ,EAAA,MAAAH;EAAAG,EAAA,MAAAI;EAAAJ,EAAA,MAAAL;EAAAK,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OATNe;AASM"}
1
+ {"version":3,"file":"ThemeProvider.js","names":["React","PortalContainerContext","cx","ThemeTokenName","Theme","Partial","Record","ColorMode","themeToStyle","theme","CSSProperties","style","name","value","Object","entries","createTheme","themes","assign","ThemeProviderProps","HTMLAttributes","HTMLDivElement","ref","Ref","mode","ThemeProvider","t0","$","_c","children","className","props","container","setContainer","useState","t1","t2","t3","t4","t5","Symbol","for","t6","_c"],"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PortalContainerContext } from '../utils/portal';\nimport { cx } from '../utils/cx';\n\n/** Token names without the `--oui-` prefix, e.g. `color-accent` or `radius-card`. */\nexport type ThemeTokenName =\n | `color-${string}`\n | `font-${string}`\n | `radius-${string}`\n | `shadow-${string}`\n | `control-${string}`\n | `duration-${string}`\n | `ease${string}`\n | `z-${string}`\n | `focus-${string}`\n | `${string}-radius`\n | `${string}-height`;\n\n/** A partial set of token overrides. Values are any valid CSS value. */\nexport type Theme = Partial<Record<ThemeTokenName, string>>;\n\nexport type ColorMode = 'light' | 'dark';\n\n/** Converts a theme object into CSS custom properties for a `style` prop. */\nexport function themeToStyle(theme: Theme | undefined): React.CSSProperties {\n const style: Record<string, string> = {};\n if (!theme) return style;\n for (const [name, value] of Object.entries(theme)) {\n if (value != null && value !== '') style[`--oui-${name}`] = value;\n }\n return style as React.CSSProperties;\n}\n\n/** Builds a theme from a base, applying overrides on top. */\nexport function createTheme(...themes: Theme[]): Theme {\n return Object.assign({}, ...themes);\n}\n\nexport interface ThemeProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the provider's root element. */\n ref?: React.Ref<HTMLDivElement>;\n /** Token overrides applied to this subtree. */\n theme?: Theme;\n /** Color mode for this subtree. */\n mode?: ColorMode;\n}\n\n/**\n * Scopes a theme to its children. Popups opened inside are portalled into the\n * provider so they pick up the same tokens.\n */\nexport function ThemeProvider({ theme, mode, className, style, children, ref, ...props }: ThemeProviderProps) {\n const [container, setContainer] = React.useState<HTMLDivElement | null>(null);\n return (\n <div\n ref={ref}\n className={cx('oui-theme', className)}\n data-oui-theme={mode}\n style={{ ...themeToStyle(theme), ...style }}\n {...props}\n >\n <PortalContainerContext value={container}>{children}</PortalContainerContext>\n <div className=\"oui-theme__portal\" ref={setContainer} />\n </div>\n );\n}\n"],"mappings":";;;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EAAA,MAAAlB;EAAAkB,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,QAAAhB,SAAAgB,EAAA,QAAAS,IAAA;EAAxBC,KAAA;GAAA,GAAKD;GAAmB,GAAKzB;EAAM;EAACgB,EAAA,MAAAhB;EAAAgB,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAE,YAAAF,EAAA,QAAAK,WAAA;EAG3CM,KAAA,oBAAC,wBAAD;GAA+BN,OAAAA;GAAYH;EAApB,CAAA;EAAsDF,EAAA,MAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,QAAAa,OAAAC,IAAA,2BAAA,GAAA;EAC7EF,KAAA,oBAAA,OAAA;GAAe,WAAA;GAAyBN,KAAAA;EAAY,CAAA;EAAIN,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAH,QAAAG,EAAA,QAAAI,SAAAJ,EAAA,QAAAL,OAAAK,EAAA,QAAAQ,MAAAR,EAAA,QAAAU,MAAAV,EAAA,QAAAW,IAAA;EAR1DI,KAAA,qBAAA,OAAA;GACOpB;GACM,WAAAa;GACKX,kBAAAA;GACT,OAAAa;GAAoC,GACvCN;GALN,UAAA,CAOEO,IACAC,EACI;;EAAAZ,EAAA,MAAAH;EAAAG,EAAA,MAAAI;EAAAJ,EAAA,MAAAL;EAAAK,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OATNe;AASM"}
@@ -5,4 +5,8 @@ import * as React from 'react';
5
5
  * inherit its tokens — this context carries the container element.
6
6
  */
7
7
  export declare const PortalContainerContext: React.Context<HTMLElement | null>;
8
+ /**
9
+ * Returns the element popups should portal into: the nearest `ThemeProvider`, or
10
+ * `undefined` for the document body. Pass it as `container` when building a custom portalled popup.
11
+ */
8
12
  export declare function usePortalContainer(): HTMLElement | undefined;
@@ -7,6 +7,10 @@ import * as React from "react";
7
7
  * inherit its tokens — this context carries the container element.
8
8
  */
9
9
  var PortalContainerContext = React.createContext(null);
10
+ /**
11
+ * Returns the element popups should portal into: the nearest `ThemeProvider`, or
12
+ * `undefined` for the document body. Pass it as `container` when building a custom portalled popup.
13
+ */
10
14
  function usePortalContainer() {
11
15
  return React.useContext(PortalContainerContext) ?? void 0;
12
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","names":["React","PortalContainerContext","createContext","HTMLElement","usePortalContainer","useContext","undefined"],"sources":["../../src/utils/portal.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Popups (menus, selects, dialogs…) are portalled. When a ThemeProvider scopes\n * a theme to part of the page, popups must render inside that scope so they\n * inherit its tokens — this context carries the container element.\n */\nexport const PortalContainerContext = React.createContext<HTMLElement | null>(null);\n\nexport function usePortalContainer(): HTMLElement | undefined {\n return React.useContext(PortalContainerContext) ?? undefined;\n}\n"],"mappings":";;;;;;;;AAOA,IAAaC,yBAAyBD,MAAME,cAAkC,IAAI;AAElF,SAAOE,qBAAA;CAAA,OACEJ,MAAKK,WAAYJ,sBAAmC,KAApDK,KAAAA;AAAqD"}
1
+ {"version":3,"file":"portal.js","names":["React","PortalContainerContext","createContext","HTMLElement","usePortalContainer","useContext","undefined"],"sources":["../../src/utils/portal.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Popups (menus, selects, dialogs…) are portalled. When a ThemeProvider scopes\n * a theme to part of the page, popups must render inside that scope so they\n * inherit its tokens — this context carries the container element.\n */\nexport const PortalContainerContext = React.createContext<HTMLElement | null>(null);\n\n/**\n * Returns the element popups should portal into: the nearest `ThemeProvider`, or\n * `undefined` for the document body. Pass it as `container` when building a custom portalled popup.\n */\nexport function usePortalContainer(): HTMLElement | undefined {\n return React.useContext(PortalContainerContext) ?? undefined;\n}\n"],"mappings":";;;;;;;;AAOA,IAAaC,yBAAyBD,MAAME,cAAkC,IAAI;;;;;AAMlF,SAAOE,qBAAA;CAAA,OACEJ,MAAKK,WAAYJ,sBAAmC,KAApDK,KAAAA;AAAqD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimum-intelligence/opti-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Optimum's customizable React component library, built on Base UI.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Optimum Intelligence",
@@ -31,7 +31,10 @@
31
31
  "import": "./dist/index.js"
32
32
  },
33
33
  "./styles.css": "./dist/opti-ui.css",
34
- "./fonts.css": "./dist/fonts.css"
34
+ "./fonts.css": "./dist/fonts.css",
35
+ "./components.json": "./dist/components.json",
36
+ "./llms.txt": "./dist/llms.txt",
37
+ "./llms-full.txt": "./dist/llms-full.txt"
35
38
  },
36
39
  "sideEffects": [
37
40
  "**/*.css"
@@ -39,7 +42,8 @@
39
42
  "scripts": {
40
43
  "dev": "vite --host 127.0.0.1",
41
44
  "typecheck": "tsc --noEmit",
42
- "build": "npm run typecheck && vite build && tsc -p tsconfig.build.json",
45
+ "build": "npm run typecheck && vite build && tsc -p tsconfig.build.json && npm run docs",
46
+ "docs": "node scripts/generate-docs.mjs",
43
47
  "build:showcase": "vite build --mode showcase",
44
48
  "test": "npm run build && node --test tests/",
45
49
  "prepack": "npm run build"