@antscorp/ui 0.1.2 → 0.1.3
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 +1 -1
- package/dist/atoms/AddButton.d.ts +1 -1
- package/dist/atoms/AddButton.doc.d.ts +21 -0
- package/dist/atoms/AddGlyph.doc.d.ts +16 -0
- package/dist/atoms/Chip.doc.d.ts +29 -0
- package/dist/atoms/ChipSkeletons.doc.d.ts +21 -0
- package/dist/atoms/FieldHeading.doc.d.ts +15 -0
- package/dist/atoms/HoverSwap.doc.d.ts +25 -0
- package/dist/atoms/InfoTip.doc.d.ts +25 -0
- package/dist/atoms/InfoTip.js +2 -0
- package/dist/atoms/JointLabel.doc.d.ts +15 -0
- package/dist/atoms/LabeledDivider.d.ts +1 -1
- package/dist/atoms/LabeledDivider.doc.d.ts +21 -0
- package/dist/atoms/LogoImage.doc.d.ts +21 -0
- package/dist/atoms/PanelSearchInput.d.ts +1 -1
- package/dist/atoms/PanelSearchInput.doc.d.ts +25 -0
- package/dist/atoms/PathMark.doc.d.ts +16 -0
- package/dist/atoms/RemoveButton.doc.d.ts +16 -0
- package/dist/atoms/RowSkeletons.doc.d.ts +25 -0
- package/dist/atoms/TextAction.d.ts +3 -3
- package/dist/atoms/TextAction.doc.d.ts +25 -0
- package/dist/atoms/TruncatedOption.d.ts +1 -1
- package/dist/atoms/TruncatedOption.doc.d.ts +24 -0
- package/dist/atoms/TruncatedText.doc.d.ts +15 -0
- package/dist/cli.js +248 -0
- package/dist/doc/schema.d.ts +34 -0
- package/dist/doc/schema.js +33 -0
- package/dist/docs.json +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53 -51
- package/dist/lib/useLoadingShown.d.ts +1 -1
- package/dist/molecules/AccentCard.d.ts +2 -3
- package/dist/molecules/AccentCard.doc.d.ts +25 -0
- package/dist/molecules/CheckGroup.doc.d.ts +25 -0
- package/dist/molecules/CheckRow.d.ts +1 -1
- package/dist/molecules/CheckRow.doc.d.ts +25 -0
- package/dist/molecules/ChoiceDialog.doc.d.ts +21 -0
- package/dist/molecules/ChoiceTiles.d.ts +1 -1
- package/dist/molecules/ChoiceTiles.doc.d.ts +21 -0
- package/dist/molecules/CommitTextField.doc.d.ts +29 -0
- package/dist/molecules/ConfirmDialog.doc.d.ts +21 -0
- package/dist/molecules/DateTimeInput.doc.d.ts +25 -0
- package/dist/molecules/DurationInput.doc.d.ts +25 -0
- package/dist/molecules/FieldGroup.d.ts +1 -1
- package/dist/molecules/FieldGroup.doc.d.ts +25 -0
- package/dist/molecules/FieldRow.d.ts +1 -1
- package/dist/molecules/FieldRow.doc.d.ts +24 -0
- package/dist/molecules/FieldSkeleton.doc.d.ts +25 -0
- package/dist/molecules/FrequencyLimitRow.doc.d.ts +25 -0
- package/dist/molecules/InlineEditableText.doc.d.ts +25 -0
- package/dist/molecules/LoadMoreRow.doc.d.ts +21 -0
- package/dist/molecules/LoadState.doc.d.ts +21 -0
- package/dist/molecules/MetaTable.d.ts +1 -1
- package/dist/molecules/MetaTable.doc.d.ts +25 -0
- package/dist/molecules/PercentRow.doc.d.ts +25 -0
- package/dist/molecules/PhoneFrame.d.ts +1 -1
- package/dist/molecules/PhoneFrame.doc.d.ts +21 -0
- package/dist/molecules/ProblemsButton.doc.d.ts +25 -0
- package/dist/molecules/RemovableRow.d.ts +1 -1
- package/dist/molecules/RemovableRow.doc.d.ts +25 -0
- package/dist/molecules/RevealRadioGroup.doc.d.ts +25 -0
- package/dist/molecules/RevealSwitch.doc.d.ts +25 -0
- package/dist/molecules/RuleRow.doc.d.ts +25 -0
- package/dist/molecules/Select.d.ts +2 -2
- package/dist/molecules/Select.doc.d.ts +30 -0
- package/dist/molecules/Select.js +27 -27
- package/dist/molecules/SideLabelRow.d.ts +1 -1
- package/dist/molecules/SideLabelRow.doc.d.ts +20 -0
- package/dist/molecules/SplitButton.d.ts +1 -1
- package/dist/molecules/SplitButton.doc.d.ts +25 -0
- package/dist/molecules/StatusButton.doc.d.ts +25 -0
- package/dist/molecules/TagSelect.d.ts +2 -2
- package/dist/molecules/TagSelect.doc.d.ts +25 -0
- package/dist/molecules/ToggleGrid.doc.d.ts +25 -0
- package/dist/molecules/TokenTextField.doc.d.ts +29 -0
- package/dist/molecules/TransferLayout.d.ts +1 -1
- package/dist/molecules/TransferLayout.doc.d.ts +25 -0
- package/dist/molecules/TreeOptions.d.ts +1 -1
- package/dist/molecules/TreeOptions.doc.d.ts +25 -0
- package/dist/organisms/ChipListAddPopover.doc.d.ts +25 -0
- package/dist/organisms/HourOfDayRow.doc.d.ts +25 -0
- package/dist/organisms/HourOfWeekGrid.doc.d.ts +25 -0
- package/dist/organisms/RepeatableList.doc.d.ts +21 -0
- package/dist/organisms/ResizableDrawer.doc.d.ts +25 -0
- package/dist/organisms/RuleGroups.d.ts +3 -3
- package/dist/organisms/RuleGroups.doc.d.ts +21 -0
- package/dist/organisms/RuleList.doc.d.ts +25 -0
- package/dist/organisms/SearchableGroupedList.d.ts +1 -1
- package/dist/organisms/SearchableGroupedList.doc.d.ts +25 -0
- package/dist/organisms/TokenPickerDialog.doc.d.ts +21 -0
- package/dist/organisms/TransferPicker.d.ts +1 -1
- package/dist/organisms/TransferPicker.doc.d.ts +29 -0
- package/dist/organisms/TreeSearchPanel.doc.d.ts +25 -0
- package/dist/organisms/TreeSelect.d.ts +3 -3
- package/dist/organisms/TreeSelect.doc.d.ts +29 -0
- package/dist/theme/AntsomiTheme.doc.d.ts +15 -0
- package/dist/theme/AntsomiTheme.doc.js +22 -0
- package/package.json +17 -6
- package/src/atoms/AddButton.doc.ts +36 -0
- package/src/atoms/AddButton.tsx +1 -1
- package/src/atoms/AddGlyph.doc.ts +26 -0
- package/src/atoms/Chip.doc.ts +45 -0
- package/src/atoms/Chip.tsx +2 -2
- package/src/atoms/ChipSkeletons.doc.ts +31 -0
- package/src/atoms/FieldHeading.doc.ts +22 -0
- package/src/atoms/HoverSwap.doc.ts +39 -0
- package/src/atoms/InfoTip.doc.ts +37 -0
- package/src/atoms/InfoTip.tsx +2 -2
- package/src/atoms/JointLabel.doc.ts +23 -0
- package/src/atoms/LabeledDivider.doc.ts +35 -0
- package/src/atoms/LabeledDivider.tsx +1 -1
- package/src/atoms/LogoImage.doc.ts +42 -0
- package/src/atoms/PanelSearchInput.doc.ts +41 -0
- package/src/atoms/PanelSearchInput.tsx +1 -1
- package/src/atoms/PathMark.doc.ts +25 -0
- package/src/atoms/RemoveButton.doc.ts +26 -0
- package/src/atoms/RowSkeletons.doc.ts +43 -0
- package/src/atoms/TextAction.doc.ts +40 -0
- package/src/atoms/TextAction.tsx +4 -4
- package/src/atoms/TruncatedOption.doc.ts +39 -0
- package/src/atoms/TruncatedOption.tsx +1 -1
- package/src/atoms/TruncatedText.doc.ts +22 -0
- package/src/doc/schema.ts +67 -0
- package/src/index.ts +2 -0
- package/src/lib/useLoadMore.ts +1 -2
- package/src/lib/useLoadingShown.ts +1 -1
- package/src/molecules/AccentCard.doc.ts +43 -0
- package/src/molecules/AccentCard.tsx +7 -8
- package/src/molecules/CheckGroup.doc.ts +40 -0
- package/src/molecules/CheckRow.doc.ts +43 -0
- package/src/molecules/CheckRow.tsx +1 -1
- package/src/molecules/ChoiceDialog.doc.ts +48 -0
- package/src/molecules/ChoiceTiles.doc.ts +42 -0
- package/src/molecules/ChoiceTiles.tsx +3 -3
- package/src/molecules/CommitTextField.doc.ts +41 -0
- package/src/molecules/ConfirmDialog.doc.ts +43 -0
- package/src/molecules/DateTimeInput.doc.ts +48 -0
- package/src/molecules/DurationInput.doc.ts +36 -0
- package/src/molecules/DurationInput.tsx +2 -2
- package/src/molecules/FieldGroup.doc.ts +41 -0
- package/src/molecules/FieldGroup.tsx +1 -1
- package/src/molecules/FieldRow.doc.ts +36 -0
- package/src/molecules/FieldRow.tsx +1 -1
- package/src/molecules/FieldSkeleton.doc.ts +38 -0
- package/src/molecules/FrequencyLimitRow.doc.ts +48 -0
- package/src/molecules/FrequencyLimitRow.tsx +1 -1
- package/src/molecules/InlineEditableText.doc.ts +41 -0
- package/src/molecules/LoadMoreRow.doc.ts +36 -0
- package/src/molecules/LoadState.doc.ts +42 -0
- package/src/molecules/MetaTable.doc.ts +46 -0
- package/src/molecules/MetaTable.tsx +1 -1
- package/src/molecules/PercentRow.doc.ts +48 -0
- package/src/molecules/PhoneFrame.doc.ts +46 -0
- package/src/molecules/PhoneFrame.tsx +2 -2
- package/src/molecules/ProblemsButton.doc.ts +41 -0
- package/src/molecules/RemovableRow.doc.ts +48 -0
- package/src/molecules/RemovableRow.tsx +2 -2
- package/src/molecules/RevealRadioGroup.doc.ts +41 -0
- package/src/molecules/RevealSwitch.doc.ts +38 -0
- package/src/molecules/RuleRow.doc.ts +43 -0
- package/src/molecules/Select.doc.ts +62 -0
- package/src/molecules/Select.tsx +2 -2
- package/src/molecules/SideLabelRow.doc.ts +35 -0
- package/src/molecules/SideLabelRow.tsx +2 -2
- package/src/molecules/SplitButton.doc.ts +41 -0
- package/src/molecules/SplitButton.tsx +1 -1
- package/src/molecules/StatusButton.doc.ts +39 -0
- package/src/molecules/TagSelect.doc.ts +41 -0
- package/src/molecules/TagSelect.tsx +5 -5
- package/src/molecules/ToggleGrid.doc.ts +43 -0
- package/src/molecules/TokenTextField.doc.ts +41 -0
- package/src/molecules/TransferLayout.doc.ts +42 -0
- package/src/molecules/TransferLayout.tsx +2 -3
- package/src/molecules/TreeOptions.doc.ts +38 -0
- package/src/molecules/TreeOptions.tsx +6 -6
- package/src/organisms/ChipListAddPopover.doc.ts +54 -0
- package/src/organisms/HourOfDayRow.doc.ts +43 -0
- package/src/organisms/HourOfDayRow.tsx +1 -1
- package/src/organisms/HourOfWeekGrid.doc.ts +48 -0
- package/src/organisms/HourOfWeekGrid.tsx +1 -1
- package/src/organisms/RepeatableList.doc.ts +49 -0
- package/src/organisms/ResizableDrawer.doc.ts +48 -0
- package/src/organisms/RuleGroups.doc.ts +49 -0
- package/src/organisms/RuleGroups.tsx +3 -3
- package/src/organisms/RuleList.doc.ts +43 -0
- package/src/organisms/SearchableGroupedList.doc.ts +49 -0
- package/src/organisms/SearchableGroupedList.tsx +2 -2
- package/src/organisms/TokenPickerDialog.doc.ts +54 -0
- package/src/organisms/TransferPicker.doc.ts +69 -0
- package/src/organisms/TransferPicker.tsx +3 -3
- package/src/organisms/TreeSearchPanel.doc.ts +43 -0
- package/src/organisms/TreeSearchPanel.tsx +1 -1
- package/src/organisms/TreeSelect.doc.ts +56 -0
- package/src/organisms/TreeSelect.tsx +4 -4
- package/src/theme/AntsomiTheme.doc.ts +23 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for HoverSwap. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Layout",
|
|
6
|
+
keywords: ["hover", "actions", "focus", "row"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Share one position between resting content and row actions shown on hover or focus. Use permanent end content when the action should always be visible.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Put stylex.defaultMarker() on the ancestor row so hover and focus-within reach both layers.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not assume the transparent layer is removed from the tab order or the accessibility tree.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
anatomy: [
|
|
23
|
+
{
|
|
24
|
+
name: "Resting layer",
|
|
25
|
+
required: false,
|
|
26
|
+
description: "children is visible at rest.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Action layer",
|
|
30
|
+
required: true,
|
|
31
|
+
description:
|
|
32
|
+
"hoverContent occupies the same grid cell and appears on ancestor hover or focus.",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
accessibility: [
|
|
37
|
+
"Controls in the transparent action layer remain tabbable; focusing within the marked row reveals them.",
|
|
38
|
+
],
|
|
39
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for InfoTip. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Feedback",
|
|
6
|
+
keywords: ["help", "tooltip", "warning", "explanation"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Put a short supplementary explanation beside a control or value. Use visible error text for a problem the user must act on.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Supply a translated label explaining the nearby value; choose error tone for a warning glyph.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description: "Do not put essential instructions only in a tooltip.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
anatomy: [
|
|
22
|
+
{
|
|
23
|
+
name: "Glyph",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "An info icon, or a warning icon in error tone.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Tooltip",
|
|
29
|
+
required: false,
|
|
30
|
+
description: "The explanation supplied by label, shown on hover or keyboard focus.",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
accessibility: [
|
|
35
|
+
"Tab reaches the icon's wrapper, named by label, and focus opens the tooltip. Keep essential instructions visible outside it.",
|
|
36
|
+
],
|
|
37
|
+
} satisfies ComponentDoc;
|
package/src/atoms/InfoTip.tsx
CHANGED
|
@@ -16,8 +16,8 @@ export type InfoTipProps = {
|
|
|
16
16
|
export function InfoTip({ label, tone = "info" }: InfoTipProps): ReactNode {
|
|
17
17
|
const isError = tone === "error";
|
|
18
18
|
return (
|
|
19
|
-
<Tooltip content={label}>
|
|
20
|
-
<Text as="span" color="accent" aria-label={label} xstyle={styles.info}>
|
|
19
|
+
<Tooltip content={label} focusTrigger="always">
|
|
20
|
+
<Text as="span" tabIndex={0} color="accent" aria-label={label} xstyle={styles.info}>
|
|
21
21
|
<Icon icon={isError ? "warning" : "info"} size="xsm" {...(isError && { color: "error" })} />
|
|
22
22
|
</Text>
|
|
23
23
|
</Tooltip>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for JointLabel. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Data display",
|
|
6
|
+
keywords: ["joint", "and", "or", "rows"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Show a short connecting word between related rows. Use LabeledDivider when alternatives need a horizontal rule.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Pass the translated word in normal case and use width to align neighboring joints.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not encode rule evaluation in this label; the host owns the meaning and data.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for LabeledDivider. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Layout",
|
|
6
|
+
keywords: ["separator", "divider", "alternatives", "rule"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Separate two blocks with a dashed line and a short joining word. Use JointLabel for a compact word without the rule.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Keep label short and use case to control capitalization without changing the translated text.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description: "Do not use the divider as an interactive control.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
anatomy: [
|
|
22
|
+
{
|
|
23
|
+
name: "Rules",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "Dashed lines extend on both sides of the word.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Joint word",
|
|
29
|
+
required: true,
|
|
30
|
+
description: "The centered label explains the relationship between blocks.",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
accessibility: ["The wrapper is a horizontal separator named by label."],
|
|
35
|
+
} satisfies ComponentDoc;
|
|
@@ -7,7 +7,7 @@ import type { ReactNode } from "react";
|
|
|
7
7
|
export type LabeledDividerProps = {
|
|
8
8
|
/** The short word on the rule, such as "or"; it also names the separator. */
|
|
9
9
|
readonly label: string;
|
|
10
|
-
/** `sentence` (default) shows the word as given; `upper` in capitals, as
|
|
10
|
+
/** `sentence` (default) shows the word as given; `upper` in capitals, such as "OR". */
|
|
11
11
|
readonly case?: "sentence" | "upper" | undefined;
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for LogoImage. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Data display",
|
|
6
|
+
keywords: ["logo", "avatar", "image", "fallback"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Show a decorative logo or avatar beside content that already names it. A skeleton reserves its box until loading finishes, and fallback replaces a failed image.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Supply a fallback appropriate to the surrounding control and match size to its reserved box.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not use this decorative image to carry information that is absent from adjacent text.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
anatomy: [
|
|
23
|
+
{
|
|
24
|
+
name: "Image",
|
|
25
|
+
required: false,
|
|
26
|
+
description:
|
|
27
|
+
"A lazy-loaded image in the requested square or round box, until a load failure replaces it.",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Loading placeholder",
|
|
31
|
+
required: false,
|
|
32
|
+
description: "A matching skeleton while the image loads.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Fallback",
|
|
36
|
+
required: false,
|
|
37
|
+
description: "Host content shown instead of the image after a load failure.",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
accessibility: ["The image has an empty alt attribute; provide the identifying text elsewhere."],
|
|
42
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for PanelSearchInput. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Inputs",
|
|
6
|
+
keywords: ["search", "query", "panel", "clear"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Place a controlled search row at the top of a dropdown panel. Use SearchableGroupedList when filtering and grouped results should be composed for you.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Supply label and labels.clear, and update value on each onChange; add a Divider below when separating results.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not expect the input to filter data itself or provide disabled and read-only modes.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
anatomy: [
|
|
23
|
+
{
|
|
24
|
+
name: "Search glyph",
|
|
25
|
+
required: true,
|
|
26
|
+
description: "A magnifier at the start or end of the row.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Input",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "The controlled text query.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Clear button",
|
|
35
|
+
required: false,
|
|
36
|
+
description: "Clears a nonempty query and restores focus to the input.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
accessibility: ["The input is named by label and the clear button by labels.clear."],
|
|
41
|
+
} satisfies ComponentDoc;
|
|
@@ -28,7 +28,7 @@ export type PanelSearchInputProps = {
|
|
|
28
28
|
/** The clear button's name, such as "Clear search"; it shows only an icon. */
|
|
29
29
|
readonly clear: string;
|
|
30
30
|
};
|
|
31
|
-
/** Where the magnifier sits: `start` (default) or `end`, after the clear button
|
|
31
|
+
/** Where the magnifier sits: `start` (default) or `end`, after the clear button. */
|
|
32
32
|
readonly iconPosition?: "start" | "end" | undefined;
|
|
33
33
|
/** The input element, to focus it (with `useFocusLater` in a pop-over, say). */
|
|
34
34
|
readonly ref?: Ref<HTMLInputElement> | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for PathMark. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Layout",
|
|
6
|
+
keywords: ["path", "reveal", "focus", "form"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Mark controls so revealPath can scroll to and focus the value associated with a data path. Nested marks interpret their paths relative to the enclosing mark.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Wrap the controls of the value and use a relative path inside another PathMark.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description: "Do not expect PathMark to render a visual frame or provide a control label.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
accessibility: [
|
|
23
|
+
"Keep accessible names on the wrapped controls; PathMark only carries their path for revealPath.",
|
|
24
|
+
],
|
|
25
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for RemoveButton. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Inputs",
|
|
6
|
+
keywords: ["remove", "button", "row", "delete"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Offer an icon-only action to remove the surrounding row or item. Use TextAction for a removal that should have a visible text caption.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Name what will be removed through label and perform the data change in onClick.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not use isDisabled for a read-only presentation when isReadOnly should hide the removal affordance.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
accessibility: [
|
|
24
|
+
"label names the icon-only button; include the item or row being removed when needed to distinguish actions.",
|
|
25
|
+
],
|
|
26
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for RowSkeletons. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Feedback",
|
|
6
|
+
keywords: ["loading", "skeleton", "rows", "tiles"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Stand in for options, checkbox rows or framed picks while data loads. Use ChipSkeletons for compact picked values and FieldSkeleton for a field.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Match layout, variant, count and hasIcon to the content that will replace the placeholder.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not create multiple loading statuses inside one named load; use hasStatus=false for nested placeholders.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
anatomy: [
|
|
23
|
+
{
|
|
24
|
+
name: "Text bars",
|
|
25
|
+
required: true,
|
|
26
|
+
description: "Varied shimmer widths stand in for row or tile labels.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Leading shape",
|
|
30
|
+
required: false,
|
|
31
|
+
description: "An icon placeholder or checkbox shape when requested.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "End bar",
|
|
35
|
+
required: false,
|
|
36
|
+
description: "A short trailing value in check and framed variants.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
accessibility: [
|
|
41
|
+
"By default the wrapper has role status, named through labels.loading; hasStatus=false hides it from assistive technology.",
|
|
42
|
+
],
|
|
43
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for TextAction. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Inputs",
|
|
6
|
+
keywords: ["action", "text", "button", "chevron"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Offer a quiet action styled as bold accent text, optionally with an icon or menu chevron. Use AddButton for an add action with the kit's plus glyph.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Pass label in normal case and let case control its appearance; omit onClick when a Popover wrapper owns activation.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description: "Do not treat this action as navigation; it renders a button without an href.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
anatomy: [
|
|
22
|
+
{
|
|
23
|
+
name: "Label",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "The translated action text.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Leading icon",
|
|
29
|
+
required: false,
|
|
30
|
+
description: "Host-supplied content before the label.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Chevron",
|
|
34
|
+
required: false,
|
|
35
|
+
description: "An indicator for an action that opens a menu.",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
accessibility: ["The text supplies the button's accessible name."],
|
|
40
|
+
} satisfies ComponentDoc;
|
package/src/atoms/TextAction.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export type TextActionProps = {
|
|
|
10
10
|
readonly label: string;
|
|
11
11
|
/** A glyph before the text, in the text's colour, such as an Astryx `Icon` of a bin for a removal. */
|
|
12
12
|
readonly icon?: ReactNode;
|
|
13
|
-
/** `upper` (default) shows the label in capitals, as
|
|
13
|
+
/** `upper` (default) shows the label in capitals, such as "REMOVE ALL"; `sentence` as given. */
|
|
14
14
|
readonly case?: "upper" | "sentence" | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Called when it is pressed. Leave it out when a wrapper handles the presses, such as an Astryx
|
|
@@ -24,8 +24,8 @@ export type TextActionProps = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* An action drawn as text alone: bold capitals in the accent, no frame, as
|
|
28
|
-
* and "CREATE NEW … ▾", or in sentence case with a glyph before it
|
|
27
|
+
* An action drawn as text alone: bold capitals in the accent, no frame, such as "REMOVE ALL"
|
|
28
|
+
* and "CREATE NEW … ▾", or in sentence case with a glyph before it
|
|
29
29
|
* (a bin, then "Remove"). An Astryx `Link` without an `href`, so a `<button>` in a link's look, with
|
|
30
30
|
* a down chevron after the text when it opens a menu; still a button without `onClick`, so it can
|
|
31
31
|
* be a `Popover`'s trigger. It holds no state.
|
|
@@ -54,7 +54,7 @@ export function TextAction({
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const styles = stylex.create({
|
|
57
|
-
// Capitals are a look, not text, so translations stay in normal case.
|
|
57
|
+
// Capitals are a look, not text, so translations stay in normal case. Text actions have
|
|
58
58
|
// no underline, not even on hover (Astryx's Link adds one). The theme styles no link, so this
|
|
59
59
|
// sets what nothing else does.
|
|
60
60
|
action: { whiteSpace: "nowrap", textDecoration: "none" },
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for TruncatedOption. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Selection",
|
|
6
|
+
keywords: ["option", "ellipsis", "select", "label"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Render a Selector option with a one-line label and a tooltip when it is cut. Use TruncatedText for plain text outside an option.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Provide a recognizable option label; an absent label falls back to option.value.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description: "Do not expect this presentation view to own selection or open a list.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
anatomy: [
|
|
22
|
+
{
|
|
23
|
+
name: "Label",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "The option label, or its value, rendered through TruncatedText.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Icon",
|
|
29
|
+
required: false,
|
|
30
|
+
description: "The option's supplied icon.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Description",
|
|
34
|
+
required: false,
|
|
35
|
+
description: "Supporting option text rendered by SelectorOption.",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
} satisfies ComponentDoc;
|
|
@@ -11,7 +11,7 @@ export type TruncatedOptionProps = {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A Selector option whose label ends in an ellipsis when it is wider than the pop-up, with the
|
|
14
|
-
* whole label in a tooltip on hover
|
|
14
|
+
* whole label in a tooltip on hover. Its icon and description show as the
|
|
15
15
|
* Selector's own option's. It holds no state.
|
|
16
16
|
*/
|
|
17
17
|
export function TruncatedOption({ option }: TruncatedOptionProps): ReactNode {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for TruncatedText. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Data display",
|
|
6
|
+
keywords: ["text", "ellipsis", "tooltip", "overflow"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Keep a value on one line within the space its parent supplies. Astryx Text shows the whole label in a tooltip when the text is cut.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description: "Give the parent a constrained width so truncation has a useful boundary.",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
guidance: false,
|
|
17
|
+
description:
|
|
18
|
+
"Do not use error tone as the only explanation of a problem; provide the reason nearby.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const text = z.string().trim().min(1);
|
|
4
|
+
|
|
5
|
+
/** Structured guidance beside a view; its props and examples come from TypeScript and stories. */
|
|
6
|
+
export const componentDocSchema = z.object({
|
|
7
|
+
category: z
|
|
8
|
+
.enum(["Inputs", "Selection", "Feedback", "Layout", "Data display", "Overlays", "Theme"])
|
|
9
|
+
.describe(
|
|
10
|
+
"The view's purpose: Inputs edits values; Selection chooses options; Feedback communicates status; Layout arranges content; Data display presents values; Overlays shows dialogs or panels; Theme provides visual tokens and icons.",
|
|
11
|
+
),
|
|
12
|
+
keywords: z.array(text).min(3).describe("At least three search terms for the view."),
|
|
13
|
+
related: z
|
|
14
|
+
.array(
|
|
15
|
+
z.object({
|
|
16
|
+
name: text.describe("A kit view or Astryx facade module, such as astryx/Badge."),
|
|
17
|
+
when: text.describe("When to choose this alternative."),
|
|
18
|
+
}),
|
|
19
|
+
)
|
|
20
|
+
.min(1)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe(
|
|
23
|
+
"Alternatives, validated against public views and facade modules during docs generation.",
|
|
24
|
+
),
|
|
25
|
+
example: text
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("The existing story export shown first, validated during docs generation."),
|
|
28
|
+
usage: z
|
|
29
|
+
.object({
|
|
30
|
+
description: text.describe("When and how to use the view."),
|
|
31
|
+
bestPractices: z
|
|
32
|
+
.array(
|
|
33
|
+
z.object({
|
|
34
|
+
guidance: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.describe("True for a recommended practice; false for a practice to avoid."),
|
|
37
|
+
description: text.describe("The practice and its reason."),
|
|
38
|
+
}),
|
|
39
|
+
)
|
|
40
|
+
.min(2)
|
|
41
|
+
.refine(
|
|
42
|
+
(items) => items.some((item) => item.guidance) && items.some((item) => !item.guidance),
|
|
43
|
+
"Include a recommended practice and a practice to avoid.",
|
|
44
|
+
)
|
|
45
|
+
.describe("Recommended practices and practices to avoid."),
|
|
46
|
+
anatomy: z
|
|
47
|
+
.array(
|
|
48
|
+
z.object({
|
|
49
|
+
name: text.describe("The part's name."),
|
|
50
|
+
required: z.boolean().describe("Whether this part is always present."),
|
|
51
|
+
description: text.describe("The part's purpose and the condition when it appears."),
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
.min(1)
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("The view's visible and interactive parts."),
|
|
57
|
+
})
|
|
58
|
+
.describe("Usage, best practices and optional anatomy."),
|
|
59
|
+
accessibility: z
|
|
60
|
+
.array(text)
|
|
61
|
+
.min(1)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe("Accessible naming and interaction guidance."),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/** Authoring contract for a view's `<View>.doc.ts` export. */
|
|
67
|
+
export type ComponentDoc = z.input<typeof componentDocSchema>;
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { PathMark, type PathMarkProps, useEnclosingPath } from "./atoms/PathMark
|
|
|
15
15
|
export { RowSkeletons, type RowSkeletonsProps } from "./atoms/RowSkeletons";
|
|
16
16
|
export { TextAction, type TextActionProps } from "./atoms/TextAction";
|
|
17
17
|
export { TruncatedText, type TruncatedTextProps } from "./atoms/TruncatedText";
|
|
18
|
+
export { TruncatedOption, type TruncatedOptionProps } from "./atoms/TruncatedOption";
|
|
18
19
|
export { AccentCard, type AccentCardProps } from "./molecules/AccentCard";
|
|
19
20
|
export { ChoiceDialog, type ChoiceDialogProps } from "./molecules/ChoiceDialog";
|
|
20
21
|
export { type ChoiceTile, ChoiceTiles, type ChoiceTilesProps } from "./molecules/ChoiceTiles";
|
|
@@ -117,3 +118,4 @@ export { HourOfDayRow, type HourOfDayRowProps } from "./organisms/HourOfDayRow";
|
|
|
117
118
|
export { HourOfWeekGrid, type HourOfWeekGridProps } from "./organisms/HourOfWeekGrid";
|
|
118
119
|
export { ResizableDrawer, type ResizableDrawerProps } from "./organisms/ResizableDrawer";
|
|
119
120
|
export { TreeSelect, type TreeSelectItem, type TreeSelectProps } from "./organisms/TreeSelect";
|
|
121
|
+
export { TreeSearchPanel, type TreeSearchPanelProps } from "./organisms/TreeSearchPanel";
|
package/src/lib/useLoadMore.ts
CHANGED
|
@@ -14,8 +14,7 @@ export type LoadMoreOptions = {
|
|
|
14
14
|
readonly itemCount: number;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
// (UITargetUpdateSegment `index.jsx:719-728`).
|
|
17
|
+
// Load the next page 20px before the list's end so scrolling can continue without a pause.
|
|
19
18
|
const NEAR_END = "0px 0px 20px 0px";
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSpinDelay } from "spin-delay";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* When a loading state shows, for every view of the kit
|
|
4
|
+
* When a loading state shows, for every view of the kit: only after the load has
|
|
5
5
|
* lasted `delay` ms, then for at least `minDuration` ms, so a fast load shows nothing and a slow
|
|
6
6
|
* one never flashes. `delay` matches the antsomi theme's skeleton `animationDelay`.
|
|
7
7
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentDoc } from "../doc/schema";
|
|
2
|
+
|
|
3
|
+
/** Usage guidance for AccentCard. */
|
|
4
|
+
export const doc = {
|
|
5
|
+
category: "Layout",
|
|
6
|
+
keywords: ["card", "header", "rows", "footer"],
|
|
7
|
+
usage: {
|
|
8
|
+
description:
|
|
9
|
+
"Group related rows under a titled header, with an optional close action and footer. Choose stripe or banner to match the surrounding composition.",
|
|
10
|
+
bestPractices: [
|
|
11
|
+
{
|
|
12
|
+
guidance: true,
|
|
13
|
+
description:
|
|
14
|
+
"Provide labels.close with onClose, and disable or make the supplied row controls read-only in the host.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
guidance: false,
|
|
18
|
+
description:
|
|
19
|
+
"Do not expect isDisabled to disable the card's children; it only blocks closing.",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
anatomy: [
|
|
23
|
+
{
|
|
24
|
+
name: "Header",
|
|
25
|
+
required: true,
|
|
26
|
+
description: "The title and optional named close button.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Rows",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "Host content stacked below the header.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Footer",
|
|
35
|
+
required: false,
|
|
36
|
+
description: "Host content separated from the rows by a line.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
accessibility: [
|
|
41
|
+
"The card is a group named by title; labels.close names its optional close button.",
|
|
42
|
+
],
|
|
43
|
+
} satisfies ComponentDoc;
|