@gnist/design-system 5.5.3 → 5.6.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 (63) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -0
  3. package/dist/components/actions/selectionControls/Checkbox.js +1 -1
  4. package/dist/components/actions/selectionControls/RadioButton.js +2 -2
  5. package/dist/components/actions/selectionControls/Switch.cjs +19 -9
  6. package/dist/components/actions/selectionControls/Switch.d.ts +1 -1
  7. package/dist/components/actions/selectionControls/Switch.d.ts.map +1 -1
  8. package/dist/components/actions/selectionControls/Switch.js +21 -11
  9. package/dist/components/actions/selectionControls/switch.css.cjs +123 -48
  10. package/dist/components/actions/selectionControls/switch.css.d.ts +10 -12
  11. package/dist/components/actions/selectionControls/switch.css.d.ts.map +1 -1
  12. package/dist/components/actions/selectionControls/switch.css.js +124 -49
  13. package/dist/components/feedback/alerts/AlertBanner.js +1 -1
  14. package/dist/components/inputs/dropdowns/SelectBase.js +1 -1
  15. package/dist/components/inputs/pickers/Calendar.css.js +1 -1
  16. package/dist/components/inputs/textFields/TextArea.js +1 -1
  17. package/dist/components/inputs/textFields/TextField.js +1 -1
  18. package/dist/components/surfaces/modal/Modal.js +1 -1
  19. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-filled.svg.cjs +1 -1
  20. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-filled.svg.js +1 -1
  21. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-outlined.svg.cjs +1 -1
  22. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-outlined.svg.js +1 -1
  23. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-round.svg.cjs +1 -1
  24. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-round.svg.js +1 -1
  25. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-sharp.svg.cjs +1 -1
  26. package/dist/foundation/iconography/svg/social/sentiment_dissatisfied-sharp.svg.js +1 -1
  27. package/dist/foundation/iconography/svg/social/sentiment_neutral-filled.svg.cjs +1 -1
  28. package/dist/foundation/iconography/svg/social/sentiment_neutral-filled.svg.js +1 -1
  29. package/dist/foundation/iconography/svg/social/sentiment_neutral-outlined.svg.cjs +1 -1
  30. package/dist/foundation/iconography/svg/social/sentiment_neutral-outlined.svg.js +1 -1
  31. package/dist/foundation/iconography/svg/social/sentiment_neutral-round.svg.cjs +1 -1
  32. package/dist/foundation/iconography/svg/social/sentiment_neutral-round.svg.js +1 -1
  33. package/dist/foundation/iconography/svg/social/sentiment_neutral-sharp.svg.cjs +1 -1
  34. package/dist/foundation/iconography/svg/social/sentiment_neutral-sharp.svg.js +1 -1
  35. package/dist/foundation/iconography/svg/social/sentiment_satisfied-filled.svg.cjs +1 -1
  36. package/dist/foundation/iconography/svg/social/sentiment_satisfied-filled.svg.js +1 -1
  37. package/dist/foundation/iconography/svg/social/sentiment_satisfied-outlined.svg.cjs +1 -1
  38. package/dist/foundation/iconography/svg/social/sentiment_satisfied-outlined.svg.js +1 -1
  39. package/dist/foundation/iconography/svg/social/sentiment_satisfied-round.svg.cjs +1 -1
  40. package/dist/foundation/iconography/svg/social/sentiment_satisfied-round.svg.js +1 -1
  41. package/dist/foundation/iconography/svg/social/sentiment_satisfied-sharp.svg.cjs +1 -1
  42. package/dist/foundation/iconography/svg/social/sentiment_satisfied-sharp.svg.js +1 -1
  43. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-filled.svg.cjs +1 -1
  44. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-filled.svg.js +1 -1
  45. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-outlined.svg.cjs +1 -1
  46. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-outlined.svg.js +1 -1
  47. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-round.svg.cjs +1 -1
  48. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-round.svg.js +1 -1
  49. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-sharp.svg.cjs +1 -1
  50. package/dist/foundation/iconography/svg/social/sentiment_very_dissatisfied-sharp.svg.js +1 -1
  51. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-filled.svg.cjs +1 -1
  52. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-filled.svg.js +1 -1
  53. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-outlined.svg.cjs +1 -1
  54. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-outlined.svg.js +1 -1
  55. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-round.svg.cjs +1 -1
  56. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-round.svg.js +1 -1
  57. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-sharp.svg.cjs +1 -1
  58. package/dist/foundation/iconography/svg/social/sentiment_very_satisfied-sharp.svg.js +1 -1
  59. package/dist/foundation/logos/svg/index.cjs +27 -27
  60. package/dist/index.cjs +26 -26
  61. package/dist/utilities/validation/validation.js +1 -1
  62. package/dist/utilities/validation/validators.js +1 -1
  63. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.6.1](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@5.6.0...@gnist/design-system@5.6.1) (2026-04-17)
