@elliemae/ds-form-toggle 3.12.0-rc.2 → 3.12.0-rc.4

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.
@@ -36,9 +36,10 @@ var import_ds_utilities = require("@elliemae/ds-utilities");
36
36
  var import_propTypes = require("./propTypes");
37
37
  var import_styles = require("./styles");
38
38
  var import_addTooltipOnReadOnly = require("./utils/addTooltipOnReadOnly");
39
+ var import_DSFormToggleDefinitions = require("./DSFormToggleDefinitions");
39
40
  const DSControlledToggle = (props) => {
40
41
  const propsWithDefaults = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_propTypes.defaultProps);
41
- (0, import_ds_utilities.useValidateTypescriptPropTypes)(propsWithDefaults, import_propTypes.propTypes);
42
+ (0, import_ds_utilities.useValidateTypescriptPropTypes)(propsWithDefaults, import_propTypes.propTypes, import_DSFormToggleDefinitions.DSFormToggleName);
42
43
  const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } = propsWithDefaults;
43
44
  const [isLongerTextRendering, setIsLongerTextRendering] = (0, import_react.useState)(false);
44
45
  const [width, setWidth] = (0, import_react.useState)(0);
@@ -68,71 +69,58 @@ const DSControlledToggle = (props) => {
68
69
  );
69
70
  const globalAttrs = (0, import_ds_utilities.useGetGlobalAttributes)(rest, { onClick: handleOnChange });
70
71
  const xStyledProps = (0, import_ds_utilities.useGetXstyledProps)(rest);
71
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, {
72
- size,
73
- "data-testid": "ds-controlled-toggle",
74
- ...containerProps,
75
- ...xStyledProps,
76
- disabled,
77
- children: (0, import_addTooltipOnReadOnly.addTooltipOnReadOnly)(
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledButton, {
79
- role: "switch",
80
- ...globalAttrs,
81
- value,
82
- type: "button",
83
- buttonType: "raw",
84
- "data-testid": "ds-controlled-toggle-checkbox",
85
- id: instanceUID,
86
- "aria-readonly": readOnly,
87
- "aria-disabled": disabled,
88
- "aria-checked": checked,
89
- onClick: handleOnChange,
90
- readOnly,
91
- disabled,
92
- children: [
93
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledLabel, {
94
- checked,
95
- size,
96
- width,
97
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledVisibleContent, {
98
- checked,
99
- size,
100
- readOnly,
101
- active,
102
- disabled,
103
- children: [
104
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCircle, {
105
- checked,
106
- size,
107
- readOnly,
108
- disabled
109
- }),
110
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledText, {
111
- "aria-hidden": "true",
112
- ref: labelTextRef,
113
- isLongerTextRendering,
114
- checked,
115
- size,
116
- disabled,
117
- children: checked ? labelOn : labelOff
118
- })
119
- ]
120
- })
121
- }),
122
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.SetLabelWidth, {
123
- size,
124
- ref: widthTextRef,
125
- "aria-hidden": "true",
126
- children: longerText
127
- })
128
- ]
129
- }),
130
- readOnly
131
- )
132
- });
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ import_styles.StyledContainer,
74
+ {
75
+ size,
76
+ "data-testid": "ds-controlled-toggle",
77
+ ...containerProps,
78
+ ...xStyledProps,
79
+ disabled,
80
+ children: (0, import_addTooltipOnReadOnly.addTooltipOnReadOnly)(
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
+ import_styles.StyledButton,
83
+ {
84
+ role: "switch",
85
+ ...globalAttrs,
86
+ value,
87
+ type: "button",
88
+ buttonType: "raw",
89
+ "data-testid": "ds-controlled-toggle-checkbox",
90
+ id: instanceUID,
91
+ "aria-readonly": readOnly,
92
+ "aria-disabled": disabled,
93
+ "aria-checked": checked,
94
+ onClick: handleOnChange,
95
+ readOnly,
96
+ disabled,
97
+ children: [
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledLabel, { checked, size, width, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledVisibleContent, { checked, size, readOnly, active, disabled, children: [
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCircle, { checked, size, readOnly, disabled }),
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ import_styles.StyledText,
102
+ {
103
+ "aria-hidden": "true",
104
+ ref: labelTextRef,
105
+ isLongerTextRendering,
106
+ checked,
107
+ size,
108
+ disabled,
109
+ children: checked ? labelOn : labelOff
110
+ }
111
+ )
112
+ ] }) }),
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.SetLabelWidth, { size, ref: widthTextRef, "aria-hidden": "true", children: longerText })
114
+ ]
115
+ }
116
+ ),
117
+ readOnly
118
+ )
119
+ }
120
+ );
133
121
  };
