viewkitjs 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/MIGRATION.md +40 -3
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +3 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/use-cell-format.d.ts +8 -1
- package/views/dist/cells/use-cell-format.js +13 -2
- package/views/dist/contract.d.ts +70 -3
- package/views/dist/contract.js +76 -0
- package/views/dist/controls/alert/alert.d.ts +46 -0
- package/views/dist/controls/alert/alert.js +11 -0
- package/views/dist/controls/alert/looks.d.ts +4 -0
- package/views/dist/controls/alert/looks.js +19 -0
- package/views/dist/controls/alert/tokens.d.ts +92 -0
- package/views/dist/controls/alert/tokens.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
- package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
- package/views/dist/controls/alert-dialog/confirm.js +11 -0
- package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
- package/views/dist/controls/alert-dialog/looks.js +17 -0
- package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
- package/views/dist/controls/alert-dialog/tokens.js +32 -0
- package/views/dist/controls/alert-dialog.css +95 -0
- package/views/dist/controls/alert.css +51 -0
- package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
- package/views/dist/controls/collapsible/collapsible.js +18 -0
- package/views/dist/controls/collapsible/looks.d.ts +4 -0
- package/views/dist/controls/collapsible/looks.js +5 -0
- package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
- package/views/dist/controls/collapsible/map-collapse.js +6 -0
- package/views/dist/controls/collapsible/tokens.d.ts +68 -0
- package/views/dist/controls/collapsible/tokens.js +19 -0
- package/views/dist/controls/collapsible.css +83 -0
- package/views/dist/controls/compound-editor/place-parts.js +5 -1
- package/views/dist/controls/controls.d.ts +9 -0
- package/views/dist/controls/controls.js +9 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/filter-editor/filter-editor.d.ts +56 -0
- package/views/dist/controls/filter-editor/filter-editor.js +208 -0
- package/views/dist/controls/filter-editor/how.d.ts +23 -0
- package/views/dist/controls/filter-editor/how.js +13 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +18 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +164 -0
- package/views/dist/controls/filter-editor/map-rules.d.ts +85 -0
- package/views/dist/controls/filter-editor/map-rules.js +273 -0
- package/views/dist/controls/filter-editor/parts.d.ts +46 -0
- package/views/dist/controls/filter-editor/parts.js +75 -0
- package/views/dist/controls/filter-editor/rules.d.ts +104 -0
- package/views/dist/controls/filter-editor/rules.js +148 -0
- package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
- package/views/dist/controls/filter-editor/tokens.js +23 -0
- package/views/dist/controls/filter-editor/words.d.ts +59 -0
- package/views/dist/controls/filter-editor/words.js +40 -0
- package/views/dist/controls/filter-editor.css +124 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
- package/views/dist/controls/group-editor/group-editor.js +126 -0
- package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
- package/views/dist/controls/group-editor/map-group-body.js +106 -0
- package/views/dist/controls/group-editor/rules.d.ts +48 -0
- package/views/dist/controls/group-editor/rules.js +41 -0
- package/views/dist/controls/group-editor/tokens.d.ts +15 -0
- package/views/dist/controls/group-editor/tokens.js +6 -0
- package/views/dist/controls/group-editor/words.d.ts +39 -0
- package/views/dist/controls/group-editor/words.js +21 -0
- package/views/dist/controls/group-editor.css +20 -0
- package/views/dist/controls/index.d.ts +19 -1
- package/views/dist/controls/index.js +19 -1
- package/views/dist/controls/internal/editor-parts.d.ts +8 -1
- package/views/dist/controls/internal/editor-parts.js +5 -0
- package/views/dist/controls/internal/step-return.d.ts +9 -0
- package/views/dist/controls/internal/step-return.js +27 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +5 -3
- package/views/dist/controls/links-editor/links-editor.js +38 -17
- package/views/dist/controls/links-editor/map-links-body.js +4 -1
- package/views/dist/controls/links-editor.css +1 -1
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
- package/views/dist/controls/menu-list/menu-list.js +25 -16
- package/views/dist/controls/modal/looks.d.ts +4 -0
- package/views/dist/controls/modal/looks.js +25 -0
- package/views/dist/controls/modal/modal.d.ts +69 -0
- package/views/dist/controls/modal/modal.js +62 -0
- package/views/dist/controls/modal/tokens.d.ts +192 -0
- package/views/dist/controls/modal/tokens.js +50 -0
- package/views/dist/controls/modal.css +130 -0
- package/views/dist/controls/notice/notice.d.ts +49 -0
- package/views/dist/controls/notice/notice.js +35 -0
- package/views/dist/controls/notice/tokens.d.ts +99 -0
- package/views/dist/controls/notice/tokens.js +27 -0
- package/views/dist/controls/notice.css +100 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/pane/looks.d.ts +4 -0
- package/views/dist/controls/pane/looks.js +11 -0
- package/views/dist/controls/pane/pane.d.ts +63 -0
- package/views/dist/controls/pane/pane.js +98 -0
- package/views/dist/controls/pane/state.d.ts +14 -0
- package/views/dist/controls/pane/state.js +7 -0
- package/views/dist/controls/pane/tokens.d.ts +79 -0
- package/views/dist/controls/pane/tokens.js +22 -0
- package/views/dist/controls/pane.css +104 -0
- package/views/dist/controls/picker/rows.d.ts +4 -2
- package/views/dist/controls/picker/rows.js +4 -3
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
- package/views/dist/controls/sort-editor/rules.d.ts +48 -0
- package/views/dist/controls/sort-editor/rules.js +24 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
- package/views/dist/controls/sort-editor/sort-editor.js +180 -0
- package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
- package/views/dist/controls/sort-editor/tokens.js +22 -0
- package/views/dist/controls/sort-editor/words.d.ts +48 -0
- package/views/dist/controls/sort-editor/words.js +25 -0
- package/views/dist/controls/sort-editor.css +96 -0
- package/views/dist/controls/toast/toast.d.ts +75 -0
- package/views/dist/controls/toast/toast.js +99 -0
- package/views/dist/controls/toast/tokens.d.ts +100 -0
- package/views/dist/controls/toast/tokens.js +27 -0
- package/views/dist/controls/toast.css +93 -0
- package/views/dist/controls/tokens.js +20 -0
- package/views/dist/controls/values-editor/values-editor.js +7 -1
- package/views/dist/display/date.js +2 -2
- package/views/dist/display/format.js +10 -2
- package/views/dist/display/options.d.ts +3 -1
- package/views/dist/display/use-display-options.d.ts +3 -0
- package/views/dist/display/use-display-options.js +10 -2
- package/views/dist/display/viewer.d.ts +1 -1
- package/views/dist/display/viewer.js +1 -1
- package/views/dist/editors/DateEditor.js +11 -9
- package/views/dist/editors/relation-panel.js +7 -1
- package/views/dist/editors/relation-picker.d.ts +2 -1
- package/views/dist/editors/relation-picker.js +4 -3
- package/views/dist/editors/relation-source.d.ts +4 -1
- package/views/dist/editors/relation-source.js +5 -2
- package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
- package/views/dist/fields/number-edit.d.ts +6 -0
- package/views/dist/fields/number-edit.js +8 -1
- package/views/dist/grid/chrome/GridCellEditors.js +2 -2
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
- package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
- package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
- package/views/dist/grid/chrome/GridFooter.js +2 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
- package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
- package/views/dist/grid/core/commit-model.d.ts +7 -0
- package/views/dist/grid/core/commit-model.js +5 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/editing-model.js +3 -7
- package/views/dist/grid/core/undo-owner.d.ts +6 -0
- package/views/dist/grid/core/undo-owner.js +13 -0
- package/views/dist/grid/core/useGridEditing.d.ts +2 -0
- package/views/dist/grid/core/useGridEditing.js +4 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/panels/model.d.ts +6 -1
- package/views/dist/panels/react/customize-body.d.ts +4 -2
- package/views/dist/panels/react/customize-body.js +3 -3
- package/views/dist/panels/react/customize.js +4 -2
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +9 -6
- package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
- package/views/dist/panels/react/filter/filter-body.js +17 -6
- package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
- package/views/dist/panels/react/filter/filter-part-body.js +3 -1
- package/views/dist/panels/react/panel-sheet.d.ts +5 -1
- package/views/dist/panels/react/panel-sheet.js +6 -2
- package/views/dist/panels/react/panel-step.d.ts +12 -0
- package/views/dist/panels/react/panel-step.js +26 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
- package/views/dist/panels/react/sort/SortEditor.js +5 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +84 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +49 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +36 -21
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
- package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
- package/views/dist/panels/react/toolbar/panel-part.js +2 -2
- package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
- package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
- package/views/dist/panels/react.d.ts +1 -0
- package/views/dist/panels/react.js +1 -0
- package/views/dist/panels/settings/filter-groups.js +35 -1
- package/views/dist/panels/settings/group-buckets.js +1 -0
- package/views/dist/provider/ViewsProvider.d.ts +7 -1
- package/views/dist/provider/ViewsProvider.js +23 -3
- package/views/dist/provider/components.d.ts +30 -4
- package/views/dist/provider/moment.d.ts +6 -0
- package/views/dist/provider/moment.js +10 -0
- package/views/dist/styles.css +847 -52
- package/views/dist/styles.unlayered.css +848 -52
- package/views/docs/contract.md +15 -9
- package/views/docs/controls/alert-dialog.md +37 -0
- package/views/docs/controls/alert.md +30 -0
- package/views/docs/controls/collapsible.md +22 -0
- package/views/docs/controls/filter-editor.md +28 -0
- package/views/docs/controls/group-editor.md +11 -0
- package/views/docs/controls/modal.md +55 -0
- package/views/docs/controls/notice.md +32 -0
- package/views/docs/controls/pane.md +25 -0
- package/views/docs/controls/sort-editor.md +27 -0
- package/views/docs/controls/toast.md +32 -0
- package/views/docs/guides/cells.md +1 -1
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +19 -0
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +213 -7
- package/views/docs/reference/display.md +2 -2
- package/views/docs/reference/editors-relation.md +1 -1
- package/views/docs/reference/looks.md +10 -0
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +7 -7
- package/views/docs/reference/views.md +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* The Alert. Every value it draws with is a public name (controls/alert/tokens.ts); this file only says which name each part takes. Its options
|
|
2
|
+
(looks.ts) are data attributes on the frame around it, and each one only chooses other names:
|
|
3
|
+
|
|
4
|
+
data-alert-buttons end · full its buttons on a computer: at the end, or filling its foot
|
|
5
|
+
data-alert-pair side · stacked its buttons on the phone, which always fill its foot
|
|
6
|
+
data-alert-mark none · shown a round mark over its words, which centres them
|
|
7
|
+
data-alert-size 32 · 36 · 44 its buttons' height on a computer
|
|
8
|
+
data-alert-phone panel · sheet what it stands in on the phone, which the Alert Dialog reads
|
|
9
|
+
|
|
10
|
+
data-screen on it says where it stands, phone or computer, and data-shell what it stands in, the Alert Dialog's panel or a sheet.
|
|
11
|
+
How far its words stand from the panel's edge is the panel's (--alert-padding, alert-dialog.css), 24 where nothing sets it.
|
|
12
|
+
|
|
13
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
14
|
+
@layer components {
|
|
15
|
+
|
|
16
|
+
/* ── What it says ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
17
|
+
.o-alert-body { position: relative; display: grid; min-width: 0; color: var(--vk-fg); }
|
|
18
|
+
.o-alert-body[data-shell="panel"] { padding: var(--alert-padding, calc(var(--vk-spacing) * 6)); }
|
|
19
|
+
.o-alert-body[data-shell="sheet"] { padding: calc(var(--vk-spacing) * 2); }
|
|
20
|
+
.o-alert-title { margin: 0; font-size: var(--vk-font-size-lg); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); font-weight: var(--vk-font-weight-semibold); text-wrap: balance; overflow-wrap: anywhere; }
|
|
21
|
+
.o-alert-line { margin: calc(var(--vk-spacing) * 1) 0 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); text-wrap: pretty; }
|
|
22
|
+
.o-alert-line.o-alert-wrong { color: var(--vk-danger); }
|
|
23
|
+
.o-alert-body[data-screen="phone"] .o-alert-line { font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
24
|
+
|
|
25
|
+
/* ── Its buttons: at the end on a computer unless they fill its foot, as they always do on the phone. A foot that fills stands 12 from a
|
|
26
|
+
panel's edge, so a 24 corner and a 12 button nest, and the way out stands on the overlay's card ────────────────────────────────── */
|
|
27
|
+
.o-alert-foot { display: flex; justify-content: flex-end; gap: calc(var(--vk-spacing) * 2); margin-top: calc(var(--vk-spacing) * 5); }
|
|
28
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"]) .o-alert-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
29
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"]) .o-alert-foot > .o-button { width: 100%; padding-inline: 0; }
|
|
30
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"])[data-shell="panel"] { padding-bottom: calc(var(--vk-spacing) * 3); }
|
|
31
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"])[data-shell="panel"] .o-alert-foot { margin-inline: calc(var(--vk-spacing) * 3 - var(--alert-padding, calc(var(--vk-spacing) * 6))); }
|
|
32
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"]) .o-alert-cancel:not(:disabled) { border-color: transparent; background-color: var(--vk-overlay-card); }
|
|
33
|
+
/* A hover only on a screen with a pointer (iOS keeps :hover on what was last tapped); a press and the forced state stay out. */
|
|
34
|
+
:is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"]) .o-alert-cancel:active:not(:disabled) { border-color: transparent; background-color: var(--vk-overlay-card-pressed); }
|
|
35
|
+
@media (hover: hover) { :is([data-alert-buttons="full"] .o-alert-body, .o-alert-body[data-screen="phone"]) .o-alert-cancel:hover:not(:disabled) { border-color: transparent; background-color: var(--vk-overlay-card-pressed); } }
|
|
36
|
+
[data-alert-size="32"] .o-alert-body[data-screen="computer"] .o-alert-foot > .o-button { height: calc(var(--vk-spacing) * 8); --button-side: calc(var(--vk-spacing) * 8); padding-inline: calc(var(--vk-spacing) * 3); }
|
|
37
|
+
[data-alert-size="44"] .o-alert-body[data-screen="computer"] .o-alert-foot > .o-button { height: calc(var(--vk-spacing) * 11); --button-side: calc(var(--vk-spacing) * 11); padding-inline: calc(var(--vk-spacing) * 5); font-size: var(--vk-font-size-base); }
|
|
38
|
+
[data-alert-pair="stacked"] .o-alert-body[data-screen="phone"] .o-alert-foot { grid-template-columns: minmax(0, 1fr); }
|
|
39
|
+
[data-alert-pair="stacked"] .o-alert-body[data-screen="phone"] .o-alert-foot > .o-alert-cancel { order: 1; }
|
|
40
|
+
|
|
41
|
+
/* ── Its mark: round, in its action's colour, its words centred under it ─────────────────────────────────────────────────────────── */
|
|
42
|
+
.o-alert-mark { display: none; }
|
|
43
|
+
[data-alert-mark="shown"] .o-alert-mark { display: grid; place-items: center; justify-self: center; width: calc(var(--vk-spacing) * 12); height: calc(var(--vk-spacing) * 12); margin-bottom: calc(var(--vk-spacing) * 3); border-radius: var(--vk-radius-full); background-color: var(--vk-brand-subtler); color: var(--vk-fg-accent); }
|
|
44
|
+
[data-alert-mark="shown"] .o-alert-body[data-screen="phone"] .o-alert-mark { width: calc(var(--vk-spacing) * 14); height: calc(var(--vk-spacing) * 14); margin-bottom: calc(var(--vk-spacing) * 4); }
|
|
45
|
+
[data-alert-mark="shown"] .o-alert-body[data-kind="information"] .o-alert-mark { background-color: var(--vk-info-subtler); color: var(--vk-info); }
|
|
46
|
+
[data-alert-mark="shown"] .o-alert-body[data-kind="success"] .o-alert-mark { background-color: var(--vk-success-subtler); color: var(--vk-success); }
|
|
47
|
+
[data-alert-mark="shown"] .o-alert-body[data-kind="warning"] .o-alert-mark { background-color: var(--vk-warning-subtler); color: var(--vk-warning); }
|
|
48
|
+
[data-alert-mark="shown"] .o-alert-body[data-kind="danger"] .o-alert-mark { background-color: var(--vk-danger-subtler); color: var(--vk-danger); }
|
|
49
|
+
.o-alert-mark > svg { width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); }
|
|
50
|
+
[data-alert-mark="shown"] :is(.o-alert-title, .o-alert-line) { text-align: center; }
|
|
51
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface CollapsibleProps {
|
|
3
|
+
/** Open, when it is set from outside (a grid's group, a filter's details); with onOpenChange. */
|
|
4
|
+
open?: boolean;
|
|
5
|
+
/** Open at first, when it keeps its own state. */
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
/** Its trigger was pressed: whether it opens or closes. */
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
/** It can't be opened or closed: its trigger is off, and the part stays as it is. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Its trigger and its part (CollapsibleTrigger, CollapsiblePanel), or the part alone when it is set open from outside. */
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** One part that opens and closes in place, under its trigger or set open from outside. */
|
|
16
|
+
export declare function Collapsible({ open, defaultOpen, onOpenChange, disabled, className, children }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export interface CollapsibleTriggerProps {
|
|
18
|
+
/** What opens: its name, and what it holds when that helps ("Closed deals", "12"). */
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/** Your own element in place of the plain row (a Button, a heading's button): it keeps its look and gains the behaviour. */
|
|
21
|
+
render?: React.ReactElement;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/** What opens and closes it, plain: its name after a chevron, which turns down when the part is open; 32 high, 44 on a phone. A place
|
|
25
|
+
* that draws its own (a heading, a Button, a row) hands it as `render`. */
|
|
26
|
+
export declare function CollapsibleTrigger({ children, render, className }: CollapsibleTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export interface CollapsiblePanelProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/** A class on what it holds, inside the box that crops. */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** A class on the box that crops while it moves, so a bleed or a padding there isn't shaved (a row's outline). */
|
|
32
|
+
clipClassName?: string;
|
|
33
|
+
/** Its time in ms, opening and closing alike, where the motion names' isn't right (a grid's own). Reduced motion still wins. */
|
|
34
|
+
durationMs?: number;
|
|
35
|
+
/** It stays on the page while closed, hidden until the browser's find reaches it, which opens it. */
|
|
36
|
+
hiddenUntilFound?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** The part that opens and closes: the box that crops it while its height moves, and what it holds inside. */
|
|
39
|
+
export declare function CollapsiblePanel({ children, className, clipClassName, durationMs, hiddenUntilFound }: CollapsiblePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
|
|
3
|
+
import { cx } from "../../internal/cx.js";
|
|
4
|
+
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
5
|
+
export function Collapsible({ open, defaultOpen, onOpenChange, disabled, className, children }) {
|
|
6
|
+
const phone = usePhoneForm();
|
|
7
|
+
return (_jsx(BaseCollapsible.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, disabled: disabled, className: cx("o-collapsible", className), "data-kit": "collapsible", ...phoneMark(phone), children: children }));
|
|
8
|
+
}
|
|
9
|
+
const CHEVRON = "M9 6l6 6l-6 6";
|
|
10
|
+
export function CollapsibleTrigger({ children, render, className }) {
|
|
11
|
+
if (render)
|
|
12
|
+
return _jsx(BaseCollapsible.Trigger, { render: render, className: className, children: children });
|
|
13
|
+
return (_jsxs(BaseCollapsible.Trigger, { className: cx("o-collapsible-trigger", className), children: [_jsx("svg", { className: "o-collapsible-chevron", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { d: CHEVRON }) }), children] }));
|
|
14
|
+
}
|
|
15
|
+
export function CollapsiblePanel({ children, className, clipClassName, durationMs, hiddenUntilFound }) {
|
|
16
|
+
const style = durationMs === undefined ? undefined : { "--o-collapsible-time": `${durationMs}ms` };
|
|
17
|
+
return (_jsx(BaseCollapsible.Panel, { className: cx("o-collapsible-panel", clipClassName), style: style, hiddenUntilFound: hiddenUntilFound, children: _jsx("div", { className: cx("o-collapsible-body", className), children: children }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const options = [
|
|
2
|
+
{ id: "content", name: "Content", def: "fade", values: [{ id: "still", name: "Stands still" }, { id: "fade", name: "Fades" }, { id: "slide", name: "Slides out" }] },
|
|
3
|
+
{ id: "curve", name: "Curve", def: "soft", values: [{ id: "soft", name: "Soft" }, { id: "sharp", name: "Sharp" }] },
|
|
4
|
+
];
|
|
5
|
+
export const COLLAPSIBLE_LOOKS = { id: "collapsible", name: "Collapsible", options, looks: [] };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible, CollapsiblePanel } from "./collapsible.js";
|
|
4
|
+
export function MapCollapse({ open, children, className, clipClassName, durationMs }) {
|
|
5
|
+
return (_jsx(Collapsible, { open: open, className: className, children: _jsx(CollapsiblePanel, { clipClassName: clipClassName, durationMs: durationMs, children: children }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const COLLAPSIBLE_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-ease-out-sharp";
|
|
3
|
+
readonly kind: "motion";
|
|
4
|
+
readonly outright: "--ease-out-sharp";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-spacing";
|
|
7
|
+
readonly kind: "size";
|
|
8
|
+
readonly outright: "--spacing";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-radius-sm";
|
|
11
|
+
readonly kind: "size";
|
|
12
|
+
readonly outright: "--radius-sm";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-fg";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--text";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-font-size-sm";
|
|
19
|
+
readonly kind: "size";
|
|
20
|
+
readonly outright: "--text-sm";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-line-height-sm";
|
|
23
|
+
readonly kind: "size";
|
|
24
|
+
readonly outright: "--text-sm--line-height";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-font-weight-medium";
|
|
27
|
+
readonly kind: "size";
|
|
28
|
+
readonly outright: "--font-weight-medium";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-focus-width";
|
|
31
|
+
readonly kind: "size";
|
|
32
|
+
readonly outright: "--focus-width";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-border-brand";
|
|
35
|
+
readonly kind: "colour";
|
|
36
|
+
readonly outright: "--border-focused";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-focus-offset";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--focus-offset";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-fg-disabled";
|
|
43
|
+
readonly kind: "colour";
|
|
44
|
+
readonly outright: "--text-disabled";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "--vk-fg-subtle";
|
|
47
|
+
readonly kind: "colour";
|
|
48
|
+
readonly outright: "--text-subtle";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-duration-fast";
|
|
51
|
+
readonly kind: "motion";
|
|
52
|
+
readonly outright: "--duration-fast";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "--vk-ease-out";
|
|
55
|
+
readonly kind: "motion";
|
|
56
|
+
readonly outright: "--ease-out";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "--vk-duration-base";
|
|
59
|
+
readonly kind: "motion";
|
|
60
|
+
readonly outright: "--duration-base";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "--vk-duration-slow";
|
|
63
|
+
readonly kind: "motion";
|
|
64
|
+
readonly outright: "--duration-slow";
|
|
65
|
+
}];
|
|
66
|
+
/** The Collapsible's own machinery: its times and curve, its part's height (Base UI's `--collapsible-panel-height`), the
|
|
67
|
+
* time an app hands (`--o-collapsible-time`) and its trigger's height. */
|
|
68
|
+
export declare const COLLAPSIBLE_PRIVATE: readonly ["--o-collapsible-", "--collapsible-"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const COLLAPSIBLE_TOKENS = [
|
|
2
|
+
{ name: "--vk-ease-out-sharp", kind: "motion", outright: "--ease-out-sharp" },
|
|
3
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
4
|
+
{ name: "--vk-radius-sm", kind: "size", outright: "--radius-sm" },
|
|
5
|
+
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
6
|
+
{ name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
|
|
7
|
+
{ name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
|
|
8
|
+
{ name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
|
|
9
|
+
{ name: "--vk-focus-width", kind: "size", outright: "--focus-width" },
|
|
10
|
+
{ name: "--vk-border-brand", kind: "colour", outright: "--border-focused" },
|
|
11
|
+
{ name: "--vk-focus-offset", kind: "size", outright: "--focus-offset" },
|
|
12
|
+
{ name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
|
|
13
|
+
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
14
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
15
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
16
|
+
{ name: "--vk-duration-base", kind: "motion", outright: "--duration-base" },
|
|
17
|
+
{ name: "--vk-duration-slow", kind: "motion", outright: "--duration-slow" },
|
|
18
|
+
];
|
|
19
|
+
export const COLLAPSIBLE_PRIVATE = ["--o-collapsible-", "--collapsible-"];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* The Collapsible. Every value it draws with is a public name (controls/collapsible/tokens.ts); this file only says which
|
|
2
|
+
name each part takes. Base UI marks the trigger data-panel-open while its part is open, and data-disabled; the part data-open or
|
|
3
|
+
data-closed, and data-starting-style and data-ending-style as it comes and goes, and gives it its height to move
|
|
4
|
+
to as --collapsible-panel-height. Its options (looks.ts) are data attributes on the frame or the app around
|
|
5
|
+
it: data-collapsible-content and data-collapsible-curve.
|
|
6
|
+
|
|
7
|
+
The rules sit in the components layer, so a utility class on it still wins. */
|
|
8
|
+
@layer components {
|
|
9
|
+
|
|
10
|
+
/* ── The curve everything of it moves on: ease-out, or under Curve › Sharp ease-out-sharp ──────────── */
|
|
11
|
+
[data-collapsible-curve="sharp"] :is(.o-collapsible-trigger, .o-collapsible-panel) { --o-collapsible-ease: var(--vk-ease-out-sharp); }
|
|
12
|
+
|
|
13
|
+
/* ── The trigger, plain (its look belongs to the place it stands in, and none wears a ground under the pointer): a chevron
|
|
14
|
+
before its name, text-sm at medium weight, 32 high, 44 on a phone, where a row you press is a 44px target. Under the pointer its chevron takes the text's colour; its focus
|
|
15
|
+
ringed. The chevron turns down while the part is open, on the part's curve and in a short part's own times:
|
|
16
|
+
duration-base opening, duration-fast closing ────────────────────────────────────────────────────────────────── */
|
|
17
|
+
.o-collapsible-trigger {
|
|
18
|
+
--collapsible-trigger-h: calc(var(--vk-spacing) * 8);
|
|
19
|
+
display: inline-flex; align-items: center; gap: calc(var(--vk-spacing) * 1.5); box-sizing: border-box;
|
|
20
|
+
min-height: var(--collapsible-trigger-h); margin: 0; padding: 0;
|
|
21
|
+
border: 0; border-radius: var(--vk-radius-sm); background-color: transparent;
|
|
22
|
+
color: var(--vk-fg); font: inherit; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
23
|
+
font-weight: var(--vk-font-weight-medium); text-align: left; cursor: pointer; outline: none; user-select: none;
|
|
24
|
+
-webkit-tap-highlight-color: transparent;
|
|
25
|
+
}
|
|
26
|
+
.o-collapsible-trigger:where([data-vk-phone], [data-vk-phone] *) { --collapsible-trigger-h: calc(var(--vk-spacing) * 11); }
|
|
27
|
+
.o-collapsible-trigger:focus-visible { outline: var(--vk-focus-width) solid var(--vk-border-brand); outline-offset: var(--vk-focus-offset); }
|
|
28
|
+
.o-collapsible-trigger[data-disabled] { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
29
|
+
.o-collapsible-chevron {
|
|
30
|
+
flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4);
|
|
31
|
+
fill: none; stroke: var(--vk-fg-subtle); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
|
|
32
|
+
transition: rotate var(--vk-duration-fast) var(--o-collapsible-ease, var(--vk-ease-out)), stroke var(--vk-duration-fast) var(--vk-ease-out);
|
|
33
|
+
}
|
|
34
|
+
.o-collapsible-trigger[data-panel-open] .o-collapsible-chevron { rotate: 90deg; transition-duration: var(--vk-duration-base), var(--vk-duration-fast); }
|
|
35
|
+
/* A hover only on a screen with a pointer. */
|
|
36
|
+
@media (hover: hover) { .o-collapsible-trigger:not([data-disabled]):hover .o-collapsible-chevron { stroke: var(--vk-fg); } }
|
|
37
|
+
.o-collapsible-trigger[data-disabled] .o-collapsible-chevron { stroke: var(--vk-fg-disabled); }
|
|
38
|
+
|
|
39
|
+
/* ── The part: the box that crops it while its height moves, from nothing to what it holds. It crops without
|
|
40
|
+
scrolling (clip, never hidden), so what sticks inside it, a grid's frozen columns, still
|
|
41
|
+
sticks to the scroller beyond it. Both ways it eases out: it answers the press at once and settles, as
|
|
42
|
+
shadcn's and Base UI's own do. Its time follows its height, between the motion names: opening from duration-base
|
|
43
|
+
to duration-slow, closing from duration-fast to duration-base, the longest reached at 600px tall (spacing × 150),
|
|
44
|
+
so a short part moves as it always did and a tall one no longer snaps. The height is Base UI's, read as a length
|
|
45
|
+
(--o-collapsible-h, registered at the file's end: at rest Base UI says auto, which reads as none); how far along
|
|
46
|
+
that 600px it stands is --o-collapsible-part, 0 to 1. A browser that can't divide one length by another keeps the
|
|
47
|
+
two plain times. An app's own time (durationMs) sets --o-collapsible-time for both ──────────────────────────── */
|
|
48
|
+
.o-collapsible-panel {
|
|
49
|
+
--o-collapsible-open: var(--vk-duration-base); --o-collapsible-close: var(--vk-duration-fast);
|
|
50
|
+
box-sizing: border-box; overflow: clip; height: var(--collapsible-panel-height);
|
|
51
|
+
transition: height var(--o-collapsible-time, var(--o-collapsible-open)) var(--o-collapsible-ease, var(--vk-ease-out));
|
|
52
|
+
}
|
|
53
|
+
@supports (width: calc(tan(atan2(1px, 1px)) * 1px)) {
|
|
54
|
+
.o-collapsible-panel {
|
|
55
|
+
--o-collapsible-h: var(--collapsible-panel-height);
|
|
56
|
+
--o-collapsible-part: min(1, tan(atan2(var(--o-collapsible-h), calc(var(--vk-spacing) * 150))));
|
|
57
|
+
--o-collapsible-open: calc(var(--vk-duration-base) + (var(--vk-duration-slow) - var(--vk-duration-base)) * var(--o-collapsible-part));
|
|
58
|
+
--o-collapsible-close: calc(var(--vk-duration-fast) + (var(--vk-duration-base) - var(--vk-duration-fast)) * var(--o-collapsible-part));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.o-collapsible-panel[data-ending-style] { transition-duration: var(--o-collapsible-time, var(--o-collapsible-close)); }
|
|
62
|
+
.o-collapsible-panel:is([data-starting-style], [data-ending-style]) { height: 0; }
|
|
63
|
+
|
|
64
|
+
/* ── Content: how what it holds comes and goes. Fades, the default (what nothing set draws), unless a frame picks Stands still, which draws nothing here (the box
|
|
65
|
+
crops it as it moves), or Slides out. Fades: it comes in with the height, in the height's own time and on its curve, and goes in
|
|
66
|
+
half the closing time, so the moving edge passes over nothing and never cuts a line of text. Slides out: it is
|
|
67
|
+
anchored to the part's lower edge, so it comes out from under its trigger and goes back under it. The part's
|
|
68
|
+
times reach what it holds as the variables above, which it inherits ─────────────────────────────────────────── */
|
|
69
|
+
.o-collapsible-body:not([data-collapsible-content="still"] *, [data-collapsible-content="slide"] *) { transition: opacity var(--o-collapsible-time, var(--o-collapsible-open)) var(--o-collapsible-ease, var(--vk-ease-out)); }
|
|
70
|
+
.o-collapsible-panel[data-ending-style] > .o-collapsible-body:not([data-collapsible-content="still"] *, [data-collapsible-content="slide"] *) { transition-duration: calc(var(--o-collapsible-time, var(--o-collapsible-close)) * 0.5); }
|
|
71
|
+
.o-collapsible-panel:is([data-starting-style], [data-ending-style]) > .o-collapsible-body:not([data-collapsible-content="still"] *, [data-collapsible-content="slide"] *) { opacity: 0; }
|
|
72
|
+
[data-collapsible-content="slide"] .o-collapsible-panel:not([hidden]) { display: flex; flex-direction: column; justify-content: flex-end; }
|
|
73
|
+
[data-collapsible-content="slide"] .o-collapsible-body { flex: none; }
|
|
74
|
+
|
|
75
|
+
/* Under reduced motion it opens and closes at once, whatever time an app gave it, and what it holds with it, framed or not: the
|
|
76
|
+
fade is the default with no frame, so these match every body, at the fade rules' own weight, later. */
|
|
77
|
+
@media (prefers-reduced-motion: reduce) {
|
|
78
|
+
.o-collapsible-panel, .o-collapsible-panel[data-ending-style], .o-collapsible-chevron, .o-collapsible-trigger[data-panel-open] .o-collapsible-chevron,
|
|
79
|
+
:root .o-collapsible-body, :root .o-collapsible-panel[data-ending-style] > .o-collapsible-body { transition: none; }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/* The part's height as a length, so a time can be worked out from it: Base UI's auto, at rest, reads as none. */
|
|
83
|
+
@property --o-collapsible-h { syntax: "<length>"; inherits: false; initial-value: 0px; }
|
|
@@ -12,6 +12,7 @@ import { countriesOf, PLACE_PARTS, placeOf, regionFor, rowsOf, streetOf, streetP
|
|
|
12
12
|
import { QuietField, PartsRow, MIHAI_CARD } from "./row.js";
|
|
13
13
|
import { blurKeeps, useHeldFocus, useShellHand } from "./keeping.js";
|
|
14
14
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
15
|
+
import { useStepReturn } from "../internal/step-return.js";
|
|
15
16
|
import { samePlaceEcho } from "./shell.js";
|
|
16
17
|
import { compoundWords } from "./words.js";
|
|
17
18
|
const glyph = (paths, className) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
@@ -86,8 +87,11 @@ export function usePlaceParts(props, worn, wornAt) {
|
|
|
86
87
|
}
|
|
87
88
|
swapping.current = true;
|
|
88
89
|
setList(null);
|
|
89
|
-
setFocusTo(phone
|
|
90
|
+
setFocusTo(phone ? null : "first");
|
|
91
|
+
if (phone)
|
|
92
|
+
requestAnimationFrame(() => { swapping.current = false; });
|
|
90
93
|
};
|
|
94
|
+
useStepReturn(root, phone && list ? [list === "countries" ? '[data-pick="country"]:is(button), [data-pick="country"] button' : '[data-pick="region"]:is(button), [data-pick="region"] button'] : []);
|
|
91
95
|
const pickCountry = (code) => setDraft((d) => {
|
|
92
96
|
if ((d.countryCode ?? "") === code)
|
|
93
97
|
return d;
|
|
@@ -5,7 +5,11 @@ import { MapSheet } from "./sheet/map-sheet.js";
|
|
|
5
5
|
import { MapCheckbox } from "./checkbox/map-checkbox.js";
|
|
6
6
|
import { MapInput } from "./input/map-input.js";
|
|
7
7
|
import { MapMenu } from "./menu/map-menu.js";
|
|
8
|
+
import { MapSortBody } from "./sort-editor/map-sort-body.js";
|
|
8
9
|
import { MapViewsListBody } from "./views-list/map-views-list-body.js";
|
|
10
|
+
import { MapFilterBody, MapFilterPartBody } from "./filter-editor/map-filter-body.js";
|
|
11
|
+
import { MapGroupBody } from "./group-editor/map-group-body.js";
|
|
12
|
+
import { MapCollapse } from "./collapsible/map-collapse.js";
|
|
9
13
|
import { MapTextBody } from "./text-editor/map-text-body.js";
|
|
10
14
|
import { MapPicker } from "./picker/map-picker.js";
|
|
11
15
|
import { MapFieldsBody } from "./picker/map-fields-body.js";
|
|
@@ -23,7 +27,12 @@ export declare const CONTROLS: {
|
|
|
23
27
|
Input: typeof MapInput;
|
|
24
28
|
Checkbox: typeof MapCheckbox;
|
|
25
29
|
Menu: typeof MapMenu;
|
|
30
|
+
SortBody: typeof MapSortBody;
|
|
26
31
|
ViewsListBody: typeof MapViewsListBody;
|
|
32
|
+
FilterBody: typeof MapFilterBody;
|
|
33
|
+
FilterPartBody: typeof MapFilterPartBody;
|
|
34
|
+
GroupBody: typeof MapGroupBody;
|
|
35
|
+
Collapse: typeof MapCollapse;
|
|
27
36
|
TextBody: typeof MapTextBody;
|
|
28
37
|
Picker: typeof MapPicker;
|
|
29
38
|
FieldsBody: typeof MapFieldsBody;
|
|
@@ -5,7 +5,11 @@ import { MapSheet } from "./sheet/map-sheet.js";
|
|
|
5
5
|
import { MapCheckbox } from "./checkbox/map-checkbox.js";
|
|
6
6
|
import { MapInput } from "./input/map-input.js";
|
|
7
7
|
import { MapMenu } from "./menu/map-menu.js";
|
|
8
|
+
import { MapSortBody } from "./sort-editor/map-sort-body.js";
|
|
8
9
|
import { MapViewsListBody } from "./views-list/map-views-list-body.js";
|
|
10
|
+
import { MapFilterBody, MapFilterPartBody } from "./filter-editor/map-filter-body.js";
|
|
11
|
+
import { MapGroupBody } from "./group-editor/map-group-body.js";
|
|
12
|
+
import { MapCollapse } from "./collapsible/map-collapse.js";
|
|
9
13
|
import { MapTextBody } from "./text-editor/map-text-body.js";
|
|
10
14
|
import { MapPicker } from "./picker/map-picker.js";
|
|
11
15
|
import { MapFieldsBody } from "./picker/map-fields-body.js";
|
|
@@ -23,7 +27,12 @@ export const CONTROLS = {
|
|
|
23
27
|
Input: MapInput,
|
|
24
28
|
Checkbox: MapCheckbox,
|
|
25
29
|
Menu: MapMenu,
|
|
30
|
+
SortBody: MapSortBody,
|
|
26
31
|
ViewsListBody: MapViewsListBody,
|
|
32
|
+
FilterBody: MapFilterBody,
|
|
33
|
+
FilterPartBody: MapFilterPartBody,
|
|
34
|
+
GroupBody: MapGroupBody,
|
|
35
|
+
Collapse: MapCollapse,
|
|
27
36
|
TextBody: MapTextBody,
|
|
28
37
|
Picker: MapPicker,
|
|
29
38
|
FieldsBody: MapFieldsBody,
|
|
@@ -22,7 +22,8 @@ export interface DateEditorProps {
|
|
|
22
22
|
days?: "any" | "from-today" | "until-today";
|
|
23
23
|
/** The quick picks that fit the field; left out, Today, Tomorrow and Next week, and No date where it may be empty. */
|
|
24
24
|
picks?: DatePick[];
|
|
25
|
-
/** Today
|
|
25
|
+
/** Today: ViewKit's date body hands the provider's moment; a page that shows a fixed day hands that one; left out, this
|
|
26
|
+
* browser's own. */
|
|
26
27
|
today?: string;
|
|
27
28
|
/** What was typed on what opened it: the line starts with it, and says at once when it isn't a date. */
|
|
28
29
|
typed?: string;
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { useViews } from "../../provider/context.js";
|
|
6
|
+
import { useMoment } from "../../provider/moment.js";
|
|
6
7
|
import { Button } from "../button/button.js";
|
|
7
8
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
8
9
|
import { addMonths, dateNames, parts, todayOf } from "./calendar.js";
|
|
@@ -12,11 +13,12 @@ import { dateEditorWordsOf } from "./map-date-body.js";
|
|
|
12
13
|
import { dateWords } from "./words.js";
|
|
13
14
|
export function MapCalendar({ value, onChange, min, max, month, onMonthChange, className }) {
|
|
14
15
|
const { conventions } = useViews();
|
|
16
|
+
const now = useMoment();
|
|
15
17
|
const w = React.useMemo(() => dateWords(dateEditorWordsOf(conventions.messages)), [conventions.messages]);
|
|
16
18
|
const names = dateNames(conventions.language);
|
|
17
19
|
const [wornRef, worn] = useDateEditorWorn();
|
|
18
20
|
const host = React.useContext(PhoneHost), small = usePhone(), phone = Boolean(host) || small;
|
|
19
|
-
const today = todayOf();
|
|
21
|
+
const today = todayOf(now ?? undefined);
|
|
20
22
|
const [key, setKey] = React.useState(value ?? (month ? `${month}-01` : today));
|
|
21
23
|
const [held, setHeld] = React.useState({ value, month });
|
|
22
24
|
if (held.value !== value || held.month !== month) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SheetHeadProps } from "../sheet/bottom-sheet.js";
|
|
3
|
+
import { type FilterField } from "./how.js";
|
|
4
|
+
import { type FilterGroup, type FilterRule } from "./rules.js";
|
|
5
|
+
import { type FilterEditorWords } from "./words.js";
|
|
6
|
+
export type { FilterField, FieldType } from "./how.js";
|
|
7
|
+
export type { FilterAside, FilterGroup, FilterRule } from "./rules.js";
|
|
8
|
+
/** ViewKit's own words and value body for a rule the kit has no box of its own for: its field's words, its way's word, its value's
|
|
9
|
+
* words (null with none yet), and its value body (null where it takes none). */
|
|
10
|
+
export interface FilterOwn {
|
|
11
|
+
field: string;
|
|
12
|
+
way: string;
|
|
13
|
+
value: string | null;
|
|
14
|
+
body: React.ReactNode | null;
|
|
15
|
+
}
|
|
16
|
+
export interface FilterEditorProps {
|
|
17
|
+
/** What it filters, as its shell names it ("Filter"): the Sheet's title on a phone, and the rules' name to a screen reader. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** The fields a list filters by, each typed, a choice's values with it; one leading one level in (a deal's Company) holds its own. */
|
|
20
|
+
fields: FilterField[];
|
|
21
|
+
/** The view's filter: its rules, joined by its join, groups in it. */
|
|
22
|
+
filter: FilterGroup;
|
|
23
|
+
/** Each change, as it is made: a rule added, changed or taken away, a join turned, a group made. */
|
|
24
|
+
onFilterChange: (filter: FilterGroup) => void;
|
|
25
|
+
/** The rule it opens at, its value open: a rule just added. */
|
|
26
|
+
at?: string;
|
|
27
|
+
/** The ids already taken outside `filter`, which a rule or group it makes never repeats. */
|
|
28
|
+
ids?: string[];
|
|
29
|
+
/** How many levels deep its rules may stand, its own the first: three unless said; an advanced filter's editor two. */
|
|
30
|
+
levels?: number;
|
|
31
|
+
/** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. `narrow`, on a computer
|
|
32
|
+
* in a narrow place (Customize's Filter, in the Pane): the phone's structure at a computer's sizes. */
|
|
33
|
+
form?: "computer" | "phone" | "narrow";
|
|
34
|
+
/** The job is done and what holds it closes: on a computer the last rule taken away or Clear all filters; on a phone ✓, or ✕
|
|
35
|
+
* once the filter is back. */
|
|
36
|
+
onDone?: () => void;
|
|
37
|
+
/** For a page that shows a state, standing still: `at`'s value list stands open under its box (on a phone, its step), and nothing
|
|
38
|
+
* takes the focus. */
|
|
39
|
+
standing?: boolean;
|
|
40
|
+
/** ViewKit's own words and value body for a rule the kit has no box for (set aside, a way only ViewKit words, a field the kit
|
|
41
|
+
* doesn't list, a choice with no values); null where the kit draws the rule itself. */
|
|
42
|
+
own?: (rule: FilterRule) => FilterOwn | null;
|
|
43
|
+
/** Its words; English unless handed. */
|
|
44
|
+
words?: Partial<FilterEditorWords>;
|
|
45
|
+
}
|
|
46
|
+
export interface FilterEditorParts {
|
|
47
|
+
body: React.ReactNode;
|
|
48
|
+
/** On a phone, the Sheet head's ✕ and ✓, or on a step its Back (`onBack`) alone; {} on a computer and in the narrow form. */
|
|
49
|
+
head: Pick<SheetHeadProps, "close" | "left" | "right" | "onBack">;
|
|
50
|
+
/** On a phone's step, its title: Add filter, Field, how a field compares, or the field's name; absent off a step. */
|
|
51
|
+
title?: string;
|
|
52
|
+
}
|
|
53
|
+
/** The filter editor's state and the parts a shell pours in. */
|
|
54
|
+
export declare function useFilterEditor(props: FilterEditorProps): FilterEditorParts;
|
|
55
|
+
/** The body alone, for a shell that holds only a body (the Popover). */
|
|
56
|
+
export declare function FilterEditor(props: FilterEditorProps): import("react/jsx-runtime").JSX.Element;
|