@galaxy-io/dls 1.4.15 → 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 (35) hide show
  1. package/dist/inputs/CheckboxInput.d.ts +11 -14
  2. package/dist/inputs/CheckboxInput.js +10 -27
  3. package/dist/inputs/ColorInput.d.ts +4 -2
  4. package/dist/inputs/ColorInput.js +14 -28
  5. package/dist/inputs/CopyInput.d.ts +4 -2
  6. package/dist/inputs/CopyInput.js +11 -3
  7. package/dist/inputs/DateInput.d.ts +4 -2
  8. package/dist/inputs/DateInput.js +24 -31
  9. package/dist/inputs/Input.d.ts +82 -5
  10. package/dist/inputs/Input.js +111 -33
  11. package/dist/inputs/MultiSelectInput.d.ts +4 -4
  12. package/dist/inputs/MultiSelectInput.js +36 -45
  13. package/dist/inputs/MultiTextInput.d.ts +5 -16
  14. package/dist/inputs/MultiTextInput.js +24 -31
  15. package/dist/inputs/NumberInput.d.ts +1 -1
  16. package/dist/inputs/NumberInput.js +10 -2
  17. package/dist/inputs/PasswordInput.d.ts +4 -3
  18. package/dist/inputs/PasswordInput.js +6 -3
  19. package/dist/inputs/RadioInput.d.ts +11 -14
  20. package/dist/inputs/RadioInput.js +18 -34
  21. package/dist/inputs/SelectInput.d.ts +5 -14
  22. package/dist/inputs/SelectInput.js +35 -57
  23. package/dist/inputs/SliderInput.d.ts +9 -1
  24. package/dist/inputs/SliderInput.js +47 -21
  25. package/dist/inputs/SwitcherInput.d.ts +7 -2
  26. package/dist/inputs/SwitcherInput.js +7 -7
  27. package/dist/inputs/TextAreaInput.d.ts +5 -18
  28. package/dist/inputs/TextAreaInput.js +29 -57
  29. package/dist/inputs/TextInput.d.ts +6 -2
  30. package/dist/inputs/TextInput.js +2 -1
  31. package/dist/inputs/ToggleInput.d.ts +10 -1
  32. package/dist/inputs/ToggleInput.js +31 -9
  33. package/dist/styles.css +15 -15
  34. package/dist/table/TableSelectCell.js +5 -4
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import Input, { InputSize } from "./Input.js";
1
+ import Input from "./Input.js";
2
2
  import { forwardRef, useState } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { EyeIcon, EyeSlashIcon } from "@phosphor-icons/react";
@@ -8,17 +8,19 @@ var DEFAULT_STATE = { showPassword: false };
8
8
  * A masked text field with a built-in reveal toggle in the trailing slot.
9
9
  * Toggling only flips the DOM `type` — the value is never transformed.
10
10
  */