134
122
  DSControlledToggle.propTypes = import_propTypes.propTypes;
135
- DSControlledToggle.displayName = "DSControlledToggle";
123
+ DSControlledToggle.displayName = import_DSFormToggleDefinitions.DSFormToggleName;
136
124
  const DSControlledToggleWithSchema = (0, import_ds_utilities.describe)(DSControlledToggle);
137
125
  DSControlledToggleWithSchema.propTypes = import_propTypes.propTypes;
138
126
  //# sourceMappingURL=ControlledToggle.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ControlledToggle.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useState, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport type { DSButtonT } from '@elliemae/ds-button';\nimport { propTypes, defaultProps, type DSControlledToggleT } from './propTypes';\nimport {\n StyledContainer,\n StyledButton,\n StyledLabel,\n StyledVisibleContent,\n StyledCircle,\n StyledText,\n SetLabelWidth,\n} from './styles';\nimport { addTooltipOnReadOnly } from './utils/addTooltipOnReadOnly';\n\ntype DSButtonV2OnClick = DSButtonT.InternalProps['onClick'];\n\nconst DSControlledToggle = (props: DSControlledToggleT.Props): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, propTypes);\n const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } =\n propsWithDefaults;\n\n const [isLongerTextRendering, setIsLongerTextRendering] = useState<boolean>(false);\n const [width, setWidth] = useState<number>(0);\n const labelTextRef = useRef<HTMLDivElement | null>(null);\n const widthTextRef = useRef<HTMLDivElement | null>(null);\n\n const longerText = useMemo(() => (labelOn.length > labelOff.length ? labelOn : labelOff), [labelOff, labelOn]);\n\n const instanceUID = useMemo(() => id || uid(5), [id]);\n\n useEffect(() => {\n if (labelTextRef.current) {\n setIsLongerTextRendering(labelTextRef.current.innerText === longerText);\n }\n }, [labelTextRef, longerText, checked]);\n\n useEffect(() => {\n if (widthTextRef.current) {\n setWidth(widthTextRef.current.clientWidth);\n }\n }, [widthTextRef]);\n\n const handleOnChange = useCallback<DSButtonV2OnClick>(\n (e) => {\n if (disabled || readOnly) return;\n if (onChange) {\n onChange();\n }\n },\n [disabled, readOnly, onChange],\n );\n\n const globalAttrs = useGetGlobalAttributes(rest, { onClick: handleOnChange });\n const xStyledProps = useGetXstyledProps(rest);\n\n return (\n <StyledContainer\n size={size}\n data-testid=\"ds-controlled-toggle\"\n {...containerProps}\n {...xStyledProps}\n disabled={disabled}\n >\n {addTooltipOnReadOnly(\n <StyledButton\n role=\"switch\"\n {...globalAttrs}\n value={value}\n type=\"button\"\n buttonType=\"raw\"\n data-testid=\"ds-controlled-toggle-checkbox\"\n id={instanceUID}\n aria-readonly={readOnly}\n aria-disabled={disabled}\n aria-checked={checked}\n onClick={handleOnChange}\n readOnly={readOnly}\n disabled={disabled}\n >\n <StyledLabel checked={checked} size={size} width={width}>\n <StyledVisibleContent checked={checked} size={size} readOnly={readOnly} active={active} disabled={disabled}>\n <StyledCircle checked={checked} size={size} readOnly={readOnly} disabled={disabled} />\n <StyledText\n aria-hidden=\"true\"\n ref={labelTextRef}\n isLongerTextRendering={isLongerTextRendering}\n checked={checked}\n size={size}\n disabled={disabled}\n >\n {checked ? labelOn : labelOff}\n </StyledText>\n </StyledVisibleContent>\n </StyledLabel>\n <SetLabelWidth size={size} ref={widthTextRef} aria-hidden=\"true\">\n {longerText}\n </SetLabelWidth>\n </StyledButton>,\n readOnly,\n )}\n </StyledContainer>\n );\n};\n\nDSControlledToggle.propTypes = propTypes;\nDSControlledToggle.displayName = 'DSControlledToggle';\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = propTypes;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyFX;AAzFZ,mBAAyE;AACzE,iBAAoB;AACpB,0BAMO;AAEP,uBAAkE;AAClE,oBAQO;AACP,kCAAqC;AAIrC,MAAM,qBAAqB,CAAC,UAAkD;AAC5E,QAAM,wBAAoB,kDAA6B,OAAO,6BAAY;AAC1E,0DAA+B,mBAAmB,0BAAS;AAC3D,QAAM,EAAE,SAAS,UAAU,OAAO,SAAS,UAAU,MAAM,UAAU,QAAQ,UAAU,gBAAgB,OAAO,KAAK,IACjH;AAEF,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAkB,KAAK;AACjF,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,mBAAe,qBAA8B,IAAI;AACvD,QAAM,mBAAe,qBAA8B,IAAI;AAEvD,QAAM,iBAAa,sBAAQ,MAAO,QAAQ,SAAS,SAAS,SAAS,UAAU,UAAW,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kBACC,eAAY;AAAA,kBACZ,KAAK;AAAA,kBACL;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBAEC,oBAAU,UAAU;AAAA,iBACvB;AAAA;AAAA,aACF;AAAA,WACF;AAAA,UACA,4CAAC;AAAA,YAAc;AAAA,YAAY,KAAK;AAAA,YAAc,eAAY;AAAA,YACvD;AAAA,WACH;AAAA;AAAA,OACF;AAAA,MACA;AAAA,IACF;AAAA,GACF;AAEJ;AAEA,mBAAmB,YAAY;AAC/B,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,8BAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