7
+
8
+ **Note:** Version bump only for package @gnist/design-system
9
+
10
+ ## [5.6.0](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@5.5.3...@gnist/design-system@5.6.0) (2026-03-20)
11
+
12
+ ### Features
13
+
14
+ * update sentiment icons to new look ([e2bc676](https://github.com/mollerdigital/design-system-design-system/commit/e2bc67689413d18a230b9a6fe6fec075579fd7ca))
15
+
6
16
  ## [5.5.3](https://github.com/mollerdigital/design-system-design-system/compare/@gnist/design-system@5.5.2...@gnist/design-system@5.5.3) (2026-03-20)
7
17
 
8
18
  **Note:** Version bump only for package @gnist/design-system
package/README.md CHANGED
@@ -100,6 +100,8 @@ export const App: React.FC = () => {
100
100
  };
101
101
  ```
102
102
 
103
+ > Note: The `brandless` and `gnist` themes are for **internal use only**. Both use the "Geist" font family, so if you are using either of these themes, import `@gnist/design-system/fonts/tools` as your font.
104
+
103
105
  ### Next.js projects
104
106
 
105
107
  If you are setting up in a Next.js project, the procedure is quite the same.
@@ -9,7 +9,7 @@ import "../../../foundation/iconography/IconVariantProvider.js";
9
9
  import "../../../foundation/iconography/icons.js";
10
10
  import { Icon } from "../../../foundation/iconography/Icon.js";
11
11
  import { CheckboxRecipe, checkbox } from "./checkbox.css.js";
12
- import { InputWrapper, LabelRecipe, InputStyleRecipe, LabelStyle, indentedDescriptionStyle } from "./shared.css.js";
12
+ import { InputWrapper, InputStyleRecipe, LabelStyle, LabelRecipe, indentedDescriptionStyle } from "./shared.css.js";
13
13
  import { SelectionDescription, HelperTextWrapper } from "./shared.js";
14
14
  const CustomCheckbox = ({ value, disabled }) => {
15
15
  if (!value) {
@@ -5,8 +5,8 @@ import { ScreenReaderOnly } from "../../../utilities/accessibility/ScreenReaderO
5
5
  import "../../../utilities/accessibility/visuallyHidden.css.js";
6
6
  import { createValidHtmlId } from "../../../utilities/html/index.js";
7
7
  import classNames from "classnames";
8
- import { RadioButtonRecipe, CheckedCircleRecipe } from "./radiobutton.css.js";
9
- import { LabelRecipe, InputStyleRecipe, LabelStyle, InputWrapper, indentedDescriptionStyle } from "./shared.css.js";
8
+ import { CheckedCircleRecipe, RadioButtonRecipe } from "./radiobutton.css.js";
9
+ import { InputStyleRecipe, LabelStyle, LabelRecipe, InputWrapper, indentedDescriptionStyle } from "./shared.css.js";
10
10
  import { SelectionDescription, HelperTextWrapper } from "./shared.js";
11
11
  import { useRadio } from "./RadioGroup.js";
12
12
  const CustomRadioButton = ({ isChecked, disabled, validity }) => {
@@ -2,33 +2,43 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
+ const InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
5
6
  const ScreenReaderOnly = require("../../../utilities/accessibility/ScreenReaderOnly.cjs");
6
7
  require("../../../utilities/accessibility/visuallyHidden.css.cjs");
7
8
  const index = require("../../../utilities/html/index.cjs");
9
+ require("../../../foundation/iconography/ExtraIconsProvider.cjs");
10
+ require("../../../foundation/iconography/IconVariantProvider.cjs");
11
+ require("../../../foundation/iconography/icons.cjs");
12
+ const Icon = require("../../../foundation/iconography/Icon.cjs");
8
13
  const switch_css = require("./switch.css.cjs");
9
14
  const shared_css = require("./shared.css.cjs");
15
+ const shared = require("./shared.cjs");
10
16
  const atoms_css_js = require("@gnist/themes/atoms.css.js");
11
- function Switch({ label, description, value = false, onChange, disabled, id = index.createValidHtmlId(label || "toggle"), position = "left", hideLabel = false, className, ref, ...rest }) {
17
+ function Switch({ label, description, value = false, onChange, disabled, id = index.createValidHtmlId(label || "toggle"), position = "left", hideLabel = false, canShowErrorMessage = false, className, ref, ...rest }) {
12
18
  const inputId = id;
19
+ const helperId = `${id}-helper`;
20
+ const { helperTextProps, inputAriaProps } = InputHelperText.useInputHelperText({
21
+ id: helperId,
22
+ reserveSpaceForMessage: canShowErrorMessage
23
+ });
13
24
  const LabelElement = () => {
14
- return jsxRuntime.jsxs("span", { className: switch_css.SwitchLabelRecipe({
15
- disabled,
16
- side: position === "right" ? "left" : "right"
17
- }), children: [label, description && jsxRuntime.jsx("div", { className: switch_css.switchDescription, children: description })] });
25
+ return jsxRuntime.jsx("span", { className: switch_css.switchLabelContent, children: jsxRuntime.jsx("span", { className: switch_css.SwitchLabelRecipe({ disabled }), children: label }) });
18
26
  };
19
- return jsxRuntime.jsxs("span", { className: `${shared_css.InputWrapper} ${switch_css.focusContainer} ${className} ${atoms_css_js.atoms({ borderRadius: hideLabel ? "full" : "input" })}`, ref, children: [jsxRuntime.jsx("input", { type: "checkbox", id: inputId, disabled, onChange, checked: value === true, className: shared_css.InputStyleRecipe({ disabled }), style: {
27
+ const descriptionElement = description ?? jsxRuntime.jsx(shared.SelectionDescription, { disabled, children: jsxRuntime.jsx("div", { className: switch_css.switchDescription, children: description }) });
28
+ const switchElement = jsxRuntime.jsxs("span", { className: `${switch_css.switchField} ${className ?? ""}`, ref, children: [jsxRuntime.jsxs("span", { className: `${shared_css.InputWrapper} ${switch_css.focusContainer} ${atoms_css_js.atoms({ borderRadius: hideLabel ? "full" : "input" })}`, children: [jsxRuntime.jsx("input", { type: "checkbox", id: inputId, disabled, onChange, checked: value === true, className: shared_css.InputStyleRecipe({ disabled }), style: {
20
29
  position: "absolute",
21
30
  opacity: 0,
22
31
  width: "100%",
23
32
  height: "100%",
24
33
  margin: 0,
25
34
  cursor: disabled ? "not-allowed" : "pointer"
26
- }, ...rest }), jsxRuntime.jsxs("label", { htmlFor: inputId, className: switch_css.switchContainerStyle, children: [position === "right" && !hideLabel && jsxRuntime.jsx(LabelElement, {}), jsxRuntime.jsx("span", { className: switch_css.SwitchRecipe({
35
+ }, ...inputAriaProps, ...rest }), jsxRuntime.jsxs("label", { htmlFor: inputId, className: switch_css.switchRow, children: [position === "right" && !hideLabel && jsxRuntime.jsx(LabelElement, {}), jsxRuntime.jsx("span", { className: switch_css.SwitchRecipe({
27
36
  selected: value,
28
37
  disabled
29
38
  }), children: jsxRuntime.jsx("span", { className: switch_css.SwitchThumbRecipe({
30
- selected: value ?? false,
39
+ selected: value,
31
40
  disabled
32
- }) }) }), position === "left" && !hideLabel && jsxRuntime.jsx(LabelElement, {}), hideLabel && jsxRuntime.jsx(ScreenReaderOnly.ScreenReaderOnly, { children: label })] })] });
41
+ }), children: (value && !disabled) ?? jsxRuntime.jsx("span", { className: switch_css.switchThumbIcon, "aria-hidden": true, children: jsxRuntime.jsx(Icon.Icon, { icon: "check", size: "xs" }) }) }) }), position === "left" && !hideLabel && jsxRuntime.jsx(LabelElement, {}), hideLabel && jsxRuntime.jsx(ScreenReaderOnly.ScreenReaderOnly, { children: label })] })] }), descriptionElement] });
42
+ return jsxRuntime.jsx(shared.HelperTextWrapper, { ...helperTextProps, children: switchElement });
33
43
  }
34
44
  exports.Switch = Switch;
@@ -13,5 +13,5 @@ export interface SwitchProps extends Omit<SelectionControlProps<boolean>, "rende
13
13
  *
14
14
  * Documentation: [Switch](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-selectioncontrols-switch--docs)
15
15
  */
16
- export declare function Switch({ label, description, value, onChange, disabled, id, position, hideLabel, className, ref, ...rest }: SwitchProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Switch({ label, description, value, onChange, disabled, id, position, hideLabel, canShowErrorMessage, className, ref, ...rest }: SwitchProps): import("react/jsx-runtime").JSX.Element;
17
17
  //# sourceMappingURL=Switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Switch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAU5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,WACb,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnE,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACnB,KAAK,EACL,WAAW,EACX,KAAa,EACb,QAAQ,EACR,QAAQ,EACR,EAAyC,EACzC,QAAiB,EACjB,SAAiB,EACjB,SAAS,EACT,GAAG,EACH,GAAG,IAAI,EACV,EAAE,WAAW,2CA6Db"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAc5B,OAAO,EAEH,qBAAqB,EAExB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,WACb,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnE,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EACnB,KAAK,EACL,WAAW,EACX,KAAa,EACb,QAAQ,EACR,QAAQ,EACR,EAAyC,EACzC,QAAiB,EACjB,SAAiB,EACjB,mBAA2B,EAC3B,SAAS,EACT,GAAG,EACH,GAAG,IAAI,EACV,EAAE,WAAW,2CAkFb"}
@@ -1,33 +1,43 @@
1
1
  "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useInputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
3
4
  import { ScreenReaderOnly } from "../../../utilities/accessibility/ScreenReaderOnly.js";
4
5
  import "../../../utilities/accessibility/visuallyHidden.css.js";
5
6
  import { createValidHtmlId } from "../../../utilities/html/index.js";
6
- import { focusContainer, switchContainerStyle, SwitchRecipe, SwitchThumbRecipe, SwitchLabelRecipe, switchDescription } from "./switch.css.js";
7
+ import "../../../foundation/iconography/ExtraIconsProvider.js";
8
+ import "../../../foundation/iconography/IconVariantProvider.js";
9
+ import "../../../foundation/iconography/icons.js";
10
+ import { Icon } from "../../../foundation/iconography/Icon.js";
11
+ import { switchDescription, switchField, focusContainer, switchRow, switchThumbIcon, SwitchThumbRecipe, SwitchRecipe, switchLabelContent, SwitchLabelRecipe } from "./switch.css.js";
7
12
  import { InputWrapper, InputStyleRecipe } from "./shared.css.js";
13
+ import { SelectionDescription, HelperTextWrapper } from "./shared.js";
8
14
  import { atoms } from "@gnist/themes/atoms.css.js";
9
- function Switch({ label, description, value = false, onChange, disabled, id = createValidHtmlId(label || "toggle"), position = "left", hideLabel = false, className, ref, ...rest }) {
15
+ function Switch({ label, description, value = false, onChange, disabled, id = createValidHtmlId(label || "toggle"), position = "left", hideLabel = false, canShowErrorMessage = false, className, ref, ...rest }) {
10
16
  const inputId = id;
17
+ const helperId = `${id}-helper`;
18
+ const { helperTextProps, inputAriaProps } = useInputHelperText({
19
+ id: helperId,
20
+ reserveSpaceForMessage: canShowErrorMessage
21
+ });
11
22
  const LabelElement = () => {
12
- return jsxs("span", { className: SwitchLabelRecipe({
13
- disabled,
14
- side: position === "right" ? "left" : "right"
15
- }), children: [label, description && jsx("div", { className: switchDescription, children: description })] });
23
+ return jsx("span", { className: switchLabelContent, children: jsx("span", { className: SwitchLabelRecipe({ disabled }), children: label }) });
16
24
  };
17
- return jsxs("span", { className: `${InputWrapper} ${focusContainer} ${className} ${atoms({ borderRadius: hideLabel ? "full" : "input" })}`, ref, children: [jsx("input", { type: "checkbox", id: inputId, disabled, onChange, checked: value === true, className: InputStyleRecipe({ disabled }), style: {
25
+ const descriptionElement = description ?? jsx(SelectionDescription, { disabled, children: jsx("div", { className: switchDescription, children: description }) });
26
+ const switchElement = jsxs("span", { className: `${switchField} ${className ?? ""}`, ref, children: [jsxs("span", { className: `${InputWrapper} ${focusContainer} ${atoms({ borderRadius: hideLabel ? "full" : "input" })}`, children: [jsx("input", { type: "checkbox", id: inputId, disabled, onChange, checked: value === true, className: InputStyleRecipe({ disabled }), style: {
18
27
  position: "absolute",
19
28
  opacity: 0,
20
29
  width: "100%",
21
30
  height: "100%",
22
31
  margin: 0,
23
32
  cursor: disabled ? "not-allowed" : "pointer"
24
- }, ...rest }), jsxs("label", { htmlFor: inputId, className: switchContainerStyle, children: [position === "right" && !hideLabel && jsx(LabelElement, {}), jsx("span", { className: SwitchRecipe({
33
+ }, ...inputAriaProps, ...rest }), jsxs("label", { htmlFor: inputId, className: switchRow, children: [position === "right" && !hideLabel && jsx(LabelElement, {}), jsx("span", { className: SwitchRecipe({
25
34
  selected: value,
26
35
  disabled
27
36
  }), children: jsx("span", { className: SwitchThumbRecipe({
28
- selected: value ?? false,
37
+ selected: value,
29
38
  disabled
30
- }) }) }), position === "left" && !hideLabel && jsx(LabelElement, {}), hideLabel && jsx(ScreenReaderOnly, { children: label })] })] });
39
+ }), children: (value && !disabled) ?? jsx("span", { className: switchThumbIcon, "aria-hidden": true, children: jsx(Icon, { icon: "check", size: "xs" }) }) }) }), position === "left" && !hideLabel && jsx(LabelElement, {}), hideLabel && jsx(ScreenReaderOnly, { children: label })] })] }), descriptionElement] });
40
+ return jsx(HelperTextWrapper, { ...helperTextProps, children: switchElement });
31
41
  }
32
42
  export {
33
43
  Switch
@@ -3,56 +3,79 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const atoms_css_js = require("@gnist/themes/atoms.css.js");
5
5
  const tokens_css_js = require("@gnist/themes/tokens.css.js");
6
+ const cssUtils = require("@vanilla-extract/css-utils");
6
7
  const recipes = require("@vanilla-extract/recipes");
7
8
  const css = require("@vanilla-extract/css");
8
9
  const focusContainer = css.style({
9
10
  display: "inline-flex",
10
11
  alignItems: "center",
11
- selectors: {
12
- "&:has(:focus-visible)": {
13
- outline: `${tokens_css_js.tokens.stroke.medium} solid ${tokens_css_js.tokens.color.interactive}`,
14
- outlineOffset: "2px"
15
- }
16
- }
12
+ position: "relative",
13
+ flexShrink: 0
14
+ });
15
+ const switchField = css.style({
16
+ display: "inline-flex",
17
+ flexDirection: "column",
18
+ gap: tokens_css_js.tokens.spacing.base
17
19
  });
18
- const switchContainerStyle = css.style({
19
- display: "flex"
20
+ const switchRow = css.style({
21
+ display: "inline-flex",
22
+ alignItems: "center",
23
+ gap: tokens_css_js.tokens.spacing.xxs
24
+ });
25
+ const switchLabelContent = css.style({
26
+ display: "inline-flex",
27
+ flexDirection: "column",
28
+ gap: tokens_css_js.tokens.spacing.base,
29
+ minWidth: 0
20
30
  });
21
31
  const switchContainer = css.style([
22
32
  {
23
33
  position: "relative",
24
34
  display: "inline-flex",
35
+ alignItems: "center",
36
+ flexShrink: 0,
25
37
  cursor: "pointer",
26
- transition: "background-color 0.2s ease"
38
+ overflow: "hidden",
39
+ transition: "background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease"
27
40
  },
28
41
  atoms_css_js.atoms({
29
42
  borderRadius: "full",
30
43
  width: "xxl",
31
- height: "l"
44
+ height: "m"
32
45
  })
33
46
  ]);
34
47
  const SwitchRecipe = recipes.recipe({
35
48
  base: [
36
49
  switchContainer,
37
- atoms_css_js.atoms({
38
- borderColor: "outline"
39
- }),
40
50
  {
41
- borderWidth: "1px",
51
+ borderWidth: tokens_css_js.tokens.stroke.small,
42
52
  borderStyle: "solid",
43
- boxSizing: "border-box"
53
+ boxSizing: "border-box",
54
+ selectors: {
55
+ [`${focusContainer}:has(input:focus-visible) &`]: {
56
+ boxShadow: `0 0 0 ${tokens_css_js.tokens.stroke.medium} ${tokens_css_js.tokens.color.interactive}`
57
+ },
58
+ [`${focusContainer}:has(input:not(:disabled):hover) &`]: {
59
+ filter: "brightness(0.98)"
60
+ },
61
+ [`${focusContainer}:has(input:not(:disabled):active) &`]: {
62
+ filter: "brightness(0.94)"
63
+ }
64
+ }
44
65
  }
45
66
  ],
46
67
  variants: {
47
68
  selected: {
48
69
  true: [
49
70
  atoms_css_js.atoms({
50
- backgroundColor: "success"
71
+ backgroundColor: "success",
72
+ borderColor: "success"
51
73
  })
52
74
  ],
53
75
  false: [
54
76
  atoms_css_js.atoms({
55
- backgroundColor: "surface-variant"
77
+ backgroundColor: "surface-variant",
78
+ borderColor: "on-surface"
56
79
  })
57
80
  ]
58
81
  },
@@ -60,53 +83,114 @@ const SwitchRecipe = recipes.recipe({
60
83
  true: [
61
84
  atoms_css_js.atoms({
62
85
  backgroundColor: "disabled",
63
- borderColor: "disabled"
86
+ borderColor: "on-disabled"
64
87
  }),
65
88
  {
66
- cursor: "not-allowed",
67
- opacity: 0.6
89
+ cursor: "not-allowed"
68
90
  }
69
91
  ],
70
92
  false: {}
71
93
  }
72
- }
94
+ },
95
+ compoundVariants: [
96
+ {
97
+ variants: {
98
+ selected: true,
99
+ disabled: true
100
+ },
101
+ style: [
102
+ atoms_css_js.atoms({
103
+ backgroundColor: "on-disabled",
104
+ borderColor: "on-disabled"
105
+ })
106
+ ]
107
+ }
108
+ ]
73
109
  });
74
110
  const switchThumb = css.style({
75
111
  position: "absolute",
76
112
  top: "50%",
77
113
  transform: "translateY(-50%)",
78
- transition: "left 0.2s ease, background-color 0.2s ease",
114
+ display: "inline-flex",
115
+ alignItems: "center",
116
+ justifyContent: "center",
117
+ transition: "left 0.2s ease, transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease",
79
118
  borderRadius: "50%",
80
- backgroundColor: tokens_css_js.tokens.palette.white,
81
- boxShadow: "0 1px 3px rgba(0, 0, 0, 0.3)"
119
+ backgroundColor: tokens_css_js.tokens.color.surface,
120
+ selectors: {
121
+ [`${focusContainer}:has(input:not(:disabled):active) &`]: {
122
+ transform: "translateY(-50%) scale(0.94)"
123
+ }
124
+ }
82
125
  });
83
126
  const SwitchThumbRecipe = recipes.recipe({
84
127
  base: [
85
128
  switchThumb,
86
129
  atoms_css_js.atoms({
87
- width: "m",
88
- height: "m"
89
- })
130
+ width: "s",
131
+ height: "s"
132
+ }),
133
+ {
134
+ borderWidth: tokens_css_js.tokens.stroke.small,
135
+ borderStyle: "solid",
136
+ boxSizing: "border-box"
137
+ }
90
138
  ],
91
139
  variants: {
92
140
  selected: {
93
- true: {
94
- left: `calc(100% - ${tokens_css_js.tokens.spacing.m} - 1px)`
95
- },
96
- false: {
97
- left: "1px"
98
- }
141
+ true: [
142
+ atoms_css_js.atoms({
143
+ borderColor: "on-surface"
144
+ }),
145
+ {
146
+ left: cssUtils.calc.subtract("100%", cssUtils.calc.add(tokens_css_js.tokens.size.s, tokens_css_js.tokens.stroke.small))
147
+ }
148
+ ],
149
+ false: [
150
+ atoms_css_js.atoms({
151
+ borderColor: "on-surface"
152
+ }),
153
+ {
154
+ left: tokens_css_js.tokens.stroke.small
155
+ }
156
+ ]
99
157
  },
100
158
  disabled: {
101
159
  true: [
102
160
  atoms_css_js.atoms({
103
- backgroundColor: "on-disabled"
161
+ backgroundColor: "surface",
162
+ borderColor: "on-disabled"
104
163
  })
105
164
  ],
106
165
  false: {}
107
166
  }
108
- }
167
+ },
168
+ compoundVariants: [
169
+ {
170
+ variants: {
171
+ selected: true,
172
+ disabled: true
173
+ },
174
+ style: [
175
+ atoms_css_js.atoms({
176
+ borderColor: "surface"
177
+ })
178
+ ]
179
+ }
180
+ ]
109
181
  });
182
+ const switchThumbIcon = css.style([
183
+ {
184
+ display: "inline-flex",
185
+ alignItems: "center",
186
+ justifyContent: "center",
187
+ lineHeight: 0,
188
+ pointerEvents: "none"
189
+ },
190
+ atoms_css_js.atoms({
191
+ color: "on-surface"
192
+ })
193
+ ]);
110
194
  const switchLabel = css.style([
111
195
  {
112
196
  userSelect: "none",
@@ -127,18 +211,6 @@ const SwitchLabelRecipe = recipes.recipe({
127
211
  })
128
212
  ],
129
213
  false: {}
130
- },
131
- side: {
132
- left: [
133
- atoms_css_js.atoms({
134
- marginRight: "xxs"
135
- })
136
- ],
137
- right: [
138
- atoms_css_js.atoms({
139
- marginLeft: "xxs"
140
- })
141
- ]
142
214
  }
143
215
  }
144
216
  });
@@ -152,7 +224,10 @@ exports.SwitchRecipe = SwitchRecipe;
152
224
  exports.SwitchThumbRecipe = SwitchThumbRecipe;
153
225
  exports.focusContainer = focusContainer;
154
226
  exports.switchContainer = switchContainer;
155
- exports.switchContainerStyle = switchContainerStyle;
156
227
  exports.switchDescription = switchDescription;
228
+ exports.switchField = switchField;
157
229
  exports.switchLabel = switchLabel;
230
+ exports.switchLabelContent = switchLabelContent;
231
+ exports.switchRow = switchRow;
158
232
  exports.switchThumb = switchThumb;
233
+ exports.switchThumbIcon = switchThumbIcon;
@@ -1,5 +1,7 @@
1
1
  export declare const focusContainer: string;
2
- export declare const switchContainerStyle: string;
2
+ export declare const switchField: string;
3
+ export declare const switchRow: string;
4
+ export declare const switchLabelContent: string;
3
5
  export declare const switchContainer: string;
4
6
  export declare const SwitchRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
5
7
  selected: {
@@ -9,7 +11,6 @@ export declare const SwitchRecipe: import("@vanilla-extract/recipes").RuntimeFn<
9
11
  disabled: {
10
12
  true: (string | {
11
13
  cursor: "not-allowed";
12
- opacity: number;
13
14
  })[];
14
15
  false: {};
15
16
  };
@@ -17,28 +18,25 @@ export declare const SwitchRecipe: import("@vanilla-extract/recipes").RuntimeFn<
17
18
  export declare const switchThumb: string;
18
19
  export declare const SwitchThumbRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
19
20
  selected: {
20
- true: {
21
- left: `calc(100% - var(--${string}) - 1px)`;
22
- };
23
- false: {
24
- left: "1px";
25
- };
21
+ true: (string | {
22
+ left: string;
23
+ })[];
24
+ false: (string | {
25
+ left: `var(--${string})`;
26
+ })[];
26
27
  };
27
28
  disabled: {
28
29
  true: string[];
29
30
  false: {};
30
31
  };
31
32
  }>;
33
+ export declare const switchThumbIcon: string;
32
34
  export declare const switchLabel: string;
33
35
  export declare const SwitchLabelRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
34
36
  disabled: {
35
37
  true: string[];
36
38
  false: {};
37
39
  };
38
- side: {
39
- left: string[];
40
- right: string[];
41
- };
42
40
  }>;
43
41
  export declare const switchDescription: string;
44
42
  //# sourceMappingURL=switch.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.css.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/switch.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,QASzB,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAE/B,CAAC;AAEH,eAAO,MAAM,eAAe,QAY1B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;EAuCvB,CAAC;AAEH,eAAO,MAAM,WAAW,QAQtB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;EA0B5B,CAAC;AAEH,eAAO,MAAM,WAAW,QAStB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAwB5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAI5B,CAAC"}
1
+ {"version":3,"file":"switch.css.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/switch.css.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,QAKzB,CAAC;AAEH,eAAO,MAAM,WAAW,QAItB,CAAC;AAEH,eAAO,MAAM,SAAS,QAIpB,CAAC;AAEH,eAAO,MAAM,kBAAkB,QAK7B,CAAC;AAEH,eAAO,MAAM,eAAe,QAgB1B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;EA8DvB,CAAC;AAEH,eAAO,MAAM,WAAW,QAgBtB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;EA0D5B,CAAC;AAEH,eAAO,MAAM,eAAe,QAW1B,CAAC;AAEH,eAAO,MAAM,WAAW,QAStB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;EAY5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAI5B,CAAC"}