@sincpro/web-ui 0.0.0-stage β 0.1.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/LICENSE +21 -0
- package/README.md +157 -2
- package/dist/components/assist/AssistMark.d.ts +64 -0
- package/dist/components/assist/AssistMark.js +108 -0
- package/dist/components/assist/AssistPending.d.ts +24 -0
- package/dist/components/assist/AssistPending.js +26 -0
- package/dist/components/assist/AssistSuggestion.d.ts +42 -0
- package/dist/components/assist/AssistSuggestion.js +55 -0
- package/dist/components/assist/ChangeReview.d.ts +56 -0
- package/dist/components/assist/ChangeReview.js +121 -0
- package/dist/components/assist/assist.d.ts +77 -0
- package/dist/components/assist/assist.js +87 -0
- package/dist/components/assist/index.d.ts +5 -0
- package/dist/components/assist/index.js +7 -0
- package/dist/components/chatter/Chatter.d.ts +161 -0
- package/dist/components/chatter/Chatter.js +232 -0
- package/dist/components/chatter/Messages.d.ts +66 -0
- package/dist/components/chatter/Messages.js +43 -0
- package/dist/components/chatter/Timeline.d.ts +21 -0
- package/dist/components/chatter/Timeline.js +30 -0
- package/dist/components/chatter/index.d.ts +3 -0
- package/dist/components/chatter/index.js +4 -0
- package/dist/components/form/Form.d.ts +52 -0
- package/dist/components/form/Form.js +49 -0
- package/dist/components/form/Sheet.d.ts +43 -0
- package/dist/components/form/Sheet.js +83 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +4 -0
- package/dist/components/frame/Chart.d.ts +13 -0
- package/dist/components/frame/Chart.js +24 -0
- package/dist/components/frame/FrameView.d.ts +33 -0
- package/dist/components/frame/FrameView.js +125 -0
- package/dist/components/frame/index.d.ts +3 -0
- package/dist/components/frame/index.js +3 -0
- package/dist/components/frame/model.d.ts +43 -0
- package/dist/components/frame/model.js +101 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +11 -0
- package/dist/components/lines/LineItems.d.ts +74 -0
- package/dist/components/lines/LineItems.js +229 -0
- package/dist/components/lines/index.d.ts +1 -0
- package/dist/components/lines/index.js +2 -0
- package/dist/components/lines/lines.d.ts +23 -0
- package/dist/components/lines/lines.js +26 -0
- package/dist/components/listing/ColumnsMenu.d.ts +20 -0
- package/dist/components/listing/ColumnsMenu.js +46 -0
- package/dist/components/listing/GroupingLevels.d.ts +35 -0
- package/dist/components/listing/GroupingLevels.js +45 -0
- package/dist/components/listing/Listing.d.ts +27 -0
- package/dist/components/listing/Listing.js +86 -0
- package/dist/components/listing/ListingBar.d.ts +73 -0
- package/dist/components/listing/ListingBar.js +105 -0
- package/dist/components/listing/Pagination.d.ts +36 -0
- package/dist/components/listing/Pagination.js +69 -0
- package/dist/components/listing/RecordCard.d.ts +33 -0
- package/dist/components/listing/RecordCard.js +22 -0
- package/dist/components/listing/RecordLink.d.ts +7 -0
- package/dist/components/listing/RecordLink.js +22 -0
- package/dist/components/listing/Row.d.ts +106 -0
- package/dist/components/listing/Row.js +122 -0
- package/dist/components/listing/SortMenu.d.ts +62 -0
- package/dist/components/listing/SortMenu.js +105 -0
- package/dist/components/listing/ViewSwitcher.d.ts +24 -0
- package/dist/components/listing/ViewSwitcher.js +16 -0
- package/dist/components/listing/columns.d.ts +47 -0
- package/dist/components/listing/columns.js +72 -0
- package/dist/components/listing/grouping.d.ts +35 -0
- package/dist/components/listing/grouping.js +47 -0
- package/dist/components/listing/index.d.ts +17 -0
- package/dist/components/listing/index.js +20 -0
- package/dist/components/listing/modelColumns.d.ts +50 -0
- package/dist/components/listing/modelColumns.js +103 -0
- package/dist/components/listing/pages.d.ts +78 -0
- package/dist/components/listing/pages.js +135 -0
- package/dist/components/listing/selection.d.ts +21 -0
- package/dist/components/listing/selection.js +43 -0
- package/dist/components/listing/set.d.ts +48 -0
- package/dist/components/listing/set.js +24 -0
- package/dist/components/listing/tree.d.ts +28 -0
- package/dist/components/listing/tree.js +23 -0
- package/dist/components/navigation/CommandPalette.d.ts +40 -0
- package/dist/components/navigation/CommandPalette.js +114 -0
- package/dist/components/navigation/NavigationTree.d.ts +31 -0
- package/dist/components/navigation/NavigationTree.js +79 -0
- package/dist/components/navigation/commands.d.ts +30 -0
- package/dist/components/navigation/commands.js +30 -0
- package/dist/components/navigation/index.d.ts +3 -0
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/record/Breadcrumb.d.ts +42 -0
- package/dist/components/record/Breadcrumb.js +98 -0
- package/dist/components/record/DirtyActions.d.ts +26 -0
- package/dist/components/record/DirtyActions.js +22 -0
- package/dist/components/record/Pager.d.ts +18 -0
- package/dist/components/record/Pager.js +33 -0
- package/dist/components/record/RecordHeader.d.ts +71 -0
- package/dist/components/record/RecordHeader.js +72 -0
- package/dist/components/record/RecordSkeleton.d.ts +3 -0
- package/dist/components/record/RecordSkeleton.js +21 -0
- package/dist/components/record/SmartButtons.d.ts +35 -0
- package/dist/components/record/SmartButtons.js +38 -0
- package/dist/components/record/StatusBar.d.ts +51 -0
- package/dist/components/record/StatusBar.js +168 -0
- package/dist/components/record/ThumbBar.d.ts +36 -0
- package/dist/components/record/ThumbBar.js +86 -0
- package/dist/components/record/index.d.ts +6 -0
- package/dist/components/record/index.js +8 -0
- package/dist/components/search/CriteriaBuilder.d.ts +58 -0
- package/dist/components/search/CriteriaBuilder.js +278 -0
- package/dist/components/search/CriteriaChips.d.ts +22 -0
- package/dist/components/search/CriteriaChips.js +64 -0
- package/dist/components/search/FilterBuilder.d.ts +142 -0
- package/dist/components/search/FilterBuilder.js +421 -0
- package/dist/components/search/JoinWord.d.ts +8 -0
- package/dist/components/search/JoinWord.js +47 -0
- package/dist/components/search/JsonEditor.d.ts +19 -0
- package/dist/components/search/JsonEditor.js +78 -0
- package/dist/components/search/SearchBar.d.ts +78 -0
- package/dist/components/search/SearchBar.js +387 -0
- package/dist/components/search/criteria.d.ts +116 -0
- package/dist/components/search/criteria.js +159 -0
- package/dist/components/search/datePeriods.d.ts +122 -0
- package/dist/components/search/datePeriods.js +134 -0
- package/dist/components/search/dateRanges.d.ts +54 -0
- package/dist/components/search/dateRanges.js +89 -0
- package/dist/components/search/index.d.ts +9 -0
- package/dist/components/search/index.js +20 -0
- package/dist/components/search/model.d.ts +54 -0
- package/dist/components/search/model.js +37 -0
- package/dist/components/search/query.d.ts +166 -0
- package/dist/components/search/query.js +436 -0
- package/dist/components/shell/AppFrame.d.ts +14 -0
- package/dist/components/shell/AppFrame.js +80 -0
- package/dist/components/shell/TopBar.d.ts +73 -0
- package/dist/components/shell/TopBar.js +54 -0
- package/dist/components/shell/headerSlot.d.ts +17 -0
- package/dist/components/shell/headerSlot.js +21 -0
- package/dist/components/shell/index.d.ts +2 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/foundations/aria.d.ts +14 -0
- package/dist/foundations/aria.js +18 -0
- package/dist/foundations/calendar.d.ts +28 -0
- package/dist/foundations/calendar.js +183 -0
- package/dist/foundations/copy.d.ts +619 -0
- package/dist/foundations/copy.es.d.ts +2 -0
- package/dist/foundations/copy.es.js +377 -0
- package/dist/foundations/copy.js +472 -0
- package/dist/foundations/density.d.ts +16 -0
- package/dist/foundations/density.js +21 -0
- package/dist/foundations/grouping.d.ts +281 -0
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +14 -0
- package/dist/foundations/index.js +30 -0
- package/dist/foundations/layout.d.ts +9 -0
- package/dist/foundations/layout.js +9 -0
- package/dist/foundations/pivot.d.ts +222 -0
- package/dist/foundations/pivot.js +198 -0
- package/dist/foundations/pivotSheet.d.ts +61 -0
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +67 -0
- package/dist/foundations/slots.js +63 -0
- package/dist/foundations/sticky.d.ts +53 -0
- package/dist/foundations/sticky.js +150 -0
- package/dist/foundations/surface.d.ts +9 -0
- package/dist/foundations/surface.js +26 -0
- package/dist/foundations/theme.d.ts +42 -0
- package/dist/foundations/theme.js +88 -0
- package/dist/foundations/types.d.ts +23 -0
- package/dist/foundations/types.js +50 -0
- package/dist/foundations/variants.d.ts +19 -0
- package/dist/foundations/variants.js +48 -0
- package/dist/foundations/xlsx.d.ts +86 -0
- package/dist/foundations/xlsx.js +0 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/primitives/block/Block.d.ts +66 -0
- package/dist/primitives/block/Block.js +34 -0
- package/dist/primitives/block/Line.d.ts +18 -0
- package/dist/primitives/block/Line.js +45 -0
- package/dist/primitives/block/SectionGrid.d.ts +30 -0
- package/dist/primitives/block/SectionGrid.js +29 -0
- package/dist/primitives/block/Steps.d.ts +76 -0
- package/dist/primitives/block/Steps.js +43 -0
- package/dist/primitives/block/index.d.ts +4 -0
- package/dist/primitives/block/index.js +7 -0
- package/dist/primitives/button/Button.d.ts +137 -0
- package/dist/primitives/button/Button.js +234 -0
- package/dist/primitives/button/index.d.ts +1 -0
- package/dist/primitives/button/index.js +2 -0
- package/dist/primitives/cell/CellStack.d.ts +47 -0
- package/dist/primitives/cell/CellStack.js +33 -0
- package/dist/primitives/cell/index.d.ts +1 -0
- package/dist/primitives/cell/index.js +3 -0
- package/dist/primitives/choice/ComboBox.d.ts +16 -0
- package/dist/primitives/choice/ComboBox.js +52 -0
- package/dist/primitives/choice/RadioGroup.d.ts +18 -0
- package/dist/primitives/choice/RadioGroup.js +50 -0
- package/dist/primitives/choice/SearchField.d.ts +24 -0
- package/dist/primitives/choice/SearchField.js +27 -0
- package/dist/primitives/choice/SegmentedControl.d.ts +16 -0
- package/dist/primitives/choice/SegmentedControl.js +69 -0
- package/dist/primitives/choice/Slider.d.ts +16 -0
- package/dist/primitives/choice/Slider.js +46 -0
- package/dist/primitives/choice/Switch.d.ts +14 -0
- package/dist/primitives/choice/Switch.js +65 -0
- package/dist/primitives/choice/ThemeSwitcher.d.ts +10 -0
- package/dist/primitives/choice/ThemeSwitcher.js +25 -0
- package/dist/primitives/choice/index.d.ts +8 -0
- package/dist/primitives/choice/index.js +11 -0
- package/dist/primitives/choice/options.d.ts +28 -0
- package/dist/primitives/choice/options.js +6 -0
- package/dist/primitives/date/Calendar.d.ts +31 -0
- package/dist/primitives/date/Calendar.js +110 -0
- package/dist/primitives/date/DatePicker.d.ts +34 -0
- package/dist/primitives/date/DatePicker.js +99 -0
- package/dist/primitives/date/index.d.ts +2 -0
- package/dist/primitives/date/index.js +4 -0
- package/dist/primitives/dialog/Dialog.d.ts +118 -0
- package/dist/primitives/dialog/Dialog.js +121 -0
- package/dist/primitives/dialog/index.d.ts +1 -0
- package/dist/primitives/dialog/index.js +2 -0
- package/dist/primitives/disclosure/Disclosure.d.ts +36 -0
- package/dist/primitives/disclosure/Disclosure.js +52 -0
- package/dist/primitives/disclosure/index.d.ts +1 -0
- package/dist/primitives/disclosure/index.js +2 -0
- package/dist/primitives/field/Checks.d.ts +57 -0
- package/dist/primitives/field/Checks.js +72 -0
- package/dist/primitives/field/DropZone.d.ts +42 -0
- package/dist/primitives/field/DropZone.js +52 -0
- package/dist/primitives/field/Field.d.ts +166 -0
- package/dist/primitives/field/Field.js +240 -0
- package/dist/primitives/field/Suggest.d.ts +48 -0
- package/dist/primitives/field/Suggest.js +43 -0
- package/dist/primitives/field/aria.d.ts +61 -0
- package/dist/primitives/field/aria.js +70 -0
- package/dist/primitives/field/context.d.ts +30 -0
- package/dist/primitives/field/context.js +13 -0
- package/dist/primitives/field/index.d.ts +7 -0
- package/dist/primitives/field/index.js +11 -0
- package/dist/primitives/field/layout.d.ts +24 -0
- package/dist/primitives/field/layout.js +10 -0
- package/dist/primitives/field/mode.d.ts +9 -0
- package/dist/primitives/field/mode.js +13 -0
- package/dist/primitives/hint/Hint.d.ts +31 -0
- package/dist/primitives/hint/Hint.js +42 -0
- package/dist/primitives/hint/index.d.ts +1 -0
- package/dist/primitives/hint/index.js +1 -0
- package/dist/primitives/index.d.ts +19 -0
- package/dist/primitives/index.js +20 -0
- package/dist/primitives/menu/Menu.d.ts +100 -0
- package/dist/primitives/menu/Menu.js +59 -0
- package/dist/primitives/menu/index.d.ts +1 -0
- package/dist/primitives/menu/index.js +2 -0
- package/dist/primitives/notice/Callout.d.ts +49 -0
- package/dist/primitives/notice/Callout.js +28 -0
- package/dist/primitives/notice/Notice.d.ts +45 -0
- package/dist/primitives/notice/Notice.js +61 -0
- package/dist/primitives/notice/Toast.d.ts +55 -0
- package/dist/primitives/notice/Toast.js +142 -0
- package/dist/primitives/notice/index.d.ts +3 -0
- package/dist/primitives/notice/index.js +5 -0
- package/dist/primitives/overlay/Popover.d.ts +6 -0
- package/dist/primitives/overlay/Popover.js +27 -0
- package/dist/primitives/overlay/PopoverTrigger.d.ts +55 -0
- package/dist/primitives/overlay/PopoverTrigger.js +38 -0
- package/dist/primitives/overlay/Tooltip.d.ts +38 -0
- package/dist/primitives/overlay/Tooltip.js +74 -0
- package/dist/primitives/overlay/index.d.ts +3 -0
- package/dist/primitives/overlay/index.js +5 -0
- package/dist/primitives/picker/Picker.d.ts +48 -0
- package/dist/primitives/picker/Picker.js +150 -0
- package/dist/primitives/picker/index.d.ts +1 -0
- package/dist/primitives/picker/index.js +2 -0
- package/dist/primitives/surface/Peek.d.ts +60 -0
- package/dist/primitives/surface/Peek.js +71 -0
- package/dist/primitives/surface/index.d.ts +1 -0
- package/dist/primitives/surface/index.js +2 -0
- package/dist/primitives/table/CellEditor.d.ts +14 -0
- package/dist/primitives/table/CellEditor.js +83 -0
- package/dist/primitives/table/DataTable.d.ts +135 -0
- package/dist/primitives/table/DataTable.js +244 -0
- package/dist/primitives/table/EditableTable.d.ts +96 -0
- package/dist/primitives/table/EditableTable.js +423 -0
- package/dist/primitives/table/PivotTable.d.ts +14 -0
- package/dist/primitives/table/PivotTable.js +0 -0
- package/dist/primitives/table/ReportTable.d.ts +38 -0
- package/dist/primitives/table/ReportTable.js +106 -0
- package/dist/primitives/table/RowActions.d.ts +16 -0
- package/dist/primitives/table/RowActions.js +28 -0
- package/dist/primitives/table/SheetTable.d.ts +70 -0
- package/dist/primitives/table/SheetTable.js +197 -0
- package/dist/primitives/table/Table.d.ts +106 -0
- package/dist/primitives/table/Table.js +116 -0
- package/dist/primitives/table/index.d.ts +7 -0
- package/dist/primitives/table/index.js +9 -0
- package/dist/primitives/tabs/Tabs.d.ts +91 -0
- package/dist/primitives/tabs/Tabs.js +56 -0
- package/dist/primitives/tabs/index.d.ts +1 -0
- package/dist/primitives/tabs/index.js +1 -0
- package/dist/primitives/tag/Tag.d.ts +36 -0
- package/dist/primitives/tag/Tag.js +68 -0
- package/dist/primitives/tag/Tags.d.ts +57 -0
- package/dist/primitives/tag/Tags.js +104 -0
- package/dist/primitives/tag/TagsField.d.ts +32 -0
- package/dist/primitives/tag/TagsField.js +182 -0
- package/dist/primitives/tag/choices.d.ts +38 -0
- package/dist/primitives/tag/choices.js +26 -0
- package/dist/primitives/tag/index.d.ts +4 -0
- package/dist/primitives/tag/index.js +8 -0
- package/dist/primitives/toolbar/Toolbar.d.ts +13 -0
- package/dist/primitives/toolbar/Toolbar.js +36 -0
- package/dist/primitives/toolbar/index.d.ts +1 -0
- package/dist/primitives/toolbar/index.js +2 -0
- package/dist/primitives/value/Copyable.d.ts +37 -0
- package/dist/primitives/value/Copyable.js +50 -0
- package/dist/primitives/value/Fecha.d.ts +12 -0
- package/dist/primitives/value/Fecha.js +80 -0
- package/dist/primitives/value/Meter.d.ts +29 -0
- package/dist/primitives/value/Meter.js +46 -0
- package/dist/primitives/value/Metric.d.ts +42 -0
- package/dist/primitives/value/Metric.js +38 -0
- package/dist/primitives/value/Person.d.ts +90 -0
- package/dist/primitives/value/Person.js +208 -0
- package/dist/primitives/value/Relation.d.ts +69 -0
- package/dist/primitives/value/Relation.js +57 -0
- package/dist/primitives/value/Totals.d.ts +26 -0
- package/dist/primitives/value/Totals.js +4 -0
- package/dist/primitives/value/Value.d.ts +77 -0
- package/dist/primitives/value/Value.js +119 -0
- package/dist/primitives/value/index.d.ts +8 -0
- package/dist/primitives/value/index.js +9 -0
- package/dist/tokens.css +1025 -0
- package/dist/views/index.d.ts +2 -0
- package/dist/views/index.js +3 -0
- package/dist/views/list/List.d.ts +113 -0
- package/dist/views/list/List.js +97 -0
- package/dist/views/list/ListView.d.ts +6 -0
- package/dist/views/list/ListView.js +269 -0
- package/dist/views/list/columns.d.ts +18 -0
- package/dist/views/list/columns.js +27 -0
- package/dist/views/list/derive.d.ts +76 -0
- package/dist/views/list/derive.js +181 -0
- package/dist/views/list/index.d.ts +2 -0
- package/dist/views/list/index.js +4 -0
- package/dist/views/list/presentations.d.ts +39 -0
- package/dist/views/list/presentations.js +103 -0
- package/dist/views/list/types.d.ts +272 -0
- package/dist/views/list/types.js +1 -0
- package/dist/views/list/useNarrowList.d.ts +17 -0
- package/dist/views/list/useNarrowList.js +32 -0
- package/dist/views/record/Record.d.ts +126 -0
- package/dist/views/record/Record.js +141 -0
- package/dist/views/record/index.d.ts +1 -0
- package/dist/views/record/index.js +2 -0
- package/package.json +109 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { byDensity, useDensity } from "../../foundations/density.js";
|
|
5
|
+
import { useSurface } from "../../foundations/surface.js";
|
|
6
|
+
import { cn, focusRing, tv } from "../../foundations/variants.js";
|
|
7
|
+
import { Check, CircleAlert } from "lucide-react";
|
|
8
|
+
import { Radio, RadioGroup } from "react-aria-components";
|
|
9
|
+
/** The track the stages sit in. Same rail as the other grouped controls on each
|
|
10
|
+
* surface: a tinted well with a hairline, and on the chrome TRANSLUCENT βink at 8 %
|
|
11
|
+
* over the navyβ so the header's brand wash goes across it and it reads as a layer,
|
|
12
|
+
* not as one more box stuck on top. */
|
|
13
|
+
const trackStyles = tv({
|
|
14
|
+
base: "min-w-0 gap-0.5 rounded-control border p-0.5",
|
|
15
|
+
variants: {
|
|
16
|
+
surface: {
|
|
17
|
+
canvas: "border-line bg-ground",
|
|
18
|
+
chrome: "border-chrome-ink/15 bg-chrome-ink/8",
|
|
19
|
+
},
|
|
20
|
+
layout: {
|
|
21
|
+
trail: "inline-flex max-w-full shrink-0 items-stretch",
|
|
22
|
+
stacked: "flex w-full flex-col",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
/** One stage. Three steps βdone, current, nextβ and ONE way of painting each, the
|
|
27
|
+
* same in both layouts and with or without `onSelect`:
|
|
28
|
+
*
|
|
29
|
+
* done ink, medium, with a check β the path behind
|
|
30
|
+
* current FILLED β the only solid segment in the track
|
|
31
|
+
* next muted β in sight, not reached
|
|
32
|
+
*
|
|
33
|
+
* The current stage is the only fill. Being selectable adds hover and press TINTS
|
|
34
|
+
* (never a fill), and the stage being viewed is an underline under its label: a
|
|
35
|
+
* mark of a different KIND, so it can sit on any of the three steps β the current
|
|
36
|
+
* one included β without competing with the fill. */
|
|
37
|
+
const stageStyles = tv({
|
|
38
|
+
extend: focusRing,
|
|
39
|
+
base: "relative flex min-w-0 items-center gap-1.5 rounded-mark px-2.5 text-meta whitespace-nowrap transition-colors duration-(--duration-instant)",
|
|
40
|
+
variants: {
|
|
41
|
+
surface: { canvas: "", chrome: "outline-chrome-link" },
|
|
42
|
+
step: { done: "font-medium", current: "font-semibold", next: "" },
|
|
43
|
+
failed: { true: "", false: "" },
|
|
44
|
+
selectable: { true: "cursor-pointer", false: "" },
|
|
45
|
+
layout: { trail: "h-(--size-control-sm)", stacked: "w-full py-1 text-left" },
|
|
46
|
+
},
|
|
47
|
+
compoundVariants: [
|
|
48
|
+
/* A keyboard ring is drawn OUTSIDE the segment, over its neighbours: lifted
|
|
49
|
+
above them, or the next segment's paint covers half of it. */
|
|
50
|
+
{ isFocusVisible: true, class: "z-10" },
|
|
51
|
+
{ surface: "canvas", step: "done", class: "text-ink" },
|
|
52
|
+
{ surface: "canvas", step: "next", class: "text-muted" },
|
|
53
|
+
{ surface: "canvas", step: "current", failed: false, class: "bg-primary text-surface" },
|
|
54
|
+
{ surface: "canvas", step: "current", failed: true, class: "bg-danger text-surface" },
|
|
55
|
+
{ surface: "chrome", step: "done", class: "text-chrome-ink" },
|
|
56
|
+
{ surface: "chrome", step: "next", class: "text-chrome-muted" },
|
|
57
|
+
{
|
|
58
|
+
surface: "chrome",
|
|
59
|
+
step: "current",
|
|
60
|
+
failed: false,
|
|
61
|
+
class: "bg-chrome-ink text-chrome",
|
|
62
|
+
},
|
|
63
|
+
{ surface: "chrome", step: "current", failed: true, class: "bg-chrome-bad text-chrome" },
|
|
64
|
+
{
|
|
65
|
+
selectable: true,
|
|
66
|
+
surface: "canvas",
|
|
67
|
+
step: ["done", "next"],
|
|
68
|
+
class: "hover:bg-ink/6 pressed:bg-ink/10",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
selectable: true,
|
|
72
|
+
surface: "chrome",
|
|
73
|
+
step: ["done", "next"],
|
|
74
|
+
class: "hover:bg-chrome-ink/12 pressed:bg-chrome-ink/18",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
selectable: true,
|
|
78
|
+
surface: "canvas",
|
|
79
|
+
step: "current",
|
|
80
|
+
failed: false,
|
|
81
|
+
class: "hover:bg-primary-hover",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
/** Which step something is on, **with the steps that come next in sight**.
|
|
86
|
+
*
|
|
87
|
+
* ββ One track, one language ββββββββββββββββββββββββββββββββββββββββββ
|
|
88
|
+
*
|
|
89
|
+
* The stages are segments of ONE track, Odoo's statusbar: the order is the
|
|
90
|
+
* direction. What is behind is ink with a check, what comes next is muted, and the
|
|
91
|
+
* current stage is the only FILLED segment β `primary` on the canvas, the chrome's
|
|
92
|
+
* ink inverted on the rail. With `failed` that fill turns `danger` and carries an
|
|
93
|
+
* alert mark, so the failure is not only a color.
|
|
94
|
+
*
|
|
95
|
+
* A clipped arrow per step was tried and dropped: the notch between two arrows
|
|
96
|
+
* reads as a gap β four chips, not a path.
|
|
97
|
+
*
|
|
98
|
+
* ββ Narrow: it STACKS, it does not hide ββββββββββββββββββββββββββββββ
|
|
99
|
+
*
|
|
100
|
+
* Four stages side by side do not fit in a 480 px drawer, and the answer is not
|
|
101
|
+
* tucking them behind a chevron: a state you have to open stops answering Β«where
|
|
102
|
+
* is this at?Β», which is the only question it has. It stacks β one stage per row β
|
|
103
|
+
* in the same track, with the same three paints and the same marks. What changes
|
|
104
|
+
* is the DIRECTION, not how much is shown nor how it is painted.
|
|
105
|
+
*
|
|
106
|
+
* ββ And it can be CHOSEN βββββββββββββββββββββββββββββββββββββββββββββ
|
|
107
|
+
*
|
|
108
|
+
* With `onSelect` the track is a React Aria `RadioGroup`: one stage at a time,
|
|
109
|
+
* arrow keys move between them, Tab enters at the chosen one. It is not
|
|
110
|
+
* Β«advancingΒ» β a stage does not change by pressing it β it is choosing which
|
|
111
|
+
* stage we are talking about: in a list grouped by stage, pressing Β«generandoΒ» asks
|
|
112
|
+
* for those. So the record's CURRENT stage (`current`, the fill, `aria-current`)
|
|
113
|
+
* and the stage being VIEWED (`selected`, the underline, the checked radio) are two
|
|
114
|
+
* different things and are painted differently. Without `onSelect` it is a plain
|
|
115
|
+
* ordered list and the current stage is `aria-current="step"`. */
|
|
116
|
+
export function StatusBar({ stages, current, failed = false, surface: surfaceProp, onSelect, selected, layout, }) {
|
|
117
|
+
const d = useDensity();
|
|
118
|
+
const surface = useSurface(surfaceProp);
|
|
119
|
+
const copy = useUiCopy();
|
|
120
|
+
const at = stages.findIndex((s) => s.id === current);
|
|
121
|
+
const shape = layout ?? byDensity(d, "trail", "stacked");
|
|
122
|
+
const stacked = shape === "stacked";
|
|
123
|
+
const selectable = onSelect !== undefined;
|
|
124
|
+
function stepOf(i) {
|
|
125
|
+
if (i === at)
|
|
126
|
+
return "current";
|
|
127
|
+
return at >= 0 && i < at ? "done" : "next";
|
|
128
|
+
}
|
|
129
|
+
/** The check, the alert, or nothing. Stacked keeps the slot even when it is
|
|
130
|
+
* empty, so the labels line up in a column; side by side an empty slot would
|
|
131
|
+
* only be a gap. */
|
|
132
|
+
function mark(step) {
|
|
133
|
+
const icon = "size-(--size-icon-sm) shrink-0";
|
|
134
|
+
if (step === "done")
|
|
135
|
+
return _jsx(Check, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
136
|
+
if (step === "current" && failed) {
|
|
137
|
+
return _jsx(CircleAlert, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
138
|
+
}
|
|
139
|
+
return stacked ? _jsx("span", { className: icon, "aria-hidden": true }) : null;
|
|
140
|
+
}
|
|
141
|
+
function content(stage, step, viewed) {
|
|
142
|
+
return (_jsxs(_Fragment, { children: [mark(step), _jsx("span", { "aria-current": step === "current" && selectable ? "step" : undefined, className: cn("min-w-0 truncate", viewed &&
|
|
143
|
+
"underline decoration-2 underline-offset-4 " +
|
|
144
|
+
(step === "current"
|
|
145
|
+
? "decoration-current"
|
|
146
|
+
: surface === "chrome"
|
|
147
|
+
? "decoration-chrome-link"
|
|
148
|
+
: "decoration-primary")), children: stage.label })] }));
|
|
149
|
+
}
|
|
150
|
+
const track = trackStyles({ surface, layout: shape });
|
|
151
|
+
if (!selectable) {
|
|
152
|
+
return (_jsx("ol", { "aria-label": copy.record.status, className: track, children: stages.map((stage, i) => {
|
|
153
|
+
const step = stepOf(i);
|
|
154
|
+
return (_jsx("li", { "aria-current": step === "current" ? "step" : undefined, "data-failed": step === "current" && failed ? true : undefined, className: stageStyles({ surface, step, failed, selectable, layout: shape }), children: content(stage, step, false) }, stage.id));
|
|
155
|
+
}) }));
|
|
156
|
+
}
|
|
157
|
+
return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: stacked ? "vertical" : "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, className: track, children: stages.map((stage, i) => {
|
|
158
|
+
const step = stepOf(i);
|
|
159
|
+
return (_jsx(Radio, { value: stage.id, "data-failed": step === "current" && failed ? true : undefined, className: ({ isFocusVisible }) => stageStyles({
|
|
160
|
+
surface,
|
|
161
|
+
step,
|
|
162
|
+
failed,
|
|
163
|
+
selectable,
|
|
164
|
+
layout: shape,
|
|
165
|
+
isFocusVisible,
|
|
166
|
+
}), children: ({ isSelected }) => content(stage, step, isSelected) }, stage.id));
|
|
167
|
+
}) }));
|
|
168
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type DirtyState } from "./DirtyActions.js";
|
|
2
|
+
import type { Surface } from "../../foundations/types.js";
|
|
3
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
4
|
+
export declare function isPrimary(node: ReactNode): node is ReactElement<{
|
|
5
|
+
role?: string;
|
|
6
|
+
surface?: Surface;
|
|
7
|
+
size?: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type ThumbMode = "dirty" | "primary";
|
|
10
|
+
/** What the rail shows and what the thumb bar takes over, decided from the actions and
|
|
11
|
+
* the dirty state (see THE THUMB BAR above): dirty first, else the primary. `rail` is the
|
|
12
|
+
* list of action nodes the rail draws; `primaries` the ones that move to the bar. */
|
|
13
|
+
export declare function thumbPlan({ withRail, actions, dirty, }: {
|
|
14
|
+
withRail: boolean;
|
|
15
|
+
actions: ReactNode;
|
|
16
|
+
dirty: DirtyState | undefined;
|
|
17
|
+
}): {
|
|
18
|
+
rail: ReactNode[];
|
|
19
|
+
primaries: ReactElement<{
|
|
20
|
+
role?: string;
|
|
21
|
+
surface?: Surface;
|
|
22
|
+
size?: string;
|
|
23
|
+
}>[];
|
|
24
|
+
mode: ThumbMode | null;
|
|
25
|
+
};
|
|
26
|
+
/** The bar itself. Last in the record, so sticky-to-the-bottom is also its reserved space.
|
|
27
|
+
* On a wide record it is `display: none` and its wrapper measures nothing. */
|
|
28
|
+
export declare function ThumbBar({ mode, dirty, primaries, }: {
|
|
29
|
+
mode: ThumbMode;
|
|
30
|
+
dirty: DirtyState | undefined;
|
|
31
|
+
primaries: readonly ReactElement<{
|
|
32
|
+
role?: string;
|
|
33
|
+
surface?: Surface;
|
|
34
|
+
size?: string;
|
|
35
|
+
}>[];
|
|
36
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { DirtyActions, } from "./DirtyActions.js";
|
|
4
|
+
import { flatten } from "../../foundations/slots.js";
|
|
5
|
+
import { SurfaceProvider } from "../../foundations/surface.js";
|
|
6
|
+
import { cloneElement, isValidElement } from "react";
|
|
7
|
+
/* ==================================================================== *
|
|
8
|
+
* THE THUMB BAR β the record held in one hand.
|
|
9
|
+
*
|
|
10
|
+
* On a desk the record's actions live in the rail, at the top, next to where
|
|
11
|
+
* the eye starts. On a phone the top is the farthest place from the thumb,
|
|
12
|
+
* and the rail scrolls away with the first swipe: the action the screen
|
|
13
|
+
* exists for βΒ«Registrar pagoΒ», Β«PublicarΒ», Β«GuardarΒ»β ends up two gestures
|
|
14
|
+
* away. So when the RECORD is narrow (below `--container-handheld`, 40rem),
|
|
15
|
+
* that one action moves to a bar stuck to the bottom of the screen:
|
|
16
|
+
*
|
|
17
|
+
* ββ rail ββββββββββββββββββββββββββββ
|
|
18
|
+
* β Facturas βΊ FAC/2026/0118 βΉ βΊ β
|
|
19
|
+
* β [Imprimir] borradorβΈβ¦ β the rest stays here, or in `β―`
|
|
20
|
+
* ββββββββββββββββββββββββββββββββββββ€
|
|
21
|
+
* β β¦the sheet scrollsβ¦ β
|
|
22
|
+
* ββ thumb bar βββββββββββββββββββββββ€
|
|
23
|
+
* β [ Registrar pago ] β sticky to the bottom edge
|
|
24
|
+
* ββββββββββββββββββββββββββββββββββββ
|
|
25
|
+
*
|
|
26
|
+
* What goes in it is decided, not composed:
|
|
27
|
+
*
|
|
28
|
+
* 1. With `dirty`, the bar holds Β«sin guardarΒ», Discard and Save β the same
|
|
29
|
+
* precedence the rail already has: while there are unsaved changes the
|
|
30
|
+
* only things that can be done are confirm or throw them away.
|
|
31
|
+
* 2. Otherwise, the action written with `role="primary"` and NOTHING else.
|
|
32
|
+
* There is at most one per view (`make smoke`); the secondary ones stay in
|
|
33
|
+
* the rail and its `β―` menu. A bar of three buttons on a phone is three
|
|
34
|
+
* buttons a thumb has to choose between, and the gold stops saying which.
|
|
35
|
+
*
|
|
36
|
+
* ββ Why the record's width and not the window's ββββββββββββββββββββββ
|
|
37
|
+
*
|
|
38
|
+
* Same reason as everything else here: a record in a 380 px panel is as
|
|
39
|
+
* narrow as one on a phone. The query is a NAMED container (`record`) on the
|
|
40
|
+
* rail and on the bar β never on the paper: an unnamed container around the
|
|
41
|
+
* sheet would change what `Sheet`, `SectionGrid` and the chatter measure
|
|
42
|
+
* against, and the desk layout with it.
|
|
43
|
+
*
|
|
44
|
+
* ββ Why CSS, and why the primary is in the DOM twice βββββββββββββββββ
|
|
45
|
+
*
|
|
46
|
+
* The rail copy is hidden and the bar shown by the same container query, so
|
|
47
|
+
* there is no frame where both or neither are visible, it works on the server,
|
|
48
|
+
* and there is no resize listener. `display: none` takes the hidden copy out of
|
|
49
|
+
* the accessibility tree and out of the Tab order, so at any width exactly ONE
|
|
50
|
+
* primary exists for a person, a screen reader and the smoke count.
|
|
51
|
+
*
|
|
52
|
+
* ββ Why sticky and not fixed βββββββββββββββββββββββββββββββββββββββββ
|
|
53
|
+
*
|
|
54
|
+
* Sticky to the bottom, as the LAST thing in the record, is its own reserved
|
|
55
|
+
* space: while the record scrolls the bar floats over it, and at the end it
|
|
56
|
+
* settles in its place in the flow, under the last line β nothing is ever left
|
|
57
|
+
* covered, with no padding to keep in sync with the bar's height. A `fixed` bar
|
|
58
|
+
* would need that padding, and would stay on screen after the record ends.
|
|
59
|
+
* `safe-bottom` keeps the buttons clear of a phone's home indicator.
|
|
60
|
+
* ==================================================================== */
|
|
61
|
+
export function isPrimary(node) {
|
|
62
|
+
return isValidElement(node) && node.props.role === "primary";
|
|
63
|
+
}
|
|
64
|
+
/** What the rail shows and what the thumb bar takes over, decided from the actions and
|
|
65
|
+
* the dirty state (see THE THUMB BAR above): dirty first, else the primary. `rail` is the
|
|
66
|
+
* list of action nodes the rail draws; `primaries` the ones that move to the bar. */
|
|
67
|
+
export function thumbPlan({ withRail, actions, dirty, }) {
|
|
68
|
+
const rail = withRail && actions !== undefined ? flatten(actions) : [];
|
|
69
|
+
const primaries = rail.filter(isPrimary);
|
|
70
|
+
const mode = !withRail
|
|
71
|
+
? null
|
|
72
|
+
: dirty !== undefined
|
|
73
|
+
? "dirty"
|
|
74
|
+
: primaries.length > 0
|
|
75
|
+
? "primary"
|
|
76
|
+
: null;
|
|
77
|
+
return { rail, primaries, mode };
|
|
78
|
+
}
|
|
79
|
+
/** The bar itself. Last in the record, so sticky-to-the-bottom is also its reserved space.
|
|
80
|
+
* On a wide record it is `display: none` and its wrapper measures nothing. */
|
|
81
|
+
export function ThumbBar({ mode, dirty, primaries, }) {
|
|
82
|
+
return (_jsx("div", { className: "@container/record sticky bottom-0 z-20 mt-auto", children: _jsx(SurfaceProvider, { value: "canvas", children: _jsx("div", { "data-thumb-bar": mode, className: `hidden min-w-0 items-center gap-2 border-t border-line-strong bg-surface px-4 pt-3 safe-bottom @max-handheld/record:flex ${mode === "primary" ? "*:flex-1" : "justify-end *:first:mr-auto"}`, children: mode === "dirty" && dirty !== undefined ? (_jsx(DirtyActions, { ...dirty })) : (
|
|
83
|
+
/* On the bar's light surface whatever the rail's was, and `lg`: it is a
|
|
84
|
+
single action alone in its row β what `lg` is for. */
|
|
85
|
+
primaries.map((node) => cloneElement(node, { key: node.key, surface: "canvas", size: "lg" }))) }) }) }));
|
|
86
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Breadcrumb, type Crumb } from "./Breadcrumb.js";
|
|
2
|
+
export { DirtyActions, type DirtyState, } from "./DirtyActions.js";
|
|
3
|
+
export { Pager } from "./Pager.js";
|
|
4
|
+
export { RecordSkeleton } from "./RecordSkeleton.js";
|
|
5
|
+
export { SmartButton, SmartButtons } from "./SmartButtons.js";
|
|
6
|
+
export { type Stage, StatusBar } from "./StatusBar.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* RECORD PARTS β the header, status bar, pager and skeleton of one record. The `Record` view
|
|
2
|
+
composes them. */
|
|
3
|
+
export { Breadcrumb } from "./Breadcrumb.js";
|
|
4
|
+
export { DirtyActions, } from "./DirtyActions.js";
|
|
5
|
+
export { Pager } from "./Pager.js";
|
|
6
|
+
export { RecordSkeleton } from "./RecordSkeleton.js";
|
|
7
|
+
export { SmartButton, SmartButtons } from "./SmartButtons.js";
|
|
8
|
+
export { StatusBar } from "./StatusBar.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type BuiltFilter } from "./FilterBuilder.js";
|
|
2
|
+
import { type ModelDefinition } from "./model.js";
|
|
3
|
+
export interface BuiltSort {
|
|
4
|
+
field: string;
|
|
5
|
+
descending?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BuiltLevel {
|
|
8
|
+
field: string;
|
|
9
|
+
grain?: string | null;
|
|
10
|
+
}
|
|
11
|
+
/** Un nΓΊmero plegado de las filas de un montΓ³n: `["sum", "row_count"]`. */
|
|
12
|
+
export type BuiltFold = [string, string];
|
|
13
|
+
/** Desde dΓ³nde empieza una pΓ‘gina de montones β la misma forma que la paginaciΓ³n de filas. */
|
|
14
|
+
export type BuiltPageStrategy = {
|
|
15
|
+
token?: string | null;
|
|
16
|
+
} | {
|
|
17
|
+
rows?: number;
|
|
18
|
+
};
|
|
19
|
+
export interface BuiltGroupPagination {
|
|
20
|
+
limit?: number;
|
|
21
|
+
strategy?: BuiltPageStrategy;
|
|
22
|
+
}
|
|
23
|
+
export interface BuiltGrouping {
|
|
24
|
+
by?: BuiltLevel[];
|
|
25
|
+
totals?: Record<string, BuiltFold>;
|
|
26
|
+
/** Un filtro sobre lo que los montones plegaron: `count > 10`. Los nombres que admite son
|
|
27
|
+
* los de `totals`, mΓ‘s `"count"`. */
|
|
28
|
+
having?: BuiltFilter;
|
|
29
|
+
/** En quΓ© orden vuelven los montones: por el propio campo del nivel, por un nombre de
|
|
30
|
+
* `totals`, o por `count`. */
|
|
31
|
+
order?: BuiltSort[];
|
|
32
|
+
/** CuΓ‘ntos montones del primer nivel vuelven, y desde dΓ³nde. Ausente es todos. */
|
|
33
|
+
pagination?: BuiltGroupPagination;
|
|
34
|
+
}
|
|
35
|
+
/** La criteria tal como la declara el motor. Es lo que este componente arma y devuelve, y lo
|
|
36
|
+
* que el editor de cΓ³digo muestra. */
|
|
37
|
+
export interface BuiltCriteria {
|
|
38
|
+
where?: BuiltFilter;
|
|
39
|
+
order?: BuiltSort[];
|
|
40
|
+
grouping?: BuiltGrouping;
|
|
41
|
+
specification?: Record<string, Record<string, never>>;
|
|
42
|
+
}
|
|
43
|
+
export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }: {
|
|
44
|
+
model: ModelDefinition;
|
|
45
|
+
/** La criteria que ya estaba puesta. Reabrir tiene que seguir donde quedΓ³. */
|
|
46
|
+
initial?: BuiltCriteria;
|
|
47
|
+
/**
|
|
48
|
+
* El campo de la condiciΓ³n que hay que mostrar primero: la ficha que alguien
|
|
49
|
+
* tocΓ³ en la barra.
|
|
50
|
+
*
|
|
51
|
+
* Sin esto, tocar un recorte abrΓa el constructor en la regla uno y habΓa que
|
|
52
|
+
* buscar entre doce la que uno venΓa mirando β que es la manera mΓ‘s rΓ‘pida de
|
|
53
|
+
* editar la equivocada.
|
|
54
|
+
*/
|
|
55
|
+
focus?: string;
|
|
56
|
+
onApply: (criteria: BuiltCriteria | undefined) => void;
|
|
57
|
+
onCancel?: () => void;
|
|
58
|
+
}): import("react").JSX.Element;
|