4
+ "sourcesContent": ["import React, { useState, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport type { DSButtonT } from '@elliemae/ds-button';\nimport { propTypes, defaultProps, type DSControlledToggleT } from './propTypes';\nimport {\n StyledContainer,\n StyledButton,\n StyledLabel,\n StyledVisibleContent,\n StyledCircle,\n StyledText,\n SetLabelWidth,\n} from './styles';\nimport { addTooltipOnReadOnly } from './utils/addTooltipOnReadOnly';\nimport { DSFormToggleName } from './DSFormToggleDefinitions';\n\ntype DSButtonV2OnClick = DSButtonT.InternalProps['onClick'];\n\nconst DSControlledToggle = (props: DSControlledToggleT.Props): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, propTypes, DSFormToggleName);\n const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } =\n propsWithDefaults;\n\n const [isLongerTextRendering, setIsLongerTextRendering] = useState<boolean>(false);\n const [width, setWidth] = useState<number>(0);\n const labelTextRef = useRef<HTMLDivElement | null>(null);\n const widthTextRef = useRef<HTMLDivElement | null>(null);\n\n const longerText = useMemo(() => (labelOn.length > labelOff.length ? labelOn : labelOff), [labelOff, labelOn]);\n\n const instanceUID = useMemo(() => id || uid(5), [id]);\n\n useEffect(() => {\n if (labelTextRef.current) {\n setIsLongerTextRendering(labelTextRef.current.innerText === longerText);\n }\n }, [labelTextRef, longerText, checked]);\n\n useEffect(() => {\n if (widthTextRef.current) {\n setWidth(widthTextRef.current.clientWidth);\n }\n }, [widthTextRef]);\n\n const handleOnChange = useCallback<DSButtonV2OnClick>(\n (e) => {\n if (disabled || readOnly) return;\n if (onChange) {\n onChange();\n }\n },\n [disabled, readOnly, onChange],\n );\n\n const globalAttrs = useGetGlobalAttributes(rest, { onClick: handleOnChange });\n const xStyledProps = useGetXstyledProps(rest);\n\n return (\n <StyledContainer\n size={size}\n data-testid=\"ds-controlled-toggle\"\n {...containerProps}\n {...xStyledProps}\n disabled={disabled}\n >\n {addTooltipOnReadOnly(\n <StyledButton\n role=\"switch\"\n {...globalAttrs}\n value={value}\n type=\"button\"\n buttonType=\"raw\"\n data-testid=\"ds-controlled-toggle-checkbox\"\n id={instanceUID}\n aria-readonly={readOnly}\n aria-disabled={disabled}\n aria-checked={checked}\n onClick={handleOnChange}\n readOnly={readOnly}\n disabled={disabled}\n >\n <StyledLabel checked={checked} size={size} width={width}>\n <StyledVisibleContent checked={checked} size={size} readOnly={readOnly} active={active} disabled={disabled}>\n <StyledCircle checked={checked} size={size} readOnly={readOnly} disabled={disabled} />\n <StyledText\n aria-hidden=\"true\"\n ref={labelTextRef}\n isLongerTextRendering={isLongerTextRendering}\n checked={checked}\n size={size}\n disabled={disabled}\n >\n {checked ? labelOn : labelOff}\n </StyledText>\n </StyledVisibleContent>\n </StyledLabel>\n <SetLabelWidth size={size} ref={widthTextRef} aria-hidden=\"true\">\n {longerText}\n </SetLabelWidth>\n </StyledButton>,\n readOnly,\n )}\n </StyledContainer>\n );\n};\n\nDSControlledToggle.propTypes = propTypes;\nDSControlledToggle.displayName = DSFormToggleName;\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = propTypes;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0FX;AA1FZ,mBAAyE;AACzE,iBAAoB;AACpB,0BAMO;AAEP,uBAAkE;AAClE,oBAQO;AACP,kCAAqC;AACrC,qCAAiC;AAIjC,MAAM,qBAAqB,CAAC,UAAkD;AAC5E,QAAM,wBAAoB,kDAA6B,OAAO,6BAAY;AAC1E,0DAA+B,mBAAmB,4BAAW,+CAAgB;AAC7E,QAAM,EAAE,SAAS,UAAU,OAAO,SAAS,UAAU,MAAM,UAAU,QAAQ,UAAU,gBAAgB,OAAO,KAAK,IACjH;AAEF,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAkB,KAAK;AACjF,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,mBAAe,qBAA8B,IAAI;AACvD,QAAM,mBAAe,qBAA8B,IAAI;AAEvD,QAAM,iBAAa,sBAAQ,MAAO,QAAQ,SAAS,SAAS,SAAS,UAAU,UAAW,CAAC,UAAU,OAAO,CAAC;AAE7G,QAAM,kBAAc,sBAAQ,MAAM,UAAM,gBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEpD,8BAAU,MAAM;AACd,QAAI,aAAa,SAAS;AACxB,+BAAyB,aAAa,QAAQ,cAAc,UAAU;AAAA,IACxE;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,OAAO,CAAC;AAEtC,8BAAU,MAAM;AACd,QAAI,aAAa,SAAS;AACxB,eAAS,aAAa,QAAQ,WAAW;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAAM;AACL,UAAI,YAAY;AAAU;AAC1B,UAAI,UAAU;AACZ,iBAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,CAAC,UAAU,UAAU,QAAQ;AAAA,EAC/B;AAEA,QAAM,kBAAc,4CAAuB,MAAM,EAAE,SAAS,eAAe,CAAC;AAC5E,QAAM,mBAAe,wCAAmB,IAAI;AAE5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAY;AAAA,MACX,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,QACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACJ,GAAG;AAAA,YACJ;AAAA,YACA,MAAK;AAAA,YACL,YAAW;AAAA,YACX,eAAY;AAAA,YACZ,IAAI;AAAA,YACJ,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,gBAAc;AAAA,YACd,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YAEA;AAAA,0DAAC,6BAAY,SAAkB,MAAY,OACzC,uDAAC,sCAAqB,SAAkB,MAAY,UAAoB,QAAgB,UACtF;AAAA,4DAAC,8BAAa,SAAkB,MAAY,UAAoB,UAAoB;AAAA,gBACpF;AAAA,kBAAC;AAAA;AAAA,oBACC,eAAY;AAAA,oBACZ,KAAK;AAAA,oBACL;AAAA,oBACA;AAAA,oBACA;AAAA,oBACA;AAAA,oBAEC,oBAAU,UAAU;AAAA;AAAA,gBACvB;AAAA,iBACF,GACF;AAAA,cACA,4CAAC,+BAAc,MAAY,KAAK,cAAc,eAAY,QACvD,sBACH;AAAA;AAAA;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,mBAAmB,YAAY;AAC/B,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,8BAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,32 @@
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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var DSFormToggleDefinitions_exports = {};
26
+ __export(DSFormToggleDefinitions_exports, {
27
+ DSFormToggleName: () => DSFormToggleName
28
+ });
29
+ module.exports = __toCommonJS(DSFormToggleDefinitions_exports);
30
+ var React = __toESM(require("react"));
31
+ const DSFormToggleName = "DSFormToggle";
32
+ //# sourceMappingURL=DSFormToggleDefinitions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSFormToggleDefinitions.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export const DSFormToggleName = 'DSFormToggle';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,mBAAmB;",
6
+ "names": []
7
+ }
@@ -32,10 +32,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
32
32
  var import_ds_tooltip = require("@elliemae/ds-tooltip");
