@optimum-intelligence/opti-ui 0.4.0 → 0.5.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 (36) hide show
  1. package/README.md +9 -7
  2. package/dist/components/app-shell/AppShell.d.ts +75 -6
  3. package/dist/components/app-shell/AppShell.js +670 -185
  4. package/dist/components/app-shell/AppShell.js.map +1 -1
  5. package/dist/components/badge/Badge.d.ts +2 -4
  6. package/dist/components/badge/Badge.js +12 -29
  7. package/dist/components/badge/Badge.js.map +1 -1
  8. package/dist/components/calendar/Calendar.d.ts +19 -8
  9. package/dist/components/calendar/Calendar.js +285 -212
  10. package/dist/components/calendar/Calendar.js.map +1 -1
  11. package/dist/components/calendar/DateConfig.d.ts +37 -0
  12. package/dist/components/calendar/DateConfig.js +75 -0
  13. package/dist/components/calendar/DateConfig.js.map +1 -0
  14. package/dist/components/calendar/date-utils.d.ts +41 -6
  15. package/dist/components/calendar/date-utils.js +119 -20
  16. package/dist/components/calendar/date-utils.js.map +1 -1
  17. package/dist/components/data-table/DataTableContent.js +3 -3
  18. package/dist/components/data-table/DataTableContent.js.map +1 -1
  19. package/dist/components/date-picker/DatePicker.d.ts +33 -10
  20. package/dist/components/date-picker/DatePicker.js +315 -279
  21. package/dist/components/date-picker/DatePicker.js.map +1 -1
  22. package/dist/components/date-picker/DateRangePicker.d.ts +11 -4
  23. package/dist/components/date-picker/DateRangePicker.js +240 -206
  24. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  25. package/dist/components/date-picker/PickerField.js +1 -1
  26. package/dist/components/date-picker/PickerField.js.map +1 -1
  27. package/dist/components/table/Table.d.ts +1 -1
  28. package/dist/components/table/Table.js +2 -2
  29. package/dist/components/table/Table.js.map +1 -1
  30. package/dist/components.json +2023 -1864
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +4 -3
  33. package/dist/llms-full.txt +869 -752
  34. package/dist/llms.txt +37 -35
  35. package/dist/opti-ui.css +171 -81
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -72,24 +72,26 @@ so the components work in Next.js App Router.
72
72
 
73
73
  | Area | Components |
74
74
  | --- | --- |
75
- | Layout | `AppShell`, `Navbar` (+ `NavbarHeader/Brand/Section/SectionLabel/Item/Footer`), `PageHeader`, `Grid`, `Stack`, `Card` (+ parts), `StatCard`, `Separator`, `ScrollArea` |
75
+ | Layout | `AppShell`, `Navbar` (+ `NavbarHeader/Brand/Section/SectionLabel/Item/Group/Footer`), `PageHeader`, `Grid`, `Stack`, `Card` (+ parts), `StatCard`, `Separator`, `ScrollArea` |
76
76
  | Actions | `Button`, `IconButton`, `Toggle`, `ToggleGroup`, `SegmentedControl`, `Menu.*`, `ContextMenu.*`, `Toolbar.*` |
77
77
  | Forms | `Field.*`, `Fieldset.*`, `Form`, `Input`, `TextField`, `PasswordInput`, `PasswordField`, `Textarea`, `TextareaField`, `Select` (+ parts), `Combobox` (+ parts), `Checkbox`, `CheckboxGroup`, `Radio`, `RadioGroup`, `Switch`, `NumberField`, `Slider`, `SearchInput`, `DatePicker`, `DateTimePicker`, `DateRangePicker`, `Calendar`, `RangeCalendar`, `FileUpload`, `Dropzone`, `FileItem` |
78
78
  | Overlays | `Dialog.*` (modal, or a sheet with `placement`), `AlertDialog.*`, `Drawer` (detail side panel), `Popover.*`, `PreviewCard.*`, `Tooltip`, `ToastProvider` + `useToast()`, `CommandPalette` |
79
79
  | Disclosure & navigation | `Tabs.*`, `Accordion.*`, `Collapsible.*`, `Breadcrumbs` + `Breadcrumb`, `Pagination`, `Stepper` |
80
80
  | Feedback & data | `Alert`, `Badge`, `Tag`, `Avatar`, `AvatarGroup`, `Progress`, `Meter`, `Skeleton`, `SkeletonText`, `Spinner`, `Table` (+ parts), `DataTable`, `EmptyState`, `Heading`, `Text`, `Eyebrow`, `Link` |
