@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.
@@ -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 = 'center' | 'end' | 'start';
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 = 'bottom' | 'left' | 'right' | 'top';
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","placementOf","const","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 { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, 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;\ntype TooltipAlign = 'center' | 'end' | 'start';\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 = 'bottom' | 'left' | 'right' | 'top';\n\n// React Aria names a placement by the side and, along it, the end the\n// tooltip is aligned to — the same mapping `Popover` makes, kept identical\n// so the two agree on what `side` and `align` mean.\nfunction placementOf(side: TooltipSide, align: TooltipAlign) {\n if (align === 'center') {\n return side;\n }\n if (side === 'top' || side === 'bottom') {\n return `${side} ${align}` as const;\n }\n return `${side} ${align === 'start' ? 'top' : 'bottom'}` as const;\n}\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":";;;;;;;AAyBA,MAAMgB,SAAS,EACbC,WAAW;CACTC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAKA,MAAMC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{"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":";;;;;;;AA0BA,MAAMmB,SAAS,EACbC,WAAW;CACTC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAKA,MAAMC,sBAAsB;;;;;;;;;;;;;;;AA6D5B,SAAA7B,UAAA2C,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAZ;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAArB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,OAAAA,KAAAR,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,QAAAX,eAAAW,EAAA,QAAA9B,aAAA8B,EAAA,QAAAP,SAAAO,EAAA,QAAAJ,cAAAI,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,IAAA;EALAE,KAAA,oBAAC,SAAD;GAAyBrB,aAAAA;GAAqBO,QAAAA;GAAuB,WAAAW;GAE7CrC,0BAAAA;GAAS,GAAMsC;GAIpCf,UAAAA;EANQ,CAAA;EAOEO,EAAA,MAAAX;EAAAW,EAAA,MAAA9B;EAAA8B,EAAA,MAAAP;EAAAO,EAAA,MAAAJ;EAAAI,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAV,YAAAU,EAAA,QAAAE,SAAAF,EAAA,QAAAU,IAAA;EATVC,KAAA,qBAAC,gBAAD;GAAe,GAAKT;GAApB,UAAA,CACFZ,UACDoB,EAFkB;;EAUHV,EAAA,MAAAV;EAAAU,EAAA,MAAAE;EAAAF,EAAA,MAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAVZW;AAUY;AAtBrB,SAAAF,MAAAG,OAAA;CAAA,OAgBgGzD,MAAaO,QAAOmD,OAAQ5C,OAAMC,WAAYN,YAAYgD,MAAKE,SAAU,CAAC;AAAC"}
@@ -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(36);
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] = state.isDisabled;
91
- $[9] = t3;
92
- } else t3 = $[9];
91
+ $[8] = multiline;
92
+ $[9] = outlined;
93
+ $[10] = state.isDisabled;
94
+ $[11] = t3;
95
+ } else t3 = $[11];
93
96
  let t4;
94
- if ($[10] !== floatingLabel || $[11] !== state.isDisabled) {
97
+ if ($[12] !== floatingLabel || $[13] !== state.isDisabled) {
95
98
  t4 = props(fieldChromeStyles.column, floatingLabel && fieldChromeStyles.columnFloating, state.isDisabled && (floatingLabel ? fieldChromeStyles.columnDisabledFloating : fieldChromeStyles.columnDisabled));
96
- $[10] = floatingLabel;
97
- $[11] = state.isDisabled;
98
- $[12] = t4;
99
- } else t4 = $[12];
99
+ $[12] = floatingLabel;
100
+ $[13] = state.isDisabled;
101
+ $[14] = t4;
102
+ } else t4 = $[14];
100
103
  let t5;
101
- if ($[13] !== floated || $[14] !== floatingLabel || $[15] !== outlined) {
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
- $[13] = floated;
104
- $[14] = floatingLabel;
105
- $[15] = outlined;
106
- $[16] = t5;
107
- } else t5 = $[16];
106
+ $[15] = floated;
107
+ $[16] = floatingLabel;
108
+ $[17] = outlined;
109
+ $[18] = t5;
110
+ } else t5 = $[18];
108
111
  let t6;
