@antscorp/ui 0.1.3 → 0.1.5
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/README.md +25 -1
- package/dist/atoms/AddButton.d.ts +3 -5
- package/dist/atoms/Chip.d.ts +3 -3
- package/dist/atoms/Chip.js +1 -1
- package/dist/atoms/RemoveButton.d.ts +3 -5
- package/dist/atoms/TextAction.d.ts +3 -3
- package/dist/docs.json +1 -1
- package/dist/lib/forwardable.d.ts +8 -0
- package/dist/lib/iso.d.ts +2 -2
- package/dist/lib/iso.js +16 -8
- package/dist/lib/tokenEditorExtensions.js +1 -1
- package/dist/molecules/AccentCard.js +2 -2
- package/dist/molecules/CheckGroup.d.ts +2 -1
- package/dist/molecules/CheckRow.d.ts +3 -5
- package/dist/molecules/ChoiceTiles.js +1 -1
- package/dist/molecules/CommitTextField.d.ts +2 -19
- package/dist/molecules/CommitTextField.js +21 -18
- package/dist/molecules/ConfirmDialog.d.ts +3 -7
- package/dist/molecules/DateTimeInput.d.ts +7 -3
- package/dist/molecules/DateTimeInput.js +82 -73
- package/dist/molecules/DurationInput.d.ts +2 -1
- package/dist/molecules/PercentRow.d.ts +2 -1
- package/dist/molecules/RemovableRow.js +32 -32
- package/dist/molecules/RevealRadioGroup.d.ts +3 -9
- package/dist/molecules/RevealSwitch.d.ts +3 -7
- package/dist/molecules/Select.d.ts +8 -23
- package/dist/molecules/Select.js +26 -20
- package/dist/molecules/StatusButton.d.ts +3 -7
- package/dist/molecules/ToggleGrid.d.ts +2 -1
- package/dist/molecules/TokenTextField.d.ts +2 -1
- package/dist/molecules/TreeOptions.d.ts +3 -2
- package/dist/molecules/TreeOptions.js +67 -44
- package/dist/organisms/HourOfDayRow.js +2 -2
- package/dist/organisms/HourOfWeekGrid.js +2 -2
- package/dist/organisms/TokenPickerDialog.d.ts +2 -1
- package/dist/organisms/TransferPicker.d.ts +2 -1
- package/dist/organisms/TreeSearchPanel.js +50 -47
- package/dist/theme/AntsomiTheme.d.ts +3 -2
- package/dist/theme/AntsomiTheme.js +8 -7
- package/dist/ui.css +1 -1
- package/package.json +23 -17
- package/src/atoms/AddButton.tsx +3 -6
- package/src/atoms/Chip.tsx +6 -5
- package/src/atoms/RemoveButton.tsx +4 -6
- package/src/atoms/TextAction.tsx +4 -4
- package/src/lib/forwardable.ts +8 -0
- package/src/lib/iso.ts +15 -3
- package/src/lib/tokenEditorExtensions.ts +1 -1
- package/src/molecules/AccentCard.tsx +4 -2
- package/src/molecules/CheckGroup.tsx +3 -3
- package/src/molecules/CheckRow.tsx +3 -6
- package/src/molecules/ChoiceTiles.tsx +3 -1
- package/src/molecules/CommitTextField.tsx +18 -20
- package/src/molecules/ConfirmDialog.tsx +6 -8
- package/src/molecules/DateTimeInput.tsx +87 -68
- package/src/molecules/DurationInput.tsx +4 -1
- package/src/molecules/PercentRow.tsx +3 -2
- package/src/molecules/RemovableRow.tsx +1 -1
- package/src/molecules/RevealRadioGroup.tsx +5 -10
- package/src/molecules/RevealSwitch.tsx +4 -8
- package/src/molecules/Select.tsx +25 -22
- package/src/molecules/StatusButton.tsx +4 -8
- package/src/molecules/ToggleGrid.tsx +3 -3
- package/src/molecules/TokenTextField.tsx +3 -3
- package/src/molecules/TreeOptions.tsx +86 -62
- package/src/organisms/HourOfDayRow.tsx +4 -2
- package/src/organisms/HourOfWeekGrid.tsx +4 -2
- package/src/organisms/TokenPickerDialog.tsx +2 -1
- package/src/organisms/TransferPicker.tsx +3 -3
- package/src/organisms/TreeSearchPanel.tsx +1 -1
- package/src/theme/AntsomiTheme.tsx +9 -3
- package/dist/atoms/AddButton.doc.d.ts +0 -21
- package/dist/atoms/AddGlyph.doc.d.ts +0 -16
- package/dist/atoms/Chip.doc.d.ts +0 -29
- package/dist/atoms/ChipSkeletons.doc.d.ts +0 -21
- package/dist/atoms/FieldHeading.doc.d.ts +0 -15
- package/dist/atoms/HoverSwap.doc.d.ts +0 -25
- package/dist/atoms/InfoTip.doc.d.ts +0 -25
- package/dist/atoms/JointLabel.doc.d.ts +0 -15
- package/dist/atoms/LabeledDivider.doc.d.ts +0 -21
- package/dist/atoms/LogoImage.doc.d.ts +0 -21
- package/dist/atoms/PanelSearchInput.doc.d.ts +0 -25
- package/dist/atoms/PathMark.doc.d.ts +0 -16
- package/dist/atoms/RemoveButton.doc.d.ts +0 -16
- package/dist/atoms/RowSkeletons.doc.d.ts +0 -25
- package/dist/atoms/TextAction.doc.d.ts +0 -25
- package/dist/atoms/TruncatedOption.doc.d.ts +0 -24
- package/dist/atoms/TruncatedText.doc.d.ts +0 -15
- package/dist/molecules/AccentCard.doc.d.ts +0 -25
- package/dist/molecules/CheckGroup.doc.d.ts +0 -25
- package/dist/molecules/CheckRow.doc.d.ts +0 -25
- package/dist/molecules/ChoiceDialog.doc.d.ts +0 -21
- package/dist/molecules/ChoiceTiles.doc.d.ts +0 -21
- package/dist/molecules/CommitTextField.doc.d.ts +0 -29
- package/dist/molecules/ConfirmDialog.doc.d.ts +0 -21
- package/dist/molecules/DateTimeInput.doc.d.ts +0 -25
- package/dist/molecules/DurationInput.doc.d.ts +0 -25
- package/dist/molecules/FieldGroup.doc.d.ts +0 -25
- package/dist/molecules/FieldRow.doc.d.ts +0 -24
- package/dist/molecules/FieldSkeleton.doc.d.ts +0 -25
- package/dist/molecules/FrequencyLimitRow.doc.d.ts +0 -25
- package/dist/molecules/InlineEditableText.doc.d.ts +0 -25
- package/dist/molecules/LoadMoreRow.doc.d.ts +0 -21
- package/dist/molecules/LoadState.doc.d.ts +0 -21
- package/dist/molecules/MetaTable.doc.d.ts +0 -25
- package/dist/molecules/PercentRow.doc.d.ts +0 -25
- package/dist/molecules/PhoneFrame.doc.d.ts +0 -21
- package/dist/molecules/ProblemsButton.doc.d.ts +0 -25
- package/dist/molecules/RemovableRow.doc.d.ts +0 -25
- package/dist/molecules/RevealRadioGroup.doc.d.ts +0 -25
- package/dist/molecules/RevealSwitch.doc.d.ts +0 -25
- package/dist/molecules/RuleRow.doc.d.ts +0 -25
- package/dist/molecules/Select.doc.d.ts +0 -30
- package/dist/molecules/SideLabelRow.doc.d.ts +0 -20
- package/dist/molecules/SplitButton.doc.d.ts +0 -25
- package/dist/molecules/StatusButton.doc.d.ts +0 -25
- package/dist/molecules/TagSelect.doc.d.ts +0 -25
- package/dist/molecules/ToggleGrid.doc.d.ts +0 -25
- package/dist/molecules/TokenTextField.doc.d.ts +0 -29
- package/dist/molecules/TransferLayout.doc.d.ts +0 -25
- package/dist/molecules/TreeOptions.doc.d.ts +0 -25
- package/dist/organisms/ChipListAddPopover.doc.d.ts +0 -25
- package/dist/organisms/HourOfDayRow.doc.d.ts +0 -25
- package/dist/organisms/HourOfWeekGrid.doc.d.ts +0 -25
- package/dist/organisms/RepeatableList.doc.d.ts +0 -21
- package/dist/organisms/ResizableDrawer.doc.d.ts +0 -25
- package/dist/organisms/RuleGroups.doc.d.ts +0 -21
- package/dist/organisms/RuleList.doc.d.ts +0 -25
- package/dist/organisms/SearchableGroupedList.doc.d.ts +0 -25
- package/dist/organisms/TokenPickerDialog.doc.d.ts +0 -21
- package/dist/organisms/TransferPicker.doc.d.ts +0 -29
- package/dist/organisms/TreeSearchPanel.doc.d.ts +0 -25
- package/dist/organisms/TreeSelect.doc.d.ts +0 -29
- package/dist/theme/AntsomiTheme.doc.d.ts +0 -15
- package/dist/theme/AntsomiTheme.doc.js +0 -22
- package/src/atoms/AddButton.doc.ts +0 -36
- package/src/atoms/AddGlyph.doc.ts +0 -26
- package/src/atoms/Chip.doc.ts +0 -45
- package/src/atoms/ChipSkeletons.doc.ts +0 -31
- package/src/atoms/FieldHeading.doc.ts +0 -22
- package/src/atoms/HoverSwap.doc.ts +0 -39
- package/src/atoms/InfoTip.doc.ts +0 -37
- package/src/atoms/JointLabel.doc.ts +0 -23
- package/src/atoms/LabeledDivider.doc.ts +0 -35
- package/src/atoms/LogoImage.doc.ts +0 -42
- package/src/atoms/PanelSearchInput.doc.ts +0 -41
- package/src/atoms/PathMark.doc.ts +0 -25
- package/src/atoms/RemoveButton.doc.ts +0 -26
- package/src/atoms/RowSkeletons.doc.ts +0 -43
- package/src/atoms/TextAction.doc.ts +0 -40
- package/src/atoms/TruncatedOption.doc.ts +0 -39
- package/src/atoms/TruncatedText.doc.ts +0 -22
- package/src/molecules/AccentCard.doc.ts +0 -43
- package/src/molecules/CheckGroup.doc.ts +0 -40
- package/src/molecules/CheckRow.doc.ts +0 -43
- package/src/molecules/ChoiceDialog.doc.ts +0 -48
- package/src/molecules/ChoiceTiles.doc.ts +0 -42
- package/src/molecules/CommitTextField.doc.ts +0 -41
- package/src/molecules/ConfirmDialog.doc.ts +0 -43
- package/src/molecules/DateTimeInput.doc.ts +0 -48
- package/src/molecules/DurationInput.doc.ts +0 -36
- package/src/molecules/FieldGroup.doc.ts +0 -41
- package/src/molecules/FieldRow.doc.ts +0 -36
- package/src/molecules/FieldSkeleton.doc.ts +0 -38
- package/src/molecules/FrequencyLimitRow.doc.ts +0 -48
- package/src/molecules/InlineEditableText.doc.ts +0 -41
- package/src/molecules/LoadMoreRow.doc.ts +0 -36
- package/src/molecules/LoadState.doc.ts +0 -42
- package/src/molecules/MetaTable.doc.ts +0 -46
- package/src/molecules/PercentRow.doc.ts +0 -48
- package/src/molecules/PhoneFrame.doc.ts +0 -46
- package/src/molecules/ProblemsButton.doc.ts +0 -41
- package/src/molecules/RemovableRow.doc.ts +0 -48
- package/src/molecules/RevealRadioGroup.doc.ts +0 -41
- package/src/molecules/RevealSwitch.doc.ts +0 -38
- package/src/molecules/RuleRow.doc.ts +0 -43
- package/src/molecules/Select.doc.ts +0 -62
- package/src/molecules/SideLabelRow.doc.ts +0 -35
- package/src/molecules/SplitButton.doc.ts +0 -41
- package/src/molecules/StatusButton.doc.ts +0 -39
- package/src/molecules/TagSelect.doc.ts +0 -41
- package/src/molecules/ToggleGrid.doc.ts +0 -43
- package/src/molecules/TokenTextField.doc.ts +0 -41
- package/src/molecules/TransferLayout.doc.ts +0 -42
- package/src/molecules/TreeOptions.doc.ts +0 -38
- package/src/organisms/ChipListAddPopover.doc.ts +0 -54
- package/src/organisms/HourOfDayRow.doc.ts +0 -43
- package/src/organisms/HourOfWeekGrid.doc.ts +0 -48
- package/src/organisms/RepeatableList.doc.ts +0 -49
- package/src/organisms/ResizableDrawer.doc.ts +0 -48
- package/src/organisms/RuleGroups.doc.ts +0 -49
- package/src/organisms/RuleList.doc.ts +0 -43
- package/src/organisms/SearchableGroupedList.doc.ts +0 -49
- package/src/organisms/TokenPickerDialog.doc.ts +0 -54
- package/src/organisms/TransferPicker.doc.ts +0 -69
- package/src/organisms/TreeSearchPanel.doc.ts +0 -43
- package/src/organisms/TreeSelect.doc.ts +0 -56
- package/src/theme/AntsomiTheme.doc.ts +0 -23
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTreeFocus } from "@astryxdesign/core/hooks";
|
|
1
2
|
import { Icon } from "@astryxdesign/core/Icon";
|
|
2
3
|
import { useIndicator } from "@astryxdesign/core/Indicator";
|
|
3
4
|
import { Text } from "@astryxdesign/core/Text";
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
} from "@astryxdesign/core/theme/tokens.stylex";
|
|
10
11
|
import { themeProps } from "@astryxdesign/core/utils";
|
|
11
12
|
import * as stylex from "@stylexjs/stylex";
|
|
12
|
-
import {
|
|
13
|
+
import { Fragment, type ReactNode, useId, useState } from "react";
|
|
13
14
|
|
|
14
15
|
/** One row of a two-level tree to pick from: a leaf, or a group of leaves. */
|
|
15
16
|
export type TreeItem = {
|
|
@@ -58,12 +59,15 @@ type Row = {
|
|
|
58
59
|
* disabled row does neither. Rows are the Selector's option rows (its styles, its option-row and
|
|
59
60
|
* check theme targets, its check on the picked leaf at the end, where a group shows its chevron),
|
|
60
61
|
* so a theme styles both alike: the picked row's look and whether a check shows are the theme's.
|
|
61
|
-
* Tab reaches the picked leaf (else the first enabled row),
|
|
62
|
-
*
|
|
62
|
+
* Tab initially reaches the picked leaf (else the first enabled row); arrows, Home and End move
|
|
63
|
+
* through enabled rows, Right opens or enters a group, Left collapses or returns to its parent,
|
|
64
|
+
* and Enter and Space act. Its state is which groups are open and which row has focus.
|
|
63
65
|
*/
|
|
64
66
|
export function TreeOptions(props: TreeOptionsProps): ReactNode {
|
|
65
67
|
const { items, value } = props;
|
|
66
68
|
const size = props.size ?? "md";
|
|
69
|
+
const id = useId();
|
|
70
|
+
const [active, setActive] = useState<string>();
|
|
67
71
|
const [open, setOpen] = useState<ReadonlySet<string>>(
|
|
68
72
|
() =>
|
|
69
73
|
new Set(
|
|
@@ -87,7 +91,9 @@ export function TreeOptions(props: TreeOptionsProps): ReactNode {
|
|
|
87
91
|
const Check = useIndicator("check");
|
|
88
92
|
const enabled = rows.filter((row) => row.item.isDisabled !== true);
|
|
89
93
|
const tabbable =
|
|
90
|
-
enabled.find((row) => row.
|
|
94
|
+
enabled.find((row) => row.item.value === active) ??
|
|
95
|
+
enabled.find((row) => row.isOpen === undefined && row.item.value === value) ??
|
|
96
|
+
enabled[0];
|
|
91
97
|
const act = (row: Row): void => {
|
|
92
98
|
if (row.item.isDisabled === true) return;
|
|
93
99
|
if (row.isOpen === undefined) {
|
|
@@ -98,56 +104,84 @@ export function TreeOptions(props: TreeOptionsProps): ReactNode {
|
|
|
98
104
|
if (!next.delete(row.item.value)) next.add(row.item.value);
|
|
99
105
|
setOpen(next);
|
|
100
106
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
107
|
+
const activate = (key: string | undefined): void => {
|
|
108
|
+
const row = rows.find((candidate) => candidate.item.value === key);
|
|
109
|
+
if (row !== undefined) act(row);
|
|
110
|
+
};
|
|
111
|
+
const { treeRef, handleKeyDown } = useTreeFocus({
|
|
112
|
+
itemSelector: '[role="treeitem"]:not([aria-disabled="true"])',
|
|
113
|
+
onToggleExpand: activate,
|
|
114
|
+
onActivate: (_item, key) => {
|
|
115
|
+
activate(key);
|
|
116
|
+
return true;
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
const groupId = (row: Row): string => `${id}-${encodeURIComponent(row.item.value)}`;
|
|
120
|
+
const renderRow = (row: Row): ReactNode => (
|
|
121
|
+
<div
|
|
122
|
+
key={row.item.value}
|
|
123
|
+
role="treeitem"
|
|
124
|
+
aria-label={row.item.label}
|
|
125
|
+
data-tree-id={row.item.value}
|
|
126
|
+
aria-level={row.level}
|
|
127
|
+
aria-expanded={row.isOpen}
|
|
128
|
+
aria-owns={row.isOpen === true ? groupId(row) : undefined}
|
|
129
|
+
aria-selected={row.isOpen === undefined ? row.item.value === value : undefined}
|
|
130
|
+
aria-disabled={row.item.isDisabled === true || undefined}
|
|
131
|
+
tabIndex={row.item === tabbable?.item ? 0 : -1}
|
|
132
|
+
onFocus={() => {
|
|
133
|
+
setActive(row.item.value);
|
|
134
|
+
}}
|
|
135
|
+
onClick={() => {
|
|
136
|
+
act(row);
|
|
137
|
+
}}
|
|
138
|
+
{...rowProps(row, size, value)}
|
|
139
|
+
>
|
|
140
|
+
{/* The option's content and mark column, as `Selector.tsx:1407-1431`. */}
|
|
141
|
+
{/* One line cut with an ellipsis, with Text's tooltip for the whole label;
|
|
126
142
|
Astryx's SelectorOption would run under the mark. */}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
<span {...stylex.props(styles.content)}>
|
|
144
|
+
<Text type="inherit" color="inherit" maxLines={1}>
|
|
145
|
+
{row.item.label}
|
|
146
|
+
</Text>
|
|
147
|
+
</span>
|
|
148
|
+
{/* A leaf's column sets no display of its own: the theme may hide it with its check. */}
|
|
149
|
+
<span {...stylex.props(styles.mark, row.isOpen !== undefined && styles.markCentred)}>
|
|
150
|
+
{row.isOpen === undefined ? (
|
|
151
|
+
<Check
|
|
152
|
+
state={row.item.value === value ? "checked" : "unchecked"}
|
|
153
|
+
size="sm"
|
|
154
|
+
isDisabled={row.item.isDisabled === true}
|
|
155
|
+
{...themeProps("selector-check")}
|
|
156
|
+
/>
|
|
157
|
+
) : (
|
|
158
|
+
<Icon icon={row.isOpen ? "chevronDown" : "chevronRight"} size="sm" color="secondary" />
|
|
159
|
+
)}
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
return (
|
|
164
|
+
// Raw tree roles preserve the trailing chevron layout; each parent owns its sibling group.
|
|
165
|
+
<div
|
|
166
|
+
role="tree"
|
|
167
|
+
aria-label={props.label}
|
|
168
|
+
ref={(element) => {
|
|
169
|
+
treeRef.current = element;
|
|
170
|
+
}}
|
|
171
|
+
onKeyDown={handleKeyDown}
|
|
172
|
+
>
|
|
173
|
+
{rows
|
|
174
|
+
.filter((row) => row.level === 1)
|
|
175
|
+
.map((row) => (
|
|
176
|
+
<Fragment key={row.item.value}>
|
|
177
|
+
{renderRow(row)}
|
|
178
|
+
{row.isOpen === true && (
|
|
179
|
+
<div role="group" id={groupId(row)}>
|
|
180
|
+
{row.item.children?.map((child) => renderRow({ item: child, level: 2 }))}
|
|
181
|
+
</div>
|
|
147
182
|
)}
|
|
148
|
-
</
|
|
149
|
-
|
|
150
|
-
))}
|
|
183
|
+
</Fragment>
|
|
184
|
+
))}
|
|
151
185
|
</div>
|
|
152
186
|
);
|
|
153
187
|
}
|
|
@@ -178,16 +212,6 @@ function rowProps(
|
|
|
178
212
|
};
|
|
179
213
|
}
|
|
180
214
|
|
|
181
|
-
// Up and Down move the keyboard to the row above or below.
|
|
182
|
-
function moveFocus(event: KeyboardEvent<HTMLDivElement>): void {
|
|
183
|
-
const step = event.key === "ArrowDown" ? 1 : event.key === "ArrowUp" ? -1 : 0;
|
|
184
|
-
if (step === 0) return;
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
const rows = [...event.currentTarget.querySelectorAll<HTMLElement>('[role="treeitem"]')];
|
|
187
|
-
const at = rows.findIndex((row) => row === event.target);
|
|
188
|
-
rows[Math.min(Math.max(at + step, 0), rows.length - 1)]?.focus();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
215
|
// Astryx `Selector/Selector.tsx` styles: `item` (345-366, without its radius), `itemContent`
|
|
192
216
|
// (367-373), `itemMarkColumn` (379-389), `itemHighlighted` (395-397, here on hover and keyboard
|
|
193
217
|
// focus, as the rows take focus, never on the picked row), `itemDisabled` (401-404) and
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccentRole } from "@antscorp/astryx-theme-antsomi/palette";
|
|
1
2
|
import { FieldStatus } from "@astryxdesign/core/FieldStatus";
|
|
2
3
|
import { ScrollableArea } from "@astryxdesign/core/ScrollableArea";
|
|
3
4
|
import { colorVars } from "@astryxdesign/core/theme/tokens.stylex";
|
|
@@ -115,6 +116,7 @@ export function HourOfDayRow(props: HourOfDayRowProps): ReactNode {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
// As the week grid's: 24px cells, 11px text.
|
|
119
|
+
const accentHover: AccentRole = "var(--ants-accent-hover)";
|
|
118
120
|
const styles = stylex.create({
|
|
119
121
|
grid: { width: "max-content", userSelect: "none", cursor: "pointer" },
|
|
120
122
|
locked: { cursor: "default" },
|
|
@@ -138,13 +140,13 @@ const styles = stylex.create({
|
|
|
138
140
|
liveOn: {
|
|
139
141
|
backgroundColor: {
|
|
140
142
|
default: colorVars["--color-accent"],
|
|
141
|
-
":hover": { default: null, "@media (hover: hover)":
|
|
143
|
+
":hover": { default: null, "@media (hover: hover)": accentHover },
|
|
142
144
|
},
|
|
143
145
|
},
|
|
144
146
|
liveOff: {
|
|
145
147
|
backgroundColor: {
|
|
146
148
|
default: colorVars["--color-neutral"],
|
|
147
|
-
":hover": { default: null, "@media (hover: hover)":
|
|
149
|
+
":hover": { default: null, "@media (hover: hover)": accentHover },
|
|
148
150
|
},
|
|
149
151
|
},
|
|
150
152
|
axis: { color: colorVars["--color-text-secondary"], fontSize: 11, whiteSpace: "nowrap" },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccentRole } from "@antscorp/astryx-theme-antsomi/palette";
|
|
1
2
|
import { FieldStatus } from "@astryxdesign/core/FieldStatus";
|
|
2
3
|
import { ScrollableArea } from "@astryxdesign/core/ScrollableArea";
|
|
3
4
|
import { Text } from "@astryxdesign/core/Text";
|
|
@@ -239,6 +240,7 @@ export function HourOfWeekGrid(props: HourOfWeekGridProps): ReactNode {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
// Sizes follow the form it came from: 24px cells, a 76px column of day names, 11px text.
|
|
243
|
+
const accentHover: AccentRole = "var(--ants-accent-hover)";
|
|
242
244
|
const styles = stylex.create({
|
|
243
245
|
// Every cell picks, as in the form it came from; the cells inherit it.
|
|
244
246
|
grid: { width: "max-content", userSelect: "none", cursor: "pointer" },
|
|
@@ -288,13 +290,13 @@ const styles = stylex.create({
|
|
|
288
290
|
liveOn: {
|
|
289
291
|
backgroundColor: {
|
|
290
292
|
default: colorVars["--color-accent"],
|
|
291
|
-
":hover": { default: null, "@media (hover: hover)":
|
|
293
|
+
":hover": { default: null, "@media (hover: hover)": accentHover },
|
|
292
294
|
},
|
|
293
295
|
},
|
|
294
296
|
liveOff: {
|
|
295
297
|
backgroundColor: {
|
|
296
298
|
default: colorVars["--color-neutral"],
|
|
297
|
-
":hover": { default: null, "@media (hover: hover)":
|
|
299
|
+
":hover": { default: null, "@media (hover: hover)": accentHover },
|
|
298
300
|
},
|
|
299
301
|
},
|
|
300
302
|
axis: {
|
|
@@ -6,6 +6,7 @@ import { TextInput } from "@astryxdesign/core/TextInput";
|
|
|
6
6
|
import { VStack } from "@astryxdesign/core/VStack";
|
|
7
7
|
import { type ReactNode, useState } from "react";
|
|
8
8
|
|
|
9
|
+
import type { Forwardable } from "../lib/forwardable";
|
|
9
10
|
import { useLoadingShown } from "../lib/useLoadingShown";
|
|
10
11
|
import { FieldSkeleton } from "../molecules/FieldSkeleton";
|
|
11
12
|
import { leafOf, type TreeItem } from "../molecules/TreeOptions";
|
|
@@ -22,7 +23,7 @@ export type TokenPickerValue = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
/** What `TokenPickerDialog` takes. */
|
|
25
|
-
export type TokenPickerDialogProps = Pick<DialogProps, "isOpen"
|
|
26
|
+
export type TokenPickerDialogProps = Forwardable<Pick<DialogProps, "isOpen">> & {
|
|
26
27
|
/** Closes or cancels the dialog. */
|
|
27
28
|
readonly onClose: () => void;
|
|
28
29
|
/** Dialog heading. */
|
|
@@ -10,6 +10,7 @@ import { InfoTip } from "../atoms/InfoTip";
|
|
|
10
10
|
import { PanelSearchInput } from "../atoms/PanelSearchInput";
|
|
11
11
|
import { RowSkeletons } from "../atoms/RowSkeletons";
|
|
12
12
|
import { TextAction } from "../atoms/TextAction";
|
|
13
|
+
import type { Forwardable } from "../lib/forwardable";
|
|
13
14
|
import { useLoadingShown } from "../lib/useLoadingShown";
|
|
14
15
|
import { type LoadMoreOptions, useLoadMore } from "../lib/useLoadMore";
|
|
15
16
|
import { CheckRow } from "../molecules/CheckRow";
|
|
@@ -34,9 +35,8 @@ export type TransferPickerOption<V extends string> = {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
/** What `TransferPicker` takes. */
|
|
37
|
-
export type TransferPickerProps<V extends string> =
|
|
38
|
-
LoadMoreOptions,
|
|
39
|
-
"onLoadMore" | "hasMore" | "isLoadingMore"
|
|
38
|
+
export type TransferPickerProps<V extends string> = Forwardable<
|
|
39
|
+
Pick<LoadMoreOptions, "onLoadMore" | "hasMore" | "isLoadingMore">
|
|
40
40
|
> & {
|
|
41
41
|
/** Names the list of options (the start column). */
|
|
42
42
|
readonly label: string;
|
|
@@ -64,7 +64,7 @@ export function TreeSearchPanel(props: TreeSearchPanelProps): ReactNode {
|
|
|
64
64
|
const { rootRef, sentinelRef } = useLoadMore({
|
|
65
65
|
...more,
|
|
66
66
|
hasLoadMoreError: labels.loadMoreError !== undefined,
|
|
67
|
-
itemCount: shown.length,
|
|
67
|
+
itemCount: shown.reduce((count, item) => count + 1 + (item.children?.length ?? 0), 0),
|
|
68
68
|
});
|
|
69
69
|
const groups = shown.filter((item) => item.children !== undefined).length;
|
|
70
70
|
return (
|
|
@@ -2,11 +2,13 @@ import { antsomiTheme } from "@antscorp/astryx-theme-antsomi";
|
|
|
2
2
|
import { Theme } from "@astryxdesign/core/theme";
|
|
3
3
|
import type { ComponentProps, ReactElement } from "react";
|
|
4
4
|
|
|
5
|
+
import type { Forwardable } from "../lib/forwardable";
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Astryx Theme props with the Antsomi base theme as the default.
|
|
7
9
|
* Inherited `children` renders the themed subtree; `mode` selects light, dark or system mode.
|
|
8
10
|
*/
|
|
9
|
-
export type AntsomiThemeProps = Omit<ComponentProps<typeof Theme>, "theme"
|
|
11
|
+
export type AntsomiThemeProps = Forwardable<Omit<ComponentProps<typeof Theme>, "theme">> & {
|
|
10
12
|
/** Optional override created with `defineTheme({ extends: antsomiTheme, … })`. */
|
|
11
13
|
readonly theme?: ComponentProps<typeof Theme>["theme"];
|
|
12
14
|
};
|
|
@@ -16,6 +18,10 @@ export type AntsomiThemeProps = Omit<ComponentProps<typeof Theme>, "theme"> & {
|
|
|
16
18
|
* Import `@antscorp/ui/theme.css` separately. Extend the base with Astryx's
|
|
17
19
|
* `defineTheme({ name: "custom", extends: antsomiTheme, tokens: { … } })` and pass it as `theme`.
|
|
18
20
|
*/
|
|
19
|
-
export function AntsomiTheme({ theme,
|
|
20
|
-
return
|
|
21
|
+
export function AntsomiTheme({ theme, mode, children }: AntsomiThemeProps): ReactElement {
|
|
22
|
+
return (
|
|
23
|
+
<Theme theme={theme ?? antsomiTheme} {...(mode !== undefined && { mode })}>
|
|
24
|
+
{children}
|
|
25
|
+
</Theme>
|
|
26
|
+
);
|
|
21
27
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for AddButton. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Inputs";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: {
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
accessibility: string[];
|
|
21
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for AddGlyph. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Data display";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
accessibility: string[];
|
|
16
|
-
};
|
package/dist/atoms/Chip.doc.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for Chip. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Data display";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
related: {
|
|
6
|
-
name: string;
|
|
7
|
-
when: string;
|
|
8
|
-
}[];
|
|
9
|
-
usage: {
|
|
10
|
-
description: string;
|
|
11
|
-
bestPractices: ({
|
|
12
|
-
guidance: true;
|
|
13
|
-
description: string;
|
|
14
|
-
} | {
|
|
15
|
-
guidance: false;
|
|
16
|
-
description: string;
|
|
17
|
-
})[];
|
|
18
|
-
anatomy: ({
|
|
19
|
-
name: string;
|
|
20
|
-
required: true;
|
|
21
|
-
description: string;
|
|
22
|
-
} | {
|
|
23
|
-
name: string;
|
|
24
|
-
required: false;
|
|
25
|
-
description: string;
|
|
26
|
-
})[];
|
|
27
|
-
};
|
|
28
|
-
accessibility: string[];
|
|
29
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for ChipSkeletons. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Feedback";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: {
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
accessibility: string[];
|
|
21
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for FieldHeading. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Data display";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for HoverSwap. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Layout";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: ({
|
|
15
|
-
name: string;
|
|
16
|
-
required: false;
|
|
17
|
-
description: string;
|
|
18
|
-
} | {
|
|
19
|
-
name: string;
|
|
20
|
-
required: true;
|
|
21
|
-
description: string;
|
|
22
|
-
})[];
|
|
23
|
-
};
|
|
24
|
-
accessibility: string[];
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for InfoTip. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Feedback";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: ({
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
} | {
|
|
19
|
-
name: string;
|
|
20
|
-
required: false;
|
|
21
|
-
description: string;
|
|
22
|
-
})[];
|
|
23
|
-
};
|
|
24
|
-
accessibility: string[];
|
|
25
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for JointLabel. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Data display";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for LabeledDivider. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Layout";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: {
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
accessibility: string[];
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for LogoImage. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Data display";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: {
|
|
15
|
-
name: string;
|
|
16
|
-
required: false;
|
|
17
|
-
description: string;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
accessibility: string[];
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for PanelSearchInput. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Inputs";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: ({
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
} | {
|
|
19
|
-
name: string;
|
|
20
|
-
required: false;
|
|
21
|
-
description: string;
|
|
22
|
-
})[];
|
|
23
|
-
};
|
|
24
|
-
accessibility: string[];
|
|
25
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for PathMark. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Layout";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
accessibility: string[];
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for RemoveButton. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Inputs";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
accessibility: string[];
|
|
16
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for RowSkeletons. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Feedback";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: ({
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
} | {
|
|
19
|
-
name: string;
|
|
20
|
-
required: false;
|
|
21
|
-
description: string;
|
|
22
|
-
})[];
|
|
23
|
-
};
|
|
24
|
-
accessibility: string[];
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Usage guidance for TextAction. */
|
|
2
|
-
export declare const doc: {
|
|
3
|
-
category: "Inputs";
|
|
4
|
-
keywords: string[];
|
|
5
|
-
usage: {
|
|
6
|
-
description: string;
|
|
7
|
-
bestPractices: ({
|
|
8
|
-
guidance: true;
|
|
9
|
-
description: string;
|
|
10
|
-
} | {
|
|
11
|
-
guidance: false;
|
|
12
|
-
description: string;
|
|
13
|
-
})[];
|
|
14
|
-
anatomy: ({
|
|
15
|
-
name: string;
|
|
16
|
-
required: true;
|
|
17
|
-
description: string;
|
|
18
|
-
} | {
|
|
19
|
-
name: string;
|
|
20
|
-
required: false;
|
|
21
|
-
description: string;
|
|
22
|
-
})[];
|
|
23
|
-
};
|
|
24
|
-
accessibility: string[];
|
|
25
|
-
};
|