@antscorp/ui 0.1.2 → 0.1.4
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 +26 -2
- package/dist/atoms/AddButton.d.ts +3 -6
- package/dist/atoms/Chip.d.ts +2 -5
- package/dist/atoms/Chip.js +1 -1
- package/dist/atoms/InfoTip.js +2 -0
- package/dist/atoms/LabeledDivider.d.ts +1 -1
- package/dist/atoms/PanelSearchInput.d.ts +1 -1
- package/dist/atoms/RemoveButton.d.ts +2 -5
- package/dist/atoms/TextAction.d.ts +5 -6
- package/dist/atoms/TruncatedOption.d.ts +1 -1
- 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/iso.d.ts +2 -2
- package/dist/lib/iso.js +16 -8
- package/dist/lib/tokenEditorExtensions.js +1 -1
- package/dist/lib/useLoadingShown.d.ts +1 -1
- package/dist/molecules/AccentCard.d.ts +2 -3
- package/dist/molecules/AccentCard.js +2 -2
- package/dist/molecules/CheckRow.d.ts +3 -8
- package/dist/molecules/ChoiceTiles.d.ts +1 -1
- package/dist/molecules/ChoiceTiles.js +1 -1
- package/dist/molecules/CommitTextField.d.ts +1 -19
- package/dist/molecules/CommitTextField.js +21 -18
- package/dist/molecules/ConfirmDialog.d.ts +2 -7
- package/dist/molecules/DateTimeInput.d.ts +6 -3
- package/dist/molecules/DateTimeInput.js +82 -73
- package/dist/molecules/FieldGroup.d.ts +1 -1
- package/dist/molecules/FieldRow.d.ts +1 -1
- package/dist/molecules/MetaTable.d.ts +1 -1
- package/dist/molecules/PhoneFrame.d.ts +1 -1
- package/dist/molecules/RemovableRow.d.ts +1 -1
- package/dist/molecules/RemovableRow.js +32 -32
- package/dist/molecules/RevealRadioGroup.d.ts +2 -9
- package/dist/molecules/RevealSwitch.d.ts +2 -7
- package/dist/molecules/Select.d.ts +8 -24
- package/dist/molecules/Select.js +50 -44
- package/dist/molecules/SideLabelRow.d.ts +1 -1
- package/dist/molecules/SplitButton.d.ts +1 -1
- package/dist/molecules/StatusButton.d.ts +2 -7
- package/dist/molecules/TagSelect.d.ts +2 -2
- package/dist/molecules/TransferLayout.d.ts +1 -1
- package/dist/molecules/TreeOptions.d.ts +4 -3
- package/dist/molecules/TreeOptions.js +67 -44
- package/dist/organisms/HourOfDayRow.js +2 -2
- package/dist/organisms/HourOfWeekGrid.js +2 -2
- package/dist/organisms/RuleGroups.d.ts +3 -3
- package/dist/organisms/SearchableGroupedList.d.ts +1 -1
- package/dist/organisms/TransferPicker.d.ts +1 -1
- package/dist/organisms/TreeSearchPanel.js +50 -47
- package/dist/organisms/TreeSelect.d.ts +3 -3
- package/dist/ui.css +1 -1
- package/package.json +36 -19
- package/src/atoms/AddButton.tsx +3 -7
- package/src/atoms/Chip.tsx +7 -9
- package/src/atoms/InfoTip.tsx +2 -2
- package/src/atoms/LabeledDivider.tsx +1 -1
- package/src/atoms/PanelSearchInput.tsx +1 -1
- package/src/atoms/RemoveButton.tsx +2 -6
- package/src/atoms/TextAction.tsx +6 -8
- package/src/atoms/TruncatedOption.tsx +1 -1
- package/src/doc/schema.ts +67 -0
- package/src/index.ts +2 -0
- package/src/lib/iso.ts +15 -3
- package/src/lib/tokenEditorExtensions.ts +1 -1
- package/src/lib/useLoadMore.ts +1 -2
- package/src/lib/useLoadingShown.ts +1 -1
- package/src/molecules/AccentCard.tsx +11 -10
- package/src/molecules/CheckRow.tsx +3 -9
- package/src/molecules/ChoiceTiles.tsx +6 -4
- package/src/molecules/CommitTextField.tsx +15 -20
- package/src/molecules/ConfirmDialog.tsx +2 -8
- package/src/molecules/DateTimeInput.tsx +86 -68
- package/src/molecules/DurationInput.tsx +2 -2
- package/src/molecules/FieldGroup.tsx +1 -1
- package/src/molecules/FieldRow.tsx +1 -1
- package/src/molecules/FrequencyLimitRow.tsx +1 -1
- package/src/molecules/MetaTable.tsx +1 -1
- package/src/molecules/PhoneFrame.tsx +2 -2
- package/src/molecules/RemovableRow.tsx +3 -3
- package/src/molecules/RevealRadioGroup.tsx +5 -10
- package/src/molecules/RevealSwitch.tsx +2 -8
- package/src/molecules/Select.tsx +23 -23
- package/src/molecules/SideLabelRow.tsx +2 -2
- package/src/molecules/SplitButton.tsx +1 -1
- package/src/molecules/StatusButton.tsx +2 -8
- package/src/molecules/TagSelect.tsx +5 -5
- package/src/molecules/TransferLayout.tsx +2 -3
- package/src/molecules/TreeOptions.tsx +89 -65
- package/src/organisms/HourOfDayRow.tsx +5 -3
- package/src/organisms/HourOfWeekGrid.tsx +5 -3
- package/src/organisms/RuleGroups.tsx +3 -3
- package/src/organisms/SearchableGroupedList.tsx +2 -2
- package/src/organisms/TransferPicker.tsx +3 -3
- package/src/organisms/TreeSearchPanel.tsx +2 -2
- package/src/organisms/TreeSelect.tsx +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { PathMark, type PathMarkProps, useEnclosingPath } from "./atoms/PathMark
|
|
|
15
15
|
export { RowSkeletons, type RowSkeletonsProps } from "./atoms/RowSkeletons.js";
|
|
16
16
|
export { TextAction, type TextActionProps } from "./atoms/TextAction.js";
|
|
17
17
|
export { TruncatedText, type TruncatedTextProps } from "./atoms/TruncatedText.js";
|
|
18
|
+
export { TruncatedOption, type TruncatedOptionProps } from "./atoms/TruncatedOption.js";
|
|
18
19
|
export { AccentCard, type AccentCardProps } from "./molecules/AccentCard.js";
|
|
19
20
|
export { ChoiceDialog, type ChoiceDialogProps } from "./molecules/ChoiceDialog.js";
|
|
20
21
|
export { type ChoiceTile, ChoiceTiles, type ChoiceTilesProps } from "./molecules/ChoiceTiles.js";
|
|
@@ -66,3 +67,4 @@ export { HourOfDayRow, type HourOfDayRowProps } from "./organisms/HourOfDayRow.j
|
|
|
66
67
|
export { HourOfWeekGrid, type HourOfWeekGridProps } from "./organisms/HourOfWeekGrid.js";
|
|
67
68
|
export { ResizableDrawer, type ResizableDrawerProps } from "./organisms/ResizableDrawer.js";
|
|
68
69
|
export { TreeSelect, type TreeSelectItem, type TreeSelectProps } from "./organisms/TreeSelect.js";
|
|
70
|
+
export { TreeSearchPanel, type TreeSearchPanelProps } from "./organisms/TreeSearchPanel.js";
|
package/dist/index.js
CHANGED
|
@@ -16,54 +16,56 @@ import { PathMark as y, useEnclosingPath as b } from "./atoms/PathMark.js";
|
|
|
16
16
|
import { RowSkeletons as x } from "./atoms/RowSkeletons.js";
|
|
17
17
|
import { TextAction as S } from "./atoms/TextAction.js";
|
|
18
18
|
import { TruncatedText as C } from "./atoms/TruncatedText.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
|
|
19
|
+
import { TruncatedOption as w } from "./atoms/TruncatedOption.js";
|
|
20
|
+
import { AccentCard as T } from "./molecules/AccentCard.js";
|
|
21
|
+
import { RevealRadioGroup as E } from "./molecules/RevealRadioGroup.js";
|
|
22
|
+
import { ChoiceDialog as D } from "./molecules/ChoiceDialog.js";
|
|
23
|
+
import { ChoiceTiles as O } from "./molecules/ChoiceTiles.js";
|
|
24
|
+
import { errorStatus as k } from "./lib/errorStatus.js";
|
|
25
|
+
import { tokenLength as A } from "./lib/tokenLength.js";
|
|
26
|
+
import { fitToMaxLength as j } from "./lib/fitToMaxLength.js";
|
|
27
|
+
import { useDraft as M } from "./lib/useDraft.js";
|
|
28
|
+
import { CommitTextField as N } from "./molecules/CommitTextField.js";
|
|
29
|
+
import { FieldSkeleton as P } from "./molecules/FieldSkeleton.js";
|
|
30
|
+
import { TokenTextField as F } from "./molecules/TokenTextField.js";
|
|
31
|
+
import { TreeOptions as I } from "./molecules/TreeOptions.js";
|
|
32
|
+
import { LoadMoreRow as L } from "./molecules/LoadMoreRow.js";
|
|
33
|
+
import { TreeSearchPanel as R } from "./organisms/TreeSearchPanel.js";
|
|
34
|
+
import { TreeSelect as z } from "./organisms/TreeSelect.js";
|
|
35
|
+
import { TokenPickerDialog as B } from "./organisms/TokenPickerDialog.js";
|
|
36
|
+
import { ConfirmDialog as V } from "./molecules/ConfirmDialog.js";
|
|
37
|
+
import { dateValue as H, timeValue as U } from "./lib/iso.js";
|
|
38
|
+
import { FieldGroup as W } from "./molecules/FieldGroup.js";
|
|
39
|
+
import { DateTimeInput as G } from "./molecules/DateTimeInput.js";
|
|
40
|
+
import { DurationInput as K } from "./molecules/DurationInput.js";
|
|
41
|
+
import { FieldRow as q } from "./molecules/FieldRow.js";
|
|
42
|
+
import { PercentRow as J } from "./molecules/PercentRow.js";
|
|
43
|
+
import { PhoneFrame as Y } from "./molecules/PhoneFrame.js";
|
|
44
|
+
import { ProblemsButton as X } from "./molecules/ProblemsButton.js";
|
|
45
|
+
import { RemovableRow as Z } from "./molecules/RemovableRow.js";
|
|
46
|
+
import { RevealSwitch as Q } from "./molecules/RevealSwitch.js";
|
|
47
|
+
import { RuleRow as $ } from "./molecules/RuleRow.js";
|
|
48
|
+
import { Select as ee } from "./molecules/Select.js";
|
|
49
|
+
import { SideLabelRow as te } from "./molecules/SideLabelRow.js";
|
|
50
|
+
import { CheckRow as ne } from "./molecules/CheckRow.js";
|
|
51
|
+
import { MetaTable as re } from "./molecules/MetaTable.js";
|
|
52
|
+
import { TransferLayout as ie } from "./molecules/TransferLayout.js";
|
|
53
|
+
import { CheckGroup as ae } from "./molecules/CheckGroup.js";
|
|
54
|
+
import { FrequencyLimitRow as oe } from "./molecules/FrequencyLimitRow.js";
|
|
55
|
+
import { InlineEditableText as se } from "./molecules/InlineEditableText.js";
|
|
56
|
+
import { LoadState as ce } from "./molecules/LoadState.js";
|
|
57
|
+
import { SplitButton as le } from "./molecules/SplitButton.js";
|
|
58
|
+
import { StatusButton as ue } from "./molecules/StatusButton.js";
|
|
59
|
+
import { TagSelect as de } from "./molecules/TagSelect.js";
|
|
60
|
+
import { ToggleGrid as fe } from "./molecules/ToggleGrid.js";
|
|
61
|
+
import { useConfirmedChange as pe } from "./lib/useConfirmedChange.js";
|
|
62
|
+
import { RepeatableList as me } from "./organisms/RepeatableList.js";
|
|
63
|
+
import { RuleGroups as he } from "./organisms/RuleGroups.js";
|
|
64
|
+
import { RuleList as ge } from "./organisms/RuleList.js";
|
|
65
|
+
import { SearchableGroupedList as _e } from "./organisms/SearchableGroupedList.js";
|
|
66
|
+
import { TransferPicker as ve } from "./organisms/TransferPicker.js";
|
|
67
|
+
import { ChipListAddPopover as ye } from "./organisms/ChipListAddPopover.js";
|
|
68
|
+
import { HourOfDayRow as be } from "./organisms/HourOfDayRow.js";
|
|
69
|
+
import { HourOfWeekGrid as xe } from "./organisms/HourOfWeekGrid.js";
|
|
70
|
+
import { ResizableDrawer as Se } from "./organisms/ResizableDrawer.js";
|
|
71
|
+
export { T as AccentCard, n as AddButton, t as AddGlyph, e as AntsomiTheme, ae as CheckGroup, ne as CheckRow, i as Chip, ye as ChipListAddPopover, l as ChipSkeletons, D as ChoiceDialog, O as ChoiceTiles, N as CommitTextField, V as ConfirmDialog, G as DateTimeInput, K as DurationInput, p as FIELD_PATH_ATTRIBUTE, W as FieldGroup, s as FieldHeading, q as FieldRow, P as FieldSkeleton, oe as FrequencyLimitRow, be as HourOfDayRow, xe as HourOfWeekGrid, a as HoverSwap, o as InfoTip, se as InlineEditableText, c as JointLabel, u as LabeledDivider, L as LoadMoreRow, ce as LoadState, f as LogoImage, re as MetaTable, d as PanelSearchInput, y as PathMark, m as PathRevealContext, J as PercentRow, Y as PhoneFrame, X as ProblemsButton, Z as RemovableRow, r as RemoveButton, me as RepeatableList, Se as ResizableDrawer, E as RevealRadioGroup, Q as RevealSwitch, x as RowSkeletons, he as RuleGroups, ge as RuleList, $ as RuleRow, _e as SearchableGroupedList, ee as Select, te as SideLabelRow, le as SplitButton, ue as StatusButton, de as TagSelect, S as TextAction, fe as ToggleGrid, B as TokenPickerDialog, F as TokenTextField, ie as TransferLayout, ve as TransferPicker, I as TreeOptions, R as TreeSearchPanel, z as TreeSelect, w as TruncatedOption, C as TruncatedText, H as dateValue, k as errorStatus, j as fitToMaxLength, h as pathMarkOf, g as revealPath, U as timeValue, A as tokenLength, pe as useConfirmedChange, M as useDraft, b as useEnclosingPath, _ as usePathReveal, v as useRevealedState };
|
package/dist/lib/iso.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { type ISODateString, type ISOTimeString } from "@astryxdesign/core/utils
|
|
|
3
3
|
export declare function timeValue(time: string): {
|
|
4
4
|
readonly value?: ISOTimeString;
|
|
5
5
|
};
|
|
6
|
-
/** Spread into a date input: `{ value }`
|
|
6
|
+
/** Spread into a date input: `{ value }` for a valid calendar date in `YYYY-MM-DD`, `{}` otherwise. */
|
|
7
7
|
export declare function dateValue(date: string): {
|
|
8
8
|
readonly value?: ISODateString;
|
|
9
9
|
};
|
|
10
|
-
/** Spread into a date input: `{ min }`
|
|
10
|
+
/** Spread into a date input: `{ min }` for a valid calendar date in `YYYY-MM-DD`, `{}` otherwise. */
|
|
11
11
|
export declare function minDate(min: string | undefined): {
|
|
12
12
|
readonly min?: ISODateString;
|
|
13
13
|
};
|
package/dist/lib/iso.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { createISOTimeString as e } from "@astryxdesign/core/utils";
|
|
1
|
+
import { createISOTimeString as e, parseISO as t } from "@astryxdesign/core/utils";
|
|
2
2
|
// src/lib/iso.ts
|
|
3
|
-
function
|
|
3
|
+
function n(t) {
|
|
4
4
|
let n = e(t);
|
|
5
5
|
return n === null ? {} : { value: n };
|
|
6
6
|
}
|
|
7
|
-
var
|
|
8
|
-
function r(e) {
|
|
9
|
-
return n(e) ? { value: e } : {};
|
|
10
|
-
}
|
|
7
|
+
var r = (e) => /^\d{4}-\d{2}-\d{2}$/u.test(e);
|
|
11
8
|
function i(e) {
|
|
12
|
-
|
|
9
|
+
if (!r(e)) return !1;
|
|
10
|
+
try {
|
|
11
|
+
return t(e), !0;
|
|
12
|
+
} catch {
|
|
13
|
+
return !1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
return i(e) ? { value: e } : {};
|
|
18
|
+
}
|
|
19
|
+
function o(e) {
|
|
20
|
+
return e !== void 0 && i(e) ? { min: e } : {};
|
|
13
21
|
}
|
|
14
|
-
export {
|
|
22
|
+
export { a as dateValue, o as minDate, n as timeValue };
|
|
@@ -187,7 +187,7 @@ var h = r.theme({
|
|
|
187
187
|
font: "inherit",
|
|
188
188
|
fontSize: "12px",
|
|
189
189
|
borderRadius: "50%",
|
|
190
|
-
color: "var(--
|
|
190
|
+
color: "var(--color-icon-accent)",
|
|
191
191
|
cursor: "pointer"
|
|
192
192
|
},
|
|
193
193
|
".cm-token:hover .cm-token-remove, .cm-token:focus-within .cm-token-remove": { opacity: "1" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* When a loading state shows, for every view of the kit
|
|
2
|
+
* When a loading state shows, for every view of the kit: only after the load has
|
|
3
3
|
* lasted `delay` ms, then for at least `minDuration` ms, so a fast load shows nothing and a slow
|
|
4
4
|
* one never flashes. `delay` matches the antsomi theme's skeleton `animationDelay`.
|
|
5
5
|
*/
|
|
@@ -21,9 +21,8 @@ export type AccentCardProps = {
|
|
|
21
21
|
readonly isDisabled?: boolean | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* `stripe` (default): a grey border with an accent stripe down the start edge and a light
|
|
24
|
-
* header bar
|
|
25
|
-
* under a dark blue header bar with the title in white capitals and a white close cross
|
|
26
|
-
* fe-app's audience picker.
|
|
24
|
+
* header bar. `banner`: no border nor stripe but a soft shadow,
|
|
25
|
+
* under a dark blue header bar with the title in white capitals and a white close cross.
|
|
27
26
|
*/
|
|
28
27
|
readonly variant?: "stripe" | "banner" | undefined;
|
|
29
28
|
};
|
|
@@ -41,7 +41,7 @@ function u(u) {
|
|
|
41
41
|
}) : /* @__PURE__ */ n(e, {
|
|
42
42
|
label: p,
|
|
43
43
|
size: "sm",
|
|
44
|
-
isDisabled: u.isDisabled,
|
|
44
|
+
isDisabled: u.isDisabled ?? !1,
|
|
45
45
|
onClick: u.onClose
|
|
46
46
|
})), f[9] = p, f[10] = h, f[11] = m, f[12] = u.isDisabled, f[13] = u.onClose, f[14] = S) : S = f[14];
|
|
47
47
|
let C;
|
|
@@ -95,7 +95,7 @@ var d = {
|
|
|
95
95
|
$$css: !0
|
|
96
96
|
},
|
|
97
97
|
banner: {
|
|
98
|
-
kWkggS: "
|
|
98
|
+
kWkggS: "aui1jxocwm",
|
|
99
99
|
kMwMTN: "aui17wrial",
|
|
100
100
|
kP9fke: "auitvhhri",
|
|
101
101
|
$$css: !0
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { type CheckboxInputProps } from "@astryxdesign/core/CheckboxInput";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
/** What `CheckRow` takes. */
|
|
3
|
-
export type CheckRowProps = {
|
|
4
|
-
/** The row's text and the checkbox's name; one line, the whole text in a tooltip when cut. */
|
|
5
|
-
readonly label: string;
|
|
4
|
+
export type CheckRowProps = Pick<CheckboxInputProps, "label" | "isDisabled" | "isReadOnly"> & {
|
|
6
5
|
/** A second line under the text, such as an id under a name; one line too. */
|
|
7
6
|
readonly description?: string | undefined;
|
|
8
7
|
/** Whether the box is ticked. */
|
|
@@ -16,16 +15,12 @@ export type CheckRowProps = {
|
|
|
16
15
|
* link to the item; the two share one place, so nothing moves. None without it.
|
|
17
16
|
*/
|
|
18
17
|
readonly hoverContent?: ReactNode;
|
|
19
|
-
/** Dims the box and blocks it; nothing is hidden. */
|
|
20
|
-
readonly isDisabled?: boolean | undefined;
|
|
21
|
-
/** Shows the box's state, not dimmed, and blocks it. */
|
|
22
|
-
readonly isReadOnly?: boolean | undefined;
|
|
23
18
|
};
|
|
24
19
|
/**
|
|
25
20
|
* One row of a list to tick: a checkbox (md, as every checkbox), the row's text on one line (and
|
|
26
21
|
* an optional second line), and content at its end that `hoverContent` replaces while the row is
|
|
27
22
|
* hovered or focused. The box is the control and is named by the text; the text itself is not a
|
|
28
|
-
* click target
|
|
23
|
+
* click target. As high as a small control, so `RowSkeletons variant="check"`
|
|
29
24
|
* stands in for it without a shift. It holds no state.
|
|
30
25
|
*/
|
|
31
26
|
export declare function CheckRow(props: CheckRowProps): ReactNode;
|
|
@@ -22,7 +22,7 @@ export type ChoiceTilesProps<V extends string> = {
|
|
|
22
22
|
readonly isDisabled?: boolean | undefined;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
* A choice among a few ways to go on
|
|
25
|
+
* A choice among a few ways to go on: a wrapping row of 180×170 cards, each
|
|
26
26
|
* a button with its glyph in a soft accent circle, a bold title and a description under it. A pick
|
|
27
27
|
* is an action, not a selected state: the host shows what follows instead. It holds no state.
|
|
28
28
|
*/
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
import { type TextInputProps } from "@astryxdesign/core/TextInput";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
/** What `CommitTextField` takes. */
|
|
4
|
-
export type CommitTextFieldProps = {
|
|
5
|
-
/** The field's label; also its accessible name when hidden. */
|
|
6
|
-
readonly label: string;
|
|
4
|
+
export type CommitTextFieldProps = Pick<TextInputProps, "label" | "isDisabled" | "isReadOnly" | "isLabelHidden" | "placeholder" | "description" | "isRequired" | "width" | "controlXstyle" | "containerXstyle"> & {
|
|
7
5
|
/** The committed text. A new value from outside (an agent, undo) replaces the draft. */
|
|
8
6
|
readonly value: string;
|
|
9
7
|
/** Called with the draft on blur or Enter, only when it differs from `value`. */
|
|
10
8
|
readonly onCommit: (value: string) => void;
|
|
11
9
|
/** The input's height, `md` by default. */
|
|
12
10
|
readonly size?: "sm" | "md";
|
|
13
|
-
/** Dims the field and blocks typing. */
|
|
14
|
-
readonly isDisabled?: boolean;
|
|
15
|
-
/** Shows the text, not dimmed, and blocks typing. */
|
|
16
|
-
readonly isReadOnly?: boolean;
|
|
17
|
-
/** Keeps the label for screen readers only. */
|
|
18
|
-
readonly isLabelHidden?: boolean;
|
|
19
|
-
/** Shown while the field is empty. */
|
|
20
|
-
readonly placeholder?: string;
|
|
21
|
-
/** Help under the label. */
|
|
22
|
-
readonly description?: string;
|
|
23
11
|
/** A problem with the value, already in the user's language. */
|
|
24
12
|
readonly error?: string | undefined;
|
|
25
13
|
/** A text area instead of a single line; Enter then adds a line. */
|
|
26
14
|
readonly isMultiline?: boolean;
|
|
27
15
|
/** For `isMultiline`: how many rows the text area shows, `4` by default. */
|
|
28
16
|
readonly rows?: number;
|
|
29
|
-
/** Marks the field as required. */
|
|
30
|
-
readonly isRequired?: boolean;
|
|
31
17
|
/**
|
|
32
18
|
* `false` (default): after a commit the draft goes back to `value`, so a refused text does not
|
|
33
19
|
* stay in the field. `true` keeps the typed text until `value` changes from outside.
|
|
@@ -37,10 +23,6 @@ export type CommitTextFieldProps = {
|
|
|
37
23
|
readonly maxLength?: number;
|
|
38
24
|
/** Fresh global pattern for whole tokens, counted as one character even in plain text. */
|
|
39
25
|
readonly pattern?: () => RegExp;
|
|
40
|
-
/** For a single line: the field's width, in pixels or any CSS length such as `"100%"`. */
|
|
41
|
-
readonly width?: number | string;
|
|
42
|
-
/** For a single line: StyleX styles for the input's box, e.g. to make it read as plain text. */
|
|
43
|
-
readonly controlXstyle?: TextInputProps["controlXstyle"];
|
|
44
26
|
};
|
|
45
27
|
/**
|
|
46
28
|
* Text that stays a local draft while typing and commits on blur or Enter, so a word typed is one
|
|
@@ -7,7 +7,7 @@ import { TextArea as a } from "@astryxdesign/core/TextArea";
|
|
|
7
7
|
import { TextInput as o } from "@astryxdesign/core/TextInput";
|
|
8
8
|
// src/molecules/CommitTextField.tsx
|
|
9
9
|
function s(s) {
|
|
10
|
-
let c = r(
|
|
10
|
+
let c = r(46), { value: l, onCommit: u, isMultiline: d, error: f, maxLength: p, isDraftKeptOnCommit: m } = s, h = d !== void 0 && d, g = m !== void 0 && m, _;
|
|
11
11
|
c[0] === u ? _ = c[1] : (_ = (e) => {
|
|
12
12
|
u(e ?? "");
|
|
13
13
|
}, c[0] = u, c[1] = _);
|
|
@@ -24,9 +24,13 @@ function s(s) {
|
|
|
24
24
|
let j;
|
|
25
25
|
c[14] === s.description ? j = c[15] : (j = s.description === void 0 ? {} : { description: s.description }, c[14] = s.description, c[15] = j);
|
|
26
26
|
let M;
|
|
27
|
-
c[16] ===
|
|
27
|
+
c[16] === s.controlXstyle ? M = c[17] : (M = s.controlXstyle === void 0 ? {} : { controlXstyle: s.controlXstyle }, c[16] = s.controlXstyle, c[17] = M);
|
|
28
28
|
let N;
|
|
29
|
-
c[18]
|
|
29
|
+
c[18] === s.containerXstyle ? N = c[19] : (N = s.containerXstyle === void 0 ? {} : { containerXstyle: s.containerXstyle }, c[18] = s.containerXstyle, c[19] = N);
|
|
30
|
+
let P;
|
|
31
|
+
c[20] === f ? P = c[21] : (P = e(f), c[20] = f, c[21] = P);
|
|
32
|
+
let F;
|
|
33
|
+
c[22] !== S || c[23] !== v || c[24] !== s.label || c[25] !== k || c[26] !== A || c[27] !== j || c[28] !== M || c[29] !== N || c[30] !== P || c[31] !== w || c[32] !== T || c[33] !== E || c[34] !== D || c[35] !== O ? (F = {
|
|
30
34
|
label: C,
|
|
31
35
|
value: v,
|
|
32
36
|
onChange: w,
|
|
@@ -38,26 +42,25 @@ function s(s) {
|
|
|
38
42
|
isRequired: k,
|
|
39
43
|
...A,
|
|
40
44
|
...j,
|
|
41
|
-
...M
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
...M,
|
|
46
|
+
...N,
|
|
47
|
+
...P
|
|
48
|
+
}, c[22] = S, c[23] = v, c[24] = s.label, c[25] = k, c[26] = A, c[27] = j, c[28] = M, c[29] = N, c[30] = P, c[31] = w, c[32] = T, c[33] = E, c[34] = D, c[35] = O, c[36] = F) : F = c[36];
|
|
49
|
+
let I = F;
|
|
44
50
|
if (h) {
|
|
45
51
|
let e = s.rows ?? 4, t;
|
|
46
|
-
return c[
|
|
47
|
-
...
|
|
52
|
+
return c[37] !== I || c[38] !== e ? (t = /* @__PURE__ */ i(a, {
|
|
53
|
+
...I,
|
|
48
54
|
rows: e
|
|
49
|
-
}), c[
|
|
55
|
+
}), c[37] = I, c[38] = e, c[39] = t) : t = c[39], t;
|
|
50
56
|
}
|
|
51
|
-
let F;
|
|
52
|
-
c[34] === s.width ? F = c[35] : (F = s.width === void 0 ? {} : { width: s.width }, c[34] = s.width, c[35] = F);
|
|
53
|
-
let I;
|
|
54
|
-
c[36] === s.controlXstyle ? I = c[37] : (I = s.controlXstyle === void 0 ? {} : { controlXstyle: s.controlXstyle }, c[36] = s.controlXstyle, c[37] = I);
|
|
55
57
|
let L;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
c[40] === s.width ? L = c[41] : (L = s.width === void 0 ? {} : { width: s.width }, c[40] = s.width, c[41] = L);
|
|
59
|
+
let R;
|
|
60
|
+
return c[42] !== S || c[43] !== I || c[44] !== L ? (R = /* @__PURE__ */ i(o, {
|
|
61
|
+
...I,
|
|
58
62
|
onEnter: S,
|
|
59
|
-
...
|
|
60
|
-
|
|
61
|
-
}), c[38] = S, c[39] = P, c[40] = F, c[41] = I, c[42] = L) : L = c[42], L;
|
|
63
|
+
...L
|
|
64
|
+
}), c[42] = S, c[43] = I, c[44] = L, c[45] = R) : R = c[45], R;
|
|
62
65
|
}
|
|
63
66
|
export { s as CommitTextField };
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { type AlertDialogProps } from "@astryxdesign/core/AlertDialog";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
/** What `ConfirmDialog` takes. */
|
|
3
|
-
export type ConfirmDialogProps = {
|
|
4
|
-
/** Open while a change waits for an answer. */
|
|
5
|
-
readonly isOpen: boolean;
|
|
6
|
-
/** The question, e.g. "Remove these rows?". */
|
|
7
|
-
readonly title: string;
|
|
8
|
-
/** What the change does. */
|
|
9
|
-
readonly description: string;
|
|
4
|
+
export type ConfirmDialogProps = Pick<AlertDialogProps, "isOpen" | "title" | "description"> & {
|
|
10
5
|
/** The texts of the two buttons; the host translates them. */
|
|
11
6
|
readonly labels: {
|
|
12
7
|
/** The confirming button, e.g. "Remove". */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type TimeInputProps } from "@astryxdesign/core/TimeInput";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import { type FieldGroupProps } from "./FieldGroup.js";
|
|
3
4
|
/** What `DateTimeInput` takes. */
|
|
4
|
-
export type DateTimeInputProps = Pick<FieldGroupProps, "isDisabled"> & {
|
|
5
|
+
export type DateTimeInputProps = Pick<FieldGroupProps, "isDisabled"> & Pick<TimeInputProps, "hourFormat"> & {
|
|
5
6
|
/** The group's label, e.g. "Start date"; it names the group and is not shown. */
|
|
6
7
|
readonly label: string;
|
|
7
8
|
/** The texts the inputs show; the host translates them. */
|
|
@@ -17,7 +18,7 @@ export type DateTimeInputProps = Pick<FieldGroupProps, "isDisabled"> & {
|
|
|
17
18
|
readonly value: string;
|
|
18
19
|
/** The inputs' size, `md` by default. */
|
|
19
20
|
readonly size?: "sm" | "md" | undefined;
|
|
20
|
-
/** Shows
|
|
21
|
+
/** Shows readable date and time fields at full opacity, without clear or picker actions. */
|
|
21
22
|
readonly isReadOnly?: boolean | undefined;
|
|
22
23
|
/** A problem with the date-time, already in the user's language. */
|
|
23
24
|
readonly error?: string | undefined;
|
|
@@ -36,7 +37,7 @@ export type DateTimeInputProps = Pick<FieldGroupProps, "isDisabled"> & {
|
|
|
36
37
|
readonly isRequired?: boolean;
|
|
37
38
|
/** The time input stays disabled until a date is picked. */
|
|
38
39
|
readonly isTimeLockedWithoutDate?: boolean;
|
|
39
|
-
/** The earliest
|
|
40
|
+
/** The earliest valid calendar date (`YYYY-MM-DD`); an absent or invalid minimum leaves dates unconstrained. */
|
|
40
41
|
readonly min?: string | undefined;
|
|
41
42
|
/** Called with the new date-time; a part not picked yet is empty, a new date starts at 00:00:00. */
|
|
42
43
|
readonly onChange: (value: string) => void;
|
|
@@ -45,5 +46,7 @@ export type DateTimeInputProps = Pick<FieldGroupProps, "isDisabled"> & {
|
|
|
45
46
|
* A date and a time of day under one label. It composes `DateInput` and `TimeInput` rather than
|
|
46
47
|
* using Astryx's `DateTimeInput`, which holds only a complete value: here a date or a time may be
|
|
47
48
|
* set alone while the other is still empty.
|
|
49
|
+
* `hourFormat` defaults to `12h`; choose `24h` for a 24-hour clock. Calendar and clear text use
|
|
50
|
+
* the facade's `InternationalizationProvider`, alongside host-translated `label` and `labels`.
|
|
48
51
|
*/
|
|
49
52
|
export declare function DateTimeInput(props: DateTimeInputProps): ReactNode;
|