109
- if ($[17] !== label || $[18] !== state || $[19] !== t5) {
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
- $[17] = label;
116
- $[18] = state;
117
- $[19] = t5;
118
- $[20] = t6;
119
- } else t6 = $[20];
118
+ $[19] = label;
119
+ $[20] = state;
120
+ $[21] = t5;
121
+ $[22] = t6;
122
+ } else t6 = $[22];
120
123
  let t7;
121
- if ($[21] !== children || $[22] !== t4 || $[23] !== t6) {
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
- $[21] = children;
127
- $[22] = t4;
128
- $[23] = t6;
129
- $[24] = t7;
130
- } else t7 = $[24];
129
+ $[23] = children;
130
+ $[24] = t4;
131
+ $[25] = t6;
132
+ $[26] = t7;
133
+ } else t7 = $[26];
131
134
  let t8;
132
- if ($[25] !== state.isDisabled || $[26] !== state.isInvalid || $[27] !== trailing) {
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
- $[25] = state.isDisabled;
138
- $[26] = state.isInvalid;
139
- $[27] = trailing;
140
- $[28] = t8;
141
- } else t8 = $[28];
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 ($[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t7 || $[33] !== t8 || $[34] !== trigger) {
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
- $[29] = t1;
155
- $[30] = t2;
156
- $[31] = t3;
157
- $[32] = t7;
158
- $[33] = t8;
159
- $[34] = trigger;
160
- $[35] = t9;
161
- } else t9 = $[35];
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(26);
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
- const multiline = t8 === void 0 ? false : t8;
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] = t1;
211
- $[8] = t2;
212
- $[9] = trailing;
213
- $[10] = trigger;
214
- $[11] = variant;
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
- t1 = $[7];
223
- t2 = $[8];
224
- trailing = $[9];
225
- trigger = $[10];
226
- variant = $[11];
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 ($[12] !== children || $[13] !== floatingLabel || $[14] !== isPopulated || $[15] !== label || $[16] !== leading || $[17] !== trailing || $[18] !== trigger || $[19] !== variant) {
230
- t3 = boxContent(label, children, floatingLabel, isPopulated, leading, trailing, trigger, variant);
231
- $[12] = children;
232
- $[13] = floatingLabel;
233
- $[14] = isPopulated;
234
- $[15] = label;
235
- $[16] = leading;
236
- $[17] = trailing;
237
- $[18] = trigger;
238
- $[19] = variant;
239
- $[20] = t3;
240
- } else t3 = $[20];
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 ($[21] !== T0 || $[22] !== t1 || $[23] !== t2 || $[24] !== t3) {
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
- $[21] = T0;
249
- $[22] = t1;
250
- $[23] = t2;
251
- $[24] = t3;
252
- $[25] = t4;
253
- } else t4 = $[25];
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$3 } = t0;
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$3);
290
+ const t4 = mergeStatefulStyles(t3, props$1);
282
291
  let t5;
283
- if ($[3] !== T0 || $[4] !== props$3 || $[5] !== t2 || $[6] !== t4) {
292
+ if ($[3] !== T0 || $[4] !== props$1 || $[5] !== t2 || $[6] !== t4) {
284
293
  t5 = /* @__PURE__ */ jsx(T0, {
285
294
  placeholder: t2,
286
- ...props$3,
295
+ ...props$1,
287
296
  ...t4
288
297
  });
289
298
  $[3] = T0;
290
- $[4] = props$3;
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`, a picker's display — and this is what carries the input's
451
- * type and its place on the line, clearing the label at the top and
452
- * truncating rather than wrapping.
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$1 } = t0;
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$1);
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$1 || $[1] !== t3) {
517
+ if ($[0] !== props$5 || $[1] !== t3) {
472
518
  t4 = /* @__PURE__ */ jsx("span", {
473
- ...props$1,
519
+ ...props$5,
474
520
  ...t3
475
521
  });
476
- $[0] = props$1;
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$5 } = t0;
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$5;
517
- t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$5);
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