@galaxy-io/dls 1.4.15 → 1.5.1

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 (41) hide show
  1. package/dist/assets/components/GalaxyFilamentWordmarkDark.d.ts +3 -0
  2. package/dist/assets/components/GalaxyFilamentWordmarkDark.js +14 -0
  3. package/dist/assets/components/GalaxyFilamentWordmarkLight.d.ts +3 -0
  4. package/dist/assets/components/GalaxyFilamentWordmarkLight.js +14 -0
  5. package/dist/icons/GalaxyFilamentWordmark.d.ts +11 -0
  6. package/dist/icons/GalaxyFilamentWordmark.js +25 -0
  7. package/dist/inputs/CheckboxInput.d.ts +11 -14
  8. package/dist/inputs/CheckboxInput.js +10 -27
  9. package/dist/inputs/ColorInput.d.ts +4 -2
  10. package/dist/inputs/ColorInput.js +14 -28
  11. package/dist/inputs/CopyInput.d.ts +4 -2
  12. package/dist/inputs/CopyInput.js +11 -3
  13. package/dist/inputs/DateInput.d.ts +4 -2
  14. package/dist/inputs/DateInput.js +24 -31
  15. package/dist/inputs/Input.d.ts +82 -5
  16. package/dist/inputs/Input.js +111 -33
  17. package/dist/inputs/MultiSelectInput.d.ts +4 -4
  18. package/dist/inputs/MultiSelectInput.js +38 -45
  19. package/dist/inputs/MultiTextInput.d.ts +5 -16
  20. package/dist/inputs/MultiTextInput.js +24 -31
  21. package/dist/inputs/NumberInput.d.ts +1 -1
  22. package/dist/inputs/NumberInput.js +10 -2
  23. package/dist/inputs/PasswordInput.d.ts +4 -3
  24. package/dist/inputs/PasswordInput.js +6 -3
  25. package/dist/inputs/RadioInput.d.ts +11 -14
  26. package/dist/inputs/RadioInput.js +18 -34
  27. package/dist/inputs/SelectInput.d.ts +5 -14
  28. package/dist/inputs/SelectInput.js +35 -57
  29. package/dist/inputs/SliderInput.d.ts +9 -1
  30. package/dist/inputs/SliderInput.js +47 -21
  31. package/dist/inputs/SwitcherInput.d.ts +7 -2
  32. package/dist/inputs/SwitcherInput.js +10 -9
  33. package/dist/inputs/TextAreaInput.d.ts +5 -18
  34. package/dist/inputs/TextAreaInput.js +29 -57
  35. package/dist/inputs/TextInput.d.ts +6 -2
  36. package/dist/inputs/TextInput.js +2 -1
  37. package/dist/inputs/ToggleInput.d.ts +10 -1
  38. package/dist/inputs/ToggleInput.js +31 -9
  39. package/dist/styles.css +15 -15
  40. package/dist/table/TableSelectCell.js +5 -4
  41. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from "react";
