@scattered-light/loomiere-base-ui 0.8.0 → 0.10.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 (83) hide show
  1. package/README.md +43 -2
  2. package/dist/{chunk-LJQ3RZDJ.js → chunk-PV5YOQMN.js} +69 -3
  3. package/dist/chunk-PV5YOQMN.js.map +1 -0
  4. package/dist/custom/index.d.ts +1 -1
  5. package/dist/custom/index.js +1 -1
  6. package/dist/design-system/components/AppBar/README.md +58 -0
  7. package/dist/design-system/components/AppBar/preview.html +19 -0
  8. package/dist/design-system/components/PickerButton/README.md +56 -0
  9. package/dist/design-system/components/PickerButton/preview.html +19 -0
  10. package/dist/design-system/components/SideNav/README.md +73 -0
  11. package/dist/design-system/components/SideNav/preview.html +19 -0
  12. package/dist/design-system/components/ToggleGroup/README.md +2 -2
  13. package/dist/design-system/components/ToggleGroup/preview.html +1 -1
  14. package/dist/design-system/components/bundle.js +7 -7
  15. package/dist/design-system/components/index.d.ts +1 -1
  16. package/dist/design-system/components/styles.css +400 -57
  17. package/dist/{index-CBAo353T.d.ts → index-D88kSSlM.d.ts} +78 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/styles/components/Accordion.css +1 -1
  21. package/dist/styles/components/AlertDialog.css +1 -1
  22. package/dist/styles/components/Autocomplete.css +1 -1
  23. package/dist/styles/components/Avatar.css +1 -1
  24. package/dist/styles/components/Button.css +1 -1
  25. package/dist/styles/components/Checkbox.css +1 -1
  26. package/dist/styles/components/CheckboxGroup.css +1 -1
  27. package/dist/styles/components/Collapsible.css +1 -1
  28. package/dist/styles/components/Combobox.css +1 -1
  29. package/dist/styles/components/ContextMenu.css +1 -1
  30. package/dist/styles/components/Dialog.css +1 -1
  31. package/dist/styles/components/Drawer.css +1 -1
  32. package/dist/styles/components/Field.css +1 -1
  33. package/dist/styles/components/Fieldset.css +1 -1
  34. package/dist/styles/components/Form.css +1 -1
  35. package/dist/styles/components/Input.css +1 -1
  36. package/dist/styles/components/Menu.css +1 -1
  37. package/dist/styles/components/Menubar.css +1 -1
  38. package/dist/styles/components/Meter.css +1 -1
  39. package/dist/styles/components/NavigationMenu.css +1 -1
  40. package/dist/styles/components/NumberField.css +1 -1
  41. package/dist/styles/components/OTPField.css +1 -1
  42. package/dist/styles/components/Popover.css +1 -1
  43. package/dist/styles/components/PreviewCard.css +1 -1
  44. package/dist/styles/components/Progress.css +1 -1
  45. package/dist/styles/components/Radio.css +1 -1
  46. package/dist/styles/components/ScrollArea.css +1 -1
  47. package/dist/styles/components/Select.css +1 -1
  48. package/dist/styles/components/Separator.css +1 -1
  49. package/dist/styles/components/Slider.css +1 -1
  50. package/dist/styles/components/Switch.css +1 -1
  51. package/dist/styles/components/Tabs.css +1 -1
  52. package/dist/styles/components/Toast.css +1 -1
  53. package/dist/styles/components/Toggle.css +1 -1
  54. package/dist/styles/components/ToggleGroup.css +42 -1
  55. package/dist/styles/components/Toolbar.css +1 -1
  56. package/dist/styles/components/Tooltip.css +1 -1
  57. package/dist/styles/custom/AppBar.css +33 -0
  58. package/dist/styles/custom/Badge.css +1 -1
  59. package/dist/styles/custom/Collection.css +1 -1
  60. package/dist/styles/custom/CollectionPagination.css +1 -1
  61. package/dist/styles/custom/CollectionToolbar.css +1 -1
  62. package/dist/styles/custom/DataList.css +1 -1
  63. package/dist/styles/custom/DataTable.css +1 -1
  64. package/dist/styles/custom/DatePicker.css +1 -1
  65. package/dist/styles/custom/DescriptionList.css +1 -1
  66. package/dist/styles/custom/EditableList.css +1 -1
  67. package/dist/styles/custom/EmptyState.css +1 -1
  68. package/dist/styles/custom/ListDetail.css +1 -1
  69. package/dist/styles/custom/MoneyField.css +1 -1
  70. package/dist/styles/custom/PickerButton.css +85 -0
  71. package/dist/styles/custom/Sheet.css +1 -1
  72. package/dist/styles/custom/SideNav.css +181 -0
  73. package/dist/styles/custom/Splitter.css +1 -1
  74. package/dist/styles/custom/StatFigure.css +1 -1
  75. package/dist/styles/custom/Table.css +1 -1
  76. package/dist/styles/index.css +4 -1
  77. package/dist/styles/reset/accessibility.css +1 -1
  78. package/dist/styles/reset/reset-accessibility.css +1 -1
  79. package/dist/styles/reset/reset-tailwind.css +1 -1
  80. package/dist/styles/reset/reset.css +1 -1
  81. package/dist/styles/tailwind.css +4 -1
  82. package/package.json +2 -2
  83. package/dist/chunk-LJQ3RZDJ.js.map +0 -1
