@kanso-labs/kanso-ui 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -9
- package/dist/button/context.js +7 -0
- package/dist/button/context.js.map +1 -0
- package/dist/button/group.js +25 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/hooks.js +81 -0
- package/dist/button/hooks.js.map +1 -0
- package/dist/button/index.d.ts +11 -0
- package/dist/button/index.js +273 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button/styles.js +23 -0
- package/dist/button/styles.js.map +1 -0
- package/dist/calendar/index.js +473 -7
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +132 -4
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/index.js +74 -9
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/styles.js +78 -4
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/index.js +12 -9
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/styles.js +21 -2
- package/dist/collection/styles.js.map +1 -1
- package/dist/color-scheme.d.ts +29 -0
- package/dist/color-scheme.js +32 -0
- package/dist/color-scheme.js.map +1 -0
- package/dist/components/avatar/index.js +35 -22
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +40 -0
- package/dist/components/badge/index.js +102 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- package/dist/components/breadcrumbs/index.js +1 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +58 -14
- package/dist/components/button/index.js +400 -147
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +54 -0
- package/dist/components/button-group/index.js +272 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +9 -1
- package/dist/components/calendar/index.js +71 -44
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +4 -4
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.js +15 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +1 -0
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +55 -8
- package/dist/components/chip/index.js +174 -63
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +16 -7
- package/dist/components/chip-group/index.js +58 -35
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-field/index.js +25 -23
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.js +42 -31
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +1 -1
- package/dist/components/color-swatch-picker/index.js +17 -13
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +5 -3
- package/dist/components/combo-box/index.js +63 -58
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +7 -6
- package/dist/components/copy-field/index.js +92 -90
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +8 -7
- package/dist/components/currency/index.js +43 -65
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.js +24 -22
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +10 -2
- package/dist/components/date-picker/index.js +76 -69
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +10 -2
- package/dist/components/date-range-picker/index.js +93 -86
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +1 -1
- package/dist/components/disclosure/index.js +6 -6
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +72 -0
- package/dist/components/fab/index.js +89 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +90 -0
- package/dist/components/fab-menu/index.js +297 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +2 -1
- package/dist/components/feed/index.js +1 -1
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +11 -8
- package/dist/components/icon-button/index.js +244 -181
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +30 -21
- package/dist/components/list/index.d.ts +15 -13
- package/dist/components/list/index.js +60 -61
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +3 -2
- package/dist/components/list-box/index.js +16 -16
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-item/index.js +1 -1
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +3 -2
- package/dist/components/menu/index.js +2 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +50 -0
- package/dist/components/navigation-bar/index.js +129 -0
- package/dist/components/navigation-bar/index.js.map +1 -0
- package/dist/components/navigation-rail/index.d.ts +59 -0
- package/dist/components/navigation-rail/index.js +166 -0
- package/dist/components/navigation-rail/index.js.map +1 -0
- package/dist/components/navigation-tree/index.d.ts +1 -5
- package/dist/components/navigation-tree/index.js +3 -3
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +6 -4
- package/dist/components/number-field/index.js +84 -84
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio-group/index.js +22 -11
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +7 -1
- package/dist/components/range-calendar/index.js +71 -44
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +2 -1
- package/dist/components/search-field/index.js +24 -25
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +79 -0
- package/dist/components/search-view/index.js +255 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -2
- package/dist/components/segmented-button/index.js +60 -31
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +1 -1
- package/dist/components/sheet/index.js +2 -2
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +2 -2
- package/dist/components/snackbar/index.js +28 -13
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/split-button/index.d.ts +83 -0
- package/dist/components/split-button/index.js +341 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/switch/index.js +11 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/table/index.d.ts +11 -9
- package/dist/components/table/index.js +87 -31
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +35 -4
- package/dist/components/tabs/index.js +403 -93
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +1 -1
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +7 -5
- package/dist/components/text-area/index.js +28 -26
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +7 -5
- package/dist/components/text-field/index.js +28 -26
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.js +24 -22
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +7 -9
- package/dist/components/tree/index.js +15 -16
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/index.js.map +1 -1
- package/dist/drag/styles.js +4 -1
- package/dist/drag/styles.js.map +1 -1
- package/dist/fab/styles.js +161 -0
- package/dist/fab/styles.js.map +1 -0
- package/dist/field/index.js +260 -214
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +10 -2
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js +55 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useRipple.js +199 -162
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/hooks/useToggleGroupDisabled.js +24 -0
- package/dist/hooks/useToggleGroupDisabled.js.map +1 -0
- package/dist/i18n/index.js +43 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/messages.js +387 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +31 -21
- package/dist/index.js +25 -16
- package/dist/navigation/context.js +7 -0
- package/dist/navigation/context.js.map +1 -0
- package/dist/navigation/index.d.ts +28 -0
- package/dist/navigation/index.js +96 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/styles.js +312 -0
- package/dist/navigation/styles.js.map +1 -0
- package/dist/react-aria.d.ts +2 -2
- package/dist/react-aria.js +2 -2
- package/dist/render/useRender.js +0 -1
- package/dist/render/useRender.js.map +1 -1
- package/dist/row/styles.js +33 -11
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/icon-button.js +9 -1
- package/dist/styles/icon-button.js.map +1 -1
- package/dist/styles/overlay.js +1 -0
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles/picker.js +1 -1
- package/dist/styles/picker.js.map +1 -1
- package/dist/styles.css +1104 -336
- package/dist/tokens/design.tokens.stylex.js +42 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/dist/tokens.css +166 -53
- package/package.json +9 -5
package/dist/field/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles, mergeStyles } from "../styles/merge.js";
|
|
3
|
+
import { useMessages } from "../i18n/index.js";
|
|
3
4
|
import { useInsideForm } from "./root.js";
|
|
4
5
|
import { fieldChromeStyles, groupStyles } from "./styles.js";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
6
7
|
import { createContext, useContext } from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Button, FieldError, FieldErrorContext, Group, Input, InputContext, Label, SelectStateContext, Text, TextArea, TextAreaContext, TextContext, VisuallyHidden, useSlottedContext } from "react-aria-components";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Button, FieldError, FieldErrorContext, Group, Input, InputContext, Label, SelectStateContext, Text, TextArea, TextAreaContext, TextContext, VisuallyHidden, useLocale, useSlottedContext } from "react-aria-components";
|
|
9
10
|
//#region src/field/index.tsx
|
|
10
11
|
const OUTSIDE_BOX = {
|
|
11
12
|
label: "none",
|
|
@@ -34,10 +35,11 @@ const BOX_CONTROLS = {
|
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
const BoxContext = createContext(OUTSIDE_BOX);
|
|
37
|
-
function boxContent(label, children, floatingLabel, isPopulated, leading, multiline, trailing, trigger, variant) {
|
|
38
|
+
function boxContent(label, children, floatingLabel, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
|
|
38
39
|
return (state) => /* @__PURE__ */ jsx(BoxContent, {
|
|
39
40
|
floatingLabel,
|
|
40
41
|
isPopulated,
|
|
42
|
+
isRequired,
|
|
41
43
|
label,
|
|
42
44
|
leading,
|
|
43
45
|
multiline,
|
|
@@ -56,96 +58,99 @@ function boxContent(label, children, floatingLabel, isPopulated, leading, multil
|
|
|
56
58
|
* for them. See the outlined variant's note above.
|
|
57
59
|
*/
|
|
58
60
|
function BoxContent(t0) {
|
|
59
|
-
const $ = c(
|
|
60
|
-
const { children, floatingLabel, isPopulated, label, leading, multiline, state, trailing, trigger, variant } = t0;
|
|
61
|
+
const $ = c(42);
|
|
62
|
+
const { children, floatingLabel, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
|
|
61
63
|
const read = useFieldPopulated();
|
|
62
64
|
const populated = isPopulated ?? read;
|
|
63
65
|
const outlined = variant === "outlined";
|
|
64
66
|
const floated = !floatingLabel || state.isFocusWithin || populated;
|
|
65
67
|
const t1 = BOX_CONTROLS[variant][floatingLabel ? "floating" : "fixed"];
|
|
66
68
|
let t2;
|
|
67
|
-
if ($[0] !== floated || $[1] !==
|
|
69
|
+
if ($[0] !== floated || $[1] !== isRequired || $[2] !== label || $[3] !== leading || $[4] !== outlined || $[5] !== state.isFocusWithin || $[6] !== trailing) {
|
|
68
70
|
t2 = outlined ? /* @__PURE__ */ jsx("fieldset", {
|
|
69
71
|
"aria-hidden": "true",
|
|
70
72
|
...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, state.isFocusWithin && fieldChromeStyles.outlineFocused),
|
|
71
73
|
children: /* @__PURE__ */ jsx("legend", {
|
|
72
74
|
...props(fieldChromeStyles.outlineNotch, floated && fieldChromeStyles.outlineNotchOpen),
|
|
73
|
-
children: floated ? label : null
|
|
75
|
+
children: floated ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, isRequired ? REQUIRED_MARK : null] }) : null
|
|
74
76
|
})
|
|
75
77
|
}) : null;
|
|
76
78
|
$[0] = floated;
|
|
77
|
-
$[1] =
|
|
78
|
-
$[2] =
|
|
79
|
-
$[3] =
|
|
80
|
-
$[4] =
|
|
81
|
-
$[5] =
|
|
82
|
-
$[6] =
|
|
83
|
-
|
|
79
|
+
$[1] = isRequired;
|
|
80
|
+
$[2] = label;
|
|
81
|
+
$[3] = leading;
|
|
82
|
+
$[4] = outlined;
|
|
83
|
+
$[5] = state.isFocusWithin;
|
|
84
|
+
$[6] = trailing;
|
|
85
|
+
$[7] = t2;
|
|
86
|
+
} else t2 = $[7];
|
|
84
87
|
let t3;
|
|
85
|
-
if ($[
|
|
88
|
+
if ($[8] !== leading || $[9] !== multiline || $[10] !== outlined || $[11] !== state.isDisabled) {
|
|
86
89
|
t3 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
87
90
|
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
88
91
|
children: leading
|
|
89
92
|
});
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
} else t3 = $[
|
|
93
|
+
$[8] = leading;
|
|
94
|
+
$[9] = multiline;
|
|
95
|
+
$[10] = outlined;
|
|
96
|
+
$[11] = state.isDisabled;
|
|
97
|
+
$[12] = t3;
|
|
98
|
+
} else t3 = $[12];
|
|
96
99
|
let t4;
|
|
97
|
-
if ($[
|
|
100
|
+
if ($[13] !== floatingLabel || $[14] !== state.isDisabled) {
|
|
98
101
|
t4 = props(fieldChromeStyles.column, floatingLabel && fieldChromeStyles.columnFloating, state.isDisabled && (floatingLabel ? fieldChromeStyles.columnDisabledFloating : fieldChromeStyles.columnDisabled));
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else t4 = $[
|
|
102
|
+
$[13] = floatingLabel;
|
|
103
|
+
$[14] = state.isDisabled;
|
|
104
|
+
$[15] = t4;
|
|
105
|
+
} else t4 = $[15];
|
|
103
106
|
let t5;
|
|
104
|
-
if ($[
|
|
107
|
+
if ($[16] !== floated || $[17] !== floatingLabel || $[18] !== outlined) {
|
|
105
108
|
t5 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated);
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t5 = $[
|
|
109
|
+
$[16] = floated;
|
|
110
|
+
$[17] = floatingLabel;
|
|
111
|
+
$[18] = outlined;
|
|
112
|
+
$[19] = t5;
|
|
113
|
+
} else t5 = $[19];
|
|
111
114
|
let t6;
|
|
112
|
-
if ($[
|
|
115
|
+
if ($[20] !== isRequired || $[21] !== label || $[22] !== state || $[23] !== t5) {
|
|
113
116
|
t6 = /* @__PURE__ */ jsx(FieldLabel, {
|
|
117
|
+
isRequired,
|
|
114
118
|
state,
|
|
115
119
|
...t5,
|
|
116
120
|
children: label
|
|
117
121
|
});
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
|
|
122
|
+
$[20] = isRequired;
|
|
123
|
+
$[21] = label;
|
|
124
|
+
$[22] = state;
|
|
125
|
+
$[23] = t5;
|
|
126
|
+
$[24] = t6;
|
|
127
|
+
} else t6 = $[24];
|
|
123
128
|
let t7;
|
|
124
|
-
if ($[
|
|
129
|
+
if ($[25] !== children || $[26] !== t4 || $[27] !== t6) {
|
|
125
130
|
t7 = /* @__PURE__ */ jsxs("div", {
|
|
126
131
|
...t4,
|
|
127
132
|
children: [t6, children]
|
|
128
133
|
});
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
} else t7 = $[
|
|
134
|
+
$[25] = children;
|
|
135
|
+
$[26] = t4;
|
|
136
|
+
$[27] = t6;
|
|
137
|
+
$[28] = t7;
|
|
138
|
+
} else t7 = $[28];
|
|
134
139
|
let t8;
|
|
135
|
-
if ($[
|
|
140
|
+
if ($[29] !== multiline || $[30] !== outlined || $[31] !== state.isDisabled || $[32] !== state.isInvalid || $[33] !== trailing) {
|
|
136
141
|
t8 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
137
142
|
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
138
143
|
children: trailing
|
|
139
144
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
} else t8 = $[
|
|
145
|
+
$[29] = multiline;
|
|
146
|
+
$[30] = outlined;
|
|
147
|
+
$[31] = state.isDisabled;
|
|
148
|
+
$[32] = state.isInvalid;
|
|
149
|
+
$[33] = trailing;
|
|
150
|
+
$[34] = t8;
|
|
151
|
+
} else t8 = $[34];
|
|
147
152
|
let t9;
|
|
148
|
-
if ($[
|
|
153
|
+
if ($[35] !== t1 || $[36] !== t2 || $[37] !== t3 || $[38] !== t7 || $[39] !== t8 || $[40] !== trigger) {
|
|
149
154
|
t9 = /* @__PURE__ */ jsxs(BoxContext, {
|
|
150
155
|
value: t1,
|
|
151
156
|
children: [
|
|
@@ -156,19 +161,19 @@ function BoxContent(t0) {
|
|
|
156
161
|
t8
|
|
157
162
|
]
|
|
158
163
|
});
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
} else t9 = $[
|
|
164
|
+
$[35] = t1;
|
|
165
|
+
$[36] = t2;
|
|
166
|
+
$[37] = t3;
|
|
167
|
+
$[38] = t7;
|
|
168
|
+
$[39] = t8;
|
|
169
|
+
$[40] = trigger;
|
|
170
|
+
$[41] = t9;
|
|
171
|
+
} else t9 = $[41];
|
|
167
172
|
return t9;
|
|
168
173
|
}
|
|
169
174
|
function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
|
|
170
175
|
const outlined = variant === "outlined";
|
|
171
|
-
return (state) => props(fieldChromeStyles.box, floatingLabel ? fieldChromeStyles.boxFloating : fieldChromeStyles.boxFixed, multiline && fieldChromeStyles.boxMultiline, leading && fieldChromeStyles.boxLeading, trailing && fieldChromeStyles.boxTrailing, outlined && fieldChromeStyles.boxOutlined, outlined && floatingLabel && fieldChromeStyles.boxOutlinedFloating, outlined && multiline && fieldChromeStyles.boxOutlinedMultiline, state.isInvalid && (outlined ? fieldChromeStyles.boxOutlinedError : fieldChromeStyles.boxError), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
|
|
176
|
+
return (state) => props(fieldChromeStyles.box, floatingLabel ? fieldChromeStyles.boxFloating : fieldChromeStyles.boxFixed, multiline && fieldChromeStyles.boxMultiline, leading && fieldChromeStyles.boxLeading, trailing && fieldChromeStyles.boxTrailing, outlined && fieldChromeStyles.boxOutlined, outlined && floatingLabel && fieldChromeStyles.boxOutlinedFloating, outlined && multiline && fieldChromeStyles.boxOutlinedMultiline, state.isInvalid && (outlined ? fieldChromeStyles.boxOutlinedError : fieldChromeStyles.boxError), outlined && state.isHovered && (state.isInvalid ? fieldChromeStyles.boxOutlinedErrorHovered : fieldChromeStyles.boxOutlinedHovered), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
|
|
172
177
|
}
|
|
173
178
|
/**
|
|
174
179
|
* The box a control sits in, filled or outlined, with its label. React
|
|
@@ -179,11 +184,12 @@ function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
|
|
|
179
184
|
* on a button rather than an input — passes the two states itself.
|
|
180
185
|
*/
|
|
181
186
|
function FieldBox(t0) {
|
|
182
|
-
const $ = c(
|
|
187
|
+
const $ = c(30);
|
|
183
188
|
let T0;
|
|
184
189
|
let children;
|
|
185
190
|
let floatingLabel;
|
|
186
191
|
let isPopulated;
|
|
192
|
+
let isRequired;
|
|
187
193
|
let label;
|
|
188
194
|
let leading;
|
|
189
195
|
let multiline;
|
|
@@ -193,16 +199,17 @@ function FieldBox(t0) {
|
|
|
193
199
|
let trigger;
|
|
194
200
|
let variant;
|
|
195
201
|
if ($[0] !== t0) {
|
|
196
|
-
const { children: t3, floatingLabel: t4, isPopulated: t5,
|
|
202
|
+
const { children: t3, floatingLabel: t4, isPopulated: t5, isRequired: t6, label: t7, leading: t8, multiline: t9, trailing: t10, trigger: t11, variant: t12, ...props } = t0;
|
|
197
203
|
children = t3;
|
|
198
204
|
isPopulated = t5;
|
|
199
|
-
label =
|
|
200
|
-
leading =
|
|
201
|
-
trailing =
|
|
202
|
-
trigger =
|
|
205
|
+
label = t7;
|
|
206
|
+
leading = t8;
|
|
207
|
+
trailing = t10;
|
|
208
|
+
trigger = t11;
|
|
203
209
|
floatingLabel = t4 === void 0 ? true : t4;
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
isRequired = t6 === void 0 ? false : t6;
|
|
211
|
+
multiline = t9 === void 0 ? false : t9;
|
|
212
|
+
variant = t12 === void 0 ? "filled" : t12;
|
|
206
213
|
T0 = Group;
|
|
207
214
|
t1 = props;
|
|
208
215
|
t2 = mergeStatefulStyles(boxStyles(floatingLabel, multiline, leading !== void 0, trailing !== void 0, variant), props);
|
|
@@ -211,55 +218,58 @@ function FieldBox(t0) {
|
|
|
211
218
|
$[2] = children;
|
|
212
219
|
$[3] = floatingLabel;
|
|
213
220
|
$[4] = isPopulated;
|
|
214
|
-
$[5] =
|
|
215
|
-
$[6] =
|
|
216
|
-
$[7] =
|
|
217
|
-
$[8] =
|
|
218
|
-
$[9] =
|
|
219
|
-
$[10] =
|
|
220
|
-
$[11] =
|
|
221
|
-
$[12] =
|
|
221
|
+
$[5] = isRequired;
|
|
222
|
+
$[6] = label;
|
|
223
|
+
$[7] = leading;
|
|
224
|
+
$[8] = multiline;
|
|
225
|
+
$[9] = t1;
|
|
226
|
+
$[10] = t2;
|
|
227
|
+
$[11] = trailing;
|
|
228
|
+
$[12] = trigger;
|
|
229
|
+
$[13] = variant;
|
|
222
230
|
} else {
|
|
223
231
|
T0 = $[1];
|
|
224
232
|
children = $[2];
|
|
225
233
|
floatingLabel = $[3];
|
|
226
234
|
isPopulated = $[4];
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
isRequired = $[5];
|
|
236
|
+
label = $[6];
|
|
237
|
+
leading = $[7];
|
|
238
|
+
multiline = $[8];
|
|
239
|
+
t1 = $[9];
|
|
240
|
+
t2 = $[10];
|
|
241
|
+
trailing = $[11];
|
|
242
|
+
trigger = $[12];
|
|
243
|
+
variant = $[13];
|
|
235
244
|
}
|
|
236
245
|
let t3;
|
|
237
|
-
if ($[
|
|
238
|
-
t3 = boxContent(label, children, floatingLabel, isPopulated, leading, multiline, trailing, trigger, variant);
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
|
|
246
|
+
if ($[14] !== children || $[15] !== floatingLabel || $[16] !== isPopulated || $[17] !== isRequired || $[18] !== label || $[19] !== leading || $[20] !== multiline || $[21] !== trailing || $[22] !== trigger || $[23] !== variant) {
|
|
247
|
+
t3 = boxContent(label, children, floatingLabel, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
|
|
248
|
+
$[14] = children;
|
|
249
|
+
$[15] = floatingLabel;
|
|
250
|
+
$[16] = isPopulated;
|
|
251
|
+
$[17] = isRequired;
|
|
252
|
+
$[18] = label;
|
|
253
|
+
$[19] = leading;
|
|
254
|
+
$[20] = multiline;
|
|
255
|
+
$[21] = trailing;
|
|
256
|
+
$[22] = trigger;
|
|
257
|
+
$[23] = variant;
|
|
258
|
+
$[24] = t3;
|
|
259
|
+
} else t3 = $[24];
|
|
250
260
|
let t4;
|
|
251
|
-
if ($[
|
|
261
|
+
if ($[25] !== T0 || $[26] !== t1 || $[27] !== t2 || $[28] !== t3) {
|
|
252
262
|
t4 = /* @__PURE__ */ jsx(T0, {
|
|
253
263
|
...t1,
|
|
254
264
|
...t2,
|
|
255
265
|
children: t3
|
|
256
266
|
});
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
} else t4 = $[
|
|
267
|
+
$[25] = T0;
|
|
268
|
+
$[26] = t1;
|
|
269
|
+
$[27] = t2;
|
|
270
|
+
$[28] = t3;
|
|
271
|
+
$[29] = t4;
|
|
272
|
+
} else t4 = $[29];
|
|
263
273
|
return t4;
|
|
264
274
|
}
|
|
265
275
|
/**
|
|
@@ -275,7 +285,7 @@ function FieldBox(t0) {
|
|
|
275
285
|
*/
|
|
276
286
|
function FieldInput(t0) {
|
|
277
287
|
const $ = c(19);
|
|
278
|
-
const { numeric: t1, placeholder, prefix, suffix, ...props$
|
|
288
|
+
const { numeric: t1, placeholder, prefix, suffix, ...props$3 } = t0;
|
|
279
289
|
const numeric = t1 === void 0 ? false : t1;
|
|
280
290
|
const box = useContext(BoxContext);
|
|
281
291
|
const T0 = Input;
|
|
@@ -287,16 +297,16 @@ function FieldInput(t0) {
|
|
|
287
297
|
$[1] = numeric;
|
|
288
298
|
$[2] = t3;
|
|
289
299
|
} else t3 = $[2];
|
|
290
|
-
const t4 = mergeStatefulStyles(t3, props$
|
|
300
|
+
const t4 = mergeStatefulStyles(t3, props$3);
|
|
291
301
|
let t5;
|
|
292
|
-
if ($[3] !== T0 || $[4] !== props$
|
|
302
|
+
if ($[3] !== T0 || $[4] !== props$3 || $[5] !== t2 || $[6] !== t4) {
|
|
293
303
|
t5 = /* @__PURE__ */ jsx(T0, {
|
|
294
304
|
placeholder: t2,
|
|
295
|
-
...props$
|
|
305
|
+
...props$3,
|
|
296
306
|
...t4
|
|
297
307
|
});
|
|
298
308
|
$[3] = T0;
|
|
299
|
-
$[4] = props$
|
|
309
|
+
$[4] = props$3;
|
|
300
310
|
$[5] = t2;
|
|
301
311
|
$[6] = t4;
|
|
302
312
|
$[7] = t5;
|
|
@@ -469,21 +479,21 @@ function FieldTextArea(t0) {
|
|
|
469
479
|
* the fill, the underline and the focus indicator, and it lights up while
|
|
470
480
|
* this has focus because the indicator follows focus within.
|
|
471
481
|
*/
|
|
472
|
-
function FieldTrigger(props$
|
|
482
|
+
function FieldTrigger(props$5) {
|
|
473
483
|
const $ = c(5);
|
|
474
484
|
let t0;
|
|
475
|
-
if ($[0] !== props$
|
|
476
|
-
t0 = mergeStatefulStyles(props(fieldChromeStyles.trigger), props$
|
|
477
|
-
$[0] = props$
|
|
485
|
+
if ($[0] !== props$5) {
|
|
486
|
+
t0 = mergeStatefulStyles(props(fieldChromeStyles.trigger), props$5);
|
|
487
|
+
$[0] = props$5;
|
|
478
488
|
$[1] = t0;
|
|
479
489
|
} else t0 = $[1];
|
|
480
490
|
let t1;
|
|
481
|
-
if ($[2] !== props$
|
|
491
|
+
if ($[2] !== props$5 || $[3] !== t0) {
|
|
482
492
|
t1 = /* @__PURE__ */ jsx(Button, {
|
|
483
|
-
...props$
|
|
493
|
+
...props$5,
|
|
484
494
|
...t0
|
|
485
495
|
});
|
|
486
|
-
$[2] = props$
|
|
496
|
+
$[2] = props$5;
|
|
487
497
|
$[3] = t0;
|
|
488
498
|
$[4] = t1;
|
|
489
499
|
} else t1 = $[4];
|
|
@@ -507,19 +517,19 @@ function FieldTrigger(props$4) {
|
|
|
507
517
|
*/
|
|
508
518
|
function FieldValue(t0) {
|
|
509
519
|
const $ = c(3);
|
|
510
|
-
const { isFocused: t1, isPlaceholder: t2, ...props$
|
|
520
|
+
const { isFocused: t1, isPlaceholder: t2, ...props$1 } = t0;
|
|
511
521
|
const isFocused = t1 === void 0 ? false : t1;
|
|
512
522
|
const isPlaceholder = t2 === void 0 ? false : t2;
|
|
513
523
|
const box = useContext(BoxContext);
|
|
514
524
|
const hidden = isPlaceholder && box.label === "floating" && !isFocused;
|
|
515
|
-
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$
|
|
525
|
+
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$1);
|
|
516
526
|
let t4;
|
|
517
|
-
if ($[0] !== props$
|
|
527
|
+
if ($[0] !== props$1 || $[1] !== t3) {
|
|
518
528
|
t4 = /* @__PURE__ */ jsx("span", {
|
|
519
|
-
...props$
|
|
529
|
+
...props$1,
|
|
520
530
|
...t3
|
|
521
531
|
});
|
|
522
|
-
$[0] = props$
|
|
532
|
+
$[0] = props$1;
|
|
523
533
|
$[1] = t3;
|
|
524
534
|
$[2] = t4;
|
|
525
535
|
} else t4 = $[2];
|
|
@@ -548,43 +558,59 @@ function useFieldPopulated() {
|
|
|
548
558
|
* its control through context.
|
|
549
559
|
*/
|
|
550
560
|
const NO_STATE = {};
|
|
561
|
+
const REQUIRED_MARK = /* @__PURE__ */ jsx("span", {
|
|
562
|
+
"aria-hidden": "true",
|
|
563
|
+
children: "*"
|
|
564
|
+
});
|
|
551
565
|
function FieldLabel(t0) {
|
|
552
|
-
const $ = c(
|
|
566
|
+
const $ = c(12);
|
|
553
567
|
let T0;
|
|
568
|
+
let children;
|
|
569
|
+
let isRequired;
|
|
554
570
|
let t1;
|
|
555
571
|
let t2;
|
|
556
572
|
if ($[0] !== t0) {
|
|
557
|
-
const {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
const
|
|
563
|
-
const
|
|
573
|
+
const { children: t3, isRequired: t4, state: t5, variant: t6, ...props$4 } = t0;
|
|
574
|
+
children = t3;
|
|
575
|
+
isRequired = t4 === void 0 ? false : t4;
|
|
576
|
+
const state = t5 === void 0 ? NO_STATE : t5;
|
|
577
|
+
const variant = t6 === void 0 ? "field" : t6;
|
|
578
|
+
const { isDisabled: t7, isFocusWithin: t8, isInvalid: t9 } = state;
|
|
579
|
+
const isDisabled = t7 === void 0 ? false : t7;
|
|
580
|
+
const isFocusWithin = t8 === void 0 ? false : t8;
|
|
581
|
+
const isInvalid = t9 === void 0 ? false : t9;
|
|
564
582
|
T0 = Label;
|
|
565
|
-
t1 = props$
|
|
566
|
-
t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$
|
|
583
|
+
t1 = props$4;
|
|
584
|
+
t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$4);
|
|
567
585
|
$[0] = t0;
|
|
568
586
|
$[1] = T0;
|
|
569
|
-
$[2] =
|
|
570
|
-
$[3] =
|
|
587
|
+
$[2] = children;
|
|
588
|
+
$[3] = isRequired;
|
|
589
|
+
$[4] = t1;
|
|
590
|
+
$[5] = t2;
|
|
571
591
|
} else {
|
|
572
592
|
T0 = $[1];
|
|
573
|
-
|
|
574
|
-
|
|
593
|
+
children = $[2];
|
|
594
|
+
isRequired = $[3];
|
|
595
|
+
t1 = $[4];
|
|
596
|
+
t2 = $[5];
|
|
575
597
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
598
|
+
const t3 = isRequired ? REQUIRED_MARK : null;
|
|
599
|
+
let t4;
|
|
600
|
+
if ($[6] !== T0 || $[7] !== children || $[8] !== t1 || $[9] !== t2 || $[10] !== t3) {
|
|
601
|
+
t4 = /* @__PURE__ */ jsxs(T0, {
|
|
579
602
|
...t1,
|
|
580
|
-
...t2
|
|
603
|
+
...t2,
|
|
604
|
+
children: [children, t3]
|
|
581
605
|
});
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
|
|
587
|
-
|
|
606
|
+
$[6] = T0;
|
|
607
|
+
$[7] = children;
|
|
608
|
+
$[8] = t1;
|
|
609
|
+
$[9] = t2;
|
|
610
|
+
$[10] = t3;
|
|
611
|
+
$[11] = t4;
|
|
612
|
+
} else t4 = $[11];
|
|
613
|
+
return t4;
|
|
588
614
|
}
|
|
589
615
|
/**
|
|
590
616
|
* The line under a field: the error while there is one, the description
|
|
@@ -596,37 +622,47 @@ function FieldLabel(t0) {
|
|
|
596
622
|
* the field's validation state is read for.
|
|
597
623
|
*/
|
|
598
624
|
function FieldMessage(t0) {
|
|
599
|
-
const $ = c(
|
|
625
|
+
const $ = c(32);
|
|
600
626
|
const { characterCount: t1, characterLimitLabel, description, error, errorId, inset: t2, maxLength } = t0;
|
|
601
627
|
const characterCount = t1 === void 0 ? false : t1;
|
|
602
628
|
const inset = t2 === void 0 ? true : t2;
|
|
603
629
|
const validation = useContext(FieldErrorContext);
|
|
604
630
|
const invalid = error !== void 0 || (validation?.isInvalid ?? false);
|
|
631
|
+
const { locale } = useLocale();
|
|
632
|
+
const messages = useMessages();
|
|
605
633
|
const input = useSlottedContext(InputContext);
|
|
606
634
|
const textArea = useSlottedContext(TextAreaContext);
|
|
607
635
|
const insideForm = useInsideForm();
|
|
608
636
|
const text = useContext(TextContext);
|
|
609
|
-
const limit = maxLength === void 0 ? void 0 : characterLimitLabel ?? `Up to ${maxLength} character${maxLength === 1 ? "" : "s"}`;
|
|
610
637
|
let t3;
|
|
611
|
-
if ($[0] !==
|
|
612
|
-
t3 =
|
|
638
|
+
if ($[0] !== characterLimitLabel || $[1] !== maxLength || $[2] !== messages) {
|
|
639
|
+
t3 = maxLength === void 0 ? void 0 : characterLimitLabel ?? messages.characterLimit(maxLength);
|
|
640
|
+
$[0] = characterLimitLabel;
|
|
641
|
+
$[1] = maxLength;
|
|
642
|
+
$[2] = messages;
|
|
643
|
+
$[3] = t3;
|
|
644
|
+
} else t3 = $[3];
|
|
645
|
+
const limit = t3;
|
|
646
|
+
let t4;
|
|
647
|
+
if ($[4] !== limit) {
|
|
648
|
+
t4 = limit === void 0 ? null : /* @__PURE__ */ jsx(VisuallyHidden, {
|
|
613
649
|
elementType: "span",
|
|
614
650
|
children: /* @__PURE__ */ jsx(Text, {
|
|
615
651
|
slot: "description",
|
|
616
652
|
children: limit
|
|
617
653
|
})
|
|
618
654
|
});
|
|
619
|
-
$[
|
|
620
|
-
$[
|
|
621
|
-
} else
|
|
622
|
-
const hidden =
|
|
655
|
+
$[4] = limit;
|
|
656
|
+
$[5] = t4;
|
|
657
|
+
} else t4 = $[5];
|
|
658
|
+
const hidden = t4;
|
|
623
659
|
if (!invalid && description === void 0 && !characterCount && !insideForm) return hidden;
|
|
624
660
|
const value = input?.value ?? textArea?.value ?? "";
|
|
625
661
|
const length = String(value).length;
|
|
626
662
|
const hint = invalid ? void 0 : description;
|
|
627
|
-
let
|
|
628
|
-
if ($[
|
|
629
|
-
|
|
663
|
+
let t5;
|
|
664
|
+
if ($[6] !== hidden || $[7] !== hint || $[8] !== limit) {
|
|
665
|
+
t5 = hint === void 0 ? hidden : /* @__PURE__ */ jsxs(Text, {
|
|
630
666
|
slot: "description",
|
|
631
667
|
...props(fieldChromeStyles.message),
|
|
632
668
|
children: [hint, limit === void 0 ? null : /* @__PURE__ */ jsx(VisuallyHidden, {
|
|
@@ -634,22 +670,22 @@ function FieldMessage(t0) {
|
|
|
634
670
|
children: ` ${limit}`
|
|
635
671
|
})]
|
|
636
672
|
});
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
} else
|
|
642
|
-
const described =
|
|
673
|
+
$[6] = hidden;
|
|
674
|
+
$[7] = hint;
|
|
675
|
+
$[8] = limit;
|
|
676
|
+
$[9] = t5;
|
|
677
|
+
} else t5 = $[9];
|
|
678
|
+
const described = t5;
|
|
643
679
|
const errorSlot = text !== null && typeof text === "object" && "slots" in text && text.slots?.errorMessage !== void 0;
|
|
644
|
-
let t5;
|
|
645
|
-
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
646
|
-
t5 = props(fieldChromeStyles.message, fieldChromeStyles.messageError);
|
|
647
|
-
$[6] = t5;
|
|
648
|
-
} else t5 = $[6];
|
|
649
|
-
const messageStyles = t5;
|
|
650
680
|
let t6;
|
|
651
|
-
if ($[
|
|
652
|
-
t6 =
|
|
681
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
682
|
+
t6 = props(fieldChromeStyles.message, fieldChromeStyles.messageError);
|
|
683
|
+
$[10] = t6;
|
|
684
|
+
} else t6 = $[10];
|
|
685
|
+
const messageStyles = t6;
|
|
686
|
+
let t7;
|
|
687
|
+
if ($[11] !== error || $[12] !== errorId || $[13] !== errorSlot) {
|
|
688
|
+
t7 = errorSlot ? /* @__PURE__ */ jsx(Text, {
|
|
653
689
|
slot: "errorMessage",
|
|
654
690
|
...messageStyles,
|
|
655
691
|
children: error
|
|
@@ -658,59 +694,69 @@ function FieldMessage(t0) {
|
|
|
658
694
|
...messageStyles,
|
|
659
695
|
children: error
|
|
660
696
|
});
|
|
661
|
-
$[
|
|
662
|
-
$[
|
|
663
|
-
$[
|
|
664
|
-
$[
|
|
665
|
-
} else
|
|
666
|
-
const written =
|
|
667
|
-
let t7;
|
|
668
|
-
if ($[11] !== inset) {
|
|
669
|
-
t7 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset);
|
|
670
|
-
$[11] = inset;
|
|
671
|
-
$[12] = t7;
|
|
672
|
-
} else t7 = $[12];
|
|
697
|
+
$[11] = error;
|
|
698
|
+
$[12] = errorId;
|
|
699
|
+
$[13] = errorSlot;
|
|
700
|
+
$[14] = t7;
|
|
701
|
+
} else t7 = $[14];
|
|
702
|
+
const written = t7;
|
|
673
703
|
let t8;
|
|
674
|
-
if ($[
|
|
675
|
-
t8 =
|
|
676
|
-
|
|
677
|
-
children: error
|
|
678
|
-
});
|
|
679
|
-
$[13] = error;
|
|
680
|
-
$[14] = validation;
|
|
681
|
-
$[15] = written;
|
|
704
|
+
if ($[15] !== inset) {
|
|
705
|
+
t8 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset);
|
|
706
|
+
$[15] = inset;
|
|
682
707
|
$[16] = t8;
|
|
683
708
|
} else t8 = $[16];
|
|
684
709
|
let t9;
|
|
685
|
-
if ($[17] !==
|
|
686
|
-
t9 =
|
|
710
|
+
if ($[17] !== error || $[18] !== validation || $[19] !== written) {
|
|
711
|
+
t9 = validation === null && error !== void 0 ? written : /* @__PURE__ */ jsx(FieldError, {
|
|
712
|
+
...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
|
|
713
|
+
children: error
|
|
714
|
+
});
|
|
715
|
+
$[17] = error;
|
|
716
|
+
$[18] = validation;
|
|
717
|
+
$[19] = written;
|
|
718
|
+
$[20] = t9;
|
|
719
|
+
} else t9 = $[20];
|
|
720
|
+
let t10;
|
|
721
|
+
if ($[21] !== characterCount || $[22] !== invalid || $[23] !== length || $[24] !== locale || $[25] !== maxLength) {
|
|
722
|
+
t10 = characterCount ? /* @__PURE__ */ jsx("span", {
|
|
687
723
|
"aria-hidden": "true",
|
|
688
724
|
...props(fieldChromeStyles.message, fieldChromeStyles.counter, invalid && fieldChromeStyles.messageError),
|
|
689
|
-
children:
|
|
725
|
+
children: countIn(locale, length, maxLength)
|
|
690
726
|
}) : null;
|
|
691
|
-
$[
|
|
692
|
-
$[
|
|
693
|
-
$[
|
|
694
|
-
$[
|
|
695
|
-
$[
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
727
|
+
$[21] = characterCount;
|
|
728
|
+
$[22] = invalid;
|
|
729
|
+
$[23] = length;
|
|
730
|
+
$[24] = locale;
|
|
731
|
+
$[25] = maxLength;
|
|
732
|
+
$[26] = t10;
|
|
733
|
+
} else t10 = $[26];
|
|
734
|
+
let t11;
|
|
735
|
+
if ($[27] !== described || $[28] !== t10 || $[29] !== t8 || $[30] !== t9) {
|
|
736
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
737
|
+
...t8,
|
|
701
738
|
children: [
|
|
702
|
-
|
|
739
|
+
t9,
|
|
703
740
|
described,
|
|
704
|
-
|
|
741
|
+
t10
|
|
705
742
|
]
|
|
706
743
|
});
|
|
707
|
-
$[
|
|
708
|
-
$[
|
|
709
|
-
$[
|
|
710
|
-
$[
|
|
711
|
-
$[
|
|
712
|
-
} else
|
|
713
|
-
return
|
|
744
|
+
$[27] = described;
|
|
745
|
+
$[28] = t10;
|
|
746
|
+
$[29] = t8;
|
|
747
|
+
$[30] = t9;
|
|
748
|
+
$[31] = t11;
|
|
749
|
+
} else t11 = $[31];
|
|
750
|
+
return t11;
|
|
751
|
+
}
|
|
752
|
+
const counterFormatters = /* @__PURE__ */ new Map();
|
|
753
|
+
function countIn(locale, length, maxLength) {
|
|
754
|
+
let formatter = counterFormatters.get(locale);
|
|
755
|
+
if (formatter === void 0) {
|
|
756
|
+
formatter = new Intl.NumberFormat(locale);
|
|
757
|
+
counterFormatters.set(locale, formatter);
|
|
758
|
+
}
|
|
759
|
+
return maxLength === void 0 ? formatter.format(length) : `${formatter.format(length)}/${formatter.format(maxLength)}`;
|
|
714
760
|
}
|
|
715
761
|
//#endregion
|
|
716
762
|
export { FieldBox, FieldInput, FieldLabel, FieldMessage, FieldSegments, FieldTextArea, FieldTrigger, FieldValue };
|