11
- var PasswordInput = forwardRef(({ size = InputSize.MEDIUM, value, placeholder, label, leading, error, isRequired, isDisabled, autoFocus, onChange, width, fillWidth, onKeyDown, onBlur, onFocus }, ref) => {
11
+ var PasswordInput = forwardRef(({ variant, size, value, placeholder, label, labelTooltip, leading, error, isRequired, isDisabled, autoFocus, onChange, width, fillWidth, onKeyDown, onBlur, onFocus, isMonospace }, ref) => {
12
12
  const [state, setState] = useState(DEFAULT_STATE);
13
13
  return /* @__PURE__ */ jsx(Input, {
14
14
  ref,
15
15
  parse: String,
16
16
  onChange,
17
+ variant,
17
18
  size,
18
19
  type: state.showPassword ? "text" : "password",
19
20
  value,
20
21
  placeholder,
21
22
  label,
23
+ labelTooltip,
22
24
  leading,
23
25
  trailing: {
24
26
  icon: state.showPassword ? EyeSlashIcon : EyeIcon,
@@ -36,7 +38,8 @@ var PasswordInput = forwardRef(({ size = InputSize.MEDIUM, value, placeholder, l
36
38
  onBlur,
37
39
  onFocus,
38
40
  width,
39
- fillWidth
41
+ fillWidth,
42
+ isMonospace
40
43
  });
41
44
  });
42
45
  PasswordInput.displayName = "PasswordInput";
@@ -1,18 +1,15 @@
1
- /** Fill color of the dot when selected. */
2
- export declare enum RadioInputVariant {
3
- PRIMARY = "PRIMARY",
4
- SECONDARY = "SECONDARY"
5
- }
6
- /** Circle size. Two steps only — this is a hit target, not a type scale. */
7
- export declare enum RadioInputSize {
8
- SMALL = "SMALL",
9
- MEDIUM = "MEDIUM"
10
- }
1
+ import { InputSize, InputVariant } from "./Input";
11
2
  export interface RadioInputProps {
12
- /** @default RadioInputVariant.PRIMARY */
13
- variant?: RadioInputVariant;
14
- /** @default RadioInputSize.MEDIUM */
15
- size?: RadioInputSize;
3
+ /**
4
+ * Unselected fill color. The selected fill is a state color and stays
5
+ * `background.primaryAlt` so the dot keeps its contrast. Unlike the field
6
+ * inputs, `TRANSPARENT` keeps the hairline border here — without it the
7
+ * circle would be invisible. @default InputVariant.PRIMARY
8
+ */
9
+ variant?: InputVariant;
10
+ /** Circle 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 radio holds none of its own. */
17
14
  isSelected: boolean;
18
15
  /** Text beside the circle. */
@@ -5,24 +5,13 @@ import Icon, { IconVariant } from "../icons/Icon.js";
5
5
  import FlexWrapper, { AlignItems } from "../containers/FlexWrapper.js";
6
6
  import RequiredMarker from "../text/RequiredMarker.js";
7
7
  import Spacing from "../containers/Spacing.js";
8
+ import { InputSize, InputVariant, getInputControlSize, getInputSurfaceColor } from "./Input.js";
8
9
  /* empty css */
9
10
  import { styled } from "@linaria/react";
10
11
  import { match } from "ts-pattern";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { InfoIcon } from "@phosphor-icons/react";
13
14
  //#region src/inputs/RadioInput.tsx
14
- /** Fill color of the dot when selected. */
15
- var RadioInputVariant = /* @__PURE__ */ function(RadioInputVariant) {
16
- RadioInputVariant["PRIMARY"] = "PRIMARY";
17
- RadioInputVariant["SECONDARY"] = "SECONDARY";
18
- return RadioInputVariant;
19
- }({});
20
- /** Circle size. Two steps only — this is a hit target, not a type scale. */
21
- var RadioInputSize = /* @__PURE__ */ function(RadioInputSize) {
22
- RadioInputSize["SMALL"] = "SMALL";
23
- RadioInputSize["MEDIUM"] = "MEDIUM";
24
- return RadioInputSize;
25
- }({});
26
15
  var _exp = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
27
16
  var _exp2 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
28
17
  var RadioContainer = /*#__PURE__*/ styled("div")({
@@ -34,14 +23,9 @@ var RadioContainer = /*#__PURE__*/ styled("div")({
34
23
  "r1pzr59l-1": [_exp2()]
35
24
  }
36
25
  });
37
- var _exp4 = () => ({ $size }) => {
38
- return match($size).with("SMALL", () => "12px").with("MEDIUM", () => "16px").exhaustive();
39
- };
26
+ var _exp4 = () => ({ $size }) => getInputControlSize($size);
40
27
  var _exp5 = () => ({ theme }) => theme.color.border.primary;
41
- var _exp6 = () => ({ theme, $isSelected }) => $isSelected ? theme.color.background.primaryAlt : theme.color.background.tertiary;
42
- var _exp7 = () => ({ 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
- };
28
+ var _exp6 = () => ({ theme, $variant, $isSelected }) => $isSelected ? theme.color.background.primaryAlt : getInputSurfaceColor(theme, $variant);
45
29
  var RadioWrapper = withTheme(/*#__PURE__*/ styled("div")({
46
30
  name: "RadioWrapper",
47
31
  class: "r1mwwvky",
@@ -49,25 +33,26 @@ var RadioWrapper = withTheme(/*#__PURE__*/ styled("div")({
49
33
  vars: {
50
34
  "r1mwwvky-0": [_exp4()],
51
35
  "r1mwwvky-1": [_exp5()],
52
- "r1mwwvky-2": [_exp6()],
53
- "r1mwwvky-3": [_exp7()]
36
+ "r1mwwvky-2": [_exp6()]
54
37
  }
55
38
  }));
56
- var _exp9 = () => ({ $size }) => {
57
- return match($size).with("SMALL", () => "6px").with("MEDIUM", () => "8px").exhaustive();
58
- };
59
- var _exp0 = () => ({ theme }) => theme.color.background.primary;
60
- var _exp1 = () => ({ $isSelected }) => $isSelected ? 1 : 0;
61
- var _exp10 = () => ({ $isSelected }) => $isSelected ? "scale(1)" : "scale(0)";
39
+ /** The dot is half the circle it sits in — see `getInputControlSize`. */
40
+ function getRadioDotSize(size) {
41
+ return match(size).returnType().with(InputSize.SMALL, () => "6px").with(InputSize.MEDIUM, () => "8px").with(InputSize.LARGE, () => "10px").exhaustive();
42
+ }
43
+ var _exp8 = () => ({ $size }) => getRadioDotSize($size);
44
+ var _exp9 = () => ({ theme }) => theme.color.background.primary;
45
+ var _exp0 = () => ({ $isSelected }) => $isSelected ? 1 : 0;
46
+ var _exp1 = () => ({ $isSelected }) => $isSelected ? "scale(1)" : "scale(0)";
62
47
  var RadioDot = withTheme(/*#__PURE__*/ styled("div")({
63
48
  name: "RadioDot",
64
49
  class: "r137y8ev",
65
50
  propsAsIs: false,
66
51
  vars: {
67
- "r137y8ev-0": [_exp9()],
68
- "r137y8ev-1": [_exp0()],
69
- "r137y8ev-2": [_exp1()],
70
- "r137y8ev-3": [_exp10()]
52
+ "r137y8ev-0": [_exp8()],
53
+ "r137y8ev-1": [_exp9()],
54
+ "r137y8ev-2": [_exp0()],
55
+ "r137y8ev-3": [_exp1()]
71
56
  }
72
57
  }));
73
58
  /**
@@ -76,7 +61,7 @@ var RadioDot = withTheme(/*#__PURE__*/ styled("div")({
76
61
  * There is no group component — render several and enforce single-selection in
77
62
  * your own state.
78
63
  */
79
- var RadioInput = ({ variant = "PRIMARY", size = "MEDIUM", isSelected, label, labelTooltip, isRequired = false, isDisabled = false, onChange }) => {
64
+ var RadioInput = ({ variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, isSelected, label, labelTooltip, isRequired = false, isDisabled = false, onChange }) => {
80
65
  const handleClick = () => {
81
66
  if (!isDisabled) onChange(!isSelected);
82
67
  };
@@ -87,7 +72,6 @@ var RadioInput = ({ variant = "PRIMARY", size = "MEDIUM", isSelected, label, lab
87
72
  $variant: variant,
88
73
  $size: size,
89
74
  $isSelected: isSelected,
90
- $isDisabled: isDisabled,
91
75
  children: /* @__PURE__ */ jsx(RadioDot, {
92
76
  $size: size,
93
77
  $isSelected: isSelected
@@ -118,4 +102,4 @@ var RadioInput = ({ variant = "PRIMARY", size = "MEDIUM", isSelected, label, lab
118
102
  });
119
103
  };
120
104
  //#endregion
121
- export { RadioInputSize, RadioInputVariant, RadioInput as default };
105
+ export { RadioInput as default };
@@ -1,13 +1,6 @@
1
1
  import { IconVariant } from "../icons/Icon";
2
- import { TextSize, TextVariant } from "../text/Text";
3
- import { InputSize } from "./Input";
4
- /** Surface treatment of the closed trigger. Shared with `MultiSelectInput`. */
5
- export declare enum SelectInputVariant {
6
- BASE = "BASE",
7
- PRIMARY = "PRIMARY",
8
- SECONDARY = "SECONDARY",
9
- TERTIARY = "TERTIARY"
10
- }
2
+ import { TextVariant } from "../text/Text";
3
+ import { InputSize, InputVariant } from "./Input";
11
4
  /** One choice in a select. */
12
5
  export interface SelectInputOption {
13
6
  /** Stable identity — selection is matched on this, not on `value`. */
@@ -30,8 +23,8 @@ export interface PinnedOption {
30
23
  }
31
24
  export interface SelectInputProps {
32
25
  label?: string;
33
- /** @default SelectInputVariant.PRIMARY */
34
- variant?: SelectInputVariant;
26
+ /** Trigger surface color. @default InputVariant.PRIMARY */
27
+ variant?: InputVariant;
35
28
  /** @default InputSize.MEDIUM */
36
29
  size?: InputSize;
37
30
  /** Every choice. Order is preserved. */
@@ -63,9 +56,7 @@ export interface SelectInputProps {
63
56
  /** Debounce before `onSearch` fires, in ms. @default 300 */
64
57
  debounceMs?: number;
65
58
  }
66
- export declare const SELECT_INPUT_VARIANT_TO_ICON_VARIANT_MAP: Record<SelectInputVariant, IconVariant>;
67
- export declare const SELECT_INPUT_SIZE_TO_ICON_SIZE: Record<InputSize, number>;
68
- export declare const SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP: Record<InputSize, TextSize>;
59
+ export declare const INPUT_VARIANT_TO_ICON_VARIANT_MAP: Record<InputVariant, IconVariant>;
69
60
  /**
70
61
  * Single-choice dropdown with keyboard navigation and optional search.
71
62
  *
@@ -5,43 +5,37 @@ import Text, { TextSize, TextVariant } from "../text/Text.js";
5
5
  import FlexItem from "../containers/FlexItem.js";
6
6
  import Icon, { IconVariant, IconWeight } from "../icons/Icon.js";
7
7
  import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrapper.js";
8
- import Dropdown, { DropdownVariant } from "../dropdown/Dropdown.js";
9
8
  import Spacing from "../containers/Spacing.js";
10
- import { InputLabel, InputSize } from "./Input.js";
9
+ import { InputLabel, InputSize, InputVariant, getInputBorderColor, getInputFontSize, getInputHeight, getInputIconSize, getInputLineHeight, getInputPadding, getInputSurfaceColor, getInputTextSize } from "./Input.js";
10
+ import Dropdown, { DropdownVariant } from "../dropdown/Dropdown.js";
11
11
  import HorizontalDivider from "../dividers/HorizontalDivider.js";
12
12
  import { useElementWidth } from "../hooks/useElementWidth.js";
13
13
  import { useControlledOpenState, useDebouncedValue } from "./hooks.js";
14
14
  /* empty css */
15
15
  import { styled } from "@linaria/react";
16
- import { match } from "ts-pattern";
17
16
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
18
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
19
18
  import { ArrowCounterClockwiseIcon, CaretDownIcon, CheckIcon } from "@phosphor-icons/react";
20
19
  //#region src/inputs/SelectInput.tsx
21
- /** Surface treatment of the closed trigger. Shared with `MultiSelectInput`. */
22
- var SelectInputVariant = /* @__PURE__ */ function(SelectInputVariant) {
23
- SelectInputVariant["BASE"] = "BASE";
24
- SelectInputVariant["PRIMARY"] = "PRIMARY";
25
- SelectInputVariant["SECONDARY"] = "SECONDARY";
26
- SelectInputVariant["TERTIARY"] = "TERTIARY";
27
- return SelectInputVariant;
28
- }({});
29
- var _exp = () => ({ $size }) => {
30
- return match($size).with(InputSize.SMALL, () => "0 6px").with(InputSize.MEDIUM, () => "0 8px").with(InputSize.LARGE, () => "0 10px").exhaustive();
31
- };
32
- var _exp2 = () => ({ $size }) => {
33
- return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
20
+ var INPUT_VARIANT_TO_DROPDOWN_VARIANT = {
21
+ [InputVariant.TRANSPARENT]: DropdownVariant.TRANSPARENT,
22
+ [InputVariant.BASE]: DropdownVariant.PRIMARY,
23
+ [InputVariant.PRIMARY]: DropdownVariant.PRIMARY,
24
+ [InputVariant.SECONDARY]: DropdownVariant.SECONDARY,
25
+ [InputVariant.TERTIARY]: DropdownVariant.TERTIARY
34
26
  };
27
+ var _exp = () => ({ $size }) => `0 ${getInputPadding($size)}`;
28
+ var _exp2 = () => ({ $size }) => getInputHeight($size);
35
29
  var _exp3 = () => ({ $fillWidth, $width }) => $fillWidth ? "100%" : $width ? getCssSizeValue($width) : "auto";
36
30
  var _exp4 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
37
31
  var _exp5 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
38
- var _exp6 = () => ({ theme }) => theme.color.background.primary;
39
- var _exp7 = () => ({ theme, $isActive, $isError }) => {
32
+ var _exp6 = () => ({ theme, $variant }) => getInputSurfaceColor(theme, $variant);
33
+ var _exp7 = () => ({ theme, $variant, $isActive, $isError }) => {
40
34
  if ($isActive) return theme.color.border.selected;
41
35
  if ($isError) return theme.color.border.error;
42
- return theme.color.border.primary;
36
+ return getInputBorderColor(theme, $variant);
43
37
  };
44
- var _exp8 = () => ({ theme, $isActive }) => $isActive ? theme.color.border.selected : theme.color.border.primary;
38
+ var _exp8 = () => ({ theme, $variant, $isActive }) => $isActive ? theme.color.border.selected : getInputBorderColor(theme, $variant);
45
39
  var StyledSelectInput = withTheme(/*#__PURE__*/ styled("div")({
46
40
  name: "StyledSelectInput",
47
41
  class: "s1ecxi56",
@@ -57,16 +51,10 @@ var StyledSelectInput = withTheme(/*#__PURE__*/ styled("div")({
57
51
  "s1ecxi56-7": [_exp8()]
58
52
  }
59
53
  }));
60
- var _exp9 = () => ({ $size }) => {
61
- return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
62
- };
54
+ var _exp9 = () => ({ $size }) => getInputHeight($size);
63
55
  var _exp0 = () => ({ theme }) => theme.color.text.primary;
64
- var _exp1 = () => ({ theme, $size }) => {
65
- return match($size).with(InputSize.SMALL, () => theme.font.sans.size.body_sm).with(InputSize.MEDIUM, () => theme.font.sans.size.body_md).with(InputSize.LARGE, () => theme.font.sans.size.body_lg).exhaustive();
66
- };
67
- var _exp10 = () => ({ theme, $size }) => {
68
- return match($size).with(InputSize.SMALL, () => theme.font.sans.height.body_sm).with(InputSize.MEDIUM, () => theme.font.sans.height.body_md).with(InputSize.LARGE, () => theme.font.sans.height.body_lg).exhaustive();
69
- };
56
+ var _exp1 = () => ({ theme, $size }) => getInputFontSize(theme, $size);
57
+ var _exp10 = () => ({ theme, $size }) => getInputLineHeight(theme, $size);
70
58
  var _exp11 = () => ({ theme }) => theme.font.sans.weight.medium;
71
59
  var _exp12 = () => ({ theme }) => theme.font.sans.family;
72
60
  var _exp13 = () => ({ theme }) => theme.color.text.tertiary;
@@ -106,10 +94,10 @@ var SelectInputOptionsContainer = /*#__PURE__*/ styled("div")({
106
94
  vars: { "sk260f0-0": [_exp16()] }
107
95
  });
108
96
  var _exp17 = () => ({ theme, $isSelected, $isFocused }) => {
109
- if ($isSelected || $isFocused) return theme.color.background.tertiary;
97
+ if ($isSelected || $isFocused) return theme.color.background.secondary;
110
98
  return "transparent";
111
99
  };
112
- var _exp19 = () => ({ theme }) => theme.color.background.tertiary;
100
+ var _exp19 = () => ({ theme }) => theme.color.background.secondary;
113
101
  var SelectInputOption = withTheme(/*#__PURE__*/ styled("button")({
114
102
  name: "SelectInputOption",
115
103
  class: "so10ras",
@@ -138,21 +126,12 @@ var OptionIconSlot = /*#__PURE__*/ styled("span")({
138
126
  class: "o9236d8",
139
127
  propsAsIs: false
140
128
  });
141
- var SELECT_INPUT_VARIANT_TO_ICON_VARIANT_MAP = {
142
- ["BASE"]: IconVariant.SECONDARY,
143
- ["PRIMARY"]: IconVariant.SECONDARY,
144
- ["SECONDARY"]: IconVariant.SECONDARY,
145
- ["TERTIARY"]: IconVariant.PRIMARY
146
- };
147
- var SELECT_INPUT_SIZE_TO_ICON_SIZE = {
148
- [InputSize.SMALL]: 12,
149
- [InputSize.MEDIUM]: 14,
150
- [InputSize.LARGE]: 16
151
- };
152
- var SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP = {
153
- [InputSize.SMALL]: TextSize.BODY_MD,
154
- [InputSize.MEDIUM]: TextSize.BODY_MD,
155
- [InputSize.LARGE]: TextSize.BODY_MD
129
+ var INPUT_VARIANT_TO_ICON_VARIANT_MAP = {
130
+ [InputVariant.TRANSPARENT]: IconVariant.SECONDARY,
131
+ [InputVariant.BASE]: IconVariant.SECONDARY,
132
+ [InputVariant.PRIMARY]: IconVariant.SECONDARY,
133
+ [InputVariant.SECONDARY]: IconVariant.SECONDARY,
134
+ [InputVariant.TERTIARY]: IconVariant.PRIMARY
156
135
  };
157
136
  /**
158
137
  * Single-choice dropdown with keyboard navigation and optional search.
@@ -161,7 +140,7 @@ var SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP = {
161
140
  * option back. Passing `onSearch` turns the trigger into a search box — you own
162
141
  * the filtering, so it works equally well against a local list or a server.
163
142
  */
164
- var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, options, value, placeholder = "Select an option...", onChange, width, fillWidth, dropdownWidth, isDisabled = false, isRequired = false, isOpen: controlledIsOpen, onOpenChange, onReset, pinnedOptions = [], error, onSearch, debounceMs = 300 }) => {
143
+ var SelectInput = ({ label, variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, options, value, placeholder = "Select an option...", onChange, width, fillWidth, dropdownWidth, isDisabled = false, isRequired = false, isOpen: controlledIsOpen, onOpenChange, onReset, pinnedOptions = [], error, onSearch, debounceMs = 300 }) => {
165
144
  const isSearchable = !!onSearch;
166
145
  const [isHovered, setIsHovered] = useState(false);
167
146
  const [searchTerm, setSearchTerm] = useState("");
@@ -321,7 +300,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
321
300
  },
322
301
  onMouseEnter: () => setFocusedOptionIndex(index),
323
302
  children: [/* @__PURE__ */ jsx(Text, {
324
- size: SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP[size],
303
+ size: getInputTextSize(size),
325
304
  cursor: !effectiveIsDisabled ? "pointer" : "not-allowed",
326
305
  isEllipsis: true,
327
306
  children: pinnedOption.label
@@ -354,7 +333,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
354
333
  shrink: 1,
355
334
  minWidth: 0,
356
335
  children: /* @__PURE__ */ jsx(Text, {
357
- size: SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP[size],
336
+ size: getInputTextSize(size),
358
337
  cursor: !effectiveIsDisabled ? "pointer" : "not-allowed",
359
338
  isEllipsis: true,
360
339
  variant: option.variant ?? TextVariant.PRIMARY,
@@ -372,7 +351,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
372
351
  style: { padding: "8px" },
373
352
  children: /* @__PURE__ */ jsx(Text, {
374
353
  variant: TextVariant.TERTIARY,
375
- size: SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP[size],
354
+ size: getInputTextSize(size),
376
355
  children: "No options found"
377
356
  })
378
357
  })
@@ -390,7 +369,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
390
369
  size: 12
391
370
  }), /* @__PURE__ */ jsx(Text, {
392
371
  variant: TextVariant.SECONDARY,
393
- size: SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP[size],
372
+ size: getInputTextSize(size),
394
373
  cursor: !effectiveIsDisabled ? "pointer" : "not-allowed",
395
374
  children: "Reset"
396
375
  })]
@@ -418,7 +397,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
418
397
  isRequired
419
398
  }),
420
399
  /* @__PURE__ */ jsx(Dropdown, {
421
- variant: DropdownVariant.PRIMARY,
400
+ variant: INPUT_VARIANT_TO_DROPDOWN_VARIANT[variant],
422
401
  body: dropdownBody,
423
402
  isOpen: visible,
424
403
  onClose: handleClose,
@@ -441,7 +420,6 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
441
420
  children: [
442
421
  /* @__PURE__ */ jsx(StyledSearchInput, {
443
422
  ref: inputRef,
444
- $variant: variant,
445
423
  $size: size,
446
424
  $isActive: visible ?? false,
447
425
  $isDisabled: effectiveIsDisabled,
@@ -464,7 +442,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
464
442
  deg: -180,
465
443
  children: /* @__PURE__ */ jsx(Icon, {
466
444
  component: CaretDownIcon,
467
- size: 10,
445
+ size: getInputIconSize(size),
468
446
  variant: !effectiveIsDisabled && (isHovered || visible) ? IconVariant.SECONDARY : IconVariant.TERTIARY
469
447
  })
470
448
  }) })
@@ -498,7 +476,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
498
476
  minWidth: 0,
499
477
  children: /* @__PURE__ */ jsx(Text, {
500
478
  variant: textVariant,
501
- size: SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP[size],
479
+ size: getInputTextSize(size),
502
480
  cursor: !effectiveIsDisabled ? "pointer" : "not-allowed",
503
481
  isEllipsis: true,
504
482
  children: selectedOption ? selectedOption.label : placeholder
@@ -511,7 +489,7 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
511
489
  deg: -180,
512
490
  children: /* @__PURE__ */ jsx(Icon, {
513
491
  component: CaretDownIcon,
514
- size: 10,
492
+ size: getInputIconSize(size),
515
493
  variant: !effectiveIsDisabled && (isHovered || visible) ? IconVariant.SECONDARY : IconVariant.TERTIARY
516
494
  })
517
495
  }) })
@@ -527,4 +505,4 @@ var SelectInput = ({ label, variant = "PRIMARY", size = InputSize.MEDIUM, option
527
505
  });
528
506
  };
529
507
  //#endregion
530
- export { SELECT_INPUT_SIZE_TO_ICON_SIZE, SELECT_INPUT_SIZE_TO_TEXT_SIZE_MAP, SELECT_INPUT_VARIANT_TO_ICON_VARIANT_MAP, SelectInputVariant, SelectInput as default };
508
+ export { INPUT_VARIANT_TO_ICON_VARIANT_MAP, SelectInput as default };
@@ -1,4 +1,12 @@
1
+ import { InputSize, InputVariant } from "./Input";
1
2
  export interface SliderInputProps {
3
+ /**
4
+ * Track color. The filled portion and the handle are state colors and stay
5
+ * `icon.primary`. @default InputVariant.PRIMARY
6
+ */
7
+ variant?: InputVariant;
8
+ /** Rail and handle size — 2/6, 3/8 or 4/10px. @default InputSize.MEDIUM */
9
+ size?: InputSize;
2
10
  label?: string;
3
11
  /** Adds an info icon beside the label with this content on hover. */
4
12
  labelTooltip?: string | React.ReactNode;
@@ -27,5 +35,5 @@ export interface SliderInputProps {
27
35
  * `onChange` fires on every pointer move. When each change is expensive, drive
28
36
  * a preview from it and commit on `onInteractionEnd`.
29
37
  */
30
- declare const SliderInput: ({ label, labelTooltip, value, onChange, onInteractionStart, onInteractionEnd, min, max, step, isDisabled, width, fillWidth, }: SliderInputProps) => import("react").JSX.Element;
38
+ declare const SliderInput: ({ variant, size, label, labelTooltip, value, onChange, onInteractionStart, onInteractionEnd, min, max, step, isDisabled, width, fillWidth, }: SliderInputProps) => import("react").JSX.Element;
31
39
  export default SliderInput;
@@ -1,12 +1,23 @@
1
1
  import { withTheme } from "../theme/GalaxyTheme.js";
2
2
  import Text from "../text/Text.js";
3
3
  import FlexWrapper, { AlignItems, FlexDirection, JustifyContent } from "../containers/FlexWrapper.js";
4
- import { InputLabel } from "./Input.js";
4
+ import { InputLabel, InputSize, InputVariant, getInputSurfaceColor, getInputTextSize } from "./Input.js";
5
5
  /* empty css */
6
6
  import { styled } from "@linaria/react";
7
+ import { match } from "ts-pattern";
7
8
  import { useCallback, useEffect, useRef, useState } from "react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  //#region src/inputs/SliderInput.tsx
11
+ /**
12
+ * Rail thickness per `InputSize`. A slider has no box to fill, so it runs its
13
+ * own scale rather than `getInputHeight`.
14
+ */
15
+ function getSliderRailHeight(size) {
16
+ return match(size).returnType().with(InputSize.SMALL, () => 2).with(InputSize.MEDIUM, () => 3).with(InputSize.LARGE, () => 4).exhaustive();
17
+ }
18
+ function getSliderHandleSize(size) {
19
+ return match(size).returnType().with(InputSize.SMALL, () => 6).with(InputSize.MEDIUM, () => 8).with(InputSize.LARGE, () => 10).exhaustive();
20
+ }
10
21
  var _exp = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "pointer";
11
22
  var _exp2 = () => ({ $isDisabled }) => $isDisabled ? .5 : 1;
12
23
  var SliderWrapper = withTheme(/*#__PURE__*/ styled("div")({
@@ -18,39 +29,48 @@ var SliderWrapper = withTheme(/*#__PURE__*/ styled("div")({
18
29
  "sbeizks-1": [_exp2()]
19
30
  }
20
31
  }));
21
- var _exp3 = () => ({ theme }) => theme.color.opacity.bw24Alt;
32
+ var _exp3 = () => ({ $size }) => `${getSliderRailHeight($size)}px`;
33
+ var _exp4 = () => ({ theme, $variant }) => getInputSurfaceColor(theme, $variant);
22
34
  var SliderTrack = withTheme(/*#__PURE__*/ styled("div")({
23
35
  name: "SliderTrack",
24
36
  class: "s42jcip",
25
37
  propsAsIs: false,
26
- vars: { "s42jcip-0": [_exp3()] }
38
+ vars: {
39
+ "s42jcip-0": [_exp3()],
40
+ "s42jcip-1": [_exp4()]
41
+ }
27
42
  }));
28
- var _exp4 = () => ({ theme }) => theme.color.icon.primary;
43
+ var _exp5 = () => ({ theme }) => theme.color.icon.primary;
29
44
  var SliderFill = withTheme(/*#__PURE__*/ styled("div")({
30
45
  name: "SliderFill",
31
46
  class: "s1b59sw7",
32
47
  propsAsIs: false,
33
- vars: { "s1b59sw7-0": [_exp4()] }
48
+ vars: { "s1b59sw7-0": [_exp5()] }
34
49
  }));
35
- var _exp5 = () => ({ $percentage }) => `calc(4px + ${$percentage}% - ${$percentage / 100 * 8}px)`;
36
- var _exp6 = () => ({ theme }) => theme.color.icon.primary;
37
- var _exp7 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "grab";
38
- var _exp8 = () => ({ $isDragging }) => $isDragging ? "none" : "left 0.1s ease-out, transform 0.1s ease-out";
39
- var _exp9 = () => ({ $isDisabled }) => $isDisabled ? "none" : "auto";
40
- var _exp0 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "grabbing";
41
- var _exp1 = () => ({ $isDisabled }) => $isDisabled ? "translate(-50%, -50%)" : "translate(-50%, -50%) scale(1.1)";
50
+ var _exp6 = () => ({ $percentage, $size }) => {
51
+ const handle = getSliderHandleSize($size);
52
+ return `calc(${handle / 2}px + ${$percentage}% - ${$percentage / 100 * handle}px)`;
53
+ };
54
+ var _exp8 = () => ({ $size }) => `${getSliderHandleSize($size)}px`;
55
+ var _exp9 = () => ({ theme }) => theme.color.icon.primary;
56
+ var _exp0 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "grab";
57
+ var _exp1 = () => ({ $isDragging }) => $isDragging ? "none" : "left 0.1s ease-out, transform 0.1s ease-out";
58
+ var _exp10 = () => ({ $isDisabled }) => $isDisabled ? "none" : "auto";
59
+ var _exp11 = () => ({ $isDisabled }) => $isDisabled ? "not-allowed" : "grabbing";
60
+ var _exp12 = () => ({ $isDisabled }) => $isDisabled ? "translate(-50%, -50%)" : "translate(-50%, -50%) scale(1.1)";
42
61
  var SliderHandle = withTheme(/*#__PURE__*/ styled("div")({
43
62
  name: "SliderHandle",
44
63
  class: "salrebx",
45
64
  propsAsIs: false,
46
65
  vars: {
47
- "salrebx-0": [_exp5()],
48
- "salrebx-1": [_exp6()],
49
- "salrebx-2": [_exp7()],
50
- "salrebx-3": [_exp8()],
51
- "salrebx-4": [_exp9()],
52
- "salrebx-5": [_exp0()],
53
- "salrebx-6": [_exp1()]
66
+ "salrebx-0": [_exp6()],
67
+ "salrebx-1": [_exp8()],
68
+ "salrebx-2": [_exp9()],
69
+ "salrebx-3": [_exp0()],
70
+ "salrebx-4": [_exp1()],
71
+ "salrebx-5": [_exp10()],
72
+ "salrebx-6": [_exp11()],
73
+ "salrebx-7": [_exp12()]
54
74
  }
55
75
  }));
56
76
  var HiddenInput = /*#__PURE__*/ styled("input")({
@@ -64,7 +84,7 @@ var HiddenInput = /*#__PURE__*/ styled("input")({
64
84
  * `onChange` fires on every pointer move. When each change is expensive, drive
65
85
  * a preview from it and commit on `onInteractionEnd`.
66
86
  */
67
- var SliderInput = ({ label, labelTooltip, value, onChange, onInteractionStart, onInteractionEnd, min = 0, max = 100, step = 1, isDisabled = false, width, fillWidth }) => {
87
+ var SliderInput = ({ variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, label, labelTooltip, value, onChange, onInteractionStart, onInteractionEnd, min = 0, max = 100, step = 1, isDisabled = false, width, fillWidth }) => {
68
88
  const [isDragging, setIsDragging] = useState(false);
69
89
  const sliderRef = useRef(null);
70
90
  const isInteractingRef = useRef(false);
@@ -134,13 +154,18 @@ var SliderInput = ({ label, labelTooltip, value, onChange, onInteractionStart, o
134
154
  children: [/* @__PURE__ */ jsx(InputLabel, {
135
155
  label,
136
156
  labelTooltip
137
- }), /* @__PURE__ */ jsx(Text, { children: value })]
157
+ }), /* @__PURE__ */ jsx(Text, {
158
+ size: getInputTextSize(size),
159
+ children: value
160
+ })]
138
161
  }), /* @__PURE__ */ jsxs(SliderWrapper, {
139
162
  ref: sliderRef,
140
163
  $isDisabled: isDisabled,
141
164
  onMouseDown: handleMouseDown,
142
165
  children: [
143
166
  /* @__PURE__ */ jsx(SliderTrack, {
167
+ $variant: variant,
168
+ $size: size,
144
169
  $isDisabled: isDisabled,
145
170
  children: /* @__PURE__ */ jsx(SliderFill, {
146
171
  $percentage: percentage,
@@ -150,6 +175,7 @@ var SliderInput = ({ label, labelTooltip, value, onChange, onInteractionStart, o
150
175
  }),
151
176
  /* @__PURE__ */ jsx(SliderHandle, {
152
177
  $percentage: percentage,
178
+ $size: size,
153
179
  $isDisabled: isDisabled,
154
180
  $isDragging: isDragging
155
181
  }),
@@ -1,4 +1,4 @@
1
- import { InputSize } from "./Input";
1
+ import { InputSize, InputVariant } from "./Input";
2
2
  export interface SwitcherInputItem {
3
3
  /** Matched against `selectedId` to decide which segment is active. */
4
4
  id: string;
@@ -7,6 +7,11 @@ export interface SwitcherInputItem {
7
7
  onClick: () => void;
8
8
  }
9
9
  export interface SwitcherInputProps {
10
+ /**
11
+ * Container surface color. The selected segment is a state color and stays
12
+ * `background.secondary` regardless. @default InputVariant.PRIMARY
13
+ */
14
+ variant?: InputVariant;
10
15
  /** @default InputSize.MEDIUM */
11
16
  size?: InputSize;
12
17
  /** Segments, left to right. */
@@ -18,5 +23,5 @@ export interface SwitcherInputProps {
18
23
  * A segmented control for switching between a few mutually exclusive views.
19
24
  * Each item carries its own `onClick`, so there is no top-level change handler.
20
25
  */
21
- declare const SwitcherInput: ({ size, items, selectedId }: SwitcherInputProps) => import("react").JSX.Element;
26
+ declare const SwitcherInput: ({ variant, size, items, selectedId, }: SwitcherInputProps) => import("react").JSX.Element;
22
27
  export default SwitcherInput;
@@ -1,19 +1,17 @@
1
1
  import { withTheme } from "../theme/GalaxyTheme.js";
2
2
  import Text, { TextWeight } from "../text/Text.js";
3
- import { InputSize } from "./Input.js";
3
+ import { InputSize, InputVariant, getInputBorderColor, getInputHeight, getInputSurfaceColor, getInputTextSize } from "./Input.js";
4
4
  /* empty css */
5
5
  import { styled } from "@linaria/react";
6
6
  import { match } from "ts-pattern";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  //#region src/inputs/SwitcherInput.tsx
9
- var _exp = () => ({ theme }) => theme.color.background.primary;
10
- var _exp2 = () => ({ theme }) => theme.color.border.primary;
9
+ var _exp = () => ({ theme, $variant }) => getInputSurfaceColor(theme, $variant);
10
+ var _exp2 = () => ({ theme, $variant }) => getInputBorderColor(theme, $variant);
11
11
  var _exp3 = () => ({ $size }) => {
12
12
  return match($size).with(InputSize.SMALL, () => "0 1.5px").with(InputSize.MEDIUM, () => "1px 2px").with(InputSize.LARGE, () => "2px 2px").exhaustive();
13
13
  };
14
- var _exp4 = () => ({ $size }) => {
15
- return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
16
- };
14
+ var _exp4 = () => ({ $size }) => getInputHeight($size);
17
15
  var StyledSwitcherInput = withTheme(/*#__PURE__*/ styled("div")({
18
16
  name: "StyledSwitcherInput",
19
17
  class: "sx2momv",
@@ -44,14 +42,16 @@ var StyledSwitcherInputItem = withTheme(/*#__PURE__*/ styled("div")({
44
42
  * A segmented control for switching between a few mutually exclusive views.
45
43
  * Each item carries its own `onClick`, so there is no top-level change handler.
46
44
  */
47
- var SwitcherInput = ({ size = InputSize.MEDIUM, items, selectedId }) => {
45
+ var SwitcherInput = ({ variant = InputVariant.PRIMARY, size = InputSize.MEDIUM, items, selectedId }) => {
48
46
  return /* @__PURE__ */ jsx(StyledSwitcherInput, {
49
47
  $size: size,
48
+ $variant: variant,
50
49
  children: items.map((item) => /* @__PURE__ */ jsx(StyledSwitcherInputItem, {
51
50
  onClick: item.onClick,
52
51
  $isSelected: item.id === selectedId,
53
52
  $size: size,
54
53
  children: /* @__PURE__ */ jsx(Text, {
54
+ size: getInputTextSize(size),
55
55
  weight: item.id === selectedId ? TextWeight.MEDIUM : TextWeight.REGULAR,
56
56
  cursor: "pointer",
57
57
  children: item.label