@elliemae/ds-form-toggle 3.70.0-next.43 → 3.70.0-next.45

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 (72) hide show
  1. package/dist/cjs/DSControlledToggle.js +50 -0
  2. package/dist/cjs/DSControlledToggle.js.map +7 -0
  3. package/dist/cjs/DSControlledToggleCTX.js +40 -0
  4. package/dist/cjs/DSControlledToggleCTX.js.map +7 -0
  5. package/dist/cjs/config/useDSControlledToggle.js +2 -17
  6. package/dist/cjs/config/useDSControlledToggle.js.map +2 -2
  7. package/dist/cjs/constants/index.js +0 -1
  8. package/dist/cjs/constants/index.js.map +2 -2
  9. package/dist/cjs/index.js +3 -3
  10. package/dist/cjs/index.js.map +2 -2
  11. package/dist/cjs/parts/Button.js +102 -0
  12. package/dist/cjs/parts/Button.js.map +7 -0
  13. package/dist/cjs/parts/Container.js +61 -0
  14. package/dist/cjs/parts/Container.js.map +7 -0
  15. package/dist/cjs/parts/styles/styles.js +246 -0
  16. package/dist/cjs/parts/styles/styles.js.map +7 -0
  17. package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js +110 -0
  18. package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js.map +7 -0
  19. package/dist/cjs/{config → parts/wcagViolation}/useGetWidestLabelWidth.js.map +1 -1
  20. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  21. package/dist/cjs/typescript-testing/slot-props.js +0 -2
  22. package/dist/cjs/typescript-testing/slot-props.js.map +2 -2
  23. package/dist/esm/DSControlledToggle.js +20 -0
  24. package/dist/esm/DSControlledToggle.js.map +7 -0
  25. package/dist/esm/DSControlledToggleCTX.js +10 -0
  26. package/dist/esm/DSControlledToggleCTX.js.map +7 -0
  27. package/dist/esm/config/useDSControlledToggle.js +2 -17
  28. package/dist/esm/config/useDSControlledToggle.js.map +2 -2
  29. package/dist/esm/constants/index.js +0 -1
  30. package/dist/esm/constants/index.js.map +2 -2
  31. package/dist/esm/index.js +4 -4
  32. package/dist/esm/index.js.map +2 -2
  33. package/dist/esm/parts/Button.js +72 -0
  34. package/dist/esm/parts/Button.js.map +7 -0
  35. package/dist/esm/parts/Container.js +31 -0
  36. package/dist/esm/parts/Container.js.map +7 -0
  37. package/dist/esm/parts/styles/styles.js +216 -0
  38. package/dist/esm/parts/styles/styles.js.map +7 -0
  39. package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js +86 -0
  40. package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js.map +7 -0
  41. package/dist/esm/{config → parts/wcagViolation}/useGetWidestLabelWidth.js.map +1 -1
  42. package/dist/esm/react-desc-prop-types.js.map +2 -2
  43. package/dist/esm/typescript-testing/slot-props.js +0 -2
  44. package/dist/esm/typescript-testing/slot-props.js.map +2 -2
  45. package/dist/types/DSControlledToggleCTX.d.ts +4 -0
  46. package/dist/types/config/useDSControlledToggle.d.ts +8 -373
  47. package/dist/types/constants/index.d.ts +0 -2
  48. package/dist/types/index.d.ts +2 -2
  49. package/dist/types/parts/Button.d.ts +3 -0
  50. package/dist/types/parts/Container.d.ts +1 -0
  51. package/dist/types/parts/styles/styles.d.ts +37 -0
  52. package/dist/types/parts/wcagViolation/Button.wcagViolationLabels.d.ts +3 -0
  53. package/dist/types/react-desc-prop-types.d.ts +0 -1
  54. package/package.json +8 -7
  55. package/dist/cjs/ControlledToggle.js +0 -127
  56. package/dist/cjs/ControlledToggle.js.map +0 -7
  57. package/dist/cjs/styles.js +0 -154
  58. package/dist/cjs/styles.js.map +0 -7
  59. package/dist/cjs/utils/styleHelpers.js +0 -116
  60. package/dist/cjs/utils/styleHelpers.js.map +0 -7
  61. package/dist/esm/ControlledToggle.js +0 -105
  62. package/dist/esm/ControlledToggle.js.map +0 -7
  63. package/dist/esm/styles.js +0 -134
  64. package/dist/esm/styles.js.map +0 -7
  65. package/dist/esm/utils/styleHelpers.js +0 -86
  66. package/dist/esm/utils/styleHelpers.js.map +0 -7
  67. package/dist/types/styles.d.ts +0 -44
  68. package/dist/types/utils/styleHelpers.d.ts +0 -41
  69. /package/dist/cjs/{config → parts/wcagViolation}/useGetWidestLabelWidth.js +0 -0
  70. /package/dist/esm/{config → parts/wcagViolation}/useGetWidestLabelWidth.js +0 -0
  71. /package/dist/types/{ControlledToggle.d.ts → DSControlledToggle.d.ts} +0 -0
  72. /package/dist/types/{config → parts/wcagViolation}/useGetWidestLabelWidth.d.ts +0 -0
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import { slotObjectToDataTestIds } from "@elliemae/ds-system";
3
3
  const DSControlledToggleName = "DSFormtoggle";
