@elliemae/ds-form-toggle 3.80.0-next.8 → 3.80.0-next.80

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 (44) hide show
  1. package/dist/cjs/config/useDSControlledToggle.js +3 -2
  2. package/dist/cjs/config/useDSControlledToggle.js.map +2 -2
  3. package/dist/cjs/config/useGetButtonProps.js +49 -11
  4. package/dist/cjs/config/useGetButtonProps.js.map +2 -2
  5. package/dist/cjs/constants/index.js +1 -0
  6. package/dist/cjs/constants/index.js.map +2 -2
  7. package/dist/cjs/parts/Button.js +3 -2
  8. package/dist/cjs/parts/Button.js.map +2 -2
  9. package/dist/cjs/parts/Container.js +32 -4
  10. package/dist/cjs/parts/Container.js.map +2 -2
  11. package/dist/cjs/parts/styles/styles.js +29 -24
  12. package/dist/cjs/parts/styles/styles.js.map +2 -2
  13. package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js +12 -2
  14. package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js.map +2 -2
  15. package/dist/cjs/react-desc-prop-types.js +15 -3
  16. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  17. package/dist/cjs/typescript-testing/form-toggle-typescript-valid.js +24 -1
  18. package/dist/cjs/typescript-testing/form-toggle-typescript-valid.js.map +3 -3
  19. package/dist/cjs/typescript-testing/slot-props.js +2 -0
  20. package/dist/cjs/typescript-testing/slot-props.js.map +2 -2
  21. package/dist/esm/config/useDSControlledToggle.js +3 -2
  22. package/dist/esm/config/useDSControlledToggle.js.map +2 -2
  23. package/dist/esm/config/useGetButtonProps.js +49 -11
  24. package/dist/esm/config/useGetButtonProps.js.map +2 -2
  25. package/dist/esm/constants/index.js +1 -0
  26. package/dist/esm/constants/index.js.map +2 -2
  27. package/dist/esm/parts/Button.js +3 -2
  28. package/dist/esm/parts/Button.js.map +2 -2
  29. package/dist/esm/parts/Container.js +34 -6
  30. package/dist/esm/parts/Container.js.map +2 -2
  31. package/dist/esm/parts/styles/styles.js +30 -25
  32. package/dist/esm/parts/styles/styles.js.map +2 -2
  33. package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js +12 -2
  34. package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js.map +2 -2
  35. package/dist/esm/react-desc-prop-types.js +15 -3
  36. package/dist/esm/react-desc-prop-types.js.map +2 -2
  37. package/dist/esm/typescript-testing/form-toggle-typescript-valid.js +24 -1
  38. package/dist/esm/typescript-testing/form-toggle-typescript-valid.js.map +3 -3
  39. package/dist/esm/typescript-testing/slot-props.js +2 -0
  40. package/dist/esm/typescript-testing/slot-props.js.map +2 -2
  41. package/dist/types/constants/index.d.ts +2 -0
  42. package/dist/types/parts/styles/styles.d.ts +4 -0
  43. package/dist/types/react-desc-prop-types.d.ts +4 -0
  44. package/package.json +10 -10
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { DSButtonV3 } from "@elliemae/ds-button-v2";
3
- import { css, styled, xStyledCommonProps } from "@elliemae/ds-system";
3
+ import { css, styled, xStyledCommonProps, lockedStateInteractionCss } from "@elliemae/ds-system";
4
4
  import { DSTypography } from "@elliemae/ds-typography";
5
5
  import { CONTROLLED_TOGGLE_SLOTS, DSControlledToggleName } from "../../constants/index.js";