33
33
  const addTooltipOnReadOnly = (Component, readOnly) => {
34
34
  if (readOnly)
35
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip.DSTooltipV3, {
36
- text: "Read Only",
37
- children: Component
38
- });
35
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip.DSTooltipV3, { text: "Read Only", children: Component });
39
36
  return Component;
40
37
  };
41
38
  //# sourceMappingURL=addTooltipOnReadOnly.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/addTooltipOnReadOnly.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\nexport const addTooltipOnReadOnly = (Component: JSX.Element, readOnly: boolean): JSX.Element => {\n if (readOnly) return <DSTooltipV3 text=\"Read Only\">{Component}</DSTooltipV3>;\n return Component;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIA;AAHvB,wBAA4B;AAErB,MAAM,uBAAuB,CAAC,WAAwB,aAAmC;AAC9F,MAAI;AAAU,WAAO,4CAAC;AAAA,MAAY,MAAK;AAAA,MAAa;AAAA,KAAU;AAC9D,SAAO;AACT;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIA;AAHvB,wBAA4B;AAErB,MAAM,uBAAuB,CAAC,WAAwB,aAAmC;AAC9F,MAAI;AAAU,WAAO,4CAAC,iCAAY,MAAK,aAAa,qBAAU;AAC9D,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -20,9 +20,10 @@ import {
