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

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
@@ -1,134 +0,0 @@
1
- import * as React from "react";
2
- import { styled, css, xStyledCommonProps } from "@elliemae/ds-system";
3
- import { DSButtonV3 } from "@elliemae/ds-button-v2";
4
- import { DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from "./constants/index.js";
5
- import {
6
- containerHeight,
7
- borderRadius,
8
- labelHeight,
9
- getInterpolatedBorderDsToggleColorByProps,
10
- getInterpolatedBgDsToggleColorByProps,
11
- circleValues,
12
- handleFontSize,
13
- margin,
14
- handleCursors
15
- } from "./utils/styleHelpers.js";
16
- const focusBorders = css`
17
- &:focus-within {
18
- &:after {
19
- content: '';
20
- top: -3px;
21
- right: -3px;
22
- bottom: -3px;
23
- left: -3px;
24
- border: 2px solid ${({ theme }) => theme.colors.brand["700"]};
25
- border-radius: 20px;
26
- position: absolute;
27
- }
28
- }
29
- `;
30
- const hoverStyled = css`
31
- background-color: ${({ $checked, theme }) => {
32
- if ($checked) return theme.colors.brand["800"];
33
- return theme.colors.neutral["600"];
34
- }};
35
-
36
- border-color: ${({ $checked, theme }) => {
37
- if ($checked) return theme.colors.brand["800"];
38
- return theme.colors.neutral["700"];
39
- }};
40
- `;
41
- const StyledContainer = styled("div", {
42
- name: DSControlledToggleName,
43
- slot: CONTROLLED_TOGGLE_SLOTS.CONTROLLED_CONTAINER
44
- })`
45
- display: inline-flex;
46
- width: fit-content;
47
- justify-content: center;
48
- align-items: center;
49
- height: ${({ $size }) => containerHeight[$size]};
50
- border-radius: ${({ $size }) => borderRadius[$size]};
51
- outline: none;
52
- position: relative;
53
- z-index: 0;
54
- border: 2px solid transparent;
55
- ${({ disabled }) => !disabled && focusBorders};
56
- ${xStyledCommonProps}
57
- `;
58
- const StyledRadiusShape = styled("div", {
59
- name: DSControlledToggleName,
60
- slot: CONTROLLED_TOGGLE_SLOTS.CONTAINER_WITH_RADIUS_SHAPE
61
- })`
62
- width: ${({ $width, $size }) => $width ? `calc(${$width}px + ${margin[$size]})` : "auto"};
63
- height: ${({ $size }) => labelHeight[$size]};
64
- z-index: 2;
65
- outline: none;
66
- border-radius: ${({ $size }) => labelHeight[$size]};
67
- `;
68
- const StyledButtonContentWrapper = styled("div", {
69
- name: DSControlledToggleName,
70
- slot: CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER
71
- })`
72
- display: flex;
73
- margin: 0;
74
- padding: 0;
75
- align-items: center;
76
- height: 100%;
77
- flex-direction: ${({ $checked }) => $checked ? "row-reverse" : "row"};
78
- border-radius: ${({ $size }) => `calc(${labelHeight[$size]} - 4px)`};
79
- border: ${(props) => props.$size === "s" ? `1px solid ${getInterpolatedBorderDsToggleColorByProps(props)}` : `
80
- 2px solid ${getInterpolatedBorderDsToggleColorByProps(props)}
81
- `};
82
- transition: background-color 0.2s;
83
- background-color: ${getInterpolatedBgDsToggleColorByProps};
84
- &:hover {
85
- cursor: ${({ $disabled, $applyAriaDisabled, $readOnly }) => handleCursors($disabled, $applyAriaDisabled, $readOnly)};
86
- ${({ $disabled, $applyAriaDisabled, $readOnly }) => !$disabled && !$applyAriaDisabled && !$readOnly && hoverStyled}
87
- }
88
- `;
89
- const StyledCircle = styled("div", {
90
- name: DSControlledToggleName,
91
- slot: CONTROLLED_TOGGLE_SLOTS.CIRCLE
92
- })`
93
- height: ${({ $size }) => circleValues[$size]};
94
- width: ${({ $size }) => circleValues[$size]};
95
- border-radius: 50%;
96
- background-color: ${({ theme, $readOnly, $applyAriaDisabled }) => $readOnly || $applyAriaDisabled ? theme.colors.neutral[100] : theme.colors.neutral["000"]};
97
- `;
98
- const StyledTextWrapper = styled("div", {
99
- name: DSControlledToggleName,
100
- slot: CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER
101
- })`
102
- flex-grow: 1;
103
- line-height: ${({ theme, $size }) => handleFontSize($size, theme)};
104
- font-size: ${({ theme, $size }) => handleFontSize($size, theme)};
105
- font-weight: ${({ theme }) => theme.fontWeights.semibold};
106
- color: ${({ theme, $disabled }) => $disabled ? "#5c6574" : theme.colors.neutral["000"]};
107
- `;
108
- const StyledButton = styled(DSButtonV3, {
109
- name: DSControlledToggleName,
110
- slot: CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX
111
- })`
112
- margin: 0;
113
- padding: 0;
114
- z-index: 20;
115
- border-radius: 20px;
116
- `;
117
- const SetLabelWidth = styled.div`
118
- font-size: ${({ theme, $size }) => handleFontSize($size, theme)};
119
- font-weight: ${({ theme }) => theme.fontWeights.semibold};
120
- width: auto;
121
- position: absolute;
122
- white-space: nowrap;
123
- visibility: hidden;
124
- `;
125
- export {
126
- SetLabelWidth,
127
- StyledButton,
128
- StyledButtonContentWrapper,
129
- StyledCircle,
130
- StyledContainer,
131
- StyledRadiusShape,
132
- StyledTextWrapper
133
- };
134
- //# sourceMappingURL=styles.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport type { DSControlledToggleT } from './react-desc-prop-types.js';\nimport { DSControlledToggleName, CONTROLLED_TOGGLE_SLOTS } from './constants/index.js';\nimport {\n containerHeight,\n borderRadius,\n labelHeight,\n getInterpolatedBorderDsToggleColorByProps,\n getInterpolatedBgDsToggleColorByProps,\n circleValues,\n handleFontSize,\n margin,\n handleCursors,\n} from './utils/styleHelpers.js';\n\nconst focusBorders = css`\n &:focus-within {\n &:after {\n content: '';\n top: -3px;\n right: -3px;\n bottom: -3px;\n left: -3px;\n border: 2px solid ${({ theme }) => theme.colors.brand['700']};\n border-radius: 20px;\n position: absolute;\n }\n }\n`;\n\nconst hoverStyled = css<{ $checked: boolean }>`\n background-color: ${({ $checked, theme }) => {\n if ($checked) return theme.colors.brand['800'];\n return theme.colors.neutral['600'];\n }};\n\n border-color: ${({ $checked, theme }) => {\n if ($checked) return theme.colors.brand['800'];\n return theme.colors.neutral['700'];\n }};\n`;\n\ninterface StyledContainerT {\n $size: DSControlledToggleT.ToggleSize;\n disabled: boolean;\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 border-radius: ${({ $size }) => borderRadius[$size]};\n outline: none;\n position: relative;\n z-index: 0;\n border: 2px solid transparent;\n ${({ disabled }) => !disabled && focusBorders};\n ${xStyledCommonProps}\n`;\ninterface StyledRadiusShapeT {\n $width: number;\n $size: DSControlledToggleT.ToggleSize;\n}\nexport const StyledRadiusShape = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.CONTAINER_WITH_RADIUS_SHAPE,\n})<StyledRadiusShapeT>`\n width: ${({ $width, $size }) => ($width ? `calc(${$width}px + ${margin[$size]})` : 'auto')};\n height: ${({ $size }) => labelHeight[$size]};\n z-index: 2;\n outline: none;\n border-radius: ${({ $size }) => labelHeight[$size]};\n`;\n\ninterface StyledButtonContentWrapperT {\n $checked: boolean;\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n}\nexport const StyledButtonContentWrapper = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER,\n})<StyledButtonContentWrapperT>`\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: ${({ $size }) => `calc(${labelHeight[$size]} - 4px)`};\n border: ${(props) =>\n props.$size === 's'\n ? `1px solid ${getInterpolatedBorderDsToggleColorByProps(props)}`\n : `\n 2px solid ${getInterpolatedBorderDsToggleColorByProps(props)}\n `};\n transition: background-color 0.2s;\n background-color: ${getInterpolatedBgDsToggleColorByProps};\n &:hover {\n cursor: ${({ $disabled, $applyAriaDisabled, $readOnly }) =>\n handleCursors($disabled, $applyAriaDisabled, $readOnly)};\n ${({ $disabled, $applyAriaDisabled, $readOnly }) => !$disabled && !$applyAriaDisabled && !$readOnly && hoverStyled}\n }\n`;\n\ninterface StyledCircleT {\n $size: DSControlledToggleT.ToggleSize;\n $readOnly: boolean;\n $applyAriaDisabled: boolean;\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 background-color: ${({ theme, $readOnly, $applyAriaDisabled }) =>\n $readOnly || $applyAriaDisabled ? theme.colors.neutral[100] : theme.colors.neutral['000']};\n`;\n\ninterface StyledTextWrapperT {\n $size: DSControlledToggleT.ToggleSize;\n $disabled: boolean;\n}\nexport const StyledTextWrapper = styled('div', {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER,\n})<StyledTextWrapperT>`\n flex-grow: 1;\n line-height: ${({ theme, $size }) => handleFontSize($size, theme)};\n font-size: ${({ theme, $size }) => handleFontSize($size, theme)};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n color: ${({ theme, $disabled }) => ($disabled ? '#5c6574' : theme.colors.neutral['000'])};\n`;\n\nexport const StyledButton = styled(DSButtonV3, {\n name: DSControlledToggleName,\n slot: CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX,\n})`\n margin: 0;\n padding: 0;\n z-index: 20;\n border-radius: 20px;\n`;\n\ninterface SetLabelWidthT {\n $size: DSControlledToggleT.ToggleSize;\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 SetLabelWidth = styled.div<SetLabelWidthT>`\n font-size: ${({ theme, $size }) => handleFontSize($size, theme)};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n width: auto;\n position: absolute;\n white-space: nowrap;\n visibility: hidden;\n`;\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
@@ -1,86 +0,0 @@
1
- import * as React from "react";
2
- import { th } from "@elliemae/ds-system";
3
- const getStyleState = ({
4
- $checked,
5
- $disabled,
6
- $applyAriaDisabled,
7
- $readOnly
8
- }) => {
9
- if ($disabled) return "disabled";
10
- if ($applyAriaDisabled) return "applyAriaDisabled";
11
- if ($readOnly) return "readOnly";
12
- if ($checked) return "checked";
13
- return "unchecked";
14
- };
15
- const circleValues = {
16
- s: "14px",
17
- m: "20px",
18
- l: "28px"
19
- };
20
- const margin = {
21
- s: "26px",
22
- m: "34px",
23
- l: "42px"
24
- };
25
- const containerHeight = {
26
- s: "20px",
27
- m: "28px",
28
- l: "36px"
29
- };
30
- const labelHeight = {
31
- s: "16px",
32
- m: "24px",
33
- l: "32px"
34
- };
35
- const borderRadius = {
36
- s: "16px",
37
- m: "20px",
38
- l: "22px"
39
- };
40
- const handleFontSize = (size, { fontSizes }) => {
41
- switch (size) {
42
- case "s":
43
- return fontSizes.microText[200];
44
- case "l":
45
- return "20px";
46
- case "m":
47
- default:
48
- return "15px";
49
- }
50
- };
51
- const bgColorsMap = {
52
- disabled: "neutral-100",
53
- applyAriaDisabled: "neutral-500",
54
- readOnly: "neutral-500",
55
- checked: "brand-600",
56
- unchecked: "neutral-500"
57
- };
58
- const getInterpolatedBgDSToggleColor = (styleState, props) => th.color(bgColorsMap[styleState])(props);
59
- const getInterpolatedBgDsToggleColorByProps = (props) => getInterpolatedBgDSToggleColor(getStyleState(props), props);
60
- const borderColorsMap = {
61
- disabled: "neutral-300",
62
- applyAriaDisabled: "neutral-500",
63
- readOnly: "neutral-500",
64
- checked: "brand-700",
65
- unchecked: "neutral-600"
66
- };
67
- const getInterpolatedBorderDSToggleColor = (styleState, props) => th.color(borderColorsMap[styleState])(props);
68
- const getInterpolatedBorderDsToggleColorByProps = (props) => getInterpolatedBorderDSToggleColor(getStyleState(props), props);
69
- const handleCursors = (disabled, applyAriaDisabled, readOnly) => {
70
- if (disabled) return "not-allowed";
71
- if (applyAriaDisabled) return "default";
72
- if (readOnly) return "default";
73
- return "pointer";
74
- };
75
- export {
76
- borderRadius,
77
- circleValues,
78
- containerHeight,
79
- getInterpolatedBgDsToggleColorByProps,
80
- getInterpolatedBorderDsToggleColorByProps,
81
- handleCursors,
82
- handleFontSize,
83
- labelHeight,
84
- margin
85
- };
86
- //# sourceMappingURL=styleHelpers.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/styleHelpers.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { th, type PropsWithTheme } from '@elliemae/ds-system';\nimport type { DSControlledToggleT } from '../react-desc-prop-types.js';\n\ntype StyleStateT = 'disabled' | 'applyAriaDisabled' | 'readOnly' | 'checked' | 'unchecked';\n\nconst getStyleState = ({\n $checked,\n $disabled,\n $applyAriaDisabled,\n $readOnly,\n}: PropsWithTheme<{\n $checked: boolean;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n}>): StyleStateT => {\n if ($disabled) return 'disabled';\n if ($applyAriaDisabled) return 'applyAriaDisabled';\n if ($readOnly) return 'readOnly';\n if ($checked) return 'checked';\n return 'unchecked';\n};\n\nexport const circleValues = {\n s: '14px',\n m: '20px',\n l: '28px',\n};\n\nexport const margin = {\n s: '26px',\n m: '34px',\n l: '42px',\n};\n\nexport const containerHeight = {\n s: '20px',\n m: '28px',\n l: '36px',\n};\n\nexport const labelHeight = {\n s: '16px',\n m: '24px',\n l: '32px',\n};\n\nexport const borderRadius = {\n s: '16px',\n m: '20px',\n l: '22px',\n};\n\nexport const handleFontSize = (\n size: DSControlledToggleT.ToggleSize,\n { fontSizes }: PropsWithTheme['theme'],\n): string => {\n switch (size) {\n case 's':\n return fontSizes.microText[200];\n case 'l':\n return '20px';\n case 'm':\n default:\n return '15px';\n }\n};\n\nconst bgColorsMap = {\n disabled: 'neutral-100',\n applyAriaDisabled: 'neutral-500',\n readOnly: 'neutral-500',\n checked: 'brand-600',\n unchecked: 'neutral-500',\n} as const;\n\nconst getInterpolatedBgDSToggleColor = (styleState: StyleStateT, props: PropsWithTheme) =>\n th.color(bgColorsMap[styleState])(props);\n\nexport const getInterpolatedBgDsToggleColorByProps = (\n props: PropsWithTheme<{\n $checked: boolean;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n }>,\n) => getInterpolatedBgDSToggleColor(getStyleState(props), props);\n\nconst borderColorsMap = {\n disabled: 'neutral-300',\n applyAriaDisabled: 'neutral-500',\n readOnly: 'neutral-500',\n checked: 'brand-700',\n unchecked: 'neutral-600',\n} as const;\n\nconst getInterpolatedBorderDSToggleColor = (styleState: StyleStateT, props: PropsWithTheme) =>\n th.color(borderColorsMap[styleState])(props);\n\nexport const getInterpolatedBorderDsToggleColorByProps = (\n props: PropsWithTheme<{\n $checked: boolean;\n $disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n }>,\n) => getInterpolatedBorderDSToggleColor(getStyleState(props), props);\n\nexport const handleCursors = (disabled: boolean, applyAriaDisabled: boolean, readOnly: boolean): string => {\n if (disabled) return 'not-allowed';\n if (applyAriaDisabled) return 'default';\n if (readOnly) return 'default';\n return 'pointer';\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAA+B;AAKxC,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKoB;AAClB,MAAI,UAAW,QAAO;AACtB,MAAI,mBAAoB,QAAO;AAC/B,MAAI,UAAW,QAAO;AACtB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAEO,MAAM,eAAe;AAAA,EAC1B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,SAAS;AAAA,EACpB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,kBAAkB;AAAA,EAC7B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,eAAe;AAAA,EAC1B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,iBAAiB,CAC5B,MACA,EAAE,UAAU,MACD;AACX,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,UAAU,UAAU,GAAG;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL;AACE,aAAO;AAAA,EACX;AACF;AAEA,MAAM,cAAc;AAAA,EAClB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AACb;AAEA,MAAM,iCAAiC,CAAC,YAAyB,UAC/D,GAAG,MAAM,YAAY,UAAU,CAAC,EAAE,KAAK;AAElC,MAAM,wCAAwC,CACnD,UAMG,+BAA+B,cAAc,KAAK,GAAG,KAAK;AAE/D,MAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AACb;AAEA,MAAM,qCAAqC,CAAC,YAAyB,UACnE,GAAG,MAAM,gBAAgB,UAAU,CAAC,EAAE,KAAK;AAEtC,MAAM,4CAA4C,CACvD,UAMG,mCAAmC,cAAc,KAAK,GAAG,KAAK;AAE5D,MAAM,gBAAgB,CAAC,UAAmB,mBAA4B,aAA8B;AACzG,MAAI,SAAU,QAAO;AACrB,MAAI,kBAAmB,QAAO;AAC9B,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,44 +0,0 @@
1
- import type { DSControlledToggleT } from './react-desc-prop-types.js';
2
- interface StyledContainerT {
3
- $size: DSControlledToggleT.ToggleSize;
4
- disabled: boolean;
5
- }
6
- 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
- interface StyledRadiusShapeT {
8
- $width: number;
9
- $size: DSControlledToggleT.ToggleSize;
10
- }
11
- export declare const StyledRadiusShape: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledRadiusShapeT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
12
- interface StyledButtonContentWrapperT {
13
- $checked: boolean;
14
- $size: DSControlledToggleT.ToggleSize;
15
- $disabled: boolean;
16
- $applyAriaDisabled: boolean;
17
- $readOnly: boolean;
18
- }
19
- export declare const StyledButtonContentWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledButtonContentWrapperT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
20
- interface StyledCircleT {
21
- $size: DSControlledToggleT.ToggleSize;
22
- $readOnly: boolean;
23
- $applyAriaDisabled: boolean;
24
- }
25
- 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>;
26
- interface StyledTextWrapperT {
27
- $size: DSControlledToggleT.ToggleSize;
28
- $disabled: boolean;
29
- }
30
- export declare const StyledTextWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledTextWrapperT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
31
- export declare const StyledButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV3T.Props>>, never>;
32
- interface SetLabelWidthT {
33
- $size: DSControlledToggleT.ToggleSize;
34
- }
35
- /**
36
- * This should not be required, we are doing this to keep the wcagViolationLabelOn/wcagViolationLabelOff working
37
- * 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
38
- *
39
- * ---
40
- *
41
- * 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
42
- */
43
- export declare const SetLabelWidth: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, SetLabelWidthT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
44
- export {};
@@ -1,41 +0,0 @@
1
- import { type PropsWithTheme } from '@elliemae/ds-system';
2
- import type { DSControlledToggleT } from '../react-desc-prop-types.js';
3
- export declare const circleValues: {
4
- s: string;
5
- m: string;
6
- l: string;
7
- };
8
- export declare const margin: {
9
- s: string;
10
- m: string;
11
- l: string;
12
- };
13
- export declare const containerHeight: {
14
- s: string;
15
- m: string;
16
- l: string;
17
- };
18
- export declare const labelHeight: {
19
- s: string;
20
- m: string;
21
- l: string;
22
- };
23
- export declare const borderRadius: {
24
- s: string;
25
- m: string;
26
- l: string;
27
- };
28
- export declare const handleFontSize: (size: DSControlledToggleT.ToggleSize, { fontSizes }: PropsWithTheme["theme"]) => string;
29
- export declare const getInterpolatedBgDsToggleColorByProps: (props: PropsWithTheme<{
30
- $checked: boolean;
31
- $disabled: boolean;
32
- $applyAriaDisabled: boolean;
33
- $readOnly: boolean;
34
- }>) => string;
35
- export declare const getInterpolatedBorderDsToggleColorByProps: (props: PropsWithTheme<{
36
- $checked: boolean;
37
- $disabled: boolean;
38
- $applyAriaDisabled: boolean;
39
- $readOnly: boolean;
40
- }>) => string;
41
- export declare const handleCursors: (disabled: boolean, applyAriaDisabled: boolean, readOnly: boolean) => string;