package/README.md CHANGED
@@ -30,8 +30,8 @@ Use Base UI as usual, with the class names the styles target, or the few wrapper
30
30
  ```tsx
31
31
  import {
32
32
  Accordion, AlertDialog, Autocomplete, Avatar, Badge, Button, Calendar, Checkbox, CheckboxGroup, Collapsible,
33
- Combobox, ContextMenu, DatePicker, DatePresets, DescriptionItem, DescriptionList, Dialog, Drawer, EmptyState, Field, Form, Input, ListDetail, Menu, Menubar, Meter, MoneyField, NumberField,
34
- OTPField, Popover, PreviewCard, Progress, Radio, ScrollArea, Select, Separator, Sheet, Slider, Splitter, StatFigure, Switch,
33
+ AppBar, AppBarSpacer, Combobox, ContextMenu, DatePicker, DatePresets, DescriptionItem, DescriptionList, Dialog, Drawer, EmptyState, Field, Form, Input, ListDetail, Menu, Menubar, Meter, MoneyField, NumberField, PickerButton,
34
+ OTPField, Popover, PreviewCard, Progress, Radio, ScrollArea, Select, Separator, Sheet, SideNav, SideNavGroup, SideNavItem, SideNavToggle, Slider, Splitter, StatFigure, Switch,
35
35
  Tabs, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, useListDetail,
36
36
  } from '@scattered-light/loomiere-base-ui';
37
37
  ```
@@ -166,6 +166,47 @@ Pieces for pages that read like an accountant's working paper. They use the them
166
166
 
167
167
  Totals in a plain table are rows: `<tr data-total="subtotal">` rules a line above, `<tr data-total="grand">` adds a double rule under. Put `data-rule="none"` on label and blank cells so the rules only run under the figures. In a DataTable, `totalStyle="subtotal"` or `"grand"` does the same to the footer (the default, `"band"`, keeps the header tray).
168
168
 
169
+ ### App bar: AppBar, PickerButton and a segmented ToggleGroup
170
+
171
+ `AppBar` is the bar across the top of an app window: one row on a line in the rule color, so an ink-rule brand gets the working-paper rule under it. `AppBarSpacer` pushes what follows it to the end, and a vertical `Separator` is a short divider between icon actions. Icon actions are quiet `Button`s holding only an icon, with an `aria-label`.
172
+
173
+ `PickerButton` names what it picks with a caps label before the choice. It opens nothing itself; render it as a trigger:
174
+
175
+ ```tsx
176
+ <AppBar>
177
+ <strong>tullo</strong>
178
+ <Menu.Root>
179
+ <Menu.Trigger render={(props) => <PickerButton {...props} label="Entity" value={entity.name} />} />
180
+ {/* Menu.Portal, Positioner, Popup, RadioGroup... */}
181
+ </Menu.Root>
182
+ <AppBarSpacer />
183
+ <ToggleGroup data-variant="segmented" aria-label="Modules" value={[module]} onValueChange={...}>
184
+ <Toggle value="accounting">Accounting</Toggle>
185
+ <Toggle value="tax">Tax</Toggle>
186
+ </ToggleGroup>
187
+ <Button emphasis="quiet" aria-label="Documents"><DocumentIcon /></Button>
188
+ <Separator orientation="vertical" />
189
+ <Button emphasis="quiet" aria-label="More"><MoreIcon /></Button>
190
+ </AppBar>
191
+ ```
192
+
193
+ `data-variant="segmented"` on a `ToggleGroup` joins its toggles in one outline (`toggle-group.segmented-border-color`, the rule color) and fills the pressed one solid (`fill.inverse`), for switching between a few views or modules.
194
+
195
+ ### Side navigation: SideNav
196
+
197
+ `SideNav` is the column of links down the side of a workspace, named by `aria-label`. `SideNavItem` is a row (a link): `current` marks the page you are on, `count` shows a figure at the end, and a `disabled` row takes a `hint`. `SideNavGroup` adds a caps heading over a set of rows. `SideNavToggle` sits inside the `SideNav` on its edge and collapses it; the parent sets the column's width and must not clip it (`overflow: visible`).
198
+
199
+ ```tsx
200
+ <SideNav aria-label="Entity navigation" collapsed={collapsed}>
201
+ <SideNavItem current href="/entity">Entity Dashboard</SideNavItem>
202
+ <SideNavItem count={5} href="/open">Open Items</SideNavItem>
203
+ <SideNavGroup label="Books">
204
+ <SideNavItem href="/accounts">Financial Accounts</SideNavItem>
205
+ </SideNavGroup>
206
+ <SideNavToggle collapsed={collapsed} onCollapsedChange={setCollapsed} />
207
+ </SideNav>
208
+ ```
209
+
169
210
  ### Collection