20
20
  SetLabelWidth
21
21
  } from "./styles";
22
22
  import { addTooltipOnReadOnly } from "./utils/addTooltipOnReadOnly";
23
+ import { DSFormToggleName } from "./DSFormToggleDefinitions";
23
24
  const DSControlledToggle = (props) => {
24
25
  const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
25
- useValidateTypescriptPropTypes(propsWithDefaults, propTypes);
26
+ useValidateTypescriptPropTypes(propsWithDefaults, propTypes, DSFormToggleName);
26
27
  const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } = propsWithDefaults;
27
28
  const [isLongerTextRendering, setIsLongerTextRendering] = useState(false);
28
29
  const [width, setWidth] = useState(0);
@@ -52,71 +53,58 @@ const DSControlledToggle = (props) => {
52
53
  );
53
54
  const globalAttrs = useGetGlobalAttributes(rest, { onClick: handleOnChange });
54
55
  const xStyledProps = useGetXstyledProps(rest);
55
- return /* @__PURE__ */ jsx(StyledContainer, {
56
- size,
57
- "data-testid": "ds-controlled-toggle",
58
- ...containerProps,
59
- ...xStyledProps,
60
- disabled,
61
- children: addTooltipOnReadOnly(
62
- /* @__PURE__ */ jsxs(StyledButton, {
63
- role: "switch",
64
- ...globalAttrs,
65
- value,
66
- type: "button",
67
- buttonType: "raw",
68
- "data-testid": "ds-controlled-toggle-checkbox",
69
- id: instanceUID,
70
- "aria-readonly": readOnly,
71
- "aria-disabled": disabled,
72
- "aria-checked": checked,
73
- onClick: handleOnChange,
74
- readOnly,
75
- disabled,
76
- children: [
77
- /* @__PURE__ */ jsx(StyledLabel, {
78
- checked,
79
- size,
80
- width,
81
- children: /* @__PURE__ */ jsxs(StyledVisibleContent, {
82
- checked,
83
- size,
84
- readOnly,
85
- active,
86
- disabled,
87
- children: [
88
- /* @__PURE__ */ jsx(StyledCircle, {
89
- checked,
90
- size,
91
- readOnly,
92
- disabled
93
- }),
94
- /* @__PURE__ */ jsx(StyledText, {
95
- "aria-hidden": "true",
96
- ref: labelTextRef,
97
- isLongerTextRendering,
98
- checked,
99
- size,
100
- disabled,
101
- children: checked ? labelOn : labelOff
102
- })
103
- ]
104
- })
105
- }),
106
- /* @__PURE__ */ jsx(SetLabelWidth, {
107
- size,
108
- ref: widthTextRef,
109
- "aria-hidden": "true",
110
- children: longerText
111
- })
112
- ]
113
- }),
114
- readOnly
115
- )
116
- });
56
+ return /* @__PURE__ */ jsx(
57
+ StyledContainer,
58
+ {
59
+ size,
60
+ "data-testid": "ds-controlled-toggle",
61
+ ...containerProps,
62
+ ...xStyledProps,
63
+ disabled,
64
+ children: addTooltipOnReadOnly(
65
+ /* @__PURE__ */ jsxs(
66
+ StyledButton,
67
+ {
68
+ role: "switch",
69
+ ...globalAttrs,
70
+ value,
71
+ type: "button",
72
+ buttonType: "raw",
73
+ "data-testid": "ds-controlled-toggle-checkbox",
74
+ id: instanceUID,
75
+ "aria-readonly": readOnly,
76
+ "aria-disabled": disabled,
77
+ "aria-checked": checked,
78
+ onClick: handleOnChange,
79
+ readOnly,
80
+ disabled,
81
+ children: [
82
+ /* @__PURE__ */ jsx(StyledLabel, { checked, size, width, children: /* @__PURE__ */ jsxs(StyledVisibleContent, { checked, size, readOnly, active, disabled, children: [
83
+ /* @__PURE__ */ jsx(StyledCircle, { checked, size, readOnly, disabled }),
84
+ /* @__PURE__ */ jsx(
85
+ StyledText,
86
+ {
87
+ "aria-hidden": "true",
88
+ ref: labelTextRef,
89
+ isLongerTextRendering,
90
+ checked,
91
+ size,
92
+ disabled,
93
+ children: checked ? labelOn : labelOff
94
+ }
95
+ )
96
+ ] }) }),
97
+ /* @__PURE__ */ jsx(SetLabelWidth, { size, ref: widthTextRef, "aria-hidden": "true", children: longerText })
98
+ ]
99
+ }
100
+ ),
101
+ readOnly
102
+ )
103
+ }
104
+ );
117
105
  };
