@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.
- package/dist/cjs/DSControlledToggle.js +50 -0
- package/dist/cjs/DSControlledToggle.js.map +7 -0
- package/dist/cjs/DSControlledToggleCTX.js +40 -0
- package/dist/cjs/DSControlledToggleCTX.js.map +7 -0
- package/dist/cjs/config/useDSControlledToggle.js +2 -17
- package/dist/cjs/config/useDSControlledToggle.js.map +2 -2
- package/dist/cjs/constants/index.js +0 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/Button.js +102 -0
- package/dist/cjs/parts/Button.js.map +7 -0
- package/dist/cjs/parts/Container.js +61 -0
- package/dist/cjs/parts/Container.js.map +7 -0
- package/dist/cjs/parts/styles/styles.js +246 -0
- package/dist/cjs/parts/styles/styles.js.map +7 -0
- package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js +110 -0
- package/dist/cjs/parts/wcagViolation/Button.wcagViolationLabels.js.map +7 -0
- package/dist/cjs/{config → parts/wcagViolation}/useGetWidestLabelWidth.js.map +1 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +0 -2
- package/dist/cjs/typescript-testing/slot-props.js.map +2 -2
- package/dist/esm/DSControlledToggle.js +20 -0
- package/dist/esm/DSControlledToggle.js.map +7 -0
- package/dist/esm/DSControlledToggleCTX.js +10 -0
- package/dist/esm/DSControlledToggleCTX.js.map +7 -0
- package/dist/esm/config/useDSControlledToggle.js +2 -17
- package/dist/esm/config/useDSControlledToggle.js.map +2 -2
- package/dist/esm/constants/index.js +0 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/parts/Button.js +72 -0
- package/dist/esm/parts/Button.js.map +7 -0
- package/dist/esm/parts/Container.js +31 -0
- package/dist/esm/parts/Container.js.map +7 -0
- package/dist/esm/parts/styles/styles.js +216 -0
- package/dist/esm/parts/styles/styles.js.map +7 -0
- package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js +86 -0
- package/dist/esm/parts/wcagViolation/Button.wcagViolationLabels.js.map +7 -0
- package/dist/esm/{config → parts/wcagViolation}/useGetWidestLabelWidth.js.map +1 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +0 -2
- package/dist/esm/typescript-testing/slot-props.js.map +2 -2
- package/dist/types/DSControlledToggleCTX.d.ts +4 -0
- package/dist/types/config/useDSControlledToggle.d.ts +8 -373
- package/dist/types/constants/index.d.ts +0 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/parts/Button.d.ts +3 -0
- package/dist/types/parts/Container.d.ts +1 -0
- package/dist/types/parts/styles/styles.d.ts +37 -0
- package/dist/types/parts/wcagViolation/Button.wcagViolationLabels.d.ts +3 -0
- package/dist/types/react-desc-prop-types.d.ts +0 -1
- package/package.json +8 -7
- package/dist/cjs/ControlledToggle.js +0 -127
- package/dist/cjs/ControlledToggle.js.map +0 -7
- package/dist/cjs/styles.js +0 -154
- package/dist/cjs/styles.js.map +0 -7
- package/dist/cjs/utils/styleHelpers.js +0 -116
- package/dist/cjs/utils/styleHelpers.js.map +0 -7
- package/dist/esm/ControlledToggle.js +0 -105
- package/dist/esm/ControlledToggle.js.map +0 -7
- package/dist/esm/styles.js +0 -134
- package/dist/esm/styles.js.map +0 -7
- package/dist/esm/utils/styleHelpers.js +0 -86
- package/dist/esm/utils/styleHelpers.js.map +0 -7
- package/dist/types/styles.d.ts +0 -44
- package/dist/types/utils/styleHelpers.d.ts +0 -41
- /package/dist/cjs/{config → parts/wcagViolation}/useGetWidestLabelWidth.js +0 -0
- /package/dist/esm/{config → parts/wcagViolation}/useGetWidestLabelWidth.js +0 -0
- /package/dist/types/{ControlledToggle.d.ts → DSControlledToggle.d.ts} +0 -0
- /package/dist/types/{config → parts/wcagViolation}/useGetWidestLabelWidth.d.ts +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var ControlledToggle_exports = {};
|
|
30
|
-
__export(ControlledToggle_exports, {
|
|
31
|
-
DSControlledToggle: () => DSControlledToggle,
|
|
32
|
-
DSControlledToggleWithSchema: () => DSControlledToggleWithSchema
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ControlledToggle_exports);
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
-
var import_useDSControlledToggle = require("./config/useDSControlledToggle.js");
|
|
39
|
-
var import_constants = require("./constants/index.js");
|
|
40
|
-
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
|
-
var import_styles = require("./styles.js");
|
|
42
|
-
const DSControlledToggle = (props) => {
|
|
43
|
-
const { propsWithDefault, xstyledProps, width, handleRefOnLabelWidth, handleRefOffLabelWidth, buttonProps } = (0, import_useDSControlledToggle.useDSControlledToggle)(props);
|
|
44
|
-
const {
|
|
45
|
-
wcagViolationLabelOn,
|
|
46
|
-
wcagViolationLabelOff,
|
|
47
|
-
checked,
|
|
48
|
-
size,
|
|
49
|
-
containerProps,
|
|
50
|
-
disabled,
|
|
51
|
-
applyAriaDisabled,
|
|
52
|
-
readOnly
|
|
53
|
-
} = propsWithDefault;
|
|
54
|
-
const { getOwnerProps, getOwnerPropsArguments } = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault);
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
-
import_styles.StyledContainer,
|
|
57
|
-
{
|
|
58
|
-
$size: size,
|
|
59
|
-
"data-testid": import_constants.CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER,
|
|
60
|
-
...containerProps,
|
|
61
|
-
...xstyledProps,
|
|
62
|
-
disabled,
|
|
63
|
-
getOwnerProps,
|
|
64
|
-
getOwnerPropsArguments,
|
|
65
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
66
|
-
import_styles.StyledButton,
|
|
67
|
-
{
|
|
68
|
-
...readOnly ? { "aria-readonly": "true" } : {},
|
|
69
|
-
...buttonProps,
|
|
70
|
-
getOwnerProps,
|
|
71
|
-
getOwnerPropsArguments,
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
import_styles.StyledRadiusShape,
|
|
75
|
-
{
|
|
76
|
-
$size: size,
|
|
77
|
-
$width: width,
|
|
78
|
-
getOwnerProps,
|
|
79
|
-
getOwnerPropsArguments,
|
|
80
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
81
|
-
import_styles.StyledButtonContentWrapper,
|
|
82
|
-
{
|
|
83
|
-
$checked: checked,
|
|
84
|
-
$size: size,
|
|
85
|
-
$readOnly: readOnly,
|
|
86
|
-
$disabled: disabled,
|
|
87
|
-
$applyAriaDisabled: applyAriaDisabled,
|
|
88
|
-
getOwnerProps,
|
|
89
|
-
getOwnerPropsArguments,
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
-
import_styles.StyledCircle,
|
|
93
|
-
{
|
|
94
|
-
$size: size,
|
|
95
|
-
$readOnly: readOnly,
|
|
96
|
-
$applyAriaDisabled: applyAriaDisabled,
|
|
97
|
-
getOwnerProps,
|
|
98
|
-
getOwnerPropsArguments
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
-
import_styles.StyledTextWrapper,
|
|
103
|
-
{
|
|
104
|
-
$size: size,
|
|
105
|
-
$disabled: disabled,
|
|
106
|
-
getOwnerProps,
|
|
107
|
-
getOwnerPropsArguments,
|
|
108
|
-
children: checked ? wcagViolationLabelOn ?? "ON" : wcagViolationLabelOff ?? "OFF"
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.SetLabelWidth, { $size: size, innerRef: handleRefOnLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOn ?? "ON" }),
|
|
117
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.SetLabelWidth, { $size: size, innerRef: handleRefOffLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOff ?? "OFF" })
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
DSControlledToggle.displayName = import_constants.DSControlledToggleName;
|
|
125
|
-
const DSControlledToggleWithSchema = (0, import_ds_props_helpers.describe)(DSControlledToggle);
|
|
126
|
-
DSControlledToggleWithSchema.propTypes = import_react_desc_prop_types.DSControlledTogglePropTypesSchema;
|
|
127
|
-
//# sourceMappingURL=ControlledToggle.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ControlledToggle.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { describe, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { useDSControlledToggle } from './config/useDSControlledToggle.js';\nimport { CONTROLLED_TOGGLE_DATA_TESTID, DSControlledToggleName } from './constants/index.js';\nimport { DSControlledTogglePropTypesSchema, type DSControlledToggleT } from './react-desc-prop-types.js';\nimport {\n SetLabelWidth,\n StyledButton,\n StyledButtonContentWrapper,\n StyledCircle,\n StyledContainer,\n StyledRadiusShape,\n StyledTextWrapper,\n} from './styles.js';\n\nconst DSControlledToggle: React.ComponentType<DSControlledToggleT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, width, handleRefOnLabelWidth, handleRefOffLabelWidth, buttonProps } =\n useDSControlledToggle(props);\n const {\n wcagViolationLabelOn,\n wcagViolationLabelOff,\n checked,\n size,\n containerProps,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n $size={size}\n data-testid={CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER}\n {...containerProps}\n {...xstyledProps}\n disabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\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 getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledRadiusShape\n $size={size}\n $width={width}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledButtonContentWrapper\n $checked={checked}\n $size={size}\n $readOnly={readOnly}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCircle\n $size={size}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n <StyledTextWrapper\n $size={size}\n $disabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {checked ? (wcagViolationLabelOn ?? 'ON') : (wcagViolationLabelOff ?? 'OFF')}\n </StyledTextWrapper>\n </StyledButtonContentWrapper>\n </StyledRadiusShape>\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 </StyledContainer>\n );\n};\n\nDSControlledToggle.displayName = DSControlledToggleName;\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = DSControlledTogglePropTypesSchema;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqDb;AArDV,8BAAwC;AAExC,mCAAsC;AACtC,uBAAsE;AACtE,mCAA4E;AAC5E,oBAQO;AAEP,MAAM,qBAAqE,CAAC,UAAU;AACpF,QAAM,EAAE,kBAAkB,cAAc,OAAO,uBAAuB,wBAAwB,YAAY,QACxG,oDAAsB,KAAK;AAC7B,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,QAAI,uCAAc,gBAAgB;AAEhF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,eAAa,+CAA8B;AAAA,MAC1C,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UAEE,GAAI,WAAW,EAAE,iBAAiB,OAAO,IAAI,CAAC;AAAA,UAC9C,GAAG;AAAA,UACJ;AAAA,UACA;AAAA,UAEA;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBAEA;AAAA,kBAAC;AAAA;AAAA,oBACC,UAAU;AAAA,oBACV,OAAO;AAAA,oBACP,WAAW;AAAA,oBACX,WAAW;AAAA,oBACX,oBAAoB;AAAA,oBACpB;AAAA,oBACA;AAAA,oBAEA;AAAA;AAAA,wBAAC;AAAA;AAAA,0BACC,OAAO;AAAA,0BACP,WAAW;AAAA,0BACX,oBAAoB;AAAA,0BACpB;AAAA,0BACA;AAAA;AAAA,sBACF;AAAA,sBACA;AAAA,wBAAC;AAAA;AAAA,0BACC,OAAO;AAAA,0BACP,WAAW;AAAA,0BACX;AAAA,0BACA;AAAA,0BAEC,oBAAW,wBAAwB,OAAS,yBAAyB;AAAA;AAAA,sBACxE;AAAA;AAAA;AAAA,gBACF;AAAA;AAAA,YACF;AAAA,YACA,4CAAC,+BAAc,OAAO,MAAM,UAAU,uBAAuB,eAAY,QACtE,kCAAwB,MAC3B;AAAA,YACA,4CAAC,+BAAc,OAAO,MAAM,UAAU,wBAAwB,eAAY,QACvE,mCAAyB,OAC5B;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,kCAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/styles.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var styles_exports = {};
|
|
30
|
-
__export(styles_exports, {
|
|
31
|
-
SetLabelWidth: () => SetLabelWidth,
|
|
32
|
-
StyledButton: () => StyledButton,
|
|
33
|
-
StyledButtonContentWrapper: () => StyledButtonContentWrapper,
|
|
34
|
-
StyledCircle: () => StyledCircle,
|
|
35
|
-
StyledContainer: () => StyledContainer,
|
|
36
|
-
StyledRadiusShape: () => StyledRadiusShape,
|
|
37
|
-
StyledTextWrapper: () => StyledTextWrapper
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(styles_exports);
|
|
40
|
-
var React = __toESM(require("react"));
|
|
41
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
42
|
-
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
43
|
-
var import_constants = require("./constants/index.js");
|
|
44
|
-
var import_styleHelpers = require("./utils/styleHelpers.js");
|
|
45
|
-
const focusBorders = import_ds_system.css`
|
|
46
|
-
&:focus-within {
|
|
47
|
-
&:after {
|
|
48
|
-
content: '';
|
|
49
|
-
top: -3px;
|
|
50
|
-
right: -3px;
|
|
51
|
-
bottom: -3px;
|
|
52
|
-
left: -3px;
|
|
53
|
-
border: 2px solid ${({ theme }) => theme.colors.brand["700"]};
|
|
54
|
-
border-radius: 20px;
|
|
55
|
-
position: absolute;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const hoverStyled = import_ds_system.css`
|
|
60
|
-
background-color: ${({ $checked, theme }) => {
|
|
61
|
-
if ($checked) return theme.colors.brand["800"];
|
|
62
|
-
return theme.colors.neutral["600"];
|
|
63
|
-
}};
|
|
64
|
-
|
|
65
|
-
border-color: ${({ $checked, theme }) => {
|
|
66
|
-
if ($checked) return theme.colors.brand["800"];
|
|
67
|
-
return theme.colors.neutral["700"];
|
|
68
|
-
}};
|
|
69
|
-
`;
|
|
70
|
-
const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
71
|
-
name: import_constants.DSControlledToggleName,
|
|
72
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.CONTROLLED_CONTAINER
|
|
73
|
-
})`
|
|
74
|
-
display: inline-flex;
|
|
75
|
-
width: fit-content;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
align-items: center;
|
|
78
|
-
height: ${({ $size }) => import_styleHelpers.containerHeight[$size]};
|
|
79
|
-
border-radius: ${({ $size }) => import_styleHelpers.borderRadius[$size]};
|
|
80
|
-
outline: none;
|
|
81
|
-
position: relative;
|
|
82
|
-
z-index: 0;
|
|
83
|
-
border: 2px solid transparent;
|
|
84
|
-
${({ disabled }) => !disabled && focusBorders};
|
|
85
|
-
${import_ds_system.xStyledCommonProps}
|
|
86
|
-
`;
|
|
87
|
-
const StyledRadiusShape = (0, import_ds_system.styled)("div", {
|
|
88
|
-
name: import_constants.DSControlledToggleName,
|
|
89
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.CONTAINER_WITH_RADIUS_SHAPE
|
|
90
|
-
})`
|
|
91
|
-
width: ${({ $width, $size }) => $width ? `calc(${$width}px + ${import_styleHelpers.margin[$size]})` : "auto"};
|
|
92
|
-
height: ${({ $size }) => import_styleHelpers.labelHeight[$size]};
|
|
93
|
-
z-index: 2;
|
|
94
|
-
outline: none;
|
|
95
|
-
border-radius: ${({ $size }) => import_styleHelpers.labelHeight[$size]};
|
|
96
|
-
`;
|
|
97
|
-
const StyledButtonContentWrapper = (0, import_ds_system.styled)("div", {
|
|
98
|
-
name: import_constants.DSControlledToggleName,
|
|
99
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.BUTTON_CONTENT_WRAPPER
|
|
100
|
-
})`
|
|
101
|
-
display: flex;
|
|
102
|
-
margin: 0;
|
|
103
|
-
padding: 0;
|
|
104
|
-
align-items: center;
|
|
105
|
-
height: 100%;
|
|
106
|
-
flex-direction: ${({ $checked }) => $checked ? "row-reverse" : "row"};
|
|
107
|
-
border-radius: ${({ $size }) => `calc(${import_styleHelpers.labelHeight[$size]} - 4px)`};
|
|
108
|
-
border: ${(props) => props.$size === "s" ? `1px solid ${(0, import_styleHelpers.getInterpolatedBorderDsToggleColorByProps)(props)}` : `
|
|
109
|
-
2px solid ${(0, import_styleHelpers.getInterpolatedBorderDsToggleColorByProps)(props)}
|
|
110
|
-
`};
|
|
111
|
-
transition: background-color 0.2s;
|
|
112
|
-
background-color: ${import_styleHelpers.getInterpolatedBgDsToggleColorByProps};
|
|
113
|
-
&:hover {
|
|
114
|
-
cursor: ${({ $disabled, $applyAriaDisabled, $readOnly }) => (0, import_styleHelpers.handleCursors)($disabled, $applyAriaDisabled, $readOnly)};
|
|
115
|
-
${({ $disabled, $applyAriaDisabled, $readOnly }) => !$disabled && !$applyAriaDisabled && !$readOnly && hoverStyled}
|
|
116
|
-
}
|
|
117
|
-
`;
|
|
118
|
-
const StyledCircle = (0, import_ds_system.styled)("div", {
|
|
119
|
-
name: import_constants.DSControlledToggleName,
|
|
120
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.CIRCLE
|
|
121
|
-
})`
|
|
122
|
-
height: ${({ $size }) => import_styleHelpers.circleValues[$size]};
|
|
123
|
-
width: ${({ $size }) => import_styleHelpers.circleValues[$size]};
|
|
124
|
-
border-radius: 50%;
|
|
125
|
-
background-color: ${({ theme, $readOnly, $applyAriaDisabled }) => $readOnly || $applyAriaDisabled ? theme.colors.neutral[100] : theme.colors.neutral["000"]};
|
|
126
|
-
`;
|
|
127
|
-
const StyledTextWrapper = (0, import_ds_system.styled)("div", {
|
|
128
|
-
name: import_constants.DSControlledToggleName,
|
|
129
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.TEXT_WRAPPER
|
|
130
|
-
})`
|
|
131
|
-
flex-grow: 1;
|
|
132
|
-
line-height: ${({ theme, $size }) => (0, import_styleHelpers.handleFontSize)($size, theme)};
|
|
133
|
-
font-size: ${({ theme, $size }) => (0, import_styleHelpers.handleFontSize)($size, theme)};
|
|
134
|
-
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
135
|
-
color: ${({ theme, $disabled }) => $disabled ? "#5c6574" : theme.colors.neutral["000"]};
|
|
136
|
-
`;
|
|
137
|
-
const StyledButton = (0, import_ds_system.styled)(import_ds_button_v2.DSButtonV3, {
|
|
138
|
-
name: import_constants.DSControlledToggleName,
|
|
139
|
-
slot: import_constants.CONTROLLED_TOGGLE_SLOTS.TOGGLE_CHECKBOX
|
|
140
|
-
})`
|
|
141
|
-
margin: 0;
|
|
142
|
-
padding: 0;
|
|
143
|
-
z-index: 20;
|
|
144
|
-
border-radius: 20px;
|
|
145
|
-
`;
|
|
146
|
-
const SetLabelWidth = import_ds_system.styled.div`
|
|
147
|
-
font-size: ${({ theme, $size }) => (0, import_styleHelpers.handleFontSize)($size, theme)};
|
|
148
|
-
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
149
|
-
width: auto;
|
|
150
|
-
position: absolute;
|
|
151
|
-
white-space: nowrap;
|
|
152
|
-
visibility: hidden;
|
|
153
|
-
`;
|
|
154
|
-
//# sourceMappingURL=styles.js.map
|
package/dist/cjs/styles.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAgD;AAChD,0BAA2B;AAE3B,uBAAgE;AAChE,0BAUO;AAEP,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAQK,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlE,MAAM,cAAc;AAA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M,oCAAe,OAAO,KAAK,CAAC;AAAA,iBAChD,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var styleHelpers_exports = {};
|
|
30
|
-
__export(styleHelpers_exports, {
|
|
31
|
-
borderRadius: () => borderRadius,
|
|
32
|
-
circleValues: () => circleValues,
|
|
33
|
-
containerHeight: () => containerHeight,
|
|
34
|
-
getInterpolatedBgDsToggleColorByProps: () => getInterpolatedBgDsToggleColorByProps,
|
|
35
|
-
getInterpolatedBorderDsToggleColorByProps: () => getInterpolatedBorderDsToggleColorByProps,
|
|
36
|
-
handleCursors: () => handleCursors,
|
|
37
|
-
handleFontSize: () => handleFontSize,
|
|
38
|
-
labelHeight: () => labelHeight,
|
|
39
|
-
margin: () => margin
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(styleHelpers_exports);
|
|
42
|
-
var React = __toESM(require("react"));
|
|
43
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
44
|
-
const getStyleState = ({
|
|
45
|
-
$checked,
|
|
46
|
-
$disabled,
|
|
47
|
-
$applyAriaDisabled,
|
|
48
|
-
$readOnly
|
|
49
|
-
}) => {
|
|
50
|
-
if ($disabled) return "disabled";
|
|
51
|
-
if ($applyAriaDisabled) return "applyAriaDisabled";
|
|
52
|
-
if ($readOnly) return "readOnly";
|
|
53
|
-
if ($checked) return "checked";
|
|
54
|
-
return "unchecked";
|
|
55
|
-
};
|
|
56
|
-
const circleValues = {
|
|
57
|
-
s: "14px",
|
|
58
|
-
m: "20px",
|
|
59
|
-
l: "28px"
|
|
60
|
-
};
|
|
61
|
-
const margin = {
|
|
62
|
-
s: "26px",
|
|
63
|
-
m: "34px",
|
|
64
|
-
l: "42px"
|
|
65
|
-
};
|
|
66
|
-
const containerHeight = {
|
|
67
|
-
s: "20px",
|
|
68
|
-
m: "28px",
|
|
69
|
-
l: "36px"
|
|
70
|
-
};
|
|
71
|
-
const labelHeight = {
|
|
72
|
-
s: "16px",
|
|
73
|
-
m: "24px",
|
|
74
|
-
l: "32px"
|
|
75
|
-
};
|
|
76
|
-
const borderRadius = {
|
|
77
|
-
s: "16px",
|
|
78
|
-
m: "20px",
|
|
79
|
-
l: "22px"
|
|
80
|
-
};
|
|
81
|
-
const handleFontSize = (size, { fontSizes }) => {
|
|
82
|
-
switch (size) {
|
|
83
|
-
case "s":
|
|
84
|
-
return fontSizes.microText[200];
|
|
85
|
-
case "l":
|
|
86
|
-
return "20px";
|
|
87
|
-
case "m":
|
|
88
|
-
default:
|
|
89
|
-
return "15px";
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const bgColorsMap = {
|
|
93
|
-
disabled: "neutral-100",
|
|
94
|
-
applyAriaDisabled: "neutral-500",
|
|
95
|
-
readOnly: "neutral-500",
|
|
96
|
-
checked: "brand-600",
|
|
97
|
-
unchecked: "neutral-500"
|
|
98
|
-
};
|
|
99
|
-
const getInterpolatedBgDSToggleColor = (styleState, props) => import_ds_system.th.color(bgColorsMap[styleState])(props);
|
|
100
|
-
const getInterpolatedBgDsToggleColorByProps = (props) => getInterpolatedBgDSToggleColor(getStyleState(props), props);
|
|
101
|
-
const borderColorsMap = {
|
|
102
|
-
disabled: "neutral-300",
|
|
103
|
-
applyAriaDisabled: "neutral-500",
|
|
104
|
-
readOnly: "neutral-500",
|
|
105
|
-
checked: "brand-700",
|
|
106
|
-
unchecked: "neutral-600"
|
|
107
|
-
};
|
|
108
|
-
const getInterpolatedBorderDSToggleColor = (styleState, props) => import_ds_system.th.color(borderColorsMap[styleState])(props);
|
|
109
|
-
const getInterpolatedBorderDsToggleColorByProps = (props) => getInterpolatedBorderDSToggleColor(getStyleState(props), props);
|
|
110
|
-
const handleCursors = (disabled, applyAriaDisabled, readOnly) => {
|
|
111
|
-
if (disabled) return "not-allowed";
|
|
112
|
-
if (applyAriaDisabled) return "default";
|
|
113
|
-
if (readOnly) return "default";
|
|
114
|
-
return "pointer";
|
|
115
|
-
};
|
|
116
|
-
//# sourceMappingURL=styleHelpers.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/styleHelpers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;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,oBAAG,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,oBAAG,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,105 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { describe, useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
4
|
-
import { useDSControlledToggle } from "./config/useDSControlledToggle.js";
|
|
5
|
-
import { CONTROLLED_TOGGLE_DATA_TESTID, DSControlledToggleName } from "./constants/index.js";
|
|
6
|
-
import { DSControlledTogglePropTypesSchema } from "./react-desc-prop-types.js";
|
|
7
|
-
import {
|
|
8
|
-
SetLabelWidth,
|
|
9
|
-
StyledButton,
|
|
10
|
-
StyledButtonContentWrapper,
|
|
11
|
-
StyledCircle,
|
|
12
|
-
StyledContainer,
|
|
13
|
-
StyledRadiusShape,
|
|
14
|
-
StyledTextWrapper
|
|
15
|
-
} from "./styles.js";
|
|
16
|
-
const DSControlledToggle = (props) => {
|
|
17
|
-
const { propsWithDefault, xstyledProps, width, handleRefOnLabelWidth, handleRefOffLabelWidth, buttonProps } = useDSControlledToggle(props);
|
|
18
|
-
const {
|
|
19
|
-
wcagViolationLabelOn,
|
|
20
|
-
wcagViolationLabelOff,
|
|
21
|
-
checked,
|
|
22
|
-
size,
|
|
23
|
-
containerProps,
|
|
24
|
-
disabled,
|
|
25
|
-
applyAriaDisabled,
|
|
26
|
-
readOnly
|
|
27
|
-
} = propsWithDefault;
|
|
28
|
-
const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);
|
|
29
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
-
StyledContainer,
|
|
31
|
-
{
|
|
32
|
-
$size: size,
|
|
33
|
-
"data-testid": CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER,
|
|
34
|
-
...containerProps,
|
|
35
|
-
...xstyledProps,
|
|
36
|
-
disabled,
|
|
37
|
-
getOwnerProps,
|
|
38
|
-
getOwnerPropsArguments,
|
|
39
|
-
children: /* @__PURE__ */ jsxs(
|
|
40
|
-
StyledButton,
|
|
41
|
-
{
|
|
42
|
-
...readOnly ? { "aria-readonly": "true" } : {},
|
|
43
|
-
...buttonProps,
|
|
44
|
-
getOwnerProps,
|
|
45
|
-
getOwnerPropsArguments,
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
StyledRadiusShape,
|
|
49
|
-
{
|
|
50
|
-
$size: size,
|
|
51
|
-
$width: width,
|
|
52
|
-
getOwnerProps,
|
|
53
|
-
getOwnerPropsArguments,
|
|
54
|
-
children: /* @__PURE__ */ jsxs(
|
|
55
|
-
StyledButtonContentWrapper,
|
|
56
|
-
{
|
|
57
|
-
$checked: checked,
|
|
58
|
-
$size: size,
|
|
59
|
-
$readOnly: readOnly,
|
|
60
|
-
$disabled: disabled,
|
|
61
|
-
$applyAriaDisabled: applyAriaDisabled,
|
|
62
|
-
getOwnerProps,
|
|
63
|
-
getOwnerPropsArguments,
|
|
64
|
-
children: [
|
|
65
|
-
/* @__PURE__ */ jsx(
|
|
66
|
-
StyledCircle,
|
|
67
|
-
{
|
|
68
|
-
$size: size,
|
|
69
|
-
$readOnly: readOnly,
|
|
70
|
-
$applyAriaDisabled: applyAriaDisabled,
|
|
71
|
-
getOwnerProps,
|
|
72
|
-
getOwnerPropsArguments
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ jsx(
|
|
76
|
-
StyledTextWrapper,
|
|
77
|
-
{
|
|
78
|
-
$size: size,
|
|
79
|
-
$disabled: disabled,
|
|
80
|
-
getOwnerProps,
|
|
81
|
-
getOwnerPropsArguments,
|
|
82
|
-
children: checked ? wcagViolationLabelOn ?? "ON" : wcagViolationLabelOff ?? "OFF"
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
),
|
|
90
|
-
/* @__PURE__ */ jsx(SetLabelWidth, { $size: size, innerRef: handleRefOnLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOn ?? "ON" }),
|
|
91
|
-
/* @__PURE__ */ jsx(SetLabelWidth, { $size: size, innerRef: handleRefOffLabelWidth, "aria-hidden": "true", children: wcagViolationLabelOff ?? "OFF" })
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
DSControlledToggle.displayName = DSControlledToggleName;
|
|
99
|
-
const DSControlledToggleWithSchema = describe(DSControlledToggle);
|
|
100
|
-
DSControlledToggleWithSchema.propTypes = DSControlledTogglePropTypesSchema;
|
|
101
|
-
export {
|
|
102
|
-
DSControlledToggle,
|
|
103
|
-
DSControlledToggleWithSchema
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=ControlledToggle.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledToggle.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { useDSControlledToggle } from './config/useDSControlledToggle.js';\nimport { CONTROLLED_TOGGLE_DATA_TESTID, DSControlledToggleName } from './constants/index.js';\nimport { DSControlledTogglePropTypesSchema, type DSControlledToggleT } from './react-desc-prop-types.js';\nimport {\n SetLabelWidth,\n StyledButton,\n StyledButtonContentWrapper,\n StyledCircle,\n StyledContainer,\n StyledRadiusShape,\n StyledTextWrapper,\n} from './styles.js';\n\nconst DSControlledToggle: React.ComponentType<DSControlledToggleT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, width, handleRefOnLabelWidth, handleRefOffLabelWidth, buttonProps } =\n useDSControlledToggle(props);\n const {\n wcagViolationLabelOn,\n wcagViolationLabelOff,\n checked,\n size,\n containerProps,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n $size={size}\n data-testid={CONTROLLED_TOGGLE_DATA_TESTID.CONTROLLED_CONTAINER}\n {...containerProps}\n {...xstyledProps}\n disabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\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 getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledRadiusShape\n $size={size}\n $width={width}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledButtonContentWrapper\n $checked={checked}\n $size={size}\n $readOnly={readOnly}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCircle\n $size={size}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n <StyledTextWrapper\n $size={size}\n $disabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {checked ? (wcagViolationLabelOn ?? 'ON') : (wcagViolationLabelOff ?? 'OFF')}\n </StyledTextWrapper>\n </StyledButtonContentWrapper>\n </StyledRadiusShape>\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 </StyledContainer>\n );\n};\n\nDSControlledToggle.displayName = DSControlledToggleName;\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = DSControlledTogglePropTypesSchema;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACqDb,SASE,KATF;AArDV,SAAS,UAAU,qBAAqB;AAExC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B,8BAA8B;AACtE,SAAS,yCAAmE;AAC5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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