2
+ declare const SvgGalaxyFilamentWordmarkDark: (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
3
+ export default SvgGalaxyFilamentWordmarkDark;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ //#region src/assets/components/GalaxyFilamentWordmarkDark.tsx
3
+ var SvgGalaxyFilamentWordmarkDark = (props) => /* @__PURE__ */ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ fill: "none",
6
+ viewBox: "0 0 4513 1200",
7
+ ...props,
8
+ children: /* @__PURE__ */ jsx("path", {
9
+ fill: "#000",
10
+ d: "M181.814 1141.98 159.701 1200 0 985.717l292.377-774.718 70.759-59.34h338.665l-41.276 102.197H517.432l-49.379 131.852h149.481l-37.837 101.538H429.725zm538.618-805.707 46.19-123.955h238.818l-46.498 123.955zM505.694 910.552l196.064-526.148h239.307L745.001 910.552zm320.218 0 283.538-758.893 21.61-58.681 159.71 214.284-225.06 603.29zm626.528-190.548-32.93 88.352h91.4l33.41-88.352zm129.72-102.196 48.65-130.549h-91.4l-29 76.484h-239.3l45.21-120.658 43.24-58.681h505.15l21.62 58.681-174.93 467.467h-525.79l-21.62-58.68 86.97-234.064zm434.51 292.744h-228.62l195.57-525.489h758.71l21.62 58.022L2590 910.552h-228.62l158.23-423.293h-62.17l-158.23 423.293h-216.93l157.73-423.293h-66.1zm981.66-245.931-54.53 143.735h90.9l40.3-104.834h239.3l-56.01 149.009-43.25 58.021H2709.9l-21.63-58.021 152.33-409.446 43.24-58.022h505.15l21.63 58.022-80.59 222.196h-239.8v-.66zm129.74-101.538 27.02-75.824h-91.89l-27.52 75.824zm425.05 347.469h-239.8l195.58-525.489h524.3l21.63 58.022-174.45 467.467h-239.79l158.22-423.293h-88.45zm567.26-429.226 37.84-101.538 85.5-230.107L4265.34 91l159.7 213.625-27.51 75.163H4513l-42.26 101.538h-111.05l-121.86 327.03h105.37l-44.03 102.196h-295.25l-23.1-56.042z"
11
+ })
12
+ });
13
+ //#endregion
14
+ export { SvgGalaxyFilamentWordmarkDark as default };
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from "react";
2
+ declare const SvgGalaxyFilamentWordmarkLight: (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
3
+ export default SvgGalaxyFilamentWordmarkLight;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ //#region src/assets/components/GalaxyFilamentWordmarkLight.tsx
3
+ var SvgGalaxyFilamentWordmarkLight = (props) => /* @__PURE__ */ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ fill: "none",
6
+ viewBox: "0 0 4513 1200",
7
+ ...props,
8
+ children: /* @__PURE__ */ jsx("path", {
9
+ fill: "#fff",
10
+ d: "M181.814 1141.98 159.701 1200 0 985.717l292.377-774.718 70.759-59.34h338.665l-41.276 102.197H517.432l-49.379 131.852h149.481l-37.837 101.538H429.725zm538.618-805.707 46.19-123.955h238.818l-46.498 123.955zM505.694 910.552l196.064-526.148h239.307L745.001 910.552zm320.218 0 283.538-758.893 21.61-58.681 159.71 214.284-225.06 603.29zm626.528-190.548-32.93 88.352h91.4l33.41-88.352zm129.72-102.196 48.65-130.549h-91.4l-29 76.484h-239.3l45.21-120.658 43.24-58.681h505.15l21.62 58.681-174.93 467.467h-525.79l-21.62-58.68 86.97-234.064zm434.51 292.744h-228.62l195.57-525.489h758.71l21.62 58.022L2590 910.552h-228.62l158.23-423.293h-62.17l-158.23 423.293h-216.93l157.73-423.293h-66.1zm981.66-245.931-54.53 143.735h90.9l40.3-104.834h239.3l-56.01 149.009-43.25 58.021H2709.9l-21.63-58.021 152.33-409.446 43.24-58.022h505.15l21.63 58.022-80.59 222.196h-239.8v-.66zm129.74-101.538 27.02-75.824h-91.89l-27.52 75.824zm425.05 347.469h-239.8l195.58-525.489h524.3l21.63 58.022-174.45 467.467h-239.79l158.22-423.293h-88.45zm567.26-429.226 37.84-101.538 85.5-230.107L4265.34 91l159.7 213.625-27.51 75.163H4513l-42.26 101.538h-111.05l-121.86 327.03h105.37l-44.03 102.196h-295.25l-23.1-56.042z"
11
+ })
12
+ });
13
+ //#endregion
14
+ export { SvgGalaxyFilamentWordmarkLight as default };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The Galaxy wordmark, in the variant that reads against the active theme.
3
+ * Use `GalaxyLogomark` when you need just the mark without the word.
4
+ */
5
+ declare const GalaxyFilamentWordmark: ({ height, isDark, }: {
6
+ /** Rendered height in px. Width follows the aspect ratio. */
7
+ height: number;
8
+ /** Force the light artwork instead of following the theme. */
9
+ isDark?: boolean;
10
+ }) => import("react").JSX.Element;
11
+ export default GalaxyFilamentWordmark;
@@ -0,0 +1,25 @@
1
+ import { GalaxyTheme } from "../theme/types.js";
2
+ import { useGalaxyTheme } from "../theme/GalaxyTheme.js";
3
+ import SvgGalaxyFilamentWordmarkDark from "../assets/components/GalaxyFilamentWordmarkDark.js";
4
+ import SvgGalaxyFilamentWordmarkLight from "../assets/components/GalaxyFilamentWordmarkLight.js";
5
+ import { match } from "ts-pattern";
6
+ import { useMemo } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ //#region src/icons/GalaxyFilamentWordmark.tsx
9
+ /**
10
+ * The Galaxy wordmark, in the variant that reads against the active theme.
11
+ * Use `GalaxyLogomark` when you need just the mark without the word.
12
+ */
13
+ var GalaxyFilamentWordmark = ({ height, isDark }) => {
14
+ const { activeTheme } = useGalaxyTheme();
15
+ return useMemo(() => {
16
+ if (isDark) return /* @__PURE__ */ jsx(SvgGalaxyFilamentWordmarkLight, { height });
17
+ return match(activeTheme).with(GalaxyTheme.DARK, () => /* @__PURE__ */ jsx(SvgGalaxyFilamentWordmarkLight, { height })).with(GalaxyTheme.LIGHT, () => /* @__PURE__ */ jsx(SvgGalaxyFilamentWordmarkDark, { height })).exhaustive();
18
+ }, [
19
+ height,
20
+ isDark,
21
+ activeTheme
22
+ ]);
23
+ };
24
+ //#endregion
25
+ export { GalaxyFilamentWordmark as default };
@@ -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
  ]