@kanso-labs/kanso-ui 0.33.0 → 0.34.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/dist/components/date-field/index.js +2 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.js +2 -2
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +18 -1
- package/dist/components/text-area/index.js +34 -26
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/time-field/index.js +2 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +6 -5
- package/dist/components/toolbar/index.js +2 -2
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +3 -2
- package/dist/components/tooltip/index.js +1 -6
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/field/index.js +145 -96
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +21 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/styles/overlay.js +2 -1
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles.css +12 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { OverlayAlign, OverlaySide } from "../../styles/overlay.js";
|
|
1
2
|
import { ReactNode } from "react";
|
|
2
3
|
import { ClassNameOrFunction, StyleOrFunction, TooltipRenderProps, TooltipTriggerComponentProps } from "react-aria-components";
|
|
3
4
|
//#region src/components/tooltip/index.d.ts
|
|
4
|
-
type TooltipAlign =
|
|
5
|
+
type TooltipAlign = OverlayAlign;
|
|
5
6
|
type TooltipProps = {
|
|
6
7
|
/**
|
|
7
8
|
* Where the tooltip sits along the side it opens on.
|
|
@@ -40,7 +41,7 @@ type TooltipProps = {
|
|
|
40
41
|
/** A function may compute the style from the tooltip's render state. */
|
|
41
42
|
style?: StyleOrFunction<TooltipRenderProps>;
|
|
42
43
|
} & Omit<TooltipTriggerComponentProps, 'children'>;
|
|
43
|
-
type TooltipSide =
|
|
44
|
+
type TooltipSide = OverlaySide;
|
|
44
45
|
/**
|
|
45
46
|
* A label for the element it wraps, shown while that element is hovered or
|
|
46
47
|
* focused — the tooltips page's plain tooltip. Its open state is React
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
|
-
import { overlay, popupOrigin } from "../../styles/overlay.js";
|
|
3
|
+
import { overlay, placementOf, popupOrigin } from "../../styles/overlay.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Tooltip, TooltipTrigger } from "react-aria-components";
|
|
@@ -22,11 +22,6 @@ const styles = { container: {
|
|
|
22
22
|
$$css: true
|
|
23
23
|
} };
|
|
24
24
|
const DEFAULT_SIDE_OFFSET = 8;
|
|
25
|
-
function placementOf(side, align) {
|
|
26
|
-
if (align === "center") return side;
|
|
27
|
-
if (side === "top" || side === "bottom") return `${side} ${align}`;
|
|
28
|
-
return `${side} ${align === "start" ? "top" : "bottom"}`;
|
|
29
|
-
}
|
|
30
25
|
/**
|
|
31
26
|
* A label for the element it wraps, shown while that element is hovered or
|
|
32
27
|
* focused — the tooltips page's plain tooltip. Its open state is React
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","ClassNameOrFunction","StyleOrFunction","TooltipRenderProps","TooltipTriggerComponentProps","stylex","Tooltip","RACTooltip","TooltipTrigger","mergeStatefulStyles","overlay","popupOrigin","colors","radii","spacing","typography","styles","container","kWkggS","kaIpWk","kB7OPa","kMwMTN","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","ks0D6T","kAzted","k8WAf4","kg3NbH","$$css","DEFAULT_SIDE_OFFSET","TooltipAlign","TooltipProps","align","alignOffset","children","className","Element","label","side","TooltipSide","sideOffset","style","Omit","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","ClassNameOrFunction","StyleOrFunction","TooltipRenderProps","TooltipTriggerComponentProps","stylex","Tooltip","RACTooltip","TooltipTrigger","OverlayAlign","OverlaySide","mergeStatefulStyles","overlay","placementOf","popupOrigin","colors","radii","spacing","typography","styles","container","kWkggS","kaIpWk","kB7OPa","kMwMTN","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","ks0D6T","kAzted","k8WAf4","kg3NbH","$$css","DEFAULT_SIDE_OFFSET","TooltipAlign","TooltipProps","align","alignOffset","children","className","Element","label","side","TooltipSide","sideOffset","style","Omit","t0","$","_c","props","t1","t2","t3","undefined","t4","t5","_temp","t6","t7","state","popup","placement"],"sources":["../../../src/components/tooltip/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ClassNameOrFunction, StyleOrFunction, TooltipRenderProps, TooltipTriggerComponentProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Tooltip as RACTooltip, TooltipTrigger } from 'react-aria-components';\nimport type { OverlayAlign, OverlaySide } from '../../styles/overlay';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, placementOf, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The tooltips page's plain tooltip: a 24dp container on inverse surface\n// with 8dp of padding, holding one line of supporting text in inverse on\n// surface at 12 over 16, which is the body-small role. The page names a\n// shape token for the container without giving its value, so the container\n// takes the smallest corner the library has — a 24dp box has room for no\n// more.\n//\n// The rich tooltip on the same page is a hover-triggered `Popover`, which is\n// where its subhead, supporting text and buttons already live; this one is\n// text and nothing else, which is why it takes its label as a string rather\n// than as parts.\n//\n// The entry is the overlay module's, shared with every anchored surface, and\n// so is the origin it grows from — the tooltip comes out of the thing it\n// describes. The surface itself is not: a tooltip inverts the page's colours\n// where a popover sits on a container role, so it draws its own.\nconst styles = {\n container: {\n kWkggS: \"x1c5gpgi\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1girmi0\",\n kMv6JI: \"x1yicsit\",\n kGuDYH: \"x1b35g6e\",\n k63SB2: \"x9d6959\",\n kb6lSQ: \"xwth0xh\",\n kLWn49: \"xybisxh\",\n ks0D6T: \"x10u2fgw\",\n kAzted: \"xjwf9q1\",\n k8WAf4: \"xmqoko8\",\n kg3NbH: \"xn60lsn\",\n $$css: true\n }\n};\n\n// The gap between the anchor and the tooltip. A number rather than a token,\n// because React Aria computes the position in JavaScript and so cannot read\n// a custom property — the same one place `Popover` spells a step out.\nconst DEFAULT_SIDE_OFFSET = 8;\n\n// The overlay module's, since which side a surface opens on is the same\n// question for every anchored overlay, and `Popover` and `Menu` ask it\n// there too. Aliased rather than re-declared so the names a call site\n// imports stay this component's.\ntype TooltipAlign = OverlayAlign;\ntype TooltipProps = {\n /**\n * Where the tooltip sits along the side it opens on.\n * @default 'center'\n */\n align?: TooltipAlign;\n /** Shifts the tooltip along that side, in pixels. */\n alignOffset?: number;\n /**\n * The element the tooltip describes, and nothing else. It has to be able\n * to take focus, since a tooltip a keyboard cannot reach is one most\n * people never see — wrap anything that cannot in `Focusable`, which this\n * package re-exports.\n */\n children?: ReactNode;\n /** A function may compute the class from the tooltip's render state. */\n className?: ClassNameOrFunction<TooltipRenderProps>;\n /**\n * Where to portal the tooltip. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the tooltip renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: Element;\n /** What the tooltip says. Text, since the page's plain tooltip is text. */\n label: ReactNode;\n /**\n * Which side of the element the tooltip opens on. It flips to the opposite\n * side on its own when there is no room.\n * @default 'top'\n */\n side?: TooltipSide;\n /** The gap between the element and the tooltip, in pixels. */\n sideOffset?: number;\n /** A function may compute the style from the tooltip's render state. */\n style?: StyleOrFunction<TooltipRenderProps>;\n} & Omit<TooltipTriggerComponentProps, 'children'>;\ntype TooltipSide = OverlaySide;\n\n/**\n * A label for the element it wraps, shown while that element is hovered or\n * focused — the tooltips page's plain tooltip. Its open state is React\n * Aria's: pass `isOpen` with `onOpenChange` to control it, `defaultOpen` to\n * let it keep its own, and `delay` and `closeDelay` for how long a pointer\n * has to rest before it appears and after it leaves.\n *\n * A tooltip is not a place to put anything a person has to read or reach:\n * it is skipped by touch entirely and dismissed by Escape, so what it says\n * has to be a repeat of what the element already means. Anything with a\n * button in it, or worth reading twice, is a `Popover`.\n *\n * The call site's `className` and `style` land on the tooltip itself.\n */\nfunction Tooltip({\n align = 'center',\n alignOffset,\n children,\n className,\n container,\n label,\n side = 'top',\n sideOffset = DEFAULT_SIDE_OFFSET,\n style,\n ...props\n}: TooltipProps) {\n return <TooltipTrigger {...props}>\n {children}\n <RACTooltip crossOffset={alignOffset} offset={sideOffset} placement={placementOf(side, align)}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles((state: TooltipRenderProps) => stylex.props(overlay.popup, styles.container, popupOrigin(state.placement)), {\n className,\n style\n })}>\n {label}\n </RACTooltip>\n </TooltipTrigger>;\n}\nexport type { TooltipAlign, TooltipProps, TooltipSide };\nexport default Tooltip;"],"mappings":"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"}
|
package/dist/field/index.js
CHANGED
|
@@ -34,12 +34,13 @@ const BOX_CONTROLS = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const BoxContext = createContext(OUTSIDE_BOX);
|
|
37
|
-
function boxContent(label, children, floatingLabel, isPopulated, leading, trailing, trigger, variant) {
|
|
37
|
+
function boxContent(label, children, floatingLabel, isPopulated, leading, multiline, trailing, trigger, variant) {
|
|
38
38
|
return (state) => /* @__PURE__ */ jsx(BoxContent, {
|
|
39
39
|
floatingLabel,
|
|
40
40
|
isPopulated,
|
|
41
41
|
label,
|
|
42
42
|
leading,
|
|
43
|
+
multiline,
|
|
43
44
|
state,
|
|
44
45
|
trailing,
|
|
45
46
|
trigger,
|
|
@@ -55,8 +56,8 @@ function boxContent(label, children, floatingLabel, isPopulated, leading, traili
|
|
|
55
56
|
* for them. See the outlined variant's note above.
|
|
56
57
|
*/
|
|
57
58
|
function BoxContent(t0) {
|
|
58
|
-
const $ = c(
|
|
59
|
-
const { children, floatingLabel, isPopulated, label, leading, state, trailing, trigger, variant } = t0;
|
|
59
|
+
const $ = c(40);
|
|
60
|
+
const { children, floatingLabel, isPopulated, label, leading, multiline, state, trailing, trigger, variant } = t0;
|
|
60
61
|
const read = useFieldPopulated();
|
|
61
62
|
const populated = isPopulated ?? read;
|
|
62
63
|
const outlined = variant === "outlined";
|
|
@@ -81,66 +82,70 @@ function BoxContent(t0) {
|
|
|
81
82
|
$[6] = t2;
|
|
82
83
|
} else t2 = $[6];
|
|
83
84
|
let t3;
|
|
84
|
-
if ($[7] !== leading || $[8] !== state.isDisabled) {
|
|
85
|
+
if ($[7] !== leading || $[8] !== multiline || $[9] !== outlined || $[10] !== state.isDisabled) {
|
|
85
86
|
t3 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
86
|
-
...props(fieldChromeStyles.icon, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
87
|
+
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
87
88
|
children: leading
|
|
88
89
|
});
|
|
89
90
|
$[7] = leading;
|
|
90
|
-
$[8] =
|
|
91
|
-
$[9] =
|
|
92
|
-
|
|
91
|
+
$[8] = multiline;
|
|
92
|
+
$[9] = outlined;
|
|
93
|
+
$[10] = state.isDisabled;
|
|
94
|
+
$[11] = t3;
|
|
95
|
+
} else t3 = $[11];
|
|
93
96
|
let t4;
|
|
94
|
-
if ($[
|
|
97
|
+
if ($[12] !== floatingLabel || $[13] !== state.isDisabled) {
|
|
95
98
|
t4 = props(fieldChromeStyles.column, floatingLabel && fieldChromeStyles.columnFloating, state.isDisabled && (floatingLabel ? fieldChromeStyles.columnDisabledFloating : fieldChromeStyles.columnDisabled));
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
} else t4 = $[
|
|
99
|
+
$[12] = floatingLabel;
|
|
100
|
+
$[13] = state.isDisabled;
|
|
101
|
+
$[14] = t4;
|
|
102
|
+
} else t4 = $[14];
|
|
100
103
|
let t5;
|
|
101
|
-
if ($[
|
|
104
|
+
if ($[15] !== floated || $[16] !== floatingLabel || $[17] !== outlined) {
|
|
102
105
|
t5 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated);
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
} else t5 = $[
|
|
106
|
+
$[15] = floated;
|
|
107
|
+
$[16] = floatingLabel;
|
|
108
|
+
$[17] = outlined;
|
|
109
|
+
$[18] = t5;
|
|
110
|
+
} else t5 = $[18];
|
|
108
111
|
let t6;
|
|
109
|
-
if ($[
|
|
112
|
+
if ($[19] !== label || $[20] !== state || $[21] !== t5) {
|
|
110
113
|
t6 = /* @__PURE__ */ jsx(FieldLabel, {
|
|
111
114
|
state,
|
|
112
115
|
...t5,
|
|
113
116
|
children: label
|
|
114
117
|
});
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
} else t6 = $[
|
|
118
|
+
$[19] = label;
|
|
119
|
+
$[20] = state;
|
|
120
|
+
$[21] = t5;
|
|
121
|
+
$[22] = t6;
|
|
122
|
+
} else t6 = $[22];
|
|
120
123
|
let t7;
|
|
121
|
-
if ($[
|
|
124
|
+
if ($[23] !== children || $[24] !== t4 || $[25] !== t6) {
|
|
122
125
|
t7 = /* @__PURE__ */ jsxs("div", {
|
|
123
126
|
...t4,
|
|
124
127
|
children: [t6, children]
|
|
125
128
|
});
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
} else t7 = $[
|
|
129
|
+
$[23] = children;
|
|
130
|
+
$[24] = t4;
|
|
131
|
+
$[25] = t6;
|
|
132
|
+
$[26] = t7;
|
|
133
|
+
} else t7 = $[26];
|
|
131
134
|
let t8;
|
|
132
|
-
if ($[
|
|
135
|
+
if ($[27] !== multiline || $[28] !== outlined || $[29] !== state.isDisabled || $[30] !== state.isInvalid || $[31] !== trailing) {
|
|
133
136
|
t8 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
134
|
-
...props(fieldChromeStyles.icon, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
137
|
+
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
135
138
|
children: trailing
|
|
136
139
|
});
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
|
|
140
|
+
$[27] = multiline;
|
|
141
|
+
$[28] = outlined;
|
|
142
|
+
$[29] = state.isDisabled;
|
|
143
|
+
$[30] = state.isInvalid;
|
|
144
|
+
$[31] = trailing;
|
|
145
|
+
$[32] = t8;
|
|
146
|
+
} else t8 = $[32];
|
|
142
147
|
let t9;
|
|
143
|
-
if ($[
|
|
148
|
+
if ($[33] !== t1 || $[34] !== t2 || $[35] !== t3 || $[36] !== t7 || $[37] !== t8 || $[38] !== trigger) {
|
|
144
149
|
t9 = /* @__PURE__ */ jsxs(BoxContext, {
|
|
145
150
|
value: t1,
|
|
146
151
|
children: [
|
|
@@ -151,19 +156,19 @@ function BoxContent(t0) {
|
|
|
151
156
|
t8
|
|
152
157
|
]
|
|
153
158
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
} else t9 = $[
|
|
159
|
+
$[33] = t1;
|
|
160
|
+
$[34] = t2;
|
|
161
|
+
$[35] = t3;
|
|
162
|
+
$[36] = t7;
|
|
163
|
+
$[37] = t8;
|
|
164
|
+
$[38] = trigger;
|
|
165
|
+
$[39] = t9;
|
|
166
|
+
} else t9 = $[39];
|
|
162
167
|
return t9;
|
|
163
168
|
}
|
|
164
169
|
function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
|
|
165
170
|
const outlined = variant === "outlined";
|
|
166
|
-
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, state.isInvalid && (outlined ? fieldChromeStyles.boxOutlinedError : fieldChromeStyles.boxError), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
|
|
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));
|
|
167
172
|
}
|
|
168
173
|
/**
|
|
169
174
|
* The box a control sits in, filled or outlined, with its label. React
|
|
@@ -174,13 +179,14 @@ function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
|
|
|
174
179
|
* on a button rather than an input — passes the two states itself.
|
|
175
180
|
*/
|
|
176
181
|
function FieldBox(t0) {
|
|
177
|
-
const $ = c(
|
|
182
|
+
const $ = c(28);
|
|
178
183
|
let T0;
|
|
179
184
|
let children;
|
|
180
185
|
let floatingLabel;
|
|
181
186
|
let isPopulated;
|
|
182
187
|
let label;
|
|
183
188
|
let leading;
|
|
189
|
+
let multiline;
|
|
184
190
|
let t1;
|
|
185
191
|
let t2;
|
|
186
192
|
let trailing;
|
|
@@ -195,7 +201,7 @@ function FieldBox(t0) {
|
|
|
195
201
|
trailing = t9;
|
|
196
202
|
trigger = t10;
|
|
197
203
|
floatingLabel = t4 === void 0 ? true : t4;
|
|
198
|
-
|
|
204
|
+
multiline = t8 === void 0 ? false : t8;
|
|
199
205
|
variant = t11 === void 0 ? "filled" : t11;
|
|
200
206
|
T0 = Group;
|
|
201
207
|
t1 = props;
|
|
@@ -207,11 +213,12 @@ function FieldBox(t0) {
|
|
|
207
213
|
$[4] = isPopulated;
|
|
208
214
|
$[5] = label;
|
|
209
215
|
$[6] = leading;
|
|
210
|
-
$[7] =
|
|
211
|
-
$[8] =
|
|
212
|
-
$[9] =
|
|
213
|
-
$[10] =
|
|
214
|
-
$[11] =
|
|
216
|
+
$[7] = multiline;
|
|
217
|
+
$[8] = t1;
|
|
218
|
+
$[9] = t2;
|
|
219
|
+
$[10] = trailing;
|
|
220
|
+
$[11] = trigger;
|
|
221
|
+
$[12] = variant;
|
|
215
222
|
} else {
|
|
216
223
|
T0 = $[1];
|
|
217
224
|
children = $[2];
|
|
@@ -219,38 +226,40 @@ function FieldBox(t0) {
|
|
|
219
226
|
isPopulated = $[4];
|
|
220
227
|
label = $[5];
|
|
221
228
|
leading = $[6];
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
multiline = $[7];
|
|
230
|
+
t1 = $[8];
|
|
231
|
+
t2 = $[9];
|
|
232
|
+
trailing = $[10];
|
|
233
|
+
trigger = $[11];
|
|
234
|
+
variant = $[12];
|
|
227
235
|
}
|
|
228
236
|
let t3;
|
|
229
|
-
if ($[
|
|
230
|
-
t3 = boxContent(label, children, floatingLabel, isPopulated, leading, trailing, trigger, variant);
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
|
|
237
|
+
if ($[13] !== children || $[14] !== floatingLabel || $[15] !== isPopulated || $[16] !== label || $[17] !== leading || $[18] !== multiline || $[19] !== trailing || $[20] !== trigger || $[21] !== variant) {
|
|
238
|
+
t3 = boxContent(label, children, floatingLabel, isPopulated, leading, multiline, trailing, trigger, variant);
|
|
239
|
+
$[13] = children;
|
|
240
|
+
$[14] = floatingLabel;
|
|
241
|
+
$[15] = isPopulated;
|
|
242
|
+
$[16] = label;
|
|
243
|
+
$[17] = leading;
|
|
244
|
+
$[18] = multiline;
|
|
245
|
+
$[19] = trailing;
|
|
246
|
+
$[20] = trigger;
|
|
247
|
+
$[21] = variant;
|
|
248
|
+
$[22] = t3;
|
|
249
|
+
} else t3 = $[22];
|
|
241
250
|
let t4;
|
|
242
|
-
if ($[
|
|
251
|
+
if ($[23] !== T0 || $[24] !== t1 || $[25] !== t2 || $[26] !== t3) {
|
|
243
252
|
t4 = /* @__PURE__ */ jsx(T0, {
|
|
244
253
|
...t1,
|
|
245
254
|
...t2,
|
|
246
255
|
children: t3
|
|
247
256
|
});
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
} else t4 = $[
|
|
257
|
+
$[23] = T0;
|
|
258
|
+
$[24] = t1;
|
|
259
|
+
$[25] = t2;
|
|
260
|
+
$[26] = t3;
|
|
261
|
+
$[27] = t4;
|
|
262
|
+
} else t4 = $[27];
|
|
254
263
|
return t4;
|
|
255
264
|
}
|
|
256
265
|
/**
|
|
@@ -266,7 +275,7 @@ function FieldBox(t0) {
|
|
|
266
275
|
*/
|
|
267
276
|
function FieldInput(t0) {
|
|
268
277
|
const $ = c(19);
|
|
269
|
-
const { numeric: t1, placeholder, prefix, suffix, ...props$
|
|
278
|
+
const { numeric: t1, placeholder, prefix, suffix, ...props$1 } = t0;
|
|
270
279
|
const numeric = t1 === void 0 ? false : t1;
|
|
271
280
|
const box = useContext(BoxContext);
|
|
272
281
|
const T0 = Input;
|
|
@@ -278,16 +287,16 @@ function FieldInput(t0) {
|
|
|
278
287
|
$[1] = numeric;
|
|
279
288
|
$[2] = t3;
|
|
280
289
|
} else t3 = $[2];
|
|
281
|
-
const t4 = mergeStatefulStyles(t3, props$
|
|
290
|
+
const t4 = mergeStatefulStyles(t3, props$1);
|
|
282
291
|
let t5;
|
|
283
|
-
if ($[3] !== T0 || $[4] !== props$
|
|
292
|
+
if ($[3] !== T0 || $[4] !== props$1 || $[5] !== t2 || $[6] !== t4) {
|
|
284
293
|
t5 = /* @__PURE__ */ jsx(T0, {
|
|
285
294
|
placeholder: t2,
|
|
286
|
-
...props$
|
|
295
|
+
...props$1,
|
|
287
296
|
...t4
|
|
288
297
|
});
|
|
289
298
|
$[3] = T0;
|
|
290
|
-
$[4] = props$
|
|
299
|
+
$[4] = props$1;
|
|
291
300
|
$[5] = t2;
|
|
292
301
|
$[6] = t4;
|
|
293
302
|
$[7] = t5;
|
|
@@ -337,6 +346,42 @@ function FieldInput(t0) {
|
|
|
337
346
|
return t9;
|
|
338
347
|
}
|
|
339
348
|
/**
|
|
349
|
+
* A date or a time's segments, in a {@link FieldBox}: React Aria's
|
|
350
|
+
* `DateInput`, or the group holding a range's two. This is what carries the
|
|
351
|
+
* control's type and its place on the line, clearing the label at the top,
|
|
352
|
+
* as {@link FieldValue} does for a value that was chosen.
|
|
353
|
+
*
|
|
354
|
+
* A typed value longer than its box behaves as an input's text does. It is
|
|
355
|
+
* clipped rather than cut short, since every segment on the line is still a
|
|
356
|
+
* place to type. The browser scrolls whichever segment has focus into view,
|
|
357
|
+
* as it scrolls to an input's caret. And when focus leaves the segments the
|
|
358
|
+
* line goes back to its start, as an input's text does on blur, so a value
|
|
359
|
+
* at rest reads from its beginning rather than from wherever it was left.
|
|
360
|
+
*/
|
|
361
|
+
function FieldSegments(t0) {
|
|
362
|
+
const $ = c(5);
|
|
363
|
+
const { children } = t0;
|
|
364
|
+
const box = useContext(BoxContext);
|
|
365
|
+
let t1;
|
|
366
|
+
if ($[0] !== box.underLabel) {
|
|
367
|
+
t1 = props(fieldChromeStyles.input, fieldChromeStyles.segments, box.underLabel && fieldChromeStyles.inputUnderLabel);
|
|
368
|
+
$[0] = box.underLabel;
|
|
369
|
+
$[1] = t1;
|
|
370
|
+
} else t1 = $[1];
|
|
371
|
+
let t2;
|
|
372
|
+
if ($[2] !== children || $[3] !== t1) {
|
|
373
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
374
|
+
onBlur: returnToStart,
|
|
375
|
+
...t1,
|
|
376
|
+
children
|
|
377
|
+
});
|
|
378
|
+
$[2] = children;
|
|
379
|
+
$[3] = t1;
|
|
380
|
+
$[4] = t2;
|
|
381
|
+
} else t2 = $[4];
|
|
382
|
+
return t2;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
340
385
|
* A field's multi-line text control, in a {@link FieldBox} drawn `multiline`.
|
|
341
386
|
* React Aria's `TextArea`, with the same label association, value and
|
|
342
387
|
* validation {@link FieldInput} takes from the field around it, and the same
|
|
@@ -447,9 +492,10 @@ function FieldTrigger(props$4) {
|
|
|
447
492
|
/**
|
|
448
493
|
* A field's value where it was chosen rather than typed, in a
|
|
449
494
|
* {@link FieldBox}. Put React Aria's own element inside it — a select's
|
|
450
|
-
* `SelectValue
|
|
451
|
-
*
|
|
452
|
-
*
|
|
495
|
+
* `SelectValue` — and this is what carries the input's type and its place on
|
|
496
|
+
* the line, clearing the label at the top and truncating rather than
|
|
497
|
+
* wrapping. A date or a time is typed, segment by segment, and takes
|
|
498
|
+
* {@link FieldSegments} instead.
|
|
453
499
|
*
|
|
454
500
|
* The wrapper is the styled one rather than React Aria's element, because
|
|
455
501
|
* this is the box's flex item: styling the element inside instead left it
|
|
@@ -461,24 +507,27 @@ function FieldTrigger(props$4) {
|
|
|
461
507
|
*/
|
|
462
508
|
function FieldValue(t0) {
|
|
463
509
|
const $ = c(3);
|
|
464
|
-
const { isFocused: t1, isPlaceholder: t2, ...props$
|
|
510
|
+
const { isFocused: t1, isPlaceholder: t2, ...props$5 } = t0;
|
|
465
511
|
const isFocused = t1 === void 0 ? false : t1;
|
|
466
512
|
const isPlaceholder = t2 === void 0 ? false : t2;
|
|
467
513
|
const box = useContext(BoxContext);
|
|
468
514
|
const hidden = isPlaceholder && box.label === "floating" && !isFocused;
|
|
469
|
-
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$
|
|
515
|
+
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$5);
|
|
470
516
|
let t4;
|
|
471
|
-
if ($[0] !== props$
|
|
517
|
+
if ($[0] !== props$5 || $[1] !== t3) {
|
|
472
518
|
t4 = /* @__PURE__ */ jsx("span", {
|
|
473
|
-
...props$
|
|
519
|
+
...props$5,
|
|
474
520
|
...t3
|
|
475
521
|
});
|
|
476
|
-
$[0] = props$
|
|
522
|
+
$[0] = props$5;
|
|
477
523
|
$[1] = t3;
|
|
478
524
|
$[2] = t4;
|
|
479
525
|
} else t4 = $[2];
|
|
480
526
|
return t4;
|
|
481
527
|
}
|
|
528
|
+
function returnToStart(event) {
|
|
529
|
+
if (!event.currentTarget.contains(event.relatedTarget)) event.currentTarget.scrollLeft = 0;
|
|
530
|
+
}
|
|
482
531
|
function useFieldPopulated() {
|
|
483
532
|
const input = useSlottedContext(InputContext);
|
|
484
533
|
const textArea = useSlottedContext(TextAreaContext);
|
|
@@ -505,7 +554,7 @@ function FieldLabel(t0) {
|
|
|
505
554
|
let t1;
|
|
506
555
|
let t2;
|
|
507
556
|
if ($[0] !== t0) {
|
|
508
|
-
const { state: t3, variant: t4, ...props$
|
|
557
|
+
const { state: t3, variant: t4, ...props$3 } = t0;
|
|
509
558
|
const state = t3 === void 0 ? NO_STATE : t3;
|
|
510
559
|
const variant = t4 === void 0 ? "field" : t4;
|
|
511
560
|
const { isDisabled: t5, isFocusWithin: t6, isInvalid: t7 } = state;
|
|
@@ -513,8 +562,8 @@ function FieldLabel(t0) {
|
|
|
513
562
|
const isFocusWithin = t6 === void 0 ? false : t6;
|
|
514
563
|
const isInvalid = t7 === void 0 ? false : t7;
|
|
515
564
|
T0 = Label;
|
|
516
|
-
t1 = props$
|
|
517
|
-
t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$
|
|
565
|
+
t1 = props$3;
|
|
566
|
+
t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$3);
|
|
518
567
|
$[0] = t0;
|
|
519
568
|
$[1] = T0;
|
|
520
569
|
$[2] = t1;
|
|
@@ -662,6 +711,6 @@ function FieldMessage(t0) {
|
|
|
662
711
|
return t10;
|
|
663
712
|
}
|
|
664
713
|
//#endregion
|
|
665
|
-
export { FieldBox, FieldInput, FieldLabel, FieldMessage, FieldTextArea, FieldTrigger, FieldValue };
|
|
714
|
+
export { FieldBox, FieldInput, FieldLabel, FieldMessage, FieldSegments, FieldTextArea, FieldTrigger, FieldValue };
|
|
666
715
|
|
|
667
716
|
//# sourceMappingURL=index.js.map
|