118
106
  DSControlledToggle.propTypes = propTypes;
119
- DSControlledToggle.displayName = "DSControlledToggle";
107
+ DSControlledToggle.displayName = DSFormToggleName;
120
108
  const DSControlledToggleWithSchema = describe(DSControlledToggle);
121
109
  DSControlledToggleWithSchema.propTypes = propTypes;
122
110
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledToggle.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport type { DSButtonT } from '@elliemae/ds-button';\nimport { propTypes, defaultProps, type DSControlledToggleT } from './propTypes';\nimport {\n StyledContainer,\n StyledButton,\n StyledLabel,\n StyledVisibleContent,\n StyledCircle,\n StyledText,\n SetLabelWidth,\n} from './styles';\nimport { addTooltipOnReadOnly } from './utils/addTooltipOnReadOnly';\n\ntype DSButtonV2OnClick = DSButtonT.InternalProps['onClick'];\n\nconst DSControlledToggle = (props: DSControlledToggleT.Props): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, propTypes);\n const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } =\n propsWithDefaults;\n\n const [isLongerTextRendering, setIsLongerTextRendering] = useState<boolean>(false);\n const [width, setWidth] = useState<number>(0);\n const labelTextRef = useRef<HTMLDivElement | null>(null);\n const widthTextRef = useRef<HTMLDivElement | null>(null);\n\n const longerText = useMemo(() => (labelOn.length > labelOff.length ? labelOn : labelOff), [labelOff, labelOn]);\n\n const instanceUID = useMemo(() => id || uid(5), [id]);\n\n useEffect(() => {\n if (labelTextRef.current) {\n setIsLongerTextRendering(labelTextRef.current.innerText === longerText);\n }\n }, [labelTextRef, longerText, checked]);\n\n useEffect(() => {\n if (widthTextRef.current) {\n setWidth(widthTextRef.current.clientWidth);\n }\n }, [widthTextRef]);\n\n const handleOnChange = useCallback<DSButtonV2OnClick>(\n (e) => {\n if (disabled || readOnly) return;\n if (onChange) {\n onChange();\n }\n },\n [disabled, readOnly, onChange],\n );\n\n const globalAttrs = useGetGlobalAttributes(rest, { onClick: handleOnChange });\n const xStyledProps = useGetXstyledProps(rest);\n\n return (\n <StyledContainer\n size={size}\n data-testid=\"ds-controlled-toggle\"\n {...containerProps}\n {...xStyledProps}\n disabled={disabled}\n >\n {addTooltipOnReadOnly(\n <StyledButton\n role=\"switch\"\n {...globalAttrs}\n value={value}\n type=\"button\"\n buttonType=\"raw\"\n data-testid=\"ds-controlled-toggle-checkbox\"\n id={instanceUID}\n aria-readonly={readOnly}\n aria-disabled={disabled}\n aria-checked={checked}\n onClick={handleOnChange}\n readOnly={readOnly}\n disabled={disabled}\n >\n <StyledLabel checked={checked} size={size} width={width}>\n <StyledVisibleContent checked={checked} size={size} readOnly={readOnly} active={active} disabled={disabled}>\n <StyledCircle checked={checked} size={size} readOnly={readOnly} disabled={disabled} />\n <StyledText\n aria-hidden=\"true\"\n ref={labelTextRef}\n isLongerTextRendering={isLongerTextRendering}\n checked={checked}\n size={size}\n disabled={disabled}\n >\n {checked ? labelOn : labelOff}\n </StyledText>\n </StyledVisibleContent>\n </StyledLabel>\n <SetLabelWidth size={size} ref={widthTextRef} aria-hidden=\"true\">\n {longerText}\n </SetLabelWidth>\n </StyledButton>,\n readOnly,\n )}\n </StyledContainer>\n );\n};\n\nDSControlledToggle.propTypes = propTypes;\nDSControlledToggle.displayName = 'DSControlledToggle';\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = propTypes;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACyFX,SACE,KADF;AAzFZ,SAAgB,UAAU,SAAS,QAAQ,WAAW,mBAAmB;AACzE,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,WAAW,oBAA8C;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAIrC,MA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AA,QACA,MAAK;AAAA,QACL,YAAW;AAAA,QACX,eAAY;AAAA,QACZ,IAAI;AAAA,QACJ,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,gBAAc;AAAA,QACd,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QAEA;AAAA,8BAAC;AAAA,YAAY;AAAA,YAAkB;AAAA,YAAY;AAAA,YACzC,+BAAC;AAAA,cAAqB;AAAA,cAAkB;AAAA,cAAY;AAAA,cAAoB;AAAA,cAAgB;AAAA,cACtF;AAAA,oCAAC;AAAA,kBAAa;AAAA,kBAAkB;AAAA,kBAAY;AAAA,kBAAoB;AAAA,iBAAoB;AAAA,gBACpF,oBAAC;AAAA,kBACC,eAAY;AAAA,kBACZ,KAAK;AAAA,kBACL;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBAEC,oBAAU,UAAU;AAAA,iBACvB;AAAA;AAAA,aACF;AAAA,WACF;AAAA,UACA,oBAAC;AAAA,YAAc;AAAA,YAAY,KAAK;AAAA,YAAc,eAAY;AAAA,YACvD;AAAA,WACH;AAAA;AAAA,OACF;AAAA,MACA;AAAA,IACF;AAAA,GACF;AAEJ;AAEA,mBAAmB,YAAY;AAC/B,mBAAmB,cAAc;AACjC,MAAM,+BAA+B,SAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport type { DSButtonT } from '@elliemae/ds-button';\nimport { propTypes, defaultProps, type DSControlledToggleT } from './propTypes';\nimport {\n StyledContainer,\n StyledButton,\n StyledLabel,\n StyledVisibleContent,\n StyledCircle,\n StyledText,\n SetLabelWidth,\n} from './styles';\nimport { addTooltipOnReadOnly } from './utils/addTooltipOnReadOnly';\nimport { DSFormToggleName } from './DSFormToggleDefinitions';\n\ntype DSButtonV2OnClick = DSButtonT.InternalProps['onClick'];\n\nconst DSControlledToggle = (props: DSControlledToggleT.Props): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, propTypes, DSFormToggleName);\n const { labelOn, labelOff, value, checked, onChange, size, readOnly, active, disabled, containerProps, id, ...rest } =\n propsWithDefaults;\n\n const [isLongerTextRendering, setIsLongerTextRendering] = useState<boolean>(false);\n const [width, setWidth] = useState<number>(0);\n const labelTextRef = useRef<HTMLDivElement | null>(null);\n const widthTextRef = useRef<HTMLDivElement | null>(null);\n\n const longerText = useMemo(() => (labelOn.length > labelOff.length ? labelOn : labelOff), [labelOff, labelOn]);\n\n const instanceUID = useMemo(() => id || uid(5), [id]);\n\n useEffect(() => {\n if (labelTextRef.current) {\n setIsLongerTextRendering(labelTextRef.current.innerText === longerText);\n }\n }, [labelTextRef, longerText, checked]);\n\n useEffect(() => {\n if (widthTextRef.current) {\n setWidth(widthTextRef.current.clientWidth);\n }\n }, [widthTextRef]);\n\n const handleOnChange = useCallback<DSButtonV2OnClick>(\n (e) => {\n if (disabled || readOnly) return;\n if (onChange) {\n onChange();\n }\n },\n [disabled, readOnly, onChange],\n );\n\n const globalAttrs = useGetGlobalAttributes(rest, { onClick: handleOnChange });\n const xStyledProps = useGetXstyledProps(rest);\n\n return (\n <StyledContainer\n size={size}\n data-testid=\"ds-controlled-toggle\"\n {...containerProps}\n {...xStyledProps}\n disabled={disabled}\n >\n {addTooltipOnReadOnly(\n <StyledButton\n role=\"switch\"\n {...globalAttrs}\n value={value}\n type=\"button\"\n buttonType=\"raw\"\n data-testid=\"ds-controlled-toggle-checkbox\"\n id={instanceUID}\n aria-readonly={readOnly}\n aria-disabled={disabled}\n aria-checked={checked}\n onClick={handleOnChange}\n readOnly={readOnly}\n disabled={disabled}\n >\n <StyledLabel checked={checked} size={size} width={width}>\n <StyledVisibleContent checked={checked} size={size} readOnly={readOnly} active={active} disabled={disabled}>\n <StyledCircle checked={checked} size={size} readOnly={readOnly} disabled={disabled} />\n <StyledText\n aria-hidden=\"true\"\n ref={labelTextRef}\n isLongerTextRendering={isLongerTextRendering}\n checked={checked}\n size={size}\n disabled={disabled}\n >\n {checked ? labelOn : labelOff}\n </StyledText>\n </StyledVisibleContent>\n </StyledLabel>\n <SetLabelWidth size={size} ref={widthTextRef} aria-hidden=\"true\">\n {longerText}\n </SetLabelWidth>\n </StyledButton>,\n readOnly,\n )}\n </StyledContainer>\n );\n};\n\nDSControlledToggle.propTypes = propTypes;\nDSControlledToggle.displayName = DSFormToggleName;\nconst DSControlledToggleWithSchema = describe(DSControlledToggle);\nDSControlledToggleWithSchema.propTypes = propTypes;\n\nexport { DSControlledToggle, DSControlledToggleWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0FX,SACE,KADF;AA1FZ,SAAgB,UAAU,SAAS,QAAQ,WAAW,mBAAmB;AACzE,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,WAAW,oBAA8C;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAIjC,MAAM,qBAAqB,CAAC,UAAkD;AAC5E,QAAM,oBAAoB,6BAA6B,OAAO,YAAY;AAC1E,iCAA+B,mBAAmB,WAAW,gBAAgB;AAC7E,QAAM,EAAE,SAAS,UAAU,OAAO,SAAS,UAAU,MAAM,UAAU,QAAQ,UAAU,gBAAgB,OAAO,KAAK,IACjH;AAEF,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAAkB,KAAK;AACjF,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,CAAC;AAC5C,QAAM,eAAe,OAA8B,IAAI;AACvD,Q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AAAA,kBAAC;AAAA;AAAA,oBACC,eAAY;AAAA,oBACZ,KAAK;AAAA,oBACL;AAAA,oBACA;AAAA,oBACA;AAAA,oBACA;AAAA,oBAEC,oBAAU,UAAU;AAAA;AAAA,gBACvB;AAAA,iBACF,GACF;AAAA,cACA,oBAAC,iBAAc,MAAY,KAAK,cAAc,eAAY,QACvD,sBACH;AAAA;AAAA;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,mBAAmB,YAAY;AAC/B,mBAAmB,cAAc;AACjC,MAAM,+BAA+B,SAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ const DSFormToggleName = "DSFormToggle";
3
+ export {
4
+ DSFormToggleName
5
+ };
6
+ //# sourceMappingURL=DSFormToggleDefinitions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSFormToggleDefinitions.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSFormToggleName = 'DSFormToggle';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,mBAAmB;",
6
+ "names": []
7
+ }
@@ -3,10 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  import { DSTooltipV3 } from "@elliemae/ds-tooltip";
4
4
  const addTooltipOnReadOnly = (Component, readOnly) => {
5
5
  if (readOnly)
6
- return /* @__PURE__ */ jsx(DSTooltipV3, {
7
- text: "Read Only",
8
- children: Component
9
- });
6
+ return /* @__PURE__ */ jsx(DSTooltipV3, { text: "Read Only", children: Component });
10
7
  return Component;
11
8
  };