170
211
 
171
212
  Install the peer, then import the views from their own entry. `EditableList` does not need it, and comes from `./custom` like Badge.
@@ -3547,6 +3547,72 @@ var DescriptionItem = React10.forwardRef(function DescriptionItem2({ className,
3547
3547
  /* @__PURE__ */ jsx("dd", { className: "DescriptionDetails", children })
3548
3548
  ] });
3549
3549
  });
3550
+ var AppBar = React10.forwardRef(function AppBar2({ className, ...props }, ref) {
3551
+ return /* @__PURE__ */ jsx("header", { ref, className: cn("AppBar", className), ...props });
3552
+ });
3553
+ var AppBarSpacer = React10.forwardRef(function AppBarSpacer2({ className, ...props }, ref) {
3554
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("AppBarSpacer", className), "aria-hidden": "true", ...props });
3555
+ });
3556
+ var PickerButton = React10.forwardRef(function PickerButton2({ className, label, value, placeholder, type = "button", children, ...props }, ref) {
3557
+ const empty = value == null || value === "";
3558
+ return /* @__PURE__ */ jsxs("button", { ref, type, className: cn("PickerButton", className), ...props, children: [
3559
+ /* @__PURE__ */ jsx("span", { className: "PickerButtonLabel", children: label }),
3560
+ /* @__PURE__ */ jsx("span", { className: "PickerButtonValue", "data-placeholder": empty ? "" : void 0, children: empty ? placeholder : value }),
3561
+ children,
3562
+ /* @__PURE__ */ jsx("svg", { className: "PickerButtonIcon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" }) })
3563
+ ] });
3564
+ });
3565
+ var SideNav = React10.forwardRef(function SideNav2({ className, collapsed, children, ...props }, ref) {
3566
+ return /* @__PURE__ */ jsx("nav", { ref, className: cn("SideNav", className), "data-collapsed": collapsed ? "" : void 0, ...props, children });
3567
+ });
3568
+ var SideNavItem = React10.forwardRef(function SideNavItem2({ className, current, count, countTone, disabled, hint, children, href, onClick, ...props }, ref) {
3569
+ return /* @__PURE__ */ jsxs(
3570
+ "a",
3571
+ {
3572
+ ref,
3573
+ className: cn("SideNavItem", className),
3574
+ href: disabled ? void 0 : href ?? "#",
3575
+ "aria-current": current ? "page" : void 0,
3576
+ "aria-disabled": disabled ? true : void 0,
3577
+ "data-current": current ? "" : void 0,
3578
+ "data-disabled": disabled ? "" : void 0,
3579
+ onClick: disabled ? (event) => event.preventDefault() : onClick,
3580
+ ...props,
3581
+ children: [
3582
+ /* @__PURE__ */ jsxs("span", { className: "SideNavItemText", children: [
3583
+ /* @__PURE__ */ jsx("span", { className: "SideNavItemLabel", children }),
3584
+ hint != null ? /* @__PURE__ */ jsx("span", { className: "SideNavItemHint", children: hint }) : null
3585
+ ] }),
3586
+ count != null ? /* @__PURE__ */ jsx("span", { className: "SideNavItemCount", "data-tone": countTone === "quiet" ? "quiet" : void 0, children: count }) : null
3587
+ ]
3588
+ }
3589
+ );
3590
+ });
3591
+ var SideNavGroup = React10.forwardRef(function SideNavGroup2({ className, label, children, ...props }, ref) {
3592
+ const labelId = React10.useId();
3593
+ return /* @__PURE__ */ jsxs("div", { ref, role: "group", "aria-labelledby": labelId, className: cn("SideNavGroup", className), ...props, children: [
3594
+ /* @__PURE__ */ jsx("div", { className: "SideNavGroupLabel", id: labelId, children: label }),
3595
+ children
3596
+ ] });
3597
+ });
3598
+ var SideNavToggle = React10.forwardRef(function SideNavToggle2({ className, collapsed, onCollapsedChange, label, onClick, ...props }, ref) {
3599
+ return /* @__PURE__ */ jsx(
3600
+ "button",
3601
+ {
3602
+ ref,
3603
+ type: "button",
3604
+ className: cn("SideNavToggle", className),
3605
+ "aria-expanded": !collapsed,
3606
+ "aria-label": label ?? (collapsed ? "Expand navigation" : "Collapse navigation"),
3607
+ onClick: (event) => {
3608
+ onClick?.(event);
3609
+ if (!event.defaultPrevented) onCollapsedChange(!collapsed);
3610
+ },
3611
+ ...props,
3612
+ children: /* @__PURE__ */ jsx("svg", { className: "SideNavToggleIcon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8l4.5 4.5" }) })
3613
+ }
3614
+ );
3615
+ });
3550
3616
  var EditableListContext = React10.createContext(null);