6
6
  const containerHeight = {
@@ -25,7 +25,7 @@ const StyledContainer = styled("div", {
25
25
  ${xStyledCommonProps}
26
26
  `;
27
27
  const SwitchButtonStateColors = css`
28
- ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {
28
+ ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, $hasError, theme }) => {
29
29
  if ($disabled)
30
30
  return `
31
31
  background-color: ${theme.colors.neutral["080"]};
@@ -33,49 +33,38 @@ const SwitchButtonStateColors = css`
33
33
  `;
34
34
  if ($readOnly || $applyAriaDisabled)
35
35
  return `
36
- background-color: ${theme.colors.neutral["050"]};
37
- border: 2px solid ${theme.colors.neutral["400"]};
36
+ background-color: ${$checked ? theme.colors.neutral["000"] : theme.colors.neutral["050"]};
37
+ border: 2px solid ${$hasError ? theme.colors.danger["900"] : theme.colors.neutral["400"]};
38
38
  `;
39
39
  if ($checked)
40
40
  return `
41
41
  background-color: ${theme.colors.brand["600"]};
42
- border: 2px solid ${theme.colors.brand["700"]};
42
+ border: 2px solid ${$hasError ? theme.colors.danger["900"] : theme.colors.brand["700"]};
43
43
  `;
44
44
  return `
45
45
  background-color: ${theme.colors.neutral["500"]};
46
- border: 2px solid ${theme.colors.neutral["600"]};
46
+ border: 2px solid ${$hasError ? theme.colors.danger["900"] : theme.colors.neutral["600"]};
47
47
  `;
48
48
  }}
49
49
  `;
50
- const SwitchCursors = css`
51
- ${({ $disabled, $readOnly, $applyAriaDisabled }) => {
52
- if ($disabled || $readOnly || $applyAriaDisabled)
53
- return `
54
- cursor: not-allowed;
55
- `;
56
- return `
57
- cursor: pointer;
58
- `;
59
- }}
60
- `;
61
50
  const SwitchHoverColors = css`
62
- ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {
51
+ ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, $hasError, theme }) => {
63
52
  if ($disabled)
64
53
  return `
65
54
  background-color: ${theme.colors.neutral["080"]};
66
55
  `;
67
56
  if ($readOnly || $applyAriaDisabled)
68
57
  return `
69
- background-color: ${theme.colors.neutral["050"]};
58
+ background-color: ${$checked ? theme.colors.neutral["000"] : theme.colors.neutral["050"]};
70
59
  `;
71
60
  if ($checked)
72
61
  return `
73
62
  background-color: ${theme.colors.brand["700"]};
74
- border-color: ${theme.colors.brand["800"]};
63
+ border-color: ${$hasError ? theme.colors.danger["900"] : theme.colors.brand["800"]};
75
64
  `;
76
65
  return `
77
66
  background-color: ${theme.colors.neutral["600"]};
78
- border-color: ${theme.colors.neutral["700"]};
67
+ border-color: ${$hasError ? theme.colors.danger["900"] : theme.colors.neutral["700"]};
79
68
  `;
80
69
  }}
81
70
  `;
@@ -92,10 +81,14 @@ const StyledButton = styled(DSButtonV3, {
92
81
  outline: 2px solid ${({ theme }) => theme.colors.brand["700"]};
93
82
  outline-offset: 1px;
94
83
  }
84
+ cursor: pointer;
95
85
  &:hover {
96
- ${SwitchCursors}
97
86
  ${SwitchHoverColors}
98
87
  }
88
+ /* not-allowed for disabled, applyAriaDisabled and readOnly comes from lockedStateInteractionCss.
89
+ The UX spec says "arrow" for readOnly/aria-disabled; not-allowed ships consistent with other Dimsum
90
+ components until UX confirms. */
91
+ ${lockedStateInteractionCss}
99
92
  `;
100
93
  const labelHeight = {
101
94
  s: "16px",
@@ -122,7 +115,7 @@ const StyledButtonContentWrapper = styled("div", {
122
115
  border-radius: 20px;
123
116
  `;
124
117
  const CircleColors = css`
125
- ${({ theme, $disabled, $readOnly, $applyAriaDisabled }) => {
118
+ ${({ theme, $disabled, $readOnly, $applyAriaDisabled, $hasError }) => {
126
119
  if ($disabled) {
127
120
  return `
128
121
  background-color: ${theme.colors.neutral["080"]};
@@ -132,7 +125,7 @@ const CircleColors = css`
132
125
  if ($readOnly || $applyAriaDisabled) {
133
126
  return `
134
127
  background-color: ${theme.colors.neutral["000"]};
135
- outline: 2px solid ${theme.colors.neutral["400"]};
128
+ outline: 2px solid ${$hasError ? theme.colors.danger["900"] : theme.colors.neutral["400"]};
136
129
  `;
137
130
  }
138
131
  return `
@@ -156,11 +149,16 @@ const StyledCircle = styled("div", {
156
149
  `;
157
150
  const TextWrapperColors = css`
158
151
  ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => {
159
- if ($disabled || $applyAriaDisabled || $readOnly) {
152
+ if ($disabled) {
160
153
  return `
161
154
  color: ${theme.colors.neutral["600"]};
162
155
  `;
163
156
  }
157
+ if ($applyAriaDisabled || $readOnly) {
158
+ return `
159
+ color: ${theme.colors.neutral["700"]};
160
+ `;
161
+ }
164
162
  return `
165
163
  color: ${theme.colors.neutral["000"]};
166
164
  `;
@@ -205,12 +203,19 @@ const StyledTextWrapper = styled(DSTypography, {
205
203
  ${RemBasedFontProperties}
206
204
  ${TextWrapperColors}
207
205
  `;
206
+ const StyledHiddenInput = styled("input", {
207
+ name: DSControlledToggleName,
208
+ slot: CONTROLLED_TOGGLE_SLOTS.HIDDEN_INPUT
209
+ })`
210
+ display: none;
211
+ `;
208
212
  export {
209
213
  RemBasedFontProperties,
210
214
  StyledButton,
211
215
  StyledButtonContentWrapper,
212
216
  StyledCircle,
213
217
  StyledContainer,
218
+ StyledHiddenInput,
214
219
  StyledTextWrapper
215
220
  };
216
221
  //# sourceMappingURL=styles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/styles/styles.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { css, styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography, type DSTypographyT } from '@elliemae/ds-typography';\nimport { CONTROLLED_TOGGLE_SLOTS, DSControlledToggleName } from '../../constants/index.js';\nimport type { DSControlledToggleT } from '../../react-desc-prop-types.js';\n\ninterface StyledContainerT {\n $size: DSControlledToggleT.ToggleSize;\n}\nconst containerHeight = {\n s: '20px',\n m: '28px',\n l: '36px',\n};\nexport const StyledContainer = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.CONTROLLED_CONTAINER,\n})<StyledContainerT>`\n display: inline-flex;\n width: fit-content;\n justify-content: center;\n align-items: center;\n height: ${({ $size }) => containerHeight[$size]};\n padding: 2px;\n border-radius: 20px;\n :focus-within {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n ${xStyledCommonProps}\n`;\ninterface StyledButtonT {\n $checked: boolean;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n}\nconst SwitchButtonStateColors = css<StyledButtonT>`\n ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {\n // 1. disabled (standard HTML attribute)\n if ($disabled)\n return `\n background-color: ${theme.colors.neutral['080']};\n border: 2px solid ${theme.colors.neutral['400']};\n `;\n // 2. Aria-Read-Only / Aria-Disabled\n if ($readOnly || $applyAriaDisabled)\n return `\n background-color: ${theme.colors.neutral['050']};\n border: 2px solid ${theme.colors.neutral['400']};\n `;\n // 3. Enabled\n // a. Checked\n if ($checked)\n return `\n background-color: ${theme.colors.brand['600']};\n border: 2px solid ${theme.colors.brand['700']};\n `;\n // b. Not checked\n return `\n background-color: ${theme.colors.neutral['500']};\n border: 2px solid ${theme.colors.neutral['600']};\n `;\n }}\n`;\nconst SwitchCursors = css<StyledButtonT>`\n ${({ $disabled, $readOnly, $applyAriaDisabled }) => {\n // 1. truly disabled (standard HTML attribute)\n if ($disabled || $readOnly || $applyAriaDisabled)\n // /\\ this \"cursor: not-allowed\" for the aria-disabled/aria-readonly is not consistent what the spec says\n // as of today readonly/aria-disabled say \"arrow\" (default) but that is not consistent with other dimsum components\n // coordinated with QA, we ship this consistent with other dimsum components and if UX confirms the intention we change it later\n return `\n cursor: not-allowed;\n `;\n // 2. Enabled\n return `\n cursor: pointer;\n `;\n }}\n`;\nconst SwitchHoverColors = css<StyledButtonT>`\n ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {\n // the button \"on hover\" overrides with background: transparent\n // disabled keeps the same color as before, no hover effect, but we compensate the transparent effect inherithed from the button hover.\n // 1. disabled (standard HTML attribute)\n if ($disabled)\n return `\n background-color: ${theme.colors.neutral['080']};\n `;\n // 2. Aria-Read-Only / Aria-Disabled\n // the button \"on hover\" overrides with background: transparent\n // disabled keeps the same color as before, no hover effect, but we compensate the transparent effect inherithed from the button hover.\n if ($readOnly || $applyAriaDisabled)\n return `\n background-color: ${theme.colors.neutral['050']};\n `;\n // 2. Enabled\n // a. Checked\n if ($checked)\n return `\n background-color: ${theme.colors.brand['700']};\n border-color: ${theme.colors.brand['800']};\n `;\n // b. Not checked\n return `\n background-color: ${theme.colors.neutral['600']};\n border-color: ${theme.colors.neutral['700']};\n `;\n }}\n`;\nexport const StyledButton = styled(DSButtonV3, {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX,\n})<StyledButtonT>`\n margin: 0;\n padding: 0;\n border-radius: 20px;\n ${SwitchButtonStateColors}\n transition: background-color 0.2s;\n :focus {\n outline: 2px solid ${({ theme }) => theme.colors.brand['700']};\n outline-offset: 1px;\n }\n &:hover {\n ${SwitchCursors}\n ${SwitchHoverColors}\n }\n`;\ninterface StyledButtonContentWrapperT {\n $size: DSControlledToggleT.ToggleSize;\n $width: number;\n $checked: boolean;\n}\nconst labelHeight = {\n s: '16px',\n m: '24px',\n l: '32px',\n};\nconst margin = {\n s: '26px',\n m: '34px',\n l: '42px',\n};\nexport const StyledButtonContentWrapper = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER,\n})<StyledButtonContentWrapperT>`\n min-width: ${({ $width, $size }) => `calc(${$width}px + ${margin[$size]})`};\n height: ${({ $size }) => labelHeight[$size]};\n display: flex;\n margin: 0;\n padding: 0;\n align-items: center;\n height: 100%;\n flex-direction: ${({ $checked }) => ($checked ? 'row-reverse' : 'row')};\n border-radius: 20px;\n`;\ninterface StyledCircleT {\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n $readOnly: boolean;\n $applyAriaDisabled: boolean;\n}\nconst CircleColors = css<StyledCircleT>`\n ${({ theme, $disabled, $readOnly, $applyAriaDisabled }) => {\n // 1. Truly disabled (standard HTML attribute)\n if ($disabled) {\n return `\n background-color: ${theme.colors.neutral['080']};\n outline: 2px solid ${theme.colors.neutral['400']};\n `;\n }\n\n // 2. Aria-disabled / aria-readonly\n if ($readOnly || $applyAriaDisabled) {\n return `\n background-color: ${theme.colors.neutral['000']};\n outline: 2px solid ${theme.colors.neutral['400']};\n `;\n }\n\n // 3. Enabled\n return `\n background-color: ${theme.colors.neutral['000']};\n `;\n }}\n`;\nconst circleValues = {\n s: '14px',\n m: '20px',\n l: '28px',\n};\nexport const StyledCircle = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.CIRCLE,\n})<StyledCircleT>`\n height: ${({ $size }) => circleValues[$size]};\n width: ${({ $size }) => circleValues[$size]};\n border-radius: 50%;\n ${CircleColors}\n`;\ninterface StyledTextWrapperT extends DSTypographyT.Props {\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n}\nconst TextWrapperColors = css<StyledTextWrapperT>`\n ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => {\n // 1. Truly disabled, applyAriaDisabled, readOnly\n if ($disabled || $applyAriaDisabled || $readOnly) {\n return `\n color: ${theme.colors.neutral['600']};\n `;\n }\n // 2. Enabled\n return `\n color: ${theme.colors.neutral['000']};\n `;\n }}\n`;\nexport const RemBasedFontProperties = css<{ $size: DSControlledToggleT.ToggleSize }>`\n ${({ theme, $size }) => {\n if ($size === 's')\n return `\n font-size: 0.6875rem; // 11px -> 11/16 = 0.6875rem\n line-height: 0.6875rem; // 11px -> 11/16 = 0.6875rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 0.84615rem; // 11px -> 11/13 = 0.84615rem\n line-height: 0.84615rem; // 11px -> 11/13 = 0.84615rem\n }\n `;\n if ($size === 'l')\n return `\n font-size: 1.25rem; // 20px -> 20/16 = 1.25rem\n line-height: 1.25rem; // 20px -> 20/16 = 1.25rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 1.53846rem; // 20px -> 20/13 = 1.53846rem\n line-height: 1.53846rem; // 20px -> 20/13 = 1.53846rem\n }\n `;\n return `\n font-size: 0.9375rem; // 15px -> 15/16 = 0.9375rem\n line-height: 0.9375rem; // 15px -> 15/16 = 0.9375rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 1.15385rem; // 15px -> 15/13 = 1.15385rem\n line-height: 1.15385rem; // 15px -> 15/13 = 1.15385rem\n }\n `;\n }}\n`;\nexport const StyledTextWrapper = styled(DSTypography, {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER,\n})<StyledTextWrapperT>`\n flex-grow: 1;\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n ${RemBasedFontProperties}\n ${TextWrapperColors}\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;AAC3B,SAAS,KAAK,QAAQ,0BAA0B;AAChD,SAAS,oBAAwC;AACjD,SAAS,yBAAyB,8BAA8B;AAMhE,MAAM,kBAAkB;AAAA,EACtB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wBAAwB;AAChC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,YAKW,CAAC,EAAE,MAAM,MAAM,gBAAgB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA,wBAIzB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,IAE9D,kBAAkB;AAAA;AAQtB,MAAM,0BAA0B;AAAA,IAC5B,CAAC,EAAE,WAAW,WAAW,oBAAoB,UAAU,MAAM,MAAM;AAEnE,MAAI;AACF,WAAO;AAAA,0BACa,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,0BAC3B,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAGjD,MAAI,aAAa;AACf,WAAO;AAAA,0BACa,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,0BAC3B,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAIjD,MAAI;AACF,WAAO;AAAA,0BACa,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA,0BACzB,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;AAG/C,SAAO;AAAA,0BACe,MAAM,OAAO,QAAQ,KAA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;AAAA;AAEI,MAAM,yBAAyB;AAAA,IAClC,CAAC,EAAE,OAAO,MAAM,MAAM;AACtB,MAAI,UAAU;AACZ,WAAO;AAAA;AAAA;AAAA,6BAGgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAKhD,MAAI,UAAU;AACZ,WAAO;AAAA;AAAA;AAAA,6BAGgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAKhD,SAAO;AAAA;AAAA;AAAA,2BAGgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAKhD,CAAC;AAAA;AAEI,MAAM,oBAAoB,OAAO,cAAc;AAAA,EACpD,MAAM;AAAA,EACN,MAAM,wBAAwB;AAChC,CAAC;AAAA;AAAA,iBAEgB,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA,IACtD,sBAAsB;AAAA,IACtB,iBAAiB;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { css, styled, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport { DSTypography, type DSTypographyT } from '@elliemae/ds-typography';\nimport { CONTROLLED_TOGGLE_SLOTS, DSControlledToggleName } from '../../constants/index.js';\nimport type { DSControlledToggleT } from '../../react-desc-prop-types.js';\n\ninterface StyledContainerT {\n $size: DSControlledToggleT.ToggleSize;\n $disabled?: boolean;\n}\nconst containerHeight = {\n s: '20px',\n m: '28px',\n l: '36px',\n};\nexport const StyledContainer = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.CONTROLLED_CONTAINER,\n})<StyledContainerT>`\n display: inline-flex;\n width: fit-content;\n justify-content: center;\n align-items: center;\n height: ${({ $size }) => containerHeight[$size]};\n padding: 2px;\n border-radius: 20px;\n :focus-within {\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n }\n ${xStyledCommonProps}\n`;\ninterface StyledButtonT {\n $checked: boolean;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n $hasError?: boolean;\n}\n// the error state only changes the border color, as the other dimsum form elements do (danger-900).\n// disabled keeps its own colors, same precedence as ds-form-input-text (disabled > error > readOnly/applyAriaDisabled)\nconst SwitchButtonStateColors = css<StyledButtonT>`\n ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, $hasError, theme }) => {\n // 1. disabled (standard HTML attribute)\n if ($disabled)\n return `\n background-color: ${theme.colors.neutral['080']};\n border: 2px solid ${theme.colors.neutral['400']};\n `;\n // 2. Aria-Read-Only / Aria-Disabled\n if ($readOnly || $applyAriaDisabled)\n return `\n background-color: ${$checked ? theme.colors.neutral['000'] : theme.colors.neutral['050']};\n border: 2px solid ${$hasError ? theme.colors.danger['900'] : theme.colors.neutral['400']};\n `;\n // 3. Enabled\n // a. Checked\n if ($checked)\n return `\n background-color: ${theme.colors.brand['600']};\n border: 2px solid ${$hasError ? theme.colors.danger['900'] : theme.colors.brand['700']};\n `;\n // b. Not checked\n return `\n background-color: ${theme.colors.neutral['500']};\n border: 2px solid ${$hasError ? theme.colors.danger['900'] : theme.colors.neutral['600']};\n `;\n }}\n`;\nconst SwitchHoverColors = css<StyledButtonT>`\n ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, $hasError, theme }) => {\n // the button \"on hover\" overrides with background: transparent\n // disabled keeps the same color as before, no hover effect, but we compensate the transparent effect inherithed from the button hover.\n // 1. disabled (standard HTML attribute)\n if ($disabled)\n return `\n background-color: ${theme.colors.neutral['080']};\n `;\n // 2. Aria-Read-Only / Aria-Disabled\n // the button \"on hover\" overrides with background: transparent\n // disabled keeps the same color as before, no hover effect, but we compensate the transparent effect inherithed from the button hover.\n if ($readOnly || $applyAriaDisabled)\n return `\n background-color: ${$checked ? theme.colors.neutral['000'] : theme.colors.neutral['050']};\n `;\n // 2. Enabled\n // a. Checked\n if ($checked)\n return `\n background-color: ${theme.colors.brand['700']};\n border-color: ${$hasError ? theme.colors.danger['900'] : theme.colors.brand['800']};\n `;\n // b. Not checked\n return `\n background-color: ${theme.colors.neutral['600']};\n border-color: ${$hasError ? theme.colors.danger['900'] : theme.colors.neutral['700']};\n `;\n }}\n`;\nexport const StyledButton = styled(DSButtonV3, {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX,\n})<StyledButtonT>`\n margin: 0;\n padding: 0;\n border-radius: 20px;\n ${SwitchButtonStateColors}\n transition: background-color 0.2s;\n :focus {\n outline: 2px solid ${({ theme }) => theme.colors.brand['700']};\n outline-offset: 1px;\n }\n cursor: pointer;\n &:hover {\n ${SwitchHoverColors}\n }\n /* not-allowed for disabled, applyAriaDisabled and readOnly comes from lockedStateInteractionCss.\n The UX spec says \"arrow\" for readOnly/aria-disabled; not-allowed ships consistent with other Dimsum\n components until UX confirms. */\n ${lockedStateInteractionCss}\n`;\ninterface StyledButtonContentWrapperT {\n $size: DSControlledToggleT.ToggleSize;\n $width: number;\n $checked: boolean;\n}\nconst labelHeight = {\n s: '16px',\n m: '24px',\n l: '32px',\n};\nconst margin = {\n s: '26px',\n m: '34px',\n l: '42px',\n};\nexport const StyledButtonContentWrapper = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER,\n})<StyledButtonContentWrapperT>`\n min-width: ${({ $width, $size }) => `calc(${$width}px + ${margin[$size]})`};\n height: ${({ $size }) => labelHeight[$size]};\n display: flex;\n margin: 0;\n padding: 0;\n align-items: center;\n height: 100%;\n flex-direction: ${({ $checked }) => ($checked ? 'row-reverse' : 'row')};\n border-radius: 20px;\n`;\ninterface StyledCircleT {\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n $readOnly: boolean;\n $applyAriaDisabled: boolean;\n $hasError?: boolean;\n}\nconst CircleColors = css<StyledCircleT>`\n ${({ theme, $disabled, $readOnly, $applyAriaDisabled, $hasError }) => {\n // 1. Truly disabled (standard HTML attribute)\n if ($disabled) {\n return `\n background-color: ${theme.colors.neutral['080']};\n outline: 2px solid ${theme.colors.neutral['400']};\n `;\n }\n\n // 2. Aria-disabled (readOnly or applyAriaDisabled)\n if ($readOnly || $applyAriaDisabled) {\n return `\n background-color: ${theme.colors.neutral['000']};\n outline: 2px solid ${$hasError ? theme.colors.danger['900'] : theme.colors.neutral['400']};\n `;\n }\n\n // 3. Enabled\n return `\n background-color: ${theme.colors.neutral['000']};\n `;\n }}\n`;\nconst circleValues = {\n s: '14px',\n m: '20px',\n l: '28px',\n};\nexport const StyledCircle = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.CIRCLE,\n})<StyledCircleT>`\n height: ${({ $size }) => circleValues[$size]};\n width: ${({ $size }) => circleValues[$size]};\n border-radius: 50%;\n ${CircleColors}\n`;\ninterface StyledTextWrapperT extends DSTypographyT.Props {\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n}\nconst TextWrapperColors = css<StyledTextWrapperT>`\n ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => {\n // 1. Truly disabled\n if ($disabled) {\n return `\n color: ${theme.colors.neutral['600']};\n `;\n }\n // 2. applyAriaDisabled, readOnly\n if ($applyAriaDisabled || $readOnly) {\n return `\n color: ${theme.colors.neutral['700']};\n `;\n }\n // 3. Enabled\n return `\n color: ${theme.colors.neutral['000']};\n `;\n }}\n`;\nexport const RemBasedFontProperties = css<{ $size: DSControlledToggleT.ToggleSize }>`\n ${({ theme, $size }) => {\n if ($size === 's')\n return `\n font-size: 0.6875rem; // 11px -> 11/16 = 0.6875rem\n line-height: 0.6875rem; // 11px -> 11/16 = 0.6875rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 0.84615rem; // 11px -> 11/13 = 0.84615rem\n line-height: 0.84615rem; // 11px -> 11/13 = 0.84615rem\n }\n `;\n if ($size === 'l')\n return `\n font-size: 1.25rem; // 20px -> 20/16 = 1.25rem\n line-height: 1.25rem; // 20px -> 20/16 = 1.25rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 1.53846rem; // 20px -> 20/13 = 1.53846rem\n line-height: 1.53846rem; // 20px -> 20/13 = 1.53846rem\n }\n `;\n return `\n font-size: 0.9375rem; // 15px -> 15/16 = 0.9375rem\n line-height: 0.9375rem; // 15px -> 15/16 = 0.9375rem\n @media (min-width: ${theme.breakpoints.small}) {\n font-size: 1.15385rem; // 15px -> 15/13 = 1.15385rem\n line-height: 1.15385rem; // 15px -> 15/13 = 1.15385rem\n }\n `;\n }}\n`;\nexport const StyledTextWrapper = styled(DSTypography, {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER,\n})<StyledTextWrapperT>`\n flex-grow: 1;\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n ${RemBasedFontProperties}\n ${TextWrapperColors}\n`;\n\n// Only rendered when makeSubmittable is true. It is not visible and not reachable by keyboard or assistive technology,\n// it only exists so a native form can submit the toggle (name and value) the way it would submit a checkbox.\nexport const StyledHiddenInput = styled('input', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.HIDDEN_INPUT,\n})`\n display: none;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;AAC3B,SAAS,KAAK,QAAQ,oBAAoB,iCAAiC;AAC3E,SAAS,oBAAwC;AACjD,SAAS,yBAAyB,8BAA8B;AAOhE,MAAM,kBAAkB;AAAA,EACtB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wBAAwB;AAChC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,YAKW,CAAC,EAAE,MAAM,MAAM,gBAAgB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA,wBAIzB,CAAC,EAAE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;AAAA,EACpD,MAAM;AAAA,EACN,MAAM,wBAAwB;AAChC,CAAC;AAAA;AAAA,iBAEgB,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA,IACtD,sBAAsB;AAAA,IACtB,iBAAiB;AAAA;AAKd,MAAM,oBAAoB,OAAO,SAAS;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,wBAAwB;AAChC,CAAC;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -23,18 +23,27 @@ const SetLabelWidth = styled.div`
23
23
  `;
24
24
  const ButtonWCAGViolation = () => {
25
25
  const { propsWithDefault, buttonProps } = React2.useContext(ControlledToggleContext);
26
- const { wcagViolationLabelOn, wcagViolationLabelOff, checked, size, disabled, applyAriaDisabled, readOnly } = propsWithDefault;
26
+ const {
27
+ wcagViolationLabelOn,
28
+ wcagViolationLabelOff,
29
+ checked,
30
+ size,
31
+ disabled,
32
+ applyAriaDisabled,
33
+ readOnly,
34
+ hasError
35
+ } = propsWithDefault;
27
36
  const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);
28
37
  const { width, handleRefOnLabelWidth, handleRefOffLabelWidth } = useGetWidestLabelWidth();
29
38
  return /* @__PURE__ */ jsxs(
30
39
  StyledButton,
31
40
  {
32
- ...readOnly ? { "aria-readonly": "true" } : {},
33
41
  ...buttonProps,
34
42
  $checked: checked,
35
43
  $readOnly: readOnly,
36
44
  $disabled: disabled,
37
45
  $applyAriaDisabled: applyAriaDisabled,
46
+ $hasError: hasError,
38
47
  getOwnerProps,
39
48
  getOwnerPropsArguments,
40
49
  children: [
@@ -54,6 +63,7 @@ const ButtonWCAGViolation = () => {
54
63
  $disabled: disabled,
55
64
  $readOnly: readOnly,
56
65
  $applyAriaDisabled: applyAriaDisabled,
66
+ $hasError: hasError,
57
67
  getOwnerProps,
58
68
  getOwnerPropsArguments
59
69
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/wcagViolation/Button.wcagViolationLabels.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TYPOGRAPHY_VARIANTS } from '@elliemae/ds-typography';\nimport { styled } from '@elliemae/ds-system';\nimport React from 'react';\nimport { ControlledToggleContext } from '../../DSControlledToggleCTX.js';\nimport type { DSControlledToggleT } from '../../react-desc-prop-types.js';\nimport {\n RemBasedFontProperties,\n StyledButton,\n StyledButtonContentWrapper,\n StyledCircle,\n StyledTextWrapper,\n} from '../styles/styles.js';\nimport { useGetWidestLabelWidth } from './useGetWidestLabelWidth.js';\n\n/**\n * we are doing this to keep the wcagViolationLabelOn/wcagViolationLabelOff working\n * this calculates the width of the widest custom label and sets the width of both labels to that width to avoid layout shift on toggle\n *\n * ---\n *\n * this can be safely removed in favor of a sensible default min-width for the accessible ON/OFF labels when we can actually kill the wcagViolationLabelOn/wcagViolationLabelOff props\n */\nconst SetLabelWidth = styled.div<{ $size: DSControlledToggleT.ToggleSize }>`\n ${RemBasedFontProperties}\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n width: auto;\n position: absolute;\n white-space: nowrap;\n visibility: hidden;\n`;\n\nexport const ButtonWCAGViolation: React.ComponentType<DSControlledToggleT.Props> = () => {\n const { propsWithDefault, buttonProps } = React.useContext(ControlledToggleContext);\n const { wcagViolationLabelOn, wcagViolationLabelOff, checked, size, disabled, applyAriaDisabled, readOnly } =\n propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n const { width, handleRefOnLabelWidth, handleRefOffLabelWidth } = useGetWidestLabelWidth();\n\n return (\n <StyledButton\n // as per morning meeting, juan said \"readOnly\" in toggle should receive aria-readonly, aria-readonly is valid for switch role, the html readonly attribute is not\n {...(readOnly ? { 'aria-readonly': 'true' } : {})}\n {...buttonProps}\n $checked={checked}\n $readOnly={readOnly}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledButtonContentWrapper\n $width={width}\n $checked={checked}\n $size={size}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCircle\n $size={size}\n $disabled={disabled}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n <StyledTextWrapper\n $size={size}\n $disabled={disabled}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n variant={TYPOGRAPHY_VARIANTS.B2}\n >\n {checked ? (wcagViolationLabelOn ?? 'ON') : (wcagViolationLabelOff ?? 'OFF')}\n </StyledTextWrapper>\n </StyledButtonContentWrapper>\n <SetLabelWidth $size={size} innerRef={handleRefOnLabelWidth} aria-hidden=\"true\">\n {wcagViolationLabelOn ?? 'ON'}\n </SetLabelWidth>\n <SetLabelWidth $size={size} innerRef={handleRefOffLabelWidth} aria-hidden=\"true\">\n {wcagViolationLabelOff ?? 'OFF'}\n </SetLabelWidth>\n </StyledButton>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACmDjB,SAOE,KAPF;AAnDN,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,OAAOA,YAAW;AAClB,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AAUvC,MAAM,gBAAgB,OAAO;AAAA,IACzB,sBAAsB;AAAA,iBACT,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnD,MAAM,sBAAsE,MAAM;AACvF,QAAM,EAAE,kBAAkB,YAAY,IAAIA,OAAM,WAAW,uBAAuB;AAClF,QAAM,EAAE,sBAAsB,uBAAuB,SAAS,MAAM,UAAU,mBAAmB,SAAS,IACxG;AACF,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAChF,QAAM,EAAE,OAAO,uBAAuB,uBAAuB,IAAI,uBAAuB;AAExF,SACE;AAAA,IAAC;AAAA;AAAA,MAEE,GAAI,WAAW,EAAE,iBAAiB,OAAO,IAAI,CAAC;AAAA,MAC9C,GAAG;AAAA,MACJ,UAAU;AAAA,MACV,WAAW;AAAA,MACX,WAAW;AAAA,MACX,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,QAAQ;AAAA,YACR,UAAU;AAAA,YACV,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YAEA;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,WAAW;AAAA,kBACX,oBAAoB;AAAA,kBACpB;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,WAAW;AAAA,kBACX,oBAAoB;AAAA,kBACpB;AAAA,kBACA;AAAA,kBACA,SAAS,oBAAoB;AAAA,kBAE5B,oBAAW,wBAAwB,OAAS,yBAAyB;AAAA;AAAA,cACxE;AAAA;AAAA;AAAA,QACF;AAAA,QACA,oBAAC,iBAAc,OAAO,MAAM,UAAU,uBAAuB,eAAY,QACtE,kCAAwB,MAC3B;AAAA,QACA,oBAAC,iBAAc,OAAO,MAAM,UAAU,wBAAwB,eAAY,QACvE,mCAAyB,OAC5B;AAAA;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TYPOGRAPHY_VARIANTS } from '@elliemae/ds-typography';\nimport { styled } from '@elliemae/ds-system';\nimport React from 'react';\nimport { ControlledToggleContext } from '../../DSControlledToggleCTX.js';\nimport type { DSControlledToggleT } from '../../react-desc-prop-types.js';\nimport {\n RemBasedFontProperties,\n StyledButton,\n StyledButtonContentWrapper,\n StyledCircle,\n StyledTextWrapper,\n} from '../styles/styles.js';\nimport { useGetWidestLabelWidth } from './useGetWidestLabelWidth.js';\n\n/**\n * we are doing this to keep the wcagViolationLabelOn/wcagViolationLabelOff working\n * this calculates the width of the widest custom label and sets the width of both labels to that width to avoid layout shift on toggle\n *\n * ---\n *\n * this can be safely removed in favor of a sensible default min-width for the accessible ON/OFF labels when we can actually kill the wcagViolationLabelOn/wcagViolationLabelOff props\n */\nconst SetLabelWidth = styled.div<{ $size: DSControlledToggleT.ToggleSize }>`\n ${RemBasedFontProperties}\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n width: auto;\n position: absolute;\n white-space: nowrap;\n visibility: hidden;\n`;\n\nexport const ButtonWCAGViolation: React.ComponentType<DSControlledToggleT.Props> = () => {\n const { propsWithDefault, buttonProps } = React.useContext(ControlledToggleContext);\n const {\n wcagViolationLabelOn,\n wcagViolationLabelOff,\n checked,\n size,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n } = propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n const { width, handleRefOnLabelWidth, handleRefOffLabelWidth } = useGetWidestLabelWidth();\n\n return (\n <StyledButton\n {...buttonProps}\n $checked={checked}\n $readOnly={readOnly}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n $hasError={hasError}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledButtonContentWrapper\n $width={width}\n $checked={checked}\n $size={size}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCircle\n $size={size}\n $disabled={disabled}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n $hasError={hasError}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n <StyledTextWrapper\n $size={size}\n $disabled={disabled}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n variant={TYPOGRAPHY_VARIANTS.B2}\n >\n {checked ? (wcagViolationLabelOn ?? 'ON') : (wcagViolationLabelOff ?? 'OFF')}\n </StyledTextWrapper>\n </StyledButtonContentWrapper>\n <SetLabelWidth $size={size} innerRef={handleRefOnLabelWidth} aria-hidden=\"true\">\n {wcagViolationLabelOn ?? 'ON'}\n </SetLabelWidth>\n <SetLabelWidth $size={size} innerRef={handleRefOffLabelWidth} aria-hidden=\"true\">\n {wcagViolationLabelOff ?? 'OFF'}\n </SetLabelWidth>\n </StyledButton>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0DjB,SAOE,KAPF;AA1DN,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,OAAOA,YAAW;AAClB,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AAUvC,MAAM,gBAAgB,OAAO;AAAA,IACzB,sBAAsB;AAAA,iBACT,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnD,MAAM,sBAAsE,MAAM;AACvF,QAAM,EAAE,kBAAkB,YAAY,IAAIA,OAAM,WAAW,uBAAuB;AAClF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAChF,QAAM,EAAE,OAAO,uBAAuB,uBAAuB,IAAI,uBAAuB;AAExF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MACV,WAAW;AAAA,MACX,WAAW;AAAA,MACX,oBAAoB;AAAA,MACpB,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,QAAQ;AAAA,YACR,UAAU;AAAA,YACV,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YAEA;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,WAAW;AAAA,kBACX,oBAAoB;AAAA,kBACpB,WAAW;AAAA,kBACX;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,WAAW;AAAA,kBACX,oBAAoB;AAAA,kBACpB;AAAA,kBACA;AAAA,kBACA,SAAS,oBAAoB;AAAA,kBAE5B,oBAAW,wBAAwB,OAAS,yBAAyB;AAAA;AAAA,cACxE;AAAA;AAAA;AAAA,QACF;AAAA,QACA,oBAAC,iBAAc,OAAO,MAAM,UAAU,uBAAuB,eAAY,QACtE,kCAAwB,MAC3B;AAAA,QACA,oBAAC,iBAAc,OAAO,MAAM,UAAU,wBAAwB,eAAY,QACvE,mCAAyB,OAC5B;AAAA;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -9,10 +9,13 @@ import { TOGGLE_SIZES, DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from ".
9
9
  const defaultProps = {
10
10
  checked: false,
11
11
  onChange: () => null,
12
+ onValueChange: () => null,
12
13
  size: TOGGLE_SIZES.MEDIUM,
13
14
  readOnly: false,
14
15
  disabled: false,
15
- applyAriaDisabled: false
16
+ applyAriaDisabled: false,
17
+ hasError: false,
18
+ makeSubmittable: false
16
19
  };
17
20
  const DSControlledTogglePropTypes = {
18
21
  ...globalAttributesPropTypes,
@@ -20,12 +23,21 @@ const DSControlledTogglePropTypes = {
20
23
  ...getPropsPerSlotPropTypes(DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS),
21
24
  checked: PropTypes.bool.description("Whether the toggle is checked or not").defaultValue("false"),
22
25
  onChange: PropTypes.func.description("OnClick callback").defaultValue("() => null"),
26
+ onValueChange: PropTypes.func.description(
27
+ "Callback triggered when the user toggles it, it receives the new checked state. It is not triggered when disabled, readOnly or applyAriaDisabled."
28
+ ).defaultValue("() => null").signature("((newChecked: boolean, e: React.MouseEvent | React.KeyboardEvent) => void)"),
23
29
  size: PropTypes.oneOf(["s", "m", "l"]).description("Size of toggle").defaultValue(TOGGLE_SIZES.MEDIUM),
24
30
  disabled: PropTypes.bool.description("Whether the toggle is disabled or not").defaultValue("false"),
25
31
  applyAriaDisabled: PropTypes.bool.description(
26
- "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
32
+ "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM."
33
+ ).defaultValue("false"),
34
+ readOnly: PropTypes.bool.description(
35
+ 'Soft lock, same as applyAriaDisabled: aria-disabled="true", CAN STILL RECEIVE FOCUS, IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM. Also announces "Read only" through a hidden description. Dimsum never writes aria-readonly.'
36
+ ).defaultValue("false"),
37
+ hasError: PropTypes.bool.description("Whether the toggle has error or not. When true the borders use the error color.").defaultValue("false"),
38
+ makeSubmittable: PropTypes.bool.description(
39
+ "Renders a hidden checkbox input so the toggle can be submitted by a native form. When true, name and value are applied to the hidden input instead of the button."
27
40
  ).defaultValue("false"),
28
- readOnly: PropTypes.bool.description("Whether the toggle is readOnly or not").defaultValue("false"),
29
41
  containerProps: PropTypes.object.description("Set of properties attached to the main container"),
30
42
  id: PropTypes.string.description("Unique id."),
31
43
  innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Toggle button ref."),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSButtonV3T } from '@elliemae/ds-button-v2';\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { TOGGLE_SIZES, DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from './constants/index.js';\n\nexport declare namespace DSControlledToggleT {\n export type ToggleSize = ObjectValues<typeof TOGGLE_SIZES>;\n\n // One entry per slot in CONTROLLED_TOGGLE_SLOTS \u2014 the function (dynamic) form of slot props.\n // Exhaustiveness against the slots is enforced in typescript-testing/slot-props.ts.\n export type SlotFunctionArguments = {\n dsFormtoggleButtonContentWrapper: () => object;\n dsFormtoggleCircle: () => object;\n dsFormtoggleTextWrapper: () => object;\n // legacy slot aliases \u2014 still injection points, see KNOWN_INTENTIONAL_DEVIATIONS.md\n dsFormtoggleControlledContainer: () => object;\n dsFormtoggleToggleCheckbox: () => object;\n };\n\n export interface DefaultProps {\n checked: boolean;\n onChange: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;\n size: ToggleSize;\n readOnly: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSControlledToggleName, typeof CONTROLLED_TOGGLE_SLOTS> {\n containerProps?: Record<string, unknown>;\n id?: string;\n /**\n * Ref forwarded to the focusable toggle button (role=\"switch\"). Mirrors the innerRef\n * contract of DSControlledRadio / DSControlledCheckbox so consumers (e.g. ds-data-table\n * custom cells) can reach the real focusable node for keyboard focus management.\n */\n innerRef?: React.MutableRefObject<HTMLButtonElement | null> | React.RefCallback<HTMLButtonElement>;\n }\n\n // this interface is the \"last chance\" for apps to keep using the deprecated props before the major release that will remove them\n // this is meant to \"break\" those using the old prop, but still allow a last chance to gradually update (requiring them to change the prop name)\n export interface PostDeprecationETAPropsFallback {\n /**\n * @deprecated a custom wcagViolationLabelOn violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n wcagViolationLabelOn?: string; // used to be \"labelOn\"\n /**\n * @deprecated a custom wcagViolationLabelOff violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n wcagViolationLabelOff?: string; // used to be \"labelOff\"\n }\n export interface PreDeprecationETAProps {\n /**\n * @deprecated a custom wcagViolationLabelOn violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n labelOn?: string; // used to be \"labelOn\"\n /**\n * @deprecated a custom wcagViolationLabelOff violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n labelOff?: string; // used to be \"labelOff\"\n }\n\n export interface ButtonV3InherithedProps extends Omit<DSButtonV3T.Props, 'size' | 'children'> {}\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps,\n PreDeprecationETAProps,\n PostDeprecationETAPropsFallback {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps,\n PreDeprecationETAProps,\n PostDeprecationETAPropsFallback {}\n}\n\nexport const defaultProps: DSControlledToggleT.DefaultProps = {\n checked: false,\n onChange: () => null,\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n};\n\nexport const DSControlledTogglePropTypes: DSPropTypesSchema<\n Omit<DSControlledToggleT.Props, keyof DSControlledToggleT.PostDeprecationETAPropsFallback> &\n DSControlledToggleT.PreDeprecationETAProps\n> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...getPropsPerSlotPropTypes(DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS),\n checked: PropTypes.bool.description('Whether the toggle is checked or not').defaultValue('false'),\n onChange: PropTypes.func.description('OnClick callback').defaultValue('() => null'),\n size: PropTypes.oneOf(['s', 'm', 'l']).description('Size of toggle').defaultValue(TOGGLE_SIZES.MEDIUM),\n disabled: PropTypes.bool.description('Whether the toggle is disabled or not').defaultValue('false'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue('false'),\n readOnly: PropTypes.bool.description('Whether the toggle is readOnly or not').defaultValue('false'),\n containerProps: PropTypes.object.description('Set of properties attached to the main container'),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Toggle button ref.'),\n labelOn: PropTypes.string\n .description('Past deprecation ETA, this fails WCAG, switch to appropiate designs')\n .deprecated({ version: '25.3' }),\n labelOff: PropTypes.string\n .description('Past deprecation ETA, this fails WCAG, switch to appropiate designs')\n .deprecated({ version: '25.3' }),\n};\n\nexport const DSControlledTogglePropTypesSchema =\n DSControlledTogglePropTypes as unknown as ValidationMap<DSControlledToggleT.Props>;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,wBAAwB,+BAA+B;AAuFvE,MAAM,eAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,UAAU,MAAM;AAAA,EAChB,MAAM,aAAa;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEO,MAAM,8BAGT;AAAA,EACF,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG,yBAAyB,wBAAwB,uBAAuB;AAAA,EAC3E,SAAS,UAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,OAAO;AAAA,EAChG,UAAU,UAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,YAAY;AAAA,EAClF,MAAM,UAAU,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,EAAE,YAAY,gBAAgB,EAAE,aAAa,aAAa,MAAM;AAAA,EACrG,UAAU,UAAU,KAAK,YAAY,uCAAuC,EAAE,aAAa,OAAO;AAAA,EAClG,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,UAAU,UAAU,KAAK,YAAY,uCAAuC,EAAE,aAAa,OAAO;AAAA,EAClG,gBAAgB,UAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,IAAI,UAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,EAAE,YAAY,oBAAoB;AAAA,EAClG,SAAS,UAAU,OAChB,YAAY,qEAAqE,EACjF,WAAW,EAAE,SAAS,OAAO,CAAC;AAAA,EACjC,UAAU,UAAU,OACjB,YAAY,qEAAqE,EACjF,WAAW,EAAE,SAAS,OAAO,CAAC;AACnC;AAEO,MAAM,oCACX;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSButtonV3T } from '@elliemae/ds-button-v2';\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { TOGGLE_SIZES, DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from './constants/index.js';\n\nexport declare namespace DSControlledToggleT {\n export type ToggleSize = ObjectValues<typeof TOGGLE_SIZES>;\n\n // One entry per slot in CONTROLLED_TOGGLE_SLOTS \u2014 the function (dynamic) form of slot props.\n // Exhaustiveness against the slots is enforced in typescript-testing/slot-props.ts.\n export type SlotFunctionArguments = {\n dsFormtoggleButtonContentWrapper: () => object;\n dsFormtoggleCircle: () => object;\n dsFormtoggleTextWrapper: () => object;\n dsFormtoggleHiddenInput: () => object;\n // legacy slot aliases \u2014 still injection points, see KNOWN_INTENTIONAL_DEVIATIONS.md\n dsFormtoggleControlledContainer: () => object;\n dsFormtoggleToggleCheckbox: () => object;\n };\n\n export interface DefaultProps {\n checked: boolean;\n onChange: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;\n onValueChange: (\n newChecked: boolean,\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>,\n ) => void;\n size: ToggleSize;\n readOnly: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n hasError: boolean;\n makeSubmittable: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSControlledToggleName,\n typeof CONTROLLED_TOGGLE_SLOTS\n > {\n containerProps?: Record<string, unknown>;\n id?: string;\n /**\n * Ref forwarded to the focusable toggle button (role=\"switch\"). Mirrors the innerRef\n * contract of DSControlledRadio / DSControlledCheckbox so consumers (e.g. ds-data-table\n * custom cells) can reach the real focusable node for keyboard focus management.\n */\n innerRef?: React.MutableRefObject<HTMLButtonElement | null> | React.RefCallback<HTMLButtonElement>;\n }\n\n // this interface is the \"last chance\" for apps to keep using the deprecated props before the major release that will remove them\n // this is meant to \"break\" those using the old prop, but still allow a last chance to gradually update (requiring them to change the prop name)\n export interface PostDeprecationETAPropsFallback {\n /**\n * @deprecated a custom wcagViolationLabelOn violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n wcagViolationLabelOn?: string; // used to be \"labelOn\"\n /**\n * @deprecated a custom wcagViolationLabelOff violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n wcagViolationLabelOff?: string; // used to be \"labelOff\"\n }\n export interface PreDeprecationETAProps {\n /**\n * @deprecated a custom wcagViolationLabelOn violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n labelOn?: string; // used to be \"labelOn\"\n /**\n * @deprecated a custom wcagViolationLabelOff violates the role='switch' by design and it's impossible to make it WCAG compliant.\n * Do not use it, if you need a custom label, you don't need a toggle, use a checkbox instead.\n */\n labelOff?: string; // used to be \"labelOff\"\n }\n\n export interface ButtonV3InherithedProps extends Omit<DSButtonV3T.Props, 'size' | 'children'> {}\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps,\n PreDeprecationETAProps,\n PostDeprecationETAPropsFallback {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps,\n PreDeprecationETAProps,\n PostDeprecationETAPropsFallback {}\n}\n\nexport const defaultProps: DSControlledToggleT.DefaultProps = {\n checked: false,\n onChange: () => null,\n onValueChange: () => null,\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n hasError: false,\n makeSubmittable: false,\n};\n\nexport const DSControlledTogglePropTypes: DSPropTypesSchema<\n Omit<DSControlledToggleT.Props, keyof DSControlledToggleT.PostDeprecationETAPropsFallback> &\n DSControlledToggleT.PreDeprecationETAProps\n> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...getPropsPerSlotPropTypes(DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS),\n checked: PropTypes.bool.description('Whether the toggle is checked or not').defaultValue('false'),\n onChange: PropTypes.func.description('OnClick callback').defaultValue('() => null'),\n onValueChange: PropTypes.func\n .description(\n 'Callback triggered when the user toggles it, it receives the new checked state. It is not triggered when disabled, readOnly or applyAriaDisabled.',\n )\n .defaultValue('() => null')\n .signature('((newChecked: boolean, e: React.MouseEvent | React.KeyboardEvent) => void)'),\n size: PropTypes.oneOf(['s', 'm', 'l']).description('Size of toggle').defaultValue(TOGGLE_SIZES.MEDIUM),\n disabled: PropTypes.bool.description('Whether the toggle is disabled or not').defaultValue('false'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM.',\n )\n .defaultValue('false'),\n readOnly: PropTypes.bool\n .description(\n 'Soft lock, same as applyAriaDisabled: aria-disabled=\"true\", CAN STILL RECEIVE FOCUS, IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM. Also announces \"Read only\" through a hidden description. Dimsum never writes aria-readonly.',\n )\n .defaultValue('false'),\n hasError: PropTypes.bool\n .description('Whether the toggle has error or not. When true the borders use the error color.')\n .defaultValue('false'),\n makeSubmittable: PropTypes.bool\n .description(\n 'Renders a hidden checkbox input so the toggle can be submitted by a native form. When true, name and value are applied to the hidden input instead of the button.',\n )\n .defaultValue('false'),\n containerProps: PropTypes.object.description('Set of properties attached to the main container'),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Toggle button ref.'),\n labelOn: PropTypes.string\n .description('Past deprecation ETA, this fails WCAG, switch to appropiate designs')\n .deprecated({ version: '25.3' }),\n labelOff: PropTypes.string\n .description('Past deprecation ETA, this fails WCAG, switch to appropiate designs')\n .deprecated({ version: '25.3' }),\n};\n\nexport const DSControlledTogglePropTypesSchema =\n DSControlledTogglePropTypes as unknown as ValidationMap<DSControlledToggleT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,wBAAwB,+BAA+B;AAkGvE,MAAM,eAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,UAAU,MAAM;AAAA,EAChB,eAAe,MAAM;AAAA,EACrB,MAAM,aAAa;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,iBAAiB;AACnB;AAEO,MAAM,8BAGT;AAAA,EACF,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG,yBAAyB,wBAAwB,uBAAuB;AAAA,EAC3E,SAAS,UAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,OAAO;AAAA,EAChG,UAAU,UAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,YAAY;AAAA,EAClF,eAAe,UAAU,KACtB;AAAA,IACC;AAAA,EACF,EACC,aAAa,YAAY,EACzB,UAAU,4EAA4E;AAAA,EACzF,MAAM,UAAU,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,EAAE,YAAY,gBAAgB,EAAE,aAAa,aAAa,MAAM;AAAA,EACrG,UAAU,UAAU,KAAK,YAAY,uCAAuC,EAAE,aAAa,OAAO;AAAA,EAClG,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,UAAU,UAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,UAAU,UAAU,KACjB,YAAY,iFAAiF,EAC7F,aAAa,OAAO;AAAA,EACvB,iBAAiB,UAAU,KACxB;AAAA,IACC;AAAA,EACF,EACC,aAAa,OAAO;AAAA,EACvB,gBAAgB,UAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,IAAI,UAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,EAAE,YAAY,oBAAoB;AAAA,EAClG,SAAS,UAAU,OAChB,YAAY,qEAAqE,EACjF,WAAW,EAAE,SAAS,OAAO,CAAC;AAAA,EACjC,UAAU,UAAU,OACjB,YAAY,qEAAqE,EACjF,WAAW,EAAE,SAAS,OAAO,CAAC;AACnC;AAEO,MAAM,oCACX;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import React2 from "react";
3
4
  import { DSControlledToggle, TOGGLE_SIZES } from "../index.js";
4
5
  const testRequiredProps = {};
5
6
  const testOptionalProps = {
@@ -28,10 +29,14 @@ const testCompleteDefaults = {
28
29
  checked: false,
29
30
  onChange: () => {
30
31
  },
32
+ onValueChange: () => {
33
+ },
31
34
  size: TOGGLE_SIZES.MEDIUM,
32
35
  readOnly: false,
33
36
  disabled: false,
34
- applyAriaDisabled: false
37
+ applyAriaDisabled: false,
38
+ hasError: false,
39
+ makeSubmittable: false
35
40
  };
36
41
  const testInternalProps = {
37
42
  ...testRequiredProps,
@@ -51,10 +56,16 @@ const testExplicitDefinition = {
51
56
  checked: true,
52
57
  onChange: () => {
53
58
  },
59
+ onValueChange: (newChecked, e) => {
60
+ },
54
61
  size: TOGGLE_SIZES.LARGE,
55
62
  readOnly: false,
56
63
  disabled: false,
57
64
  applyAriaDisabled: false,
65
+ hasError: false,
66
+ makeSubmittable: true,
67
+ name: "toggle-name",
68
+ value: "toggle-value",
58
69
  labelOn: "Enabled",
59
70
  labelOff: "Disabled",
60
71
  wcagViolationLabelOn: "Legacy On",
@@ -65,6 +76,8 @@ const testInferedTypeCompatibility = {
65
76
  checked: false,
66
77
  onChange: () => {
67
78
  },
79
+ onValueChange: (newChecked) => {
80
+ },
68
81
  size: TOGGLE_SIZES.SMALL,
69
82
  readOnly: false,
70
83
  disabled: true,
@@ -82,6 +95,10 @@ const testDefinitionAsConst = {
82
95
  disabled: false,
83
96
  applyAriaDisabled: false
84
97
  };
98
+ const ExampleUsageWithStateSetter = () => {
99
+ const [checked, setChecked] = React2.useState(false);
100
+ return /* @__PURE__ */ jsx(DSControlledToggle, { "aria-label": "state setter", checked, onValueChange: setChecked });
101
+ };
85
102
  const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
86
103
  /* @__PURE__ */ jsx(DSControlledToggle, { ...testExplicitDefinition }),
87
104
  /* @__PURE__ */ jsx(DSControlledToggle, { ...testInferedTypeCompatibility }),
@@ -96,10 +113,16 @@ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
96
113
  checked: true,
97
114
  onChange: () => {
98
115
  },
116
+ onValueChange: (newChecked, e) => {
117
+ },
99
118
  size: TOGGLE_SIZES.MEDIUM,
100
119
  readOnly: false,
101
120
  disabled: false,
102
121
  applyAriaDisabled: false,
122
+ hasError: true,
123
+ makeSubmittable: true,
124
+ name: "toggle-inline-name",
125
+ value: "toggle-inline-value",
103
126
  labelOn: "Enabled",
104
127
  labelOff: "Disabled",
105
128
  wcagViolationLabelOn: "Legacy On",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/form-toggle-typescript-valid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSControlledToggle, TOGGLE_SIZES, type DSControlledToggleT } from '../index.js';\n\n/**\n * Namespace type aliases exposed by the package public API.\n */\ntype ComponentPropsForApp = DSControlledToggleT.Props;\ntype ComponentPropsInternals = DSControlledToggleT.InternalProps;\ntype ComponentPropsDefaultProps = DSControlledToggleT.DefaultProps;\ntype ComponentPropsOptionalProps = DSControlledToggleT.OptionalProps;\ntype ComponentPropsRequiredProps = DSControlledToggleT.RequiredProps;\n\n/**\n * Required props contract (empty for this component).\n */\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\n/**\n * Optional props contract.\n */\nconst testOptionalProps: ComponentPropsOptionalProps = {\n id: 'toggle-id',\n containerProps: {\n 'data-testid': 'toggle-container',\n 'aria-label': 'toggle container',\n },\n innerRef: { current: null },\n};\n\n/**\n * Partial defaults are valid for app-facing props.\n */\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n checked: true,\n size: TOGGLE_SIZES.MEDIUM,\n};\n\n/**\n * Public props composition using explicit type annotation.\n */\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\n/**\n * Public props composition using \"as\" syntax.\n */\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n/**\n * Internal props require all default values.\n */\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n checked: false,\n onChange: () => {},\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n};\n\n/**\n * Internal props composition using explicit type annotation.\n */\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\n/**\n * Internal props composition using \"as\" syntax.\n */\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n/**\n * Explicit app-facing definition validates individual keys.\n */\nconst testExplicitDefinition: ComponentPropsForApp = {\n id: 'toggle-explicit',\n containerProps: {\n 'data-testid': 'toggle-explicit-container',\n },\n checked: true,\n onChange: () => {},\n size: TOGGLE_SIZES.LARGE,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n labelOn: 'Enabled',\n labelOff: 'Disabled',\n wcagViolationLabelOn: 'Legacy On',\n wcagViolationLabelOff: 'Legacy Off',\n};\n\n/**\n * Inferred compatibility validates the complete object against public props.\n */\nconst testInferedTypeCompatibility = {\n id: 'toggle-inferred',\n checked: false,\n onChange: () => {},\n size: TOGGLE_SIZES.SMALL,\n readOnly: false,\n disabled: true,\n applyAriaDisabled: true,\n labelOn: 'Enabled',\n labelOff: 'Disabled',\n} as ComponentPropsForApp;\n\n/**\n * As-const object should remain spread-compatible with component props.\n */\nconst testDefinitionAsConst = {\n id: 'toggle-const',\n checked: true,\n onChange: () => {},\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: true,\n disabled: false,\n applyAriaDisabled: false,\n} as const;\n\n/**\n * TS validation usage component covering spread and inline syntaxes.\n */\nconst ExampleUsageComponent = () => (\n <>\n <DSControlledToggle {...testExplicitDefinition} />\n <DSControlledToggle {...testInferedTypeCompatibility} />\n <DSControlledToggle {...testDefinitionAsConst} />\n <DSControlledToggle\n id=\"toggle-inline\"\n containerProps={{\n 'data-testid': 'toggle-inline-container',\n }}\n checked\n onChange={() => {}}\n size={TOGGLE_SIZES.MEDIUM}\n readOnly={false}\n disabled={false}\n applyAriaDisabled={false}\n labelOn=\"Enabled\"\n labelOff=\"Disabled\"\n wcagViolationLabelOn=\"Legacy On\"\n wcagViolationLabelOff=\"Legacy Off\"\n />\n </>\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACyIrB,mBACE,KADF;AAxIF,SAAS,oBAAoB,oBAA8C;AAc3E,MAAM,oBAAiD,CAAC;AAKxD,MAAM,oBAAiD;AAAA,EACrD,IAAI;AAAA,EACJ,gBAAgB;AAAA,IACd,eAAe;AAAA,IAC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,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAKA,MAAM,wBAAwB,MAC5B,iCACE;AAAA,sBAAC,sBAAoB,GAAG,wBAAwB;AAAA,EAChD,oBAAC,sBAAoB,GAAG,8BAA8B;AAAA,EACtD,oBAAC,sBAAoB,GAAG,uBAAuB;AAAA,EAC/C;AAAA,IAAC;AAAA;AAAA,MACC,IAAG;AAAA,MACH,gBAAgB;AAAA,QACd,eAAe;AAAA,MACjB;AAAA,MACA,SAAO;AAAA,MACP,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,MAAM,aAAa;AAAA,MACnB,UAAU;AAAA,MACV,UAAU;AAAA,MACV,mBAAmB;AAAA,MACnB,SAAQ;AAAA,MACR,UAAS;AAAA,MACT,sBAAqB;AAAA,MACrB,uBAAsB;AAAA;AAAA,EACxB;AAAA,GACF;",
6
- "names": []
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { DSControlledToggle, TOGGLE_SIZES, type DSControlledToggleT } from '../index.js';\n\n/**\n * Namespace type aliases exposed by the package public API.\n */\ntype ComponentPropsForApp = DSControlledToggleT.Props;\ntype ComponentPropsInternals = DSControlledToggleT.InternalProps;\ntype ComponentPropsDefaultProps = DSControlledToggleT.DefaultProps;\ntype ComponentPropsOptionalProps = DSControlledToggleT.OptionalProps;\ntype ComponentPropsRequiredProps = DSControlledToggleT.RequiredProps;\n\n/**\n * Required props contract (empty for this component).\n */\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\n/**\n * Optional props contract.\n */\nconst testOptionalProps: ComponentPropsOptionalProps = {\n id: 'toggle-id',\n containerProps: {\n 'data-testid': 'toggle-container',\n 'aria-label': 'toggle container',\n },\n innerRef: { current: null },\n};\n\n/**\n * Partial defaults are valid for app-facing props.\n */\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n checked: true,\n size: TOGGLE_SIZES.MEDIUM,\n};\n\n/**\n * Public props composition using explicit type annotation.\n */\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\n/**\n * Public props composition using \"as\" syntax.\n */\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n/**\n * Internal props require all default values.\n */\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n checked: false,\n onChange: () => {},\n onValueChange: () => {},\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n hasError: false,\n makeSubmittable: false,\n};\n\n/**\n * Internal props composition using explicit type annotation.\n */\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\n/**\n * Internal props composition using \"as\" syntax.\n */\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n/**\n * Explicit app-facing definition validates individual keys.\n */\nconst testExplicitDefinition: ComponentPropsForApp = {\n id: 'toggle-explicit',\n containerProps: {\n 'data-testid': 'toggle-explicit-container',\n },\n checked: true,\n onChange: () => {},\n onValueChange: (newChecked, e) => {},\n size: TOGGLE_SIZES.LARGE,\n readOnly: false,\n disabled: false,\n applyAriaDisabled: false,\n hasError: false,\n makeSubmittable: true,\n name: 'toggle-name',\n value: 'toggle-value',\n labelOn: 'Enabled',\n labelOff: 'Disabled',\n wcagViolationLabelOn: 'Legacy On',\n wcagViolationLabelOff: 'Legacy Off',\n};\n\n/**\n * Inferred compatibility validates the complete object against public props.\n */\nconst testInferedTypeCompatibility = {\n id: 'toggle-inferred',\n checked: false,\n onChange: () => {},\n onValueChange: (newChecked: boolean) => {},\n size: TOGGLE_SIZES.SMALL,\n readOnly: false,\n disabled: true,\n applyAriaDisabled: true,\n labelOn: 'Enabled',\n labelOff: 'Disabled',\n} as ComponentPropsForApp;\n\n/**\n * As-const object should remain spread-compatible with component props.\n */\nconst testDefinitionAsConst = {\n id: 'toggle-const',\n checked: true,\n onChange: () => {},\n size: TOGGLE_SIZES.MEDIUM,\n readOnly: true,\n disabled: false,\n applyAriaDisabled: false,\n} as const;\n\n/**\n * The state setter handed over directly as onValueChange must stay type-compatible.\n */\nconst ExampleUsageWithStateSetter = () => {\n const [checked, setChecked] = React.useState(false);\n return <DSControlledToggle aria-label=\"state setter\" checked={checked} onValueChange={setChecked} />;\n};\n\n/**\n * TS validation usage component covering spread and inline syntaxes.\n */\nconst ExampleUsageComponent = () => (\n <>\n <DSControlledToggle {...testExplicitDefinition} />\n <DSControlledToggle {...testInferedTypeCompatibility} />\n <DSControlledToggle {...testDefinitionAsConst} />\n <DSControlledToggle\n id=\"toggle-inline\"\n containerProps={{\n 'data-testid': 'toggle-inline-container',\n }}\n checked\n onChange={() => {}}\n onValueChange={(newChecked, e) => {}}\n size={TOGGLE_SIZES.MEDIUM}\n readOnly={false}\n disabled={false}\n applyAriaDisabled={false}\n hasError\n makeSubmittable\n name=\"toggle-inline-name\"\n value=\"toggle-inline-value\"\n labelOn=\"Enabled\"\n labelOff=\"Disabled\"\n wcagViolationLabelOn=\"Legacy On\"\n wcagViolationLabelOff=\"Legacy Off\"\n />\n </>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoJd,SAOP,UAPO,KAOP,YAPO;AAnJT,OAAOA,YAAW;AAClB,SAAS,oBAAoB,oBAA8C;AAc3E,MAAM,oBAAiD,CAAC;AAKxD,MAAM,oBAAiD;AAAA,EACrD,IAAI;AAAA,EACJ,gBAAgB;AAAA,IACd,eAAe;AAAA,IACf,cAAc;AAAA,EAChB;AAAA,EACA,UAAU,EAAE,SAAS,KAAK;AAC5B;AAKA,MAAM,sBAA2D;AAAA,EAC/D,SAAS;AAAA,EACT,MAAM,aAAa;AACrB;AAKA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EAC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UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,MAAM,aAAa;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAKA,MAAM,8BAA8B,MAAM;AACxC,QAAM,CAAC,SAAS,UAAU,IAAIA,OAAM,SAAS,KAAK;AAClD,SAAO,oBAAC,sBAAmB,cAAW,gBAAe,SAAkB,eAAe,YAAY;AACpG;AAKA,MAAM,wBAAwB,MAC5B,iCACE;AAAA,sBAAC,sBAAoB,GAAG,wBAAwB;AAAA,EAChD,oBAAC,sBAAoB,GAAG,8BAA8B;AAAA,EACtD,oBAAC,sBAAoB,GAAG,uBAAuB;AAAA,EAC/C;AAAA,IAAC;AAAA;AAAA,MACC,IAAG;AAAA,MACH,gBAAgB;AAAA,QACd,eAAe;AAAA,MACjB;AAAA,MACA,SAAO;AAAA,MACP,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,eAAe,CAAC,YAAY,MAAM;AAAA,MAAC;AAAA,MACnC,MAAM,aAAa;AAAA,MACnB,UAAU;AAAA,MACV,UAAU;AAAA,MACV,mBAAmB;AAAA,MACnB,UAAQ;AAAA,MACR,iBAAe;AAAA,MACf,MAAK;AAAA,MACL,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,UAAS;AAAA,MACT,sBAAqB;AAAA,MACrB,uBAAsB;AAAA;AAAA,EACxB;AAAA,GACF;",
6
+ "names": ["React"]
7
7
  }
@@ -3,6 +3,7 @@ const SlotPropsAsObject = {
3
3
  dsFormtoggleButtonContentWrapper: { "aria-label": "just a typescript test" },
4
4
  dsFormtoggleCircle: { "aria-label": "just a typescript test" },
5
5
  dsFormtoggleTextWrapper: { "aria-label": "just a typescript test" },
6
+ dsFormtoggleHiddenInput: { "aria-label": "just a typescript test" },
6
7
  dsFormtoggleControlledContainer: { "aria-label": "just a typescript test" },
7
8
  dsFormtoggleToggleCheckbox: { "aria-label": "just a typescript test" }
8
9
  };
@@ -10,6 +11,7 @@ const SlotPropsAsFunctions = {
10
11
  dsFormtoggleButtonContentWrapper: () => ({ "aria-label": "just a typescript test" }),
11
12
  dsFormtoggleCircle: () => ({ "aria-label": "just a typescript test" }),
12
13
  dsFormtoggleTextWrapper: () => ({ "aria-label": "just a typescript test" }),
14
+ dsFormtoggleHiddenInput: () => ({ "aria-label": "just a typescript test" }),
13
15
  dsFormtoggleControlledContainer: () => ({ "aria-label": "just a typescript test" }),
14
16
  dsFormtoggleToggleCheckbox: () => ({ "aria-label": "just a typescript test" })
15
17
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSControlledToggleT } from '../react-desc-prop-types.js';\nimport type { DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from '../constants/index.js';\n\n// Exhaustiveness contract over CONTROLLED_TOGGLE_SLOTS \u2014 every slot must appear in SlotFunctionArguments.\n// The legacy aliases (dsFormtoggleControlledContainer, dsFormtoggleToggleCheckbox) are real injection\n// points kept for QA/consumer compatibility \u2014 see KNOWN_INTENTIONAL_DEVIATIONS.md.\n//\n// Slot props can be passed in two forms \u2014 object (static) and function (dynamic).\nconst SlotPropsAsObject: Partial<DSControlledToggleT.Props> = {\n dsFormtoggleButtonContentWrapper: { 'aria-label': 'just a typescript test' },\n dsFormtoggleCircle: { 'aria-label': 'just a typescript test' },\n dsFormtoggleTextWrapper: { 'aria-label': 'just a typescript test' },\n dsFormtoggleControlledContainer: { 'aria-label': 'just a typescript test' },\n dsFormtoggleToggleCheckbox: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSControlledToggleT.SlotFunctionArguments = {\n dsFormtoggleButtonContentWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleCircle: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleTextWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleControlledContainer: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleToggleCheckbox: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments.\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSControlledToggleName, typeof CONTROLLED_TOGGLE_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACUvB,MAAM,oBAAwD;AAAA,EAC5D,kCAAkC,EAAE,cAAc,yBAAyB;AAAA,EAC3E,oBAAoB,EAAE,cAAc,yBAAyB;AAAA,EAC7D,yBAAyB,EAAE,cAAc,yBAAyB;AAAA,EAClE,iCAAiC,EAAE,cAAc,yBAAyB;AAAA,EAC1E,4BAA4B,EAAE,cAAc,yBAAyB;AACvE;AAEA,MAAM,uBAAkE;AAAA,EACtE,kCAAkC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAClF,oBAAoB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACpE,yBAAyB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACzE,iCAAiC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACjF,4BAA4B,OAAO,EAAE,cAAc,yBAAyB;AAC9E;AAGA,MAAM,6CAEF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSControlledToggleT } from '../react-desc-prop-types.js';\nimport type { DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from '../constants/index.js';\n\n// Exhaustiveness contract over CONTROLLED_TOGGLE_SLOTS \u2014 every slot must appear in SlotFunctionArguments.\n// The legacy aliases (dsFormtoggleControlledContainer, dsFormtoggleToggleCheckbox) are real injection\n// points kept for QA/consumer compatibility \u2014 see KNOWN_INTENTIONAL_DEVIATIONS.md.\n//\n// Slot props can be passed in two forms \u2014 object (static) and function (dynamic).\nconst SlotPropsAsObject: Partial<DSControlledToggleT.Props> = {\n dsFormtoggleButtonContentWrapper: { 'aria-label': 'just a typescript test' },\n dsFormtoggleCircle: { 'aria-label': 'just a typescript test' },\n dsFormtoggleTextWrapper: { 'aria-label': 'just a typescript test' },\n dsFormtoggleHiddenInput: { 'aria-label': 'just a typescript test' },\n dsFormtoggleControlledContainer: { 'aria-label': 'just a typescript test' },\n dsFormtoggleToggleCheckbox: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSControlledToggleT.SlotFunctionArguments = {\n dsFormtoggleButtonContentWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleCircle: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleTextWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleHiddenInput: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleControlledContainer: () => ({ 'aria-label': 'just a typescript test' }),\n dsFormtoggleToggleCheckbox: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments.\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSControlledToggleName, typeof CONTROLLED_TOGGLE_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACUvB,MAAM,oBAAwD;AAAA,EAC5D,kCAAkC,EAAE,cAAc,yBAAyB;AAAA,EAC3E,oBAAoB,EAAE,cAAc,yBAAyB;AAAA,EAC7D,yBAAyB,EAAE,cAAc,yBAAyB;AAAA,EAClE,yBAAyB,EAAE,cAAc,yBAAyB;AAAA,EAClE,iCAAiC,EAAE,cAAc,yBAAyB;AAAA,EAC1E,4BAA4B,EAAE,cAAc,yBAAyB;AACvE;AAEA,MAAM,uBAAkE;AAAA,EACtE,kCAAkC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAClF,oBAAoB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACpE,yBAAyB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACzE,yBAAyB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACzE,iCAAiC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACjF,4BAA4B,OAAO,EAAE,cAAc,yBAAyB;AAC9E;AAGA,MAAM,6CAEF;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ export declare const CONTROLLED_TOGGLE_SLOTS: {
3
3
  readonly BUTTON_CONTENT_WRAPPER: "button-content-wrapper";
4
4
  readonly CIRCLE: "circle";
5
5
  readonly TEXT_WRAPPER: "text-wrapper";
6
+ readonly HIDDEN_INPUT: "hidden-input";
6
7
  readonly CONTROLLED_CONTAINER: "controlled-container";
7
8
  readonly TOGGLE_CHECKBOX: "toggle-checkbox";
8
9
  };
@@ -12,6 +13,7 @@ export declare const CONTROLLED_TOGGLE_DATA_TESTID: {
12
13
  BUTTON_CONTENT_WRAPPER: "ds-formtoggle-button-content-wrapper";
13
14
  CIRCLE: "ds-formtoggle-circle";
14
15
  TEXT_WRAPPER: "ds-formtoggle-text-wrapper";
16
+ HIDDEN_INPUT: "ds-formtoggle-hidden-input";
15
17
  };
16
18
  export declare const TOGGLE_SIZES: {
17
19
  readonly SMALL: "s";
@@ -2,6 +2,7 @@ import { type DSTypographyT } from '@elliemae/ds-typography';
2
2
  import type { DSControlledToggleT } from '../../react-desc-prop-types.js';
3
3
  interface StyledContainerT {
4
4
  $size: DSControlledToggleT.ToggleSize;
5
+ $disabled?: boolean;
5
6
  }
6
7
  export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledContainerT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
7
8
  interface StyledButtonT {
@@ -9,6 +10,7 @@ interface StyledButtonT {
9
10
  $disabled: boolean;
10
11
  $applyAriaDisabled: boolean;
11
12
  $readOnly: boolean;
13
+ $hasError?: boolean;
12
14
  }
13
15
  export declare const StyledButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>, import("@elliemae/ds-system").Theme, StyledButtonT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>>, never>;
14
16
  interface StyledButtonContentWrapperT {
@@ -22,6 +24,7 @@ interface StyledCircleT {
22
24
  $disabled: boolean;
23
25
  $readOnly: boolean;
24
26
  $applyAriaDisabled: boolean;
27
+ $hasError?: boolean;
25
28
  }
26
29
  export declare const StyledCircle: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledCircleT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
27
30
  interface StyledTextWrapperT extends DSTypographyT.Props {
@@ -34,4 +37,5 @@ export declare const RemBasedFontProperties: import("styled-components").Flatten
34
37
  $size: DSControlledToggleT.ToggleSize;
35
38
  }, import("@xstyled/styled-components").Theme>>;
36
39
  export declare const StyledTextWrapper: import("styled-components").StyledComponent<import("react").FC<DSTypographyT.Props>, import("@elliemae/ds-system").Theme, StyledTextWrapperT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").FC<DSTypographyT.Props>>, never>;
40
+ export declare const StyledHiddenInput: import("styled-components").StyledComponent<"input", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"input">, never>;
37
41
  export {};
@@ -9,16 +9,20 @@ export declare namespace DSControlledToggleT {
9
9
  dsFormtoggleButtonContentWrapper: () => object;
10
10
  dsFormtoggleCircle: () => object;
11
11
  dsFormtoggleTextWrapper: () => object;
12
+ dsFormtoggleHiddenInput: () => object;
12
13
  dsFormtoggleControlledContainer: () => object;
13
14
  dsFormtoggleToggleCheckbox: () => object;
14
15
  };
15
16
  interface DefaultProps {
16
17
  checked: boolean;
17
18
  onChange: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
19
+ onValueChange: (newChecked: boolean, e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
18
20
  size: ToggleSize;
19
21
  readOnly: boolean;
20
22
  disabled: boolean;
21
23
  applyAriaDisabled: boolean;
24
+ hasError: boolean;
25
+ makeSubmittable: boolean;
22
26
  }
23
27
  interface RequiredProps {
24
28
  }