@galaxy-io/dls 1.4.14 → 1.5.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.
Files changed (38) hide show
  1. package/dist/charts/ChartLegend.js +3 -3
  2. package/dist/charts/ChartPrimitives.d.ts +15 -0
  3. package/dist/charts/ChartPrimitives.js +28 -9
  4. package/dist/inputs/CheckboxInput.d.ts +11 -14
  5. package/dist/inputs/CheckboxInput.js +10 -27
  6. package/dist/inputs/ColorInput.d.ts +4 -2
  7. package/dist/inputs/ColorInput.js +14 -28
  8. package/dist/inputs/CopyInput.d.ts +4 -2
  9. package/dist/inputs/CopyInput.js +11 -3
  10. package/dist/inputs/DateInput.d.ts +4 -2
  11. package/dist/inputs/DateInput.js +24 -31
  12. package/dist/inputs/Input.d.ts +82 -5
  13. package/dist/inputs/Input.js +111 -33
  14. package/dist/inputs/MultiSelectInput.d.ts +4 -4
  15. package/dist/inputs/MultiSelectInput.js +36 -45
  16. package/dist/inputs/MultiTextInput.d.ts +5 -16
  17. package/dist/inputs/MultiTextInput.js +24 -31
  18. package/dist/inputs/NumberInput.d.ts +1 -1
  19. package/dist/inputs/NumberInput.js +10 -2
  20. package/dist/inputs/PasswordInput.d.ts +4 -3
  21. package/dist/inputs/PasswordInput.js +6 -3
  22. package/dist/inputs/RadioInput.d.ts +11 -14
  23. package/dist/inputs/RadioInput.js +18 -34
  24. package/dist/inputs/SelectInput.d.ts +5 -14
  25. package/dist/inputs/SelectInput.js +35 -57
  26. package/dist/inputs/SliderInput.d.ts +9 -1
  27. package/dist/inputs/SliderInput.js +47 -21
  28. package/dist/inputs/SwitcherInput.d.ts +7 -2
  29. package/dist/inputs/SwitcherInput.js +7 -7
  30. package/dist/inputs/TextAreaInput.d.ts +5 -18
  31. package/dist/inputs/TextAreaInput.js +29 -57
  32. package/dist/inputs/TextInput.d.ts +6 -2
  33. package/dist/inputs/TextInput.js +2 -1
  34. package/dist/inputs/ToggleInput.d.ts +10 -1
  35. package/dist/inputs/ToggleInput.js +31 -9
  36. package/dist/styles.css +20 -19
  37. package/dist/table/TableSelectCell.js +5 -4
  38. package/package.json +1 -1
@@ -2,7 +2,7 @@ import Text, { TextSize, TextVariant } from "../text/Text.js";
2
2
  import Tooltip, { TooltipPosition, TooltipVariant } from "../tooltip/Tooltip.js";
3
3
  import Circle from "../shapes/Circle.js";
4
4
  import { ChartMarkState } from "./types.js";
5
- import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow } from "./ChartPrimitives.js";
5
+ import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendMeasureClip, ChartLegendOverflowList, ChartLegendRow } from "./ChartPrimitives.js";
6
6
  import { useCallback, useLayoutEffect, useRef, useState } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  //#region src/charts/ChartLegend.tsx
@@ -120,7 +120,7 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
120
120
  $vertical: vertical,
121
121
  $extent: verticalExtent,
122
122
  children: [
123
- /* @__PURE__ */ jsxs(ChartLegendMeasure, {
123
+ /* @__PURE__ */ jsx(ChartLegendMeasureClip, { children: /* @__PURE__ */ jsxs(ChartLegendMeasure, {
124
124
  ref: measureRef,
125
125
  $vertical: vertical,
126
126
  "aria-hidden": "true",
@@ -141,7 +141,7 @@ var ChartLegend = ({ items, inset, hoveredKey = null, vertical = false, vertical
141
141
  children: `+${items.length - 1} more`
142
142
  })
143
143
  })]
144
- }),
144
+ }) }),
145
145
  inlineItems.map((item) => renderItem(item, vertical)),
146
146
  overflowItems.length > 0 && /* @__PURE__ */ jsx(Tooltip, {
147
147
  isInteractive: true,
@@ -228,6 +228,21 @@ export declare const ChartLegendRow: import("@linaria/react").StyledComponent<im
228
228
  /** Plot box height in px — the side legend's fit extent. */
229
229
  $extent?: number;
230
230
  }>;
231
+ /**
232
+ * Zero-size clip around the measure layer.
233
+ *
234
+ * `visibility: hidden` suppresses paint but not *overflow*: the measure layer's
235
+ * max-content box still joins the scrollable overflow region of every ancestor
236
+ * up to the nearest scroll container, and the row above cannot clip it. A
237
+ * legend wide enough to collapse therefore handed the page a horizontal
238
+ * scrollbar into empty space — the wider the collapsed entries, the further it
239
+ * scrolled.
240
+ *
241
+ * `overflow: hidden` on a 0×0 box ends the propagation there while leaving
242
+ * descendant layout geometry untouched, so the sizes the fit computation reads
243
+ * are exactly the ones it read before.
244
+ */
245
+ export declare const ChartLegendMeasureClip: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
231
246
  /**
232
247
  * Invisible copy of every legend entry plus a worst-case trigger, laid out
233
248
  * unconstrained along the legend's own axis so the fit computation can read
@@ -307,6 +307,25 @@ var ChartLegendRow = /*#__PURE__*/ styled("div")({
307
307
  }
308
308
  });