4
4
  const CONTROLLED_TOGGLE_SLOTS = {
5
- CONTAINER_WITH_RADIUS_SHAPE: "container-with-radius-shape",
6
5
  BUTTON_CONTENT_WRAPPER: "button-content-wrapper",
7
6
  CIRCLE: "circle",
8
7
  TEXT_WRAPPER: "text-wrapper",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSControlledToggleName = 'DSFormtoggle';\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const CONTROLLED_TOGGLE_SLOTS = {\n CONTAINER_WITH_RADIUS_SHAPE: 'container-with-radius-shape',\n BUTTON_CONTENT_WRAPPER: 'button-content-wrapper',\n CIRCLE: 'circle',\n TEXT_WRAPPER: 'text-wrapper',\n // legacy ones...\n CONTROLLED_CONTAINER: 'controlled-container', // in other components this is the ROOT\n TOGGLE_CHECKBOX: 'toggle-checkbox',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const CONTROLLED_TOGGLE_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS),\n CONTROLLED_CONTAINER: 'ds-controlled-toggle', // in other components this is the ROOT\n TOGGLE_CHECKBOX: 'ds-controlled-toggle-checkbox',\n};\n\n// Specific of the toggle component\n\nexport const TOGGLE_SIZES = {\n SMALL: 's',\n MEDIUM: 'm',\n LARGE: 'l',\n} as const;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,yBAAyB;AAG/B,MAAM,0BAA0B;AAAA,EACrC,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB,QAAQ;AAAA,EACR,cAAc;AAAA;AAAA,EAEd,sBAAsB;AAAA;AAAA,EACtB,iBAAiB;AACnB;AAGO,MAAM,gCAAgC;AAAA,EAC3C,GAAG,wBAAwB,wBAAwB,uBAAuB;AAAA,EAC1E,sBAAsB;AAAA;AAAA,EACtB,iBAAiB;AACnB;AAIO,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSControlledToggleName = 'DSFormtoggle';\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const CONTROLLED_TOGGLE_SLOTS = {\n BUTTON_CONTENT_WRAPPER: 'button-content-wrapper',\n CIRCLE: 'circle',\n TEXT_WRAPPER: 'text-wrapper',\n // legacy ones...\n CONTROLLED_CONTAINER: 'controlled-container', // in other components this is the ROOT\n TOGGLE_CHECKBOX: 'toggle-checkbox',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const CONTROLLED_TOGGLE_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS),\n CONTROLLED_CONTAINER: 'ds-controlled-toggle', // in other components this is the ROOT\n TOGGLE_CHECKBOX: 'ds-controlled-toggle-checkbox',\n};\n\n// Specific of the toggle component\n\nexport const TOGGLE_SIZES = {\n SMALL: 's',\n MEDIUM: 'm',\n LARGE: 'l',\n} as const;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,yBAAyB;AAG/B,MAAM,0BAA0B;AAAA,EACrC,wBAAwB;AAAA,EACxB,QAAQ;AAAA,EACR,cAAc;AAAA;AAAA,EAEd,sBAAsB;AAAA;AAAA,EACtB,iBAAiB;AACnB;AAGO,MAAM,gCAAgC;AAAA,EAC3C,GAAG,wBAAwB,wBAAwB,uBAAuB;AAAA,EAC1E,sBAAsB;AAAA;AAAA,EACtB,iBAAiB;AACnB;AAIO,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
- import { DSControlledToggle, DSControlledToggleWithSchema } from "./ControlledToggle.js";
3
2
  import {
4
- TOGGLE_SIZES,
5
- CONTROLLED_TOGGLE_SLOTS,
6
3
  CONTROLLED_TOGGLE_DATA_TESTID,
7
- DSControlledToggleName
4
+ CONTROLLED_TOGGLE_SLOTS,
5
+ DSControlledToggleName,
6
+ TOGGLE_SIZES
8
7
  } from "./constants/index.js";
8
+ import { DSControlledToggle, DSControlledToggleWithSchema } from "./DSControlledToggle.js";
9
9
  export {
10
10
  CONTROLLED_TOGGLE_DATA_TESTID,
11
11
  CONTROLLED_TOGGLE_SLOTS,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSControlledToggle, DSControlledToggleWithSchema } from './ControlledToggle.js';\nexport {\n TOGGLE_SIZES,\n CONTROLLED_TOGGLE_SLOTS,\n CONTROLLED_TOGGLE_DATA_TESTID,\n DSControlledToggleName,\n} from './constants/index.js';\nexport type { DSControlledToggleT } from './react-desc-prop-types.js';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oBAAoB,oCAAoC;AACjE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export {\n CONTROLLED_TOGGLE_DATA_TESTID,\n CONTROLLED_TOGGLE_SLOTS,\n DSControlledToggleName,\n TOGGLE_SIZES,\n} from './constants/index.js';\nexport { DSControlledToggle, DSControlledToggleWithSchema } from './DSControlledToggle.js';\nexport type { DSControlledToggleT } from './react-desc-prop-types.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB,oCAAoC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,72 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
4
+ import { TYPOGRAPHY_VARIANTS } from "@elliemae/ds-typography";
5
+ import React2 from "react";
6
+ import { ControlledToggleContext } from "../DSControlledToggleCTX.js";
7
+ import { StyledButton, StyledButtonContentWrapper, StyledCircle, StyledTextWrapper } from "./styles/styles.js";
8
+ const widthSizeMap = {
9
+ s: 18,
10
+ m: 26,
11
+ l: 36
12
+ };
13
+ const Button = () => {
14
+ const { propsWithDefault, buttonProps } = React2.useContext(ControlledToggleContext);
15
+ const { checked, size, disabled, applyAriaDisabled, readOnly } = propsWithDefault;
16
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);
17
+ return /* @__PURE__ */ jsx(
18
+ StyledButton,
19
+ {
20
+ ...readOnly ? { "aria-readonly": "true" } : {},
21
+ ...buttonProps,
22
+ $checked: checked,
23
+ $readOnly: readOnly,
24
+ $disabled: disabled,
25
+ $applyAriaDisabled: applyAriaDisabled,
26
+ getOwnerProps,
27
+ getOwnerPropsArguments,
28
+ children: /* @__PURE__ */ jsxs(
29
+ StyledButtonContentWrapper,
30
+ {
31
+ $width: widthSizeMap[size],
32
+ $checked: checked,
33
+ $size: size,
34
+ getOwnerProps,
35
+ getOwnerPropsArguments,
36
+ children: [
37
+ /* @__PURE__ */ jsx(
38
+ StyledCircle,
39
+ {
40
+ $size: size,
41
+ $disabled: disabled,
42
+ $readOnly: readOnly,
43
+ $applyAriaDisabled: applyAriaDisabled,
44
+ getOwnerProps,
45
+ getOwnerPropsArguments
46
+ }
47
+ ),
48
+ /* @__PURE__ */ jsx(
49
+ StyledTextWrapper,
50
+ {
51
+ $size: size,
52
+ $disabled: disabled,
53
+ $readOnly: readOnly,
54
+ $applyAriaDisabled: applyAriaDisabled,
55
+ getOwnerProps,
56
+ getOwnerPropsArguments,
57
+ variant: TYPOGRAPHY_VARIANTS.B2,
58
+ role: "presentation",
59
+ "aria-hidden": "true",
60
+ children: checked ? "ON" : "OFF"
61
+ }
62
+ )
63
+ ]
64
+ }
65
+ )
66
+ }
67
+ );
68
+ };
69
+ export {
70
+ Button
71
+ };
72
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Button.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 React from 'react';\nimport { ControlledToggleContext } from '../DSControlledToggleCTX.js';\nimport { type DSControlledToggleT } from '../react-desc-prop-types.js';\nimport { StyledButton, StyledButtonContentWrapper, StyledCircle, StyledTextWrapper } from './styles/styles.js';\n\n// What is this about?\n// Currently the way the code is written for this component and the way this component UI/UX specs are handled\n// there is no defiend \"dynamic\" and \"responsive\" sizes also, the font-size are hardcoded and not aligned with typography in the different \"size\" variants.\n// In the past we accepted \"whatever\" labels for the toggle,\n// it was discarded as non compliant for the semantic of the component that only announces and accepts the \"on\" and \"off\" meaning,\n// as of today, wcag compliant way has an hardcoded \"ON\" and \"OFF\"/\n// The previous implementation was relying on a dynamic calculation of the width to keep the size of the toggle button,\n// it had it's own set of issues and was creating extra renders (see PUI-18655).\n\n// This constant is just the pre-calculated values to avoid extra javascript logic and extra renderes.\n\n// What does this means long term?\n// - When the font-size is aligned, the component specs are made responsive and the component will support \"text resize/reflow\",\n// - When the px will change to rem\n// - When the component will be updated to support \"tokens\"\n// - When/if the component will be i18n compliant and support different languages labels that are the other language version of \"on\" and \"off\" (like \"activ\u00E9\" and \"d\u00E9sactiv\u00E9\" in french)\n\n// The whole size calcualtion logic of the component needs to be reviewed and updated to not need a constant \"width\" to guarante the width to be \"the biggest of the two labels\".\n\n// The most reasonable implementation would be to:\n// - simply render both \"on\" and \"off\" in the DOM at the same time\n// - make the not active version influence the size but not visible (e.g. height:0, overflow:hidden)\n// - have the width be automatically calculated by the browser to fit the longest.\n\n// I can't implement this as part of the current ticket(PUI-16323) as that would be a visual breaking change and need coordination with QA and UX.\n\n// So, short term solution:\n// - Not responsive (in the rem, text resize WCAG sense, still is in the \"zoom\" sense as before)\n// - Not i18n compliant\n// - Not theming ready\n// Exactly as we never wrote the component to be, but at least it won't:\n// - flicker\n// - pay the cost of the WCAG non-compliant labels\n// - hide the pending issues with aproximation that \"happens to kinda fix it\"\n// Important note -> I changed the \"width\" to \"min-width\" to keep some amount of resize/reflow WCAG compliant (zoom will keep working, font size changes won't like before),\n// but true wcag compliance requires the component to use typography, be designed accordingly, written accordingly and rely on rem.\nconst widthSizeMap = {\n s: 18,\n m: 26,\n l: 36,\n} as const;\n\nexport const Button: React.ComponentType<DSControlledToggleT.Props> = () => {\n const { propsWithDefault, buttonProps } = React.useContext(ControlledToggleContext);\n const { checked, size, disabled, applyAriaDisabled, readOnly } = propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\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={widthSizeMap[size]}\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 // this is \"okay\" in this version but not in the WCAGViolation code\n // the reason being that a role switch with proper \"aria-checked\" already announces \"on\" and \"off\" to screen readers\n // so this is just a visual representation of the state, not a semantic one\n // the WCAGViolation code is violating this contract with custom labels and they need to be announced, so they can't be hidden from screen readers\n // and they can't be considered \"presentational\" as they are meaning bearing for scenario with custom texts (which is exactly WHY role switch is wrong in that case)\n // confirmed with Juan, this avoids the \"double announcement\" issue that was happening with the previous implementation of the component\n role=\"presentation\"\n aria-hidden=\"true\"\n >\n {checked ? 'ON' : 'OFF'}\n </StyledTextWrapper>\n </StyledButtonContentWrapper>\n </StyledButton>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACkEjB,SAOE,KAPF;AAlEN,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,OAAOA,YAAW;AAClB,SAAS,+BAA+B;AAExC,SAAS,cAAc,4BAA4B,cAAc,yBAAyB;AAsC1F,MAAM,eAAe;AAAA,EACnB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,SAAyD,MAAM;AAC1E,QAAM,EAAE,kBAAkB,YAAY,IAAIA,OAAM,WAAW,uBAAuB;AAClF,QAAM,EAAE,SAAS,MAAM,UAAU,mBAAmB,SAAS,IAAI;AACjE,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAEhF,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,QAAC;AAAA;AAAA,UACC,QAAQ,aAAa,IAAI;AAAA,UACzB,UAAU;AAAA,UACV,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UAEA;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO;AAAA,gBACP,WAAW;AAAA,gBACX,WAAW;AAAA,gBACX,oBAAoB;AAAA,gBACpB;AAAA,gBACA;AAAA;AAAA,YACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO;AAAA,gBACP,WAAW;AAAA,gBACX,WAAW;AAAA,gBACX,oBAAoB;AAAA,gBACpB;AAAA,gBACA;AAAA,gBACA,SAAS,oBAAoB;AAAA,gBAO7B,MAAK;AAAA,gBACL,eAAY;AAAA,gBAEX,oBAAU,OAAO;AAAA;AAAA,YACpB;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
4
+ import React2 from "react";
5
+ import { CONTROLLED_TOGGLE_DATA_TESTID } from "../constants/index.js";
6
+ import { ControlledToggleContext } from "../DSControlledToggleCTX.js";
7
+ import { Button } from "./Button.js";
8
+ import { ButtonWCAGViolation } from "./wcagViolation/Button.wcagViolationLabels.js";
9
+ import { StyledContainer } from "./styles/styles.js";
10
+ const Container = () => {
11
+ const { propsWithDefault, xstyledProps } = React2.useContext(ControlledToggleContext);
12
+ const { wcagViolationLabelOn, wcagViolationLabelOff, size, containerProps } = propsWithDefault;
13
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);
14
+ const isViolationVersion = wcagViolationLabelOn || wcagViolationLabelOff;
15
+ return /* @__PURE__ */ jsx(
16
+ StyledContainer,
17
+ {
18
+ $size: size,
19
+ "data-testid": CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER,
20
+ ...containerProps,
21
+ ...xstyledProps,
22
+ getOwnerProps,
23
+ getOwnerPropsArguments,
24
+ children: isViolationVersion ? /* @__PURE__ */ jsx(ButtonWCAGViolation, { ...propsWithDefault }) : /* @__PURE__ */ jsx(Button, { ...propsWithDefault })
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ Container
30
+ };
31
+ //# sourceMappingURL=Container.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Container.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { CONTROLLED_TOGGLE_DATA_TESTID } from '../constants/index.js';\nimport { ControlledToggleContext } from '../DSControlledToggleCTX.js';\nimport { Button } from './Button.js';\nimport { ButtonWCAGViolation } from './wcagViolation/Button.wcagViolationLabels.js';\nimport { StyledContainer } from './styles/styles.js';\n\nexport const Container = () => {\n const { propsWithDefault, xstyledProps } = React.useContext(ControlledToggleContext);\n const { wcagViolationLabelOn, wcagViolationLabelOff, size, containerProps } = propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n const isViolationVersion = wcagViolationLabelOn || wcagViolationLabelOff;\n\n return (\n <StyledContainer\n $size={size}\n data-testid={CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER}\n {...containerProps}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {isViolationVersion ? <ButtonWCAGViolation {...propsWithDefault} /> : <Button {...propsWithDefault} />}\n </StyledContainer>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwBK;AAxB5B,SAAS,qBAAqB;AAC9B,OAAOA,YAAW;AAClB,SAAS,qCAAqC;AAC9C,SAAS,+BAA+B;AACxC,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEzB,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,kBAAkB,aAAa,IAAIA,OAAM,WAAW,uBAAuB;AACnF,QAAM,EAAE,sBAAsB,uBAAuB,MAAM,eAAe,IAAI;AAC9E,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAEhF,QAAM,qBAAqB,wBAAwB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,eAAa,8BAA8B;AAAA,MAC1C,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEC,+BAAqB,oBAAC,uBAAqB,GAAG,kBAAkB,IAAK,oBAAC,UAAQ,GAAG,kBAAkB;AAAA;AAAA,EACtG;AAEJ;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,216 @@
1
+ import * as React from "react";
2
+ import { DSButtonV3 } from "@elliemae/ds-button-v2";
3
+ import { css, styled, xStyledCommonProps } from "@elliemae/ds-system";
4
+ import { DSTypography } from "@elliemae/ds-typography";
5
+ import { CONTROLLED_TOGGLE_SLOTS, DSControlledToggleName } from "../../constants/index.js";
6
+ const containerHeight = {
7
+ s: "20px",
8
+ m: "28px",
9
+ l: "36px"
10
+ };
11
+ const StyledContainer = styled("div", {
12
+ name: DSControlledToggleName,
13
+ slot: CONTROLLED_TOGGLE_SLOTS.CONTROLLED_CONTAINER
14
+ })`
15
+ display: inline-flex;
16
+ width: fit-content;
17
+ justify-content: center;
18
+ align-items: center;
19
+ height: ${({ $size }) => containerHeight[$size]};
20
+ padding: 2px;
21
+ border-radius: 20px;
22
+ :focus-within {
23
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
24
+ }
25
+ ${xStyledCommonProps}
26
+ `;
27
+ const SwitchButtonStateColors = css`
28
+ ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {
29
+ if ($disabled)
30
+ return `
31
+ background-color: ${theme.colors.neutral["080"]};
32
+ border: 2px solid ${theme.colors.neutral["400"]};
33
+ `;
34
+ if ($readOnly || $applyAriaDisabled)
35
+ return `
36
+ background-color: ${theme.colors.neutral["050"]};
37
+ border: 2px solid ${theme.colors.neutral["400"]};
38
+ `;
39
+ if ($checked)
40
+ return `
41
+ background-color: ${theme.colors.brand["600"]};
42
+ border: 2px solid ${theme.colors.brand["700"]};
43
+ `;
44
+ return `
45
+ background-color: ${theme.colors.neutral["500"]};
46
+ border: 2px solid ${theme.colors.neutral["600"]};
47
+ `;
48
+ }}
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
+ const SwitchHoverColors = css`
62
+ ${({ $disabled, $readOnly, $applyAriaDisabled, $checked, theme }) => {
63
+ if ($disabled)
64
+ return `
65
+ background-color: ${theme.colors.neutral["080"]};
66
+ `;
67
+ if ($readOnly || $applyAriaDisabled)
68
+ return `
69
+ background-color: ${theme.colors.neutral["050"]};
70
+ `;
71
+ if ($checked)
72
+ return `
73
+ background-color: ${theme.colors.brand["700"]};
74
+ border-color: ${theme.colors.brand["800"]};
75
+ `;
76
+ return `
77
+ background-color: ${theme.colors.neutral["600"]};
78
+ border-color: ${theme.colors.neutral["700"]};
79
+ `;
80
+ }}
81
+ `;
82
+ const StyledButton = styled(DSButtonV3, {
83
+ name: DSControlledToggleName,
84
+ slot: CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX
85
+ })`
86
+ margin: 0;
87
+ padding: 0;
88
+ border-radius: 20px;
89
+ ${SwitchButtonStateColors}
90
+ transition: background-color 0.2s;
91
+ :focus {
92
+ outline: 2px solid ${({ theme }) => theme.colors.brand["700"]};
93
+ outline-offset: 1px;
94
+ }
95
+ &:hover {
96
+ ${SwitchCursors}
97
+ ${SwitchHoverColors}
98
+ }
99
+ `;
100
+ const labelHeight = {
101
+ s: "16px",
102
+ m: "24px",
103
+ l: "32px"
104
+ };
105
+ const margin = {
106
+ s: "26px",
107
+ m: "34px",
108
+ l: "42px"
109
+ };
110
+ const StyledButtonContentWrapper = styled("div", {
111
+ name: DSControlledToggleName,
112
+ slot: CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER
113
+ })`
114
+ min-width: ${({ $width, $size }) => `calc(${$width}px + ${margin[$size]})`};
115
+ height: ${({ $size }) => labelHeight[$size]};
116
+ display: flex;
117
+ margin: 0;
118
+ padding: 0;
119
+ align-items: center;
120
+ height: 100%;
121
+ flex-direction: ${({ $checked }) => $checked ? "row-reverse" : "row"};
122
+ border-radius: 20px;
123
+ `;
124
+ const CircleColors = css`
125
+ ${({ theme, $disabled, $readOnly, $applyAriaDisabled }) => {
126
+ if ($disabled) {
127
+ return `
128
+ background-color: ${theme.colors.neutral["080"]};
129
+ outline: 2px solid ${theme.colors.neutral["400"]};
130
+ `;
131
+ }
132
+ if ($readOnly || $applyAriaDisabled) {
133
+ return `
134
+ background-color: ${theme.colors.neutral["000"]};
135
+ outline: 2px solid ${theme.colors.neutral["400"]};
136
+ `;
137
+ }
138
+ return `
139
+ background-color: ${theme.colors.neutral["000"]};
140
+ `;
141
+ }}
142
+ `;
143
+ const circleValues = {
144
+ s: "14px",
145
+ m: "20px",
146
+ l: "28px"
147
+ };
148
+ const StyledCircle = styled("div", {
149
+ name: DSControlledToggleName,
150
+ slot: CONTROLLED_TOGGLE_SLOTS.CIRCLE
151
+ })`
152
+ height: ${({ $size }) => circleValues[$size]};
153
+ width: ${({ $size }) => circleValues[$size]};
154
+ border-radius: 50%;
155
+ ${CircleColors}
156
+ `;
157
+ const TextWrapperColors = css`
158
+ ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => {
159
+ if ($disabled || $applyAriaDisabled || $readOnly) {
160
+ return `
161
+ color: ${theme.colors.neutral["600"]};
162
+ `;
163
+ }
164
+ return `
165
+ color: ${theme.colors.neutral["000"]};
166
+ `;
167
+ }}
168
+ `;
169
+ const RemBasedFontProperties = css`
170
+ ${({ theme, $size }) => {
171
+ if ($size === "s")
172
+ return `
173
+ font-size: 0.6875rem; // 11px -> 11/16 = 0.6875rem
174
+ line-height: 0.6875rem; // 11px -> 11/16 = 0.6875rem
175
+ @media (min-width: ${theme.breakpoints.small}) {
176
+ font-size: 0.84615rem; // 11px -> 11/13 = 0.84615rem
177
+ line-height: 0.84615rem; // 11px -> 11/13 = 0.84615rem
178
+ }
179
+ `;
180
+ if ($size === "l")
181
+ return `
182
+ font-size: 1.25rem; // 20px -> 20/16 = 1.25rem
183
+ line-height: 1.25rem; // 20px -> 20/16 = 1.25rem
184
+ @media (min-width: ${theme.breakpoints.small}) {
185
+ font-size: 1.53846rem; // 20px -> 20/13 = 1.53846rem
186
+ line-height: 1.53846rem; // 20px -> 20/13 = 1.53846rem
187
+ }
188
+ `;
189
+ return `
190
+ font-size: 0.9375rem; // 15px -> 15/16 = 0.9375rem
191
+ line-height: 0.9375rem; // 15px -> 15/16 = 0.9375rem
192
+ @media (min-width: ${theme.breakpoints.small}) {
193
+ font-size: 1.15385rem; // 15px -> 15/13 = 1.15385rem
194
+ line-height: 1.15385rem; // 15px -> 15/13 = 1.15385rem
195
+ }
196
+ `;
197
+ }}
198
+ `;
199
+ const StyledTextWrapper = styled(DSTypography, {
200
+ name: DSControlledToggleName,
201
+ slot: CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER
202
+ })`
203
+ flex-grow: 1;
204
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
205
+ ${RemBasedFontProperties}
206
+ ${TextWrapperColors}
207
+ `;
208
+ export {
209
+ RemBasedFontProperties,
210
+ StyledButton,
211
+ StyledButtonContentWrapper,
212
+ StyledCircle,
213
+ StyledContainer,
214
+ StyledTextWrapper
215
+ };
216
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,86 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
4
+ import { TYPOGRAPHY_VARIANTS } from "@elliemae/ds-typography";
5
+ import { styled } from "@elliemae/ds-system";
6
+ import React2 from "react";
7
+ import { ControlledToggleContext } from "../../DSControlledToggleCTX.js";
8
+ import {
9
+ RemBasedFontProperties,
10
+ StyledButton,
11
+ StyledButtonContentWrapper,
12
+ StyledCircle,
13
+ StyledTextWrapper
14
+ } from "../styles/styles.js";
15
+ import { useGetWidestLabelWidth } from "./useGetWidestLabelWidth.js";
16
+ const SetLabelWidth = styled.div`
17
+ ${RemBasedFontProperties}
18
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
19
+ width: auto;
20
+ position: absolute;
21
+ white-space: nowrap;
22
+ visibility: hidden;
23
+ `;
24
+ const ButtonWCAGViolation = () => {
25
+ const { propsWithDefault, buttonProps } = React2.useContext(ControlledToggleContext);
26
+ const { wcagViolationLabelOn, wcagViolationLabelOff, checked, size, disabled, applyAriaDisabled, readOnly } = propsWithDefault;
27
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);
28
+ const { width, handleRefOnLabelWidth, handleRefOffLabelWidth } = useGetWidestLabelWidth();
29
+ return /* @__PURE__ */ jsxs(
30
+ StyledButton,
31
+ {
32
+ ...readOnly ? { "aria-readonly": "true" } : {},
33
+ ...buttonProps,
34
+ $checked: checked,
35
+ $readOnly: readOnly,
36
+ $disabled: disabled,
37
+ $applyAriaDisabled: applyAriaDisabled,
38
+ getOwnerProps,
39
+ getOwnerPropsArguments,
40
+ children: [
41
+ /* @__PURE__ */ jsxs(
42
+ StyledButtonContentWrapper,
43
+ {
44
+ $width: width,
45
+ $checked: checked,
46
+ $size: size,
47
+ getOwnerProps,
48
+ getOwnerPropsArguments,
49
+ children: [
50
+ /* @__PURE__ */ jsx(
51
+ StyledCircle,
52
+ {
53
+ $size: size,
54
+ $disabled: disabled,
55
+ $readOnly: readOnly,
56
+ $applyAriaDisabled: applyAriaDisabled,
57
+ getOwnerProps,
58
+ getOwnerPropsArguments
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsx(
62
+ StyledTextWrapper,
63
+ {
64
+ $size: size,
65
+ $disabled: disabled,
66
+ $readOnly: readOnly,
67
+ $applyAriaDisabled: applyAriaDisabled,
68
+ getOwnerProps,
69
+ getOwnerPropsArguments,
70
+ variant: TYPOGRAPHY_VARIANTS.B2,
71
+ children: checked ? wcagViolationLabelOn ?? "ON" : wcagViolationLabelOff ?? "OFF"
72
+ }
73
+ )
74
+ ]
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(SetLabelWidth, { $size: size, innerRef: handleRefOnLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOn ?? "ON" }),
78
+ /* @__PURE__ */ jsx(SetLabelWidth, { $size: size, innerRef: handleRefOffLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOff ?? "OFF" })
79
+ ]
80
+ }
81
+ );
82
+ };
83
+ export {
84
+ ButtonWCAGViolation
85
+ };
86
+ //# sourceMappingURL=Button.wcagViolationLabels.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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;",
6
+ "names": ["React"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useGetWidestLabelWidth.tsx"],
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/wcagViolation/useGetWidestLabelWidth.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { throttle } from 'lodash-es';\nimport React, { useState, useRef } from 'react';\n\n/**\n * This should not be required, 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 */\nexport const useGetWidestLabelWidth = () => {\n const [width, setWidth] = useState<number>(0);\n const onLabelWidthRef = useRef<number>(68);\n const offLabelWidthRef = useRef<number>(68);\n // typescript with debounce doesn't work well, so we need to disable the exhaustive deps rule here\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const setLongestWidth = React.useCallback(\n throttle(\n () => {\n const longest = Math.max(onLabelWidthRef.current, offLabelWidthRef.current);\n setWidth(longest);\n },\n 20,\n { leading: false, trailing: true },\n ),\n [],\n );\n const handleRefOnLabelWidth = React.useCallback<React.RefCallback<HTMLDivElement>>(\n (node) => {\n const { clientWidth } = node || {};\n onLabelWidthRef.current = clientWidth ?? onLabelWidthRef.current;\n setLongestWidth();\n },\n [setLongestWidth],\n );\n const handleRefOffLabelWidth = React.useCallback<React.RefCallback<HTMLDivElement>>(\n (node) => {\n const { clientWidth } = node || {};\n offLabelWidthRef.current = clientWidth ?? offLabelWidthRef.current;\n setLongestWidth();\n },\n [setLongestWidth],\n );\n return { width, handleRefOnLabelWidth, handleRefOffLabelWidth };\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,OAAOA,UAAS,UAAU,cAAc;AAUjC,MAAM,yBAAyB,MAAM;AAC1C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,CAAC;AAC5C,QAAM,kBAAkB,OAAe,EAAE;AACzC,QAAM,mBAAmB,OAAe,EAAE;AAG1C,QAAM,kBAAkBA,OAAM;AAAA,IAC5B;AAAA,MACE,MAAM;AACJ,cAAM,UAAU,KAAK,IAAI,gBAAgB,SAAS,iBAAiB,OAAO;AAC1E,iBAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA,EAAE,SAAS,OAAO,UAAU,KAAK;AAAA,IACnC;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,wBAAwBA,OAAM;AAAA,IAClC,CAAC,SAAS;AACR,YAAM,EAAE,YAAY,IAAI,QAAQ,CAAC;AACjC,sBAAgB,UAAU,eAAe,gBAAgB;AACzD,sBAAgB;AAAA,IAClB;AAAA,IACA,CAAC,eAAe;AAAA,EAClB;AACA,QAAM,yBAAyBA,OAAM;AAAA,IACnC,CAAC,SAAS;AACR,YAAM,EAAE,YAAY,IAAI,QAAQ,CAAC;AACjC,uBAAiB,UAAU,eAAe,iBAAiB;AAC3D,sBAAgB;AAAA,IAClB;AAAA,IACA,CAAC,eAAe;AAAA,EAClB;AACA,SAAO,EAAE,OAAO,uBAAuB,uBAAuB;AAChE;",
6
6
  "names": ["React"]
@@ -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 { 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 dsFormtoggleContainerWithRadiusShape: () => object;\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\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 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;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,wBAAwB,+BAA+B;AAkFvE,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,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 { 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\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 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;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,wBAAwB,+BAA+B;AAiFvE,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,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,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  const SlotPropsAsObject = {
3
- dsFormtoggleContainerWithRadiusShape: { "aria-label": "just a typescript test" },
4
3
  dsFormtoggleButtonContentWrapper: { "aria-label": "just a typescript test" },
5
4
  dsFormtoggleCircle: { "aria-label": "just a typescript test" },
6
5
  dsFormtoggleTextWrapper: { "aria-label": "just a typescript test" },
@@ -8,7 +7,6 @@ const SlotPropsAsObject = {
8
7
  dsFormtoggleToggleCheckbox: { "aria-label": "just a typescript test" }
9
8
  };
10
9
  const SlotPropsAsFunctions = {
11
- dsFormtoggleContainerWithRadiusShape: () => ({ "aria-label": "just a typescript test" }),
12
10
  dsFormtoggleButtonContentWrapper: () => ({ "aria-label": "just a typescript test" }),
13
11
  dsFormtoggleCircle: () => ({ "aria-label": "just a typescript test" }),
14
12
  dsFormtoggleTextWrapper: () => ({ "aria-label": "just a typescript test" }),