81
- | Theme | `ThemeProvider`, `createTheme`, `themeToStyle`, icons (`CheckIcon`, `ChevronDownIcon`, …) |
81
+ | Theme | `ThemeProvider`, `createTheme`, `themeToStyle`, `DateConfigProvider`, `useDateConfig`, icons (`CheckIcon`, `ChevronDownIcon`, …) |
82
82
 
83
83
  Components with a common one-line form can be called directly, and their parts are attached for full
84
84
  control: `<Select items={…} />` or `<Select.Root>…<Select.Trigger/>…</Select.Root>`; the same applies to
85
85
  `Combobox` and `Tooltip`. Compound components (`Dialog`, `Menu`, `Tabs`, …) mirror Base UI's part names,
86
86
  so the [Base UI docs](https://base-ui.com/react/overview/quick-start) apply to them directly.
87
87
 
88
- `DatePicker` and `DateTimePicker` use ISO strings as values (`"2026-03-09"`, `"2026-03-09T14:30"`), the
89
- same format as native date inputs; `DateRangePicker` uses `{ start, end }` with both days inclusive.
90
- Dates are displayed the same way in every locale, on a 24-hour clock: `2026-03-09 14:30:00` in fields
91
- (`formatDate`) and `2026. March 9. 14:30` where they are written out (`formatDateLong`); the locale only
92
- translates month and weekday names.
88
+ Calendar dates are plain ISO strings (`"2026-03-09"`), the same format as native date inputs;
89
+ `DateRangePicker` uses `{ start, end }` with both days inclusive. Date-times are UTC instants
90
+ (`"2026-03-09T13:30:00Z"`), shown and edited in `timeZone` (the browser's by default) and converted back on
91
+ commit. `granularity` (`year` … `second`) picks the grid or time fields and cuts the value to that unit.
92
+ Display is ISO-style on a 24-hour clock (`2026-03-09 14:30`) unless you pass a `format` pattern
93
+ (`"DD.MM.YYYY"`, `"MMMM YYYY"`). `formatDate` formats values the same way outside the pickers, and
94
+ `DateConfigProvider` sets app-wide defaults for locale, time zone, week start and formats.
93
95
 
94
96
  `DataTable` handles search, filters, sorting, pagination, selection, row actions and inline editing for
95
97
  rows held in memory. Columns declare what they take part in:
@@ -59,18 +59,60 @@ export type NavbarItemState = {
59
59
  active: boolean;
60
60
  };
61
61
  export interface NavbarItemProps extends useRender.ComponentProps<'a', NavbarItemState> {
62
- /** Icon shown before the label; it stays visible when the navbar is collapsed to a rail. */
62
+ /** Icon shown before the label; it stays visible when the navbar is collapsed to a rail. Not shown inside a `NavbarGroup`. */
63
63
  icon?: React.ReactNode;
64
- /** Marks the current page (sets aria-current). */
64
+ /** Marks the current page (sets aria-current). Also opens the surrounding `NavbarGroup`. */
65
65
  active?: boolean;
66
66
  /** Trailing content such as a count badge. */
67
67
  badge?: React.ReactNode;
68
+ /**
69
+ * Also shows the item in the `AppShell` mobile tab bar (icon and label). Pin up to four items; the
70
+ * first four in navbar order are used. Has no effect outside an `AppShell`.
71
+ */
72
+ pinned?: boolean;
68
73
  }
69
74
  /**
70
75
  * Navigation link. Renders an `<a>`; use `render={<Link to="…" />}` for a
71
- * router link or `render={<button />}` for an action.
76
+ * router link or `render={<button />}` for an action. Inside a `NavbarGroup` it becomes an indented sub-link.
72
77
  */
73
- export declare function NavbarItem({ icon, active, badge, render, children, ref, ...props }: NavbarItemProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
78
+ export declare function NavbarItem({ icon, active, badge, pinned, render, children, ref, ...props }: NavbarItemProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
79
+ export interface NavbarGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
80
+ /** Ref to the group's root element. */
81
+ ref?: React.Ref<HTMLDivElement>;
82
+ /** Text of the parent row. A string also becomes its tooltip on the collapsed rail. */
83
+ label: React.ReactNode;
84
+ /** Icon of the parent row; it stays visible when the navbar is collapsed to a rail. */
85
+ icon?: React.ReactNode;
86
+ /** Trailing content of the parent row, such as a count badge. */
87
+ badge?: React.ReactNode;
88
+ /** Controlled open state. Takes over from the automatic opening on an active child. */
89
+ open?: boolean;
90
+ /**
91
+ * Initial open state when uncontrolled. Whenever a child item becomes `active`, the group opens.
92
+ * @default true when a child item is active
93
+ */
94
+ defaultOpen?: boolean;
95
+ /** Called when the user opens or closes the group. */
96
+ onOpenChange?: (open: boolean) => void;
97
+ /** Sub-links: `NavbarItem` elements (directly or in fragments), shown indented and without icons. */
98
+ children?: React.ReactNode;
99
+ }
100
+ /**
101
+ * Expandable parent row in a `Navbar` with nested `NavbarItem` sub-links. Place it in a `NavbarSection`
102
+ * next to other items. On a collapsed rail the sub-links are hidden and the parent shows as active when
103
+ * one of them is; the hover peek shows the full tree.
104
+ *
105
+ * @example
106
+ * <NavbarSection>
107
+ * <NavbarGroup icon={<Truck />} label="Fleet">
108
+ * <NavbarItem href="/fleet/vehicles" active>Vehicles</NavbarItem>
109
+ * <NavbarItem href="/fleet/drivers">Drivers</NavbarItem>
110
+ * </NavbarGroup>
111
+ * </NavbarSection>
112
+ */
113
+ export declare function NavbarGroup({ label, icon, badge, open: openProp, defaultOpen, onOpenChange, className, children, ref, ...props }: NavbarGroupProps): React.JSX.Element;
114
+ export type MobileNavPosition = 'bottom' | 'top';
115
+ export type MoreTabPosition = 'start' | 'end';
74
116
  export interface AppShellProps extends React.HTMLAttributes<HTMLDivElement> {
75
117
  /** Ref to the shell's root element. */
76
118
  ref?: React.Ref<HTMLDivElement>;
@@ -80,17 +122,44 @@ export interface AppShellProps extends React.HTMLAttributes<HTMLDivElement> {
80
122
  mobileBrand?: React.ReactNode;
81
123
  /** Extra content on the right of the mobile top bar. */
82
124
  mobileActions?: React.ReactNode;
125
+ /**
126
+ * Where small screens show the tab bar of pinned `NavbarItem`s: below or above the main area. Both look
127
+ * the same; the "More" slot (see `moreTabPosition`) opens the navbar drawer. The top bar with `mobileBrand` and
128
+ * `mobileActions` only appears when one of them is set. Without pinned items, a top bar with a menu
129
+ * button is shown instead.
130
+ */
131
+ mobileNavPosition?: MobileNavPosition;
83
132
  /** Accessible name of the button that opens the navigation drawer on small screens. */
84
133
  menuLabel?: string;
134
+ /** Label of the tab-bar slot that opens the navigation drawer. */
135
+ moreLabel?: string;
136
+ /** Whether the "More" slot comes before or after the pinned items in the tab bar. */
137
+ moreTabPosition?: MoreTabPosition;
85
138
  /** Props for the scrolling `<main>` element. */
86
139
  mainProps?: React.HTMLAttributes<HTMLElement>;
87
140
  }
88
141
  /**
89
142
  * Full-height layout with a fixed navbar and an internally scrolling main
90
- * area. Below 900px the navbar moves into a slide-in drawer.
143
+ * area. Below 900px the navbar moves into a slide-in drawer, and `NavbarItem`s marked `pinned` show in a
144
+ * tab bar (see `mobileNavPosition`).
91
145
  * Customize width with `--oui-navbar-width` and `--oui-navbar-collapsed-width`.
146
+ *
147
+ * @example
148
+ * <AppShell
149
+ * mobileBrand="OptiControl"
150
+ * navbar={
151
+ * <Navbar>
152
+ * <NavbarSection>
153
+ * <NavbarItem href="/" icon={<Home />} active pinned>Overview</NavbarItem>
154
+ * <NavbarItem href="/fleet" icon={<Truck />} pinned>Fleet</NavbarItem>
155
+ * </NavbarSection>
156
+ * </Navbar>
157
+ * }
158
+ * >
159
+ * <PageHeader title="Overview" />
160
+ * </AppShell>
92
161
  */
93
- export declare function AppShell({ navbar, mobileBrand, mobileActions, menuLabel, mainProps, className, children, ref, ...props }: AppShellProps): React.JSX.Element;
162
+ export declare function AppShell({ navbar, mobileBrand, mobileActions, mobileNavPosition, menuLabel, moreLabel, moreTabPosition, mainProps, className, children, ref, ...props }: AppShellProps): React.JSX.Element;
94
163
  export interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
95
164
  /** Ref to the `<header>` element. */
96
165
  ref?: React.Ref<HTMLElement>;