309
309
  /**
310
+ * Zero-size clip around the measure layer.
311
+ *
312
+ * `visibility: hidden` suppresses paint but not *overflow*: the measure layer's
313
+ * max-content box still joins the scrollable overflow region of every ancestor
314
+ * up to the nearest scroll container, and the row above cannot clip it. A
315
+ * legend wide enough to collapse therefore handed the page a horizontal
316
+ * scrollbar into empty space — the wider the collapsed entries, the further it
317
+ * scrolled.
318
+ *
319
+ * `overflow: hidden` on a 0×0 box ends the propagation there while leaving
320
+ * descendant layout geometry untouched, so the sizes the fit computation reads
321
+ * are exactly the ones it read before.
322
+ */
323
+ var ChartLegendMeasureClip = /*#__PURE__*/ styled("div")({
324
+ name: "ChartLegendMeasureClip",
325
+ class: "c1armna5",
326
+ propsAsIs: false
327
+ });
328
+ /**
310
329
  * Invisible copy of every legend entry plus a worst-case trigger, laid out
311
330
  * unconstrained along the legend's own axis so the fit computation can read
312
331
  * real sizes.
@@ -318,11 +337,11 @@ var _exp42 = () => ({ $vertical }) => $vertical ? "column" : "row";
318
337
  var _exp43 = () => ({ $vertical }) => $vertical ? "flex-start" : "center";
319
338
  var ChartLegendMeasure = /*#__PURE__*/ styled("div")({
320
339
  name: "ChartLegendMeasure",
321
- class: "c1armna5",
340
+ class: "cgd77rv",
322
341
  propsAsIs: false,
323
342
  vars: {
324
- "c1armna5-0": [_exp42()],
325
- "c1armna5-1": [_exp43()]
343
+ "cgd77rv-0": [_exp42()],
344
+ "cgd77rv-1": [_exp43()]
326
345
  }
327
346
  });