3551
3617
  function slug(value) {
3552
3618
  return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "field";
@@ -3766,6 +3832,6 @@ var EditableList = {
3766
3832
  Balance: EditableListBalance
3767
3833
  };
3768
3834
 
3769
- export { Badge, CURRENCY_SEARCH_THRESHOLD, Calendar, CurrencySelect, DatePicker, DatePresets, DescriptionItem, DescriptionList, Drawer, EditableList, Field, ListDetail, ListDetailDetail, ListDetailList, ListDetailRoot, MAX_MINOR_UNITS, MoneyField, MoneyFieldAffix, MoneyFieldGroup, MoneyFieldInput, MoneyFieldRoot, NumberField, Popover, Sheet, Splitter, SplitterHandle, SplitterPanel, SplitterRoot, StatFigure, addDays, addMonths, affixSide, applyKey, applyStored, ariaPercents, builtinPresets, clampDate, createPanels, cssSize, currencyName, currencySymbol, daysInMonth, defaultPresets, defaultWeekStartsOn, endOfWeek, formatDay, formatFull, formatMoney2 as formatMoney, fromMinorUnits, getCurrencyDigits, handleTarget, inclusiveDays, isValidCurrency, isoWeek, last30Days, last7Days, lastMonth, lastWeek, layoutOf, lengthBlockReason, measure, monthCells, moveFocusDate, nextMonth, nextWeek, normalizePaste, orderRange, parseDate, parseDecimalString, parseSize, presetInBounds, resetToDefault, resizeByDelta, resolvePreset, roundHalfExpand, roundingChangesValue, sameSelection, serializeSize, settle, sizeText, startOfWeek, syncPanels, thisMonth, thisQuarter, thisWeek, toDecimalString, toMinorUnits, today, todayDate, toggleCollapsed, tomorrow, useListDetail, valueText, yearToDate, yesterday };
3770
- //# sourceMappingURL=chunk-LJQ3RZDJ.js.map
3771
- //# sourceMappingURL=chunk-LJQ3RZDJ.js.map
3835
+ export { AppBar, AppBarSpacer, Badge, CURRENCY_SEARCH_THRESHOLD, Calendar, CurrencySelect, DatePicker, DatePresets, DescriptionItem, DescriptionList, Drawer, EditableList, Field, ListDetail, ListDetailDetail, ListDetailList, ListDetailRoot, MAX_MINOR_UNITS, MoneyField, MoneyFieldAffix, MoneyFieldGroup, MoneyFieldInput, MoneyFieldRoot, NumberField, PickerButton, Popover, Sheet, SideNav, SideNavGroup, SideNavItem, SideNavToggle, Splitter, SplitterHandle, SplitterPanel, SplitterRoot, StatFigure, addDays, addMonths, affixSide, applyKey, applyStored, ariaPercents, builtinPresets, clampDate, createPanels, cssSize, currencyName, currencySymbol, daysInMonth, defaultPresets, defaultWeekStartsOn, endOfWeek, formatDay, formatFull, formatMoney2 as formatMoney, fromMinorUnits, getCurrencyDigits, handleTarget, inclusiveDays, isValidCurrency, isoWeek, last30Days, last7Days, lastMonth, lastWeek, layoutOf, lengthBlockReason, measure, monthCells, moveFocusDate, nextMonth, nextWeek, normalizePaste, orderRange, parseDate, parseDecimalString, parseSize, presetInBounds, resetToDefault, resizeByDelta, resolvePreset, roundHalfExpand, roundingChangesValue, sameSelection, serializeSize, settle, sizeText, startOfWeek, syncPanels, thisMonth, thisQuarter, thisWeek, toDecimalString, toMinorUnits, today, todayDate, toggleCollapsed, tomorrow, useListDetail, valueText, yearToDate, yesterday };
3836
+ //# sourceMappingURL=chunk-PV5YOQMN.js.map
3837
+ //# sourceMappingURL=chunk-PV5YOQMN.js.map