12
9
  export {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/addTooltipOnReadOnly.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\nexport const addTooltipOnReadOnly = (Component: JSX.Element, readOnly: boolean): JSX.Element => {\n if (readOnly) return <DSTooltipV3 text=\"Read Only\">{Component}</DSTooltipV3>;\n return Component;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACIA;AAHvB,SAAS,mBAAmB;AAErB,MAAM,uBAAuB,CAAC,WAAwB,aAAmC;AAC9F,MAAI;AAAU,WAAO,oBAAC;AAAA,MAAY,MAAK;AAAA,MAAa;AAAA,KAAU;AAC9D,SAAO;AACT;",
5
+ "mappings": "AAAA,YAAY,WAAW;ACIA;AAHvB,SAAS,mBAAmB;AAErB,MAAM,uBAAuB,CAAC,WAAwB,aAAmC;AAC9F,MAAI;AAAU,WAAO,oBAAC,eAAY,MAAK,aAAa,qBAAU;AAC9D,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-form-toggle",
3
- "version": "3.12.0-rc.2",
3
+ "version": "3.12.0-rc.4",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Toggle",
6
6
  "files": [
@@ -35,10 +35,10 @@
35
35
  "indent": 4
36
36
  },
37
37
  "dependencies": {
38
- "@elliemae/ds-button": "3.12.0-rc.2",
39
- "@elliemae/ds-system": "3.12.0-rc.2",
40
- "@elliemae/ds-tooltip": "3.12.0-rc.2",
41
- "@elliemae/ds-utilities": "3.12.0-rc.2",
38
+ "@elliemae/ds-button": "3.12.0-rc.4",
39
+ "@elliemae/ds-system": "3.12.0-rc.4",
40
+ "@elliemae/ds-tooltip": "3.12.0-rc.4",
41
+ "@elliemae/ds-utilities": "3.12.0-rc.4",
42
42
  "styled-components": "~5.3.6",
43
43
  "uid": "~2.0.0"
44
44
  },