328
347
  /**
@@ -334,7 +353,7 @@ var ChartLegendMeasure = /*#__PURE__*/ styled("div")({
334
353
  */
335
354
  var ChartLegendOverflowList = /*#__PURE__*/ styled("div")({
336
355
  name: "ChartLegendOverflowList",
337
- class: "cgd77rv",
356
+ class: "cutidpi",
338
357
  propsAsIs: false
339
358
  });
340
359
  /**
@@ -358,18 +377,18 @@ var ChartLegendOverflowList = /*#__PURE__*/ styled("div")({
358
377
  var _exp45 = () => ({ $vertical }) => $vertical ? `0 0 8px 0` : `0 16px 0 0`;
359
378
  var ChartLegendItemButton = /*#__PURE__*/ styled("button")({
360
379
  name: "ChartLegendItemButton",
361
- class: "cutidpi",
380
+ class: "ccpczg",
362
381
  propsAsIs: false,
363
- vars: { "cutidpi-0": [_exp45()] }
382
+ vars: { "ccpczg-0": [_exp45()] }
364
383
  });
365
384
  /** The same row, when the legend is inert — no button semantics to announce.
366
385
  * Carries the same trailing padding; see {@link ChartLegendItemButton}. */
367
386
  var _exp47 = () => ({ $vertical }) => $vertical ? `0 0 8px 0` : `0 16px 0 0`;
368
387
  var ChartLegendItemStatic = /*#__PURE__*/ styled("div")({
369
388
  name: "ChartLegendItemStatic",
370
- class: "ccpczg",
389
+ class: "c2re25h",
371
390
  propsAsIs: false,
372
- vars: { "ccpczg-0": [_exp47()] }
391
+ vars: { "c2re25h-0": [_exp47()] }
373
392
  });
374
393
  //#endregion
375
- export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorBand, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendOverflowList, ChartLegendRow, ChartLinePath, ChartPlotBox, ChartPointCircle, ChartRoot, ChartSvg, ChartTooltipGrid, ChartTooltipLabelCell, ChartTooltipPositioner, ChartTooltipValueCell };
394
+ export { ChartArcPath, ChartAreaPath, ChartAxisLabelBox, ChartBarPath, ChartCenterBox, ChartCursorBand, ChartCursorLine, ChartEmptyOverlay, ChartGridLine, ChartHitTarget, ChartHitTargetPath, ChartLegendItemButton, ChartLegendItemStatic, ChartLegendMeasure, ChartLegendMeasureClip, ChartLegendOverflowList, ChartLegendRow, ChartLinePath, ChartPlotBox, ChartPointCircle, ChartRoot, ChartSvg, ChartTooltipGrid, ChartTooltipLabelCell, ChartTooltipPositioner, ChartTooltipValueCell };
@@ -1,18 +1,15 @@
1
- /** Fill color when checked. */
2
- export declare enum CheckboxInputVariant {
3
- PRIMARY = "PRIMARY",
4
- SECONDARY = "SECONDARY"
5
- }
6
- /** Box size. Two steps only — this is a hit target, not a type scale. */
7
- export declare enum CheckboxInputSize {
8
- SMALL = "SMALL",
9
- MEDIUM = "MEDIUM"
10
- }
1
+ import { InputSize, InputVariant } from "./Input";
11
2
  export interface CheckboxInputProps {
12
- /** @default CheckboxInputVariant.PRIMARY */
13
- variant?: CheckboxInputVariant;
14
- /** @default CheckboxInputSize.MEDIUM */
15
- size?: CheckboxInputSize;
3
+ /**
4
+ * Unchecked fill color. The checked fill is a state color and stays
5
+ * `background.primaryAlt` so the tick keeps its contrast. Unlike the field
6
+ * inputs, `TRANSPARENT` keeps the hairline border here — without it the box
7
+ * would be invisible. @default InputVariant.PRIMARY
8
+ */
9
+ variant?: InputVariant;
10
+ /** Box size — a hit target, so it steps 12 / 16 / 20px, not off the type scale.
11
+ * @default InputSize.MEDIUM */
12
+ size?: InputSize;
16
13
  /** Controlled state. The checkbox holds none of its own. */
17
14
  isChecked: boolean;
18
15
  /** Draw a dash instead of a tick — for a partially-selected group. */
@@ -3,24 +3,12 @@ import Text, { TextVariant } from "../text/Text.js";
3
3
  import Icon, { IconVariant, IconWeight } from "../icons/Icon.js";
4
4
  import FlexWrapper, { AlignItems } from "../containers/FlexWrapper.js";
5
5
  import RequiredMarker from "../text/RequiredMarker.js";
6
+ import { InputSize, InputVariant, getInputControlSize, getInputSurfaceColor } from "./Input.js";
6
7
  /* empty css */
7
8
  import { styled } from "@linaria/react";
8
- import { match } from "ts-pattern";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { CheckIcon, MinusIcon } from "@phosphor-icons/react";
11
11
  //#region src/inputs/CheckboxInput.tsx
12
- /** Fill color when checked. */
13
- var CheckboxInputVariant = /* @__PURE__ */ function(CheckboxInputVariant) {
14
- CheckboxInputVariant["PRIMARY"] = "PRIMARY";
15
- CheckboxInputVariant["SECONDARY"] = "SECONDARY";
16
- return CheckboxInputVariant;
17
- }({});
18
- /** Box size. Two steps only — this is a hit target, not a type scale. */
19
- var CheckboxInputSize = /* @__PURE__ */ function(CheckboxInputSize) {
20
- CheckboxInputSize["SMALL"] = "SMALL";
21
- CheckboxInputSize["MEDIUM"] = "MEDIUM";
22
- return CheckboxInputSize;
23
- }({});
24
12
  var _exp = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
25
13
  var _exp2 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
26
14
  var _exp3 = () => ({ theme }) => theme.color.border.selected;
@@ -34,14 +22,9 @@ var CheckboxContainer = withTheme(/*#__PURE__*/ styled("div")({
34
22
  "cythikj-2": [_exp3()]
35
23
  }
36
24
  }));
37
- var _exp5 = () => ({ $size }) => {
38
- return match($size).with("SMALL", () => "12px").with("MEDIUM", () => "16px").exhaustive();
39
- };
25
+ var _exp5 = () => ({ $size }) => getInputControlSize($size);
40
26
  var _exp6 = () => ({ theme }) => theme.color.border.primary;
41
- var _exp7 = () => ({ theme, $isChecked, $isIndeterminate }) => $isChecked || $isIndeterminate ? theme.color.background.primaryAlt : theme.color.background.tertiary;
42
- var _exp8 = () => ({ theme, $isDisabled, $variant }) => {
43
- return match($variant).with("PRIMARY", () => $isDisabled ? theme.color.border.primary : theme.color.border.primary).with("SECONDARY", () => $isDisabled ? theme.color.border.primary : theme.color.border.primary).exhaustive();
44
- };
27
+ var _exp7 = () => ({ theme, $variant, $isChecked, $isIndeterminate }) => $isChecked || $isIndeterminate ? theme.color.background.primaryAlt : getInputSurfaceColor(theme, $variant);
45
28
  var CheckboxWrapper = withTheme(/*#__PURE__*/ styled("div")({
46
29
  name: "CheckboxWrapper",
47
30
  class: "c1f4v2sg",
@@ -49,13 +32,14 @@ var CheckboxWrapper = withTheme(/*#__PURE__*/ styled("div")({
49
32
  vars: {
50
33
  "c1f4v2sg-0": [_exp5()],
51
34
  "c1f4v2sg-1": [_exp6()],
52
- "c1f4v2sg-2": [_exp7()],
53
- "c1f4v2sg-3": [_exp8()]
35
+ "c1f4v2sg-2": [_exp7()]
54
36
  }
55
37
  }));
38
+ /** The tick sits inside the box, so it runs a step under `getInputIconSize`. */
56
39
  var CHECKBOX_INPUT_SIZE_TO_ICON_SIZE_MAP = {
57
- ["SMALL"]: 10,
58
- ["MEDIUM"]: 12
40
+ [InputSize.SMALL]: 10,
41
+ [InputSize.MEDIUM]: 12,
42
+ [InputSize.LARGE]: 14
59
43
  };
60
44
  /**
61
45
  * A checkbox with an optional label. Fully controlled — you own `isChecked`.
@@ -63,7 +47,7 @@ var CHECKBOX_INPUT_SIZE_TO_ICON_SIZE_MAP = {
63
47
  * `isIndeterminate` is purely visual and does not change what `onChange`
64
48
  * reports; the callback still flips against `isChecked`.
65
49
  */
66
- var CheckboxInput = ({ variant = "PRIMARY", size = "MEDIUM", isChecked, isIndeterminate = false, label, isRequired = false, isDisabled = false, onChange, ariaLabel, stopClickPropagation = false }) => {
50
+ var CheckboxInput = ({ variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, isChecked, isIndeterminate = false, label, isRequired = false, isDisabled = false, onChange, ariaLabel, stopClickPropagation = false }) => {
67
51
  const handleClick = (event) => {
68
52
  if (stopClickPropagation) event.stopPropagation();
69
53
  if (!isDisabled) onChange(!isChecked, event);
@@ -105,7 +89,6 @@ var CheckboxInput = ({ variant = "PRIMARY", size = "MEDIUM", isChecked, isIndete
105
89
  $size: size,
106
90
  $isChecked: isChecked,
107
91
  $isIndeterminate: isIndeterminate,
108
- $isDisabled: isDisabled,
109
92
  children: renderIcon()
110
93
  }), label && /* @__PURE__ */ jsxs(FlexWrapper, {
111
94
  alignItems: AlignItems.CENTER,
@@ -118,4 +101,4 @@ var CheckboxInput = ({ variant = "PRIMARY", size = "MEDIUM", isChecked, isIndete
118
101
  });
119
102
  };
120
103
  //#endregion
121
- export { CheckboxInputSize, CheckboxInputVariant, CheckboxInput as default };
104
+ export { CheckboxInput as default };
@@ -1,6 +1,8 @@
1
- import { InputSize } from "./Input";
1
+ import { InputSize, InputVariant } from "./Input";
2
2
  export interface ColorInputProps {
3
3
  label?: string;
4
+ /** Trigger surface color. @default InputVariant.PRIMARY */
5
+ variant?: InputVariant;
4
6
  /** @default InputSize.MEDIUM */
5
7
  size?: InputSize;
6
8
  /** Controlled hex value, e.g. `"#1a1a1a"`. */
@@ -31,5 +33,5 @@ export interface ColorInputProps {
31
33
  * `onPreviewChange` fires throughout the drag while `onChange` fires on commit —
32
34
  * drive a live preview from the first and persist from the second.
33
35
  */
34
- declare const ColorInput: ({ label, size, value, placeholder, onChange, onPreviewChange, width, fillWidth, isDisabled, isRequired, error, pinnedHex, isOpen: controlledIsOpen, onOpenChange, children, }: ColorInputProps) => import("react").JSX.Element;
36
+ declare const ColorInput: ({ label, variant, size, value, placeholder, onChange, onPreviewChange, width, fillWidth, isDisabled, isRequired, error, pinnedHex, isOpen: controlledIsOpen, onOpenChange, children, }: ColorInputProps) => import("react").JSX.Element;
35
37
  export default ColorInput;
@@ -4,37 +4,32 @@ import { hexToHsva, hsvaToHex } from "../utils/colors.js";
4
4
  import Text, { TextSize, TextVariant } from "../text/Text.js";
5
5
  import Icon, { IconVariant } from "../icons/Icon.js";
6
6
  import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrapper.js";
7
+ import Spacing from "../containers/Spacing.js";
8
+ import { InputLabel, InputSize, InputVariant, getInputBorderColor, getInputHeight, getInputIconSize, getInputPadding, getInputSurfaceColor, getInputTextSize } from "./Input.js";
7
9
  import Dropdown, { DropdownVariant } from "../dropdown/Dropdown.js";
8
10
  import GridWrapper from "../containers/GridWrapper.js";
9
- import Spacing from "../containers/Spacing.js";
10
- import { InputLabel, InputSize } from "./Input.js";
11
11
  /* empty css */
12
12
  import { styled } from "@linaria/react";
13
- import { match } from "ts-pattern";
14
13
  import { useCallback, useEffect, useMemo, useState } from "react";
15
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
15
  import { CaretDownIcon } from "@phosphor-icons/react";
17
16
  import { Hue, Saturation } from "@uiw/react-color";
18
17
  //#region src/inputs/ColorInput.tsx
19
- var _exp = () => ({ $size }) => {
20
- return match($size).with(InputSize.SMALL, () => "0 6px 0 8px").with(InputSize.MEDIUM, () => "0 8px 0 10px").with(InputSize.LARGE, () => "0 10px 0 12px").exhaustive();
21
- };
22
- var _exp2 = () => ({ $size }) => {
23
- return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
24
- };
18
+ var _exp = () => ({ $size }) => `0 ${getInputPadding($size)}`;
19
+ var _exp2 = () => ({ $size }) => getInputHeight($size);
25
20
  var _exp3 = () => ({ $width, $fillWidth }) => $fillWidth ? "100%" : $width ? getCssSizeValue($width) : "auto";
26
21
  var _exp4 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
27
22
  var _exp5 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
28
- var _exp6 = () => ({ theme }) => theme.color.background.primary;
29
- var _exp7 = () => ({ theme, $isActive, $isError }) => {
23
+ var _exp6 = () => ({ theme, $variant }) => getInputSurfaceColor(theme, $variant);
24
+ var _exp7 = () => ({ theme, $variant, $isActive, $isError }) => {
30
25
  if ($isActive) return theme.color.border.selected;
31
26
  if ($isError) return theme.color.border.error;
32
- return theme.color.border.primary;
27
+ return getInputBorderColor(theme, $variant);
33
28
  };
34
- var _exp8 = () => ({ theme, $isActive, $isDisabled }) => {
35
- if ($isDisabled) return theme.color.border.primary;
29
+ var _exp8 = () => ({ theme, $variant, $isActive, $isDisabled }) => {
30
+ if ($isDisabled) return getInputBorderColor(theme, $variant);
36
31
  if ($isActive) return theme.color.border.selected;
37
- return theme.color.border.primary;
32
+ return getInputBorderColor(theme, $variant);
38
33
  };
39
34
  var StyledColorInput = withTheme(/*#__PURE__*/ styled("div")({
40
35
  name: "StyledColorInput",
@@ -123,23 +118,13 @@ var safeNormalizeHex = (hex) => {
123
118
  return null;
124
119
  }
125
120
  };
126
- var COLOR_INPUT_SIZE_TO_TEXT_SIZE = {
127
- [InputSize.SMALL]: TextSize.BODY_MD,
128
- [InputSize.MEDIUM]: TextSize.BODY_MD,
129
- [InputSize.LARGE]: TextSize.BODY_MD
130
- };
131
- var COLOR_INPUT_SIZE_TO_ICON_SIZE = {
132
- [InputSize.SMALL]: 14,
133
- [InputSize.MEDIUM]: 16,
134
- [InputSize.LARGE]: 18
135
- };
136
121
  /**
137
122
  * A hex color field with a picker popover. Fully controlled.
138
123
  *
139
124
  * `onPreviewChange` fires throughout the drag while `onChange` fires on commit —
140
125
  * drive a live preview from the first and persist from the second.
141
126
  */
142
- var ColorInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select color...", onChange, onPreviewChange, width, fillWidth = false, isDisabled = false, isRequired = false, error, pinnedHex = [], isOpen: controlledIsOpen, onOpenChange, children }) => {
127
+ var ColorInput = ({ label, variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, value, placeholder = "Select color...", onChange, onPreviewChange, width, fillWidth = false, isDisabled = false, isRequired = false, error, pinnedHex = [], isOpen: controlledIsOpen, onOpenChange, children }) => {
143
128
  const [localState, setLocalState] = useState({
144
129
  isOpen: false,
145
130
  isHovered: false
@@ -328,6 +313,7 @@ var ColorInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
328
313
  children
329
314
  }) : /* @__PURE__ */ jsxs(StyledColorInput, {
330
315
  $size: size,
316
+ $variant: variant,
331
317
  $isActive: isOpen,
332
318
  $isDisabled: isDisabled,
333
319
  $isError: !!error,
@@ -347,7 +333,7 @@ var ColorInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
347
333
  gap: 8,
348
334
  children: [value && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ColorInputPreviewSwatch, { $color: value }), /* @__PURE__ */ jsx(Spacing, { left: 4 })] }), /* @__PURE__ */ jsx(Text, {
349
335
  variant: textVariant,
350
- size: COLOR_INPUT_SIZE_TO_TEXT_SIZE[size],
336
+ size: getInputTextSize(size),
351
337
  isEllipsis: true,
352
338
  cursor: !isDisabled ? "pointer" : "not-allowed",
353
339
  children: displayValue
@@ -356,7 +342,7 @@ var ColorInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
356
342
  /* @__PURE__ */ jsx(Spacing, { left: 8 }),
357
343
  /* @__PURE__ */ jsx(Icon, {
358
344
  component: CaretDownIcon,
359
- size: COLOR_INPUT_SIZE_TO_ICON_SIZE[size],
345
+ size: getInputIconSize(size),
360
346
  variant: isOpen || localState.isHovered ? IconVariant.SECONDARY : IconVariant.TERTIARY
361
347
  })
362
348
  ]
@@ -1,10 +1,12 @@
1
- import { InputSize } from "./Input";
1
+ import { InputSize, InputVariant } from "./Input";
2
2
  export interface CopyInputProps {
3
3
  /** The text shown and copied. Read-only — there is no `onChange`. */
4
4
  value: string;
5
5
  label?: string;
6
6
  /** Adds an info icon beside the label with this content on hover. */
7
7
  labelTooltip?: string | React.ReactNode;
8
+ /** Field surface color. @default InputVariant.PRIMARY */
9
+ variant?: InputVariant;
8
10
  /** @default InputSize.MEDIUM */
9
11
  size?: InputSize;
10
12
  /** A number is px. */
@@ -18,7 +20,7 @@ export interface CopyInputProps {
18
20
  * The trailing button confirms the copy itself, so you don't need to.
19
21
  */
20
22
  declare const CopyInput: {
21
- ({ value, label, labelTooltip, size, width, fillWidth, isMonospace, }: CopyInputProps): import("react").JSX.Element;
23
+ ({ value, label, labelTooltip, variant, size, width, fillWidth, isMonospace, }: CopyInputProps): import("react").JSX.Element;
22
24
  displayName: string;
23
25
  };
24
26
  export default CopyInput;
@@ -1,6 +1,6 @@
1
1
  import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
2
2
  import FlexWrapper, { AlignItems } from "../containers/FlexWrapper.js";
3
- import { InputSize } from "./Input.js";
3
+ import { InputSize, InputVariant } from "./Input.js";
4
4
  import TextInput from "./TextInput.js";
5
5
  import { useCallback, useRef, useState } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -11,11 +11,18 @@ var INPUT_SIZE_TO_BUTTON_SIZE = {
11
11
  [InputSize.MEDIUM]: ButtonSize.MEDIUM,
12
12
  [InputSize.LARGE]: ButtonSize.LARGE
13
13
  };
14
+ var INPUT_VARIANT_TO_BUTTON_VARIANT = {
15
+ [InputVariant.TRANSPARENT]: ButtonVariant.TERTIARY,
16
+ [InputVariant.BASE]: ButtonVariant.SECONDARY,
17
+ [InputVariant.PRIMARY]: ButtonVariant.SECONDARY,
18
+ [InputVariant.SECONDARY]: ButtonVariant.SECONDARY,
19
+ [InputVariant.TERTIARY]: ButtonVariant.SECONDARY
20
+ };
14
21
  /**
15
22
  * A read-only field with a copy-to-clipboard button — API keys, IDs, share links.
16
23
  * The trailing button confirms the copy itself, so you don't need to.
17
24
  */
18
- var CopyInput = ({ value, label, labelTooltip, size = InputSize.MEDIUM, width, fillWidth, isMonospace = false }) => {
25
+ var CopyInput = ({ value, label, labelTooltip, variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, width, fillWidth, isMonospace = false }) => {
19
26
  const [copied, setCopied] = useState(false);
20
27
  const inputRef = useRef(null);
21
28
  const handleCopy = useCallback(() => {
@@ -35,13 +42,14 @@ var CopyInput = ({ value, label, labelTooltip, size = InputSize.MEDIUM, width, f
35
42
  labelTooltip,
36
43
  value,
37
44
  onChange: () => {},
45
+ variant,
38
46
  size,
39
47
  width,
40
48
  fillWidth,
41
49
  isMonospace
42
50
  }), /* @__PURE__ */ jsx(Button, {
43
51
  icon: copied ? CheckIcon : CopyIcon,
44
- variant: ButtonVariant.SECONDARY,
52
+ variant: INPUT_VARIANT_TO_BUTTON_VARIANT[variant],
45
53
  size: INPUT_SIZE_TO_BUTTON_SIZE[size],
46
54
  onClick: handleCopy
47
55
  })]
@@ -1,6 +1,8 @@
1
- import { InputSize } from "./Input";
1
+ import { InputSize, InputVariant } from "./Input";
2
2
  export interface DateInputProps {
3
3
  label?: string;
4
+ /** Trigger surface color. @default InputVariant.PRIMARY */
5
+ variant?: InputVariant;
4
6
  /** @default InputSize.MEDIUM */
5
7
  size?: InputSize;
6
8
  /** Controlled value. `null` shows the placeholder. */
@@ -28,5 +30,5 @@ export declare function defaultDateFormat(date: Date): string;
28
30
  *
29
31
  * Works in `Date` objects throughout; there is no string parsing to get wrong.
30
32
  */
31
- declare const DateInput: ({ label, size, value, placeholder, onChange, width, fillWidth, isDisabled, isRequired, error, minDate, maxDate, format, }: DateInputProps) => import("react").JSX.Element;
33
+ declare const DateInput: ({ label, variant, size, value, placeholder, onChange, width, fillWidth, isDisabled, isRequired, error, minDate, maxDate, format, }: DateInputProps) => import("react").JSX.Element;
32
34
  export default DateInput;
@@ -3,14 +3,13 @@ import { getCssSizeValue } from "../utils/linaria.js";
3
3
  import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
4
4
  import Icon, { IconVariant } from "../icons/Icon.js";
5
5
  import FlexWrapper, { AlignItems, FlexDirection, JustifyContent } from "../containers/FlexWrapper.js";
6
+ import Spacing from "../containers/Spacing.js";
7
+ import { InputLabel, InputSize, InputVariant, getInputBorderColor, getInputHeight, getInputIconSize, getInputPadding, getInputSurfaceColor, getInputTextSize } from "./Input.js";
6
8
  import Dropdown, { DropdownVariant } from "../dropdown/Dropdown.js";
7
9
  import GridWrapper from "../containers/GridWrapper.js";
8
- import Spacing from "../containers/Spacing.js";
9
- import { InputLabel, InputSize } from "./Input.js";
10
- import SelectInput, { SelectInputVariant } from "./SelectInput.js";
10
+ import SelectInput from "./SelectInput.js";
11
11
  /* empty css */
12
12
  import { styled } from "@linaria/react";
13
- import { match } from "ts-pattern";
14
13
  import { useCallback, useMemo, useRef, useState } from "react";
15
14
  import { jsx, jsxs } from "react/jsx-runtime";
16
15
  import { CalendarBlankIcon, CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";
@@ -63,25 +62,28 @@ var DATE_DAY_TO_LABEL = {
63
62
  ["FRIDAY"]: "Fri",
64
63
  ["SATURDAY"]: "Sat"
65
64
  };
66
- var _exp = () => ({ $size }) => {
67
- return match($size).with(InputSize.SMALL, () => "0 6px 0 8px").with(InputSize.MEDIUM, () => "0 8px 0 10px").with(InputSize.LARGE, () => "0 10px 0 12px").exhaustive();
68
- };
69
- var _exp2 = () => ({ $size }) => {
70
- return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
65
+ var INPUT_VARIANT_TO_DROPDOWN_VARIANT = {
66
+ [InputVariant.TRANSPARENT]: DropdownVariant.TRANSPARENT,
67
+ [InputVariant.BASE]: DropdownVariant.PRIMARY,
68
+ [InputVariant.PRIMARY]: DropdownVariant.PRIMARY,
69
+ [InputVariant.SECONDARY]: DropdownVariant.SECONDARY,
70
+ [InputVariant.TERTIARY]: DropdownVariant.TERTIARY
71
71
  };
72
+ var _exp = () => ({ $size }) => `0 ${getInputPadding($size)}`;
73
+ var _exp2 = () => ({ $size }) => getInputHeight($size);
72
74
  var _exp3 = () => ({ $width, $fillWidth }) => $fillWidth ? "100%" : $width ? getCssSizeValue($width) : "auto";
73
75
  var _exp4 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
74
76
  var _exp5 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
75
- var _exp6 = () => ({ theme }) => theme.color.background.primary;
76
- var _exp7 = () => ({ theme, $isActive, $isError }) => {
77
+ var _exp6 = () => ({ theme, $variant }) => getInputSurfaceColor(theme, $variant);
78
+ var _exp7 = () => ({ theme, $variant, $isActive, $isError }) => {
77
79
  if ($isActive) return theme.color.border.selected;
78
80
  if ($isError) return theme.color.border.error;
79
- return theme.color.border.primary;
81
+ return getInputBorderColor(theme, $variant);
80
82
  };
81
- var _exp8 = () => ({ theme, $isActive, $isDisabled }) => {
82
- if ($isDisabled) return theme.color.border.primary;
83
+ var _exp8 = () => ({ theme, $variant, $isActive, $isDisabled }) => {
84
+ if ($isDisabled) return getInputBorderColor(theme, $variant);
83
85
  if ($isActive) return theme.color.border.selected;
84
- return theme.color.border.primary;
86
+ return getInputBorderColor(theme, $variant);
85
87
  };
86
88
  var StyledDateInput = withTheme(/*#__PURE__*/ styled("div")({
87
89
  name: "StyledDateInput",
@@ -131,16 +133,6 @@ var DayCell = withTheme(/*#__PURE__*/ styled("button")({
131
133
  "d60emtx-4": [_exp11()]
132
134
  }
133
135
  }));
134
- var DATE_INPUT_SIZE_TO_TEXT_SIZE = {
135
- [InputSize.SMALL]: TextSize.BODY_MD,
136
- [InputSize.MEDIUM]: TextSize.BODY_MD,
137
- [InputSize.LARGE]: TextSize.BODY_MD
138
- };
139
- var DATE_INPUT_SIZE_TO_ICON_SIZE = {
140
- [InputSize.SMALL]: 14,
141
- [InputSize.MEDIUM]: 16,
142
- [InputSize.LARGE]: 18
143
- };
144
136
  var DEFAULT_MAX_DATE = /* @__PURE__ */ new Date();
145
137
  function defaultDateFormat(date) {
146
138
  return date.toLocaleDateString("en-US", {
@@ -157,7 +149,7 @@ var getInitialViewDate = (value) => {
157
149
  *
158
150
  * Works in `Date` objects throughout; there is no string parsing to get wrong.
159
151
  */
160
- var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select date...", onChange, width, fillWidth = false, isDisabled = false, isRequired = false, error, minDate = new Date(1970, 0, 1), maxDate = DEFAULT_MAX_DATE, format = defaultDateFormat }) => {
152
+ var DateInput = ({ label, variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, value, placeholder = "Select date...", onChange, width, fillWidth = false, isDisabled = false, isRequired = false, error, minDate = new Date(1970, 0, 1), maxDate = DEFAULT_MAX_DATE, format = defaultDateFormat }) => {
161
153
  const [state, setState] = useState({
162
154
  isOpen: false,
163
155
  isHovered: false,
@@ -383,7 +375,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
383
375
  onClick: (e) => e.stopPropagation(),
384
376
  onMouseDown: (e) => e.stopPropagation(),
385
377
  children: [/* @__PURE__ */ jsx(SelectInput, {
386
- variant: SelectInputVariant.SECONDARY,
378
+ variant,
387
379
  size: InputSize.SMALL,
388
380
  options: monthOptions,
389
381
  value: selectedMonthOption,
@@ -392,7 +384,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
392
384
  onOpenChange: handleMonthSelectOpenChange,
393
385
  width: 120
394
386
  }), /* @__PURE__ */ jsx(SelectInput, {
395
- variant: SelectInputVariant.SECONDARY,
387
+ variant,
396
388
  size: InputSize.SMALL,
397
389
  options: yearOptions,
398
390
  value: selectedYearOption,
@@ -450,7 +442,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
450
442
  isRequired
451
443
  }),
452
444
  /* @__PURE__ */ jsx(Dropdown, {
453
- variant: DropdownVariant.PRIMARY,
445
+ variant: INPUT_VARIANT_TO_DROPDOWN_VARIANT[variant],
454
446
  body: calendarBody,
455
447
  isOpen: state.isOpen,
456
448
  onClose: handleClose,
@@ -458,6 +450,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
458
450
  fillWidth,
459
451
  children: /* @__PURE__ */ jsxs(StyledDateInput, {
460
452
  $size: size,
453
+ $variant: variant,
461
454
  $isActive: state.isOpen,
462
455
  $isDisabled: isDisabled,
463
456
  $isError: !!error,
@@ -474,7 +467,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
474
467
  children: [
475
468
  /* @__PURE__ */ jsx(Text, {
476
469
  variant: textVariant,
477
- size: DATE_INPUT_SIZE_TO_TEXT_SIZE[size],
470
+ size: getInputTextSize(size),
478
471
  isEllipsis: true,
479
472
  cursor: !isDisabled ? "pointer" : "not-allowed",
480
473
  children: displayValue
@@ -482,7 +475,7 @@ var DateInput = ({ label, size = InputSize.MEDIUM, value, placeholder = "Select
482
475
  /* @__PURE__ */ jsx(Spacing, { left: 8 }),
483
476
  /* @__PURE__ */ jsx(Icon, {
484
477
  component: CalendarBlankIcon,
485
- size: DATE_INPUT_SIZE_TO_ICON_SIZE[size],
478
+ size: getInputIconSize(size),
486
479
  variant: state.isOpen || state.isHovered ? IconVariant.SECONDARY : IconVariant.TERTIARY
487
480
  })
488
481
  ]