@elliemae/ds-form-radio 3.1.0-next.20
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/ControlledRadio.js +109 -0
- package/dist/cjs/ControlledRadio.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +38 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/exported-related/data-test-ids.js +31 -0
- package/dist/cjs/exported-related/data-test-ids.js.map +7 -0
- package/dist/cjs/exported-related/index.js +23 -0
- package/dist/cjs/exported-related/index.js.map +7 -0
- package/dist/cjs/exported-related/theming.js +34 -0
- package/dist/cjs/exported-related/theming.js.map +7 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +60 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styles.js +112 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/cjs/utils/styleHelpers.js +65 -0
- package/dist/cjs/utils/styleHelpers.js.map +7 -0
- package/dist/esm/ControlledRadio.js +94 -0
- package/dist/esm/ControlledRadio.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +16 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/exported-related/data-test-ids.js +9 -0
- package/dist/esm/exported-related/data-test-ids.js.map +7 -0
- package/dist/esm/exported-related/index.js +4 -0
- package/dist/esm/exported-related/index.js.map +7 -0
- package/dist/esm/exported-related/theming.js +12 -0
- package/dist/esm/exported-related/theming.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +40 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styles.js +90 -0
- package/dist/esm/styles.js.map +7 -0
- package/dist/esm/utils/styleHelpers.js +43 -0
- package/dist/esm/utils/styleHelpers.js.map +7 -0
- package/package.json +69 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
49
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
50
|
+
var ControlledRadio_exports = {};
|
|
51
|
+
__export(ControlledRadio_exports, {
|
|
52
|
+
DSControlledRadio: () => DSControlledRadio,
|
|
53
|
+
DSControlledRadioWithSchema: () => DSControlledRadioWithSchema
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(ControlledRadio_exports);
|
|
56
|
+
var React = __toESM(require("react"));
|
|
57
|
+
var import_react = __toESM(require("react"));
|
|
58
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
59
|
+
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
60
|
+
var import_styles = require("./styles");
|
|
61
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
62
|
+
var import_useValidateProps = require("./config/useValidateProps");
|
|
63
|
+
const DSControlledRadio = (props) => {
|
|
64
|
+
const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
65
|
+
(0, import_useValidateProps.useValidateProps)(props, import_react_desc_prop_types.propTypes);
|
|
66
|
+
const { checked, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;
|
|
67
|
+
const _a = (0, import_ds_utilities.useGetGlobalAttributes)(propsWithDefault), { id, disabled, readOnly, label, className, tabIndex } = _a, restGlobals = __objRest(_a, ["id", "disabled", "readOnly", "label", "className", "tabIndex"]);
|
|
68
|
+
const xstyledProps = (0, import_ds_utilities.useGetXstyledProps)(propsWithDefault);
|
|
69
|
+
const handleOnChange = (0, import_react.useCallback)((e) => {
|
|
70
|
+
if (onChange)
|
|
71
|
+
onChange(value, e);
|
|
72
|
+
}, [onChange, value]);
|
|
73
|
+
const handleOnLabelClick = (0, import_react.useCallback)((e) => {
|
|
74
|
+
if (onChange)
|
|
75
|
+
onChange(value, e);
|
|
76
|
+
}, [onChange, value]);
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledContainer, __spreadValues({
|
|
78
|
+
"data-testid": "ds-radio-container",
|
|
79
|
+
className
|
|
80
|
+
}, xstyledProps), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledRadio, {
|
|
81
|
+
checked,
|
|
82
|
+
hasError,
|
|
83
|
+
disabled,
|
|
84
|
+
readOnly
|
|
85
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledInput, __spreadProps(__spreadValues({
|
|
86
|
+
"data-testid": "ds-radio"
|
|
87
|
+
}, restGlobals), {
|
|
88
|
+
id,
|
|
89
|
+
ref: innerRef,
|
|
90
|
+
type: "radio",
|
|
91
|
+
checked,
|
|
92
|
+
disabled,
|
|
93
|
+
onChange: handleOnChange
|
|
94
|
+
}))), label && /* @__PURE__ */ import_react.default.createElement(import_styles.StyledLabel, __spreadValues({
|
|
95
|
+
htmlFor: id,
|
|
96
|
+
disabled,
|
|
97
|
+
readOnly,
|
|
98
|
+
checked,
|
|
99
|
+
"data-testid": "ds-radio-label",
|
|
100
|
+
wrapLabel
|
|
101
|
+
}, !disabled ? { onClick: handleOnLabelClick } : {}), wrapLabel ? /* @__PURE__ */ import_react.default.createElement(import_styles.StyledWrapLabel, null, label) : /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.SimpleTruncatedTooltipText, {
|
|
102
|
+
value: label
|
|
103
|
+
})));
|
|
104
|
+
};
|
|
105
|
+
DSControlledRadio.propTypes = import_react_desc_prop_types.propTypes;
|
|
106
|
+
DSControlledRadio.displayName = "DSControlledRadio";
|
|
107
|
+
const DSControlledRadioWithSchema = (0, import_ds_utilities.describe)(DSControlledRadio);
|
|
108
|
+
DSControlledRadioWithSchema.propTypes = import_react_desc_prop_types.propTypes;
|
|
109
|
+
//# sourceMappingURL=ControlledRadio.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ControlledRadio.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, WeakValidationMap } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-utilities';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio } from './styles';\nimport { DSControlledRadioT, propTypes, defaultProps } from './react-desc-prop-types';\nimport { useValidateProps } from './config/useValidateProps';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateProps(props, propTypes);\n\n const { checked, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;\n\n const { id, disabled, readOnly, label, className, tabIndex, ...restGlobals } =\n useGetGlobalAttributes<DSControlledRadioT.Props>(propsWithDefault);\n\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (onChange) onChange(value, e);\n },\n [onChange, value],\n );\n\n const handleOnLabelClick: React.MouseEventHandler<HTMLLabelElement> = useCallback(\n (e) => {\n if (onChange) onChange(value, e);\n },\n [onChange, value],\n );\n return (\n <StyledContainer data-testid=\"ds-radio-container\" className={className} {...xstyledProps}>\n <StyledRadio checked={checked} hasError={hasError} disabled={disabled} readOnly={readOnly}>\n <StyledInput\n data-testid=\"ds-radio\"\n {...restGlobals}\n id={id}\n ref={innerRef}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={handleOnChange}\n />\n </StyledRadio>\n {label && (\n <StyledLabel\n htmlFor={id}\n disabled={disabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n wrapLabel={wrapLabel}\n {...(!disabled ? { onClick: handleOnLabelClick } : {})}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n </StyledContainer>\n );\n};\n\nDSControlledRadio.propTypes = propTypes as WeakValidationMap<unknown>;\nDSControlledRadio.displayName = 'DSControlledRadio';\nconst DSControlledRadioWithSchema = describe(DSControlledRadio);\nDSControlledRadioWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSControlledRadio, DSControlledRadioWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAsD;AACtD,0BAKO;AACP,uCAA2C;AAC3C,oBAAwF;AACxF,mCAA4D;AAC5D,8BAAiC;AAEjC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,mBAAmB,sDAA6B,OAAO,yCAAY;AACzE,gDAAiB,OAAO,sCAAS;AAEjC,QAAM,EAAE,SAAS,UAAU,UAAU,OAAO,WAAW,aAAa;AAEpE,QACE,qDAAiD,gBAAgB,GAD3D,MAAI,UAAU,UAAU,OAAO,WAAW,aAChD,IAD6D,wBAC7D,IAD6D,CAAvD,MAAI,YAAU,YAAU,SAAO,aAAW;AAGlD,QAAM,eAAe,4CAAmB,gBAAgB;AAExD,QAAM,iBAAiB,8BACrB,CAAC,MAAyB;AACxB,QAAI;AAAU,eAAS,OAAO,CAAC;AAAA,EACjC,GACA,CAAC,UAAU,KAAK,CAClB;AAEA,QAAM,qBAAgE,8BACpE,CAAC,MAAM;AACL,QAAI;AAAU,eAAS,OAAO,CAAC;AAAA,EACjC,GACA,CAAC,UAAU,KAAK,CAClB;AACA,SACE,mDAAC;AAAA,IAAgB,eAAY;AAAA,IAAqB;AAAA,KAA0B,eAC1E,mDAAC;AAAA,IAAY;AAAA,IAAkB;AAAA,IAAoB;AAAA,IAAoB;AAAA,KACrE,mDAAC;AAAA,IACC,eAAY;AAAA,KACR,cAFL;AAAA,IAGC;AAAA,IACA,KAAK;AAAA,IACL,MAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACZ,CACF,GACC,SACC,mDAAC;AAAA,IACC,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAY;AAAA,IACZ;AAAA,KACK,CAAC,WAAW,EAAE,SAAS,mBAAmB,IAAI,CAAC,IAEnD,YAAY,mDAAC,qCAAiB,KAAM,IAAqB,mDAAC;AAAA,IAA2B,OAAO;AAAA,GAAO,CACtG,CAEJ;AAEJ;AAEA,kBAAkB,YAAY;AAC9B,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var useValidateProps_exports = {};
|
|
22
|
+
__export(useValidateProps_exports, {
|
|
23
|
+
useValidateProps: () => useValidateProps
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
26
|
+
var React = __toESM(require("react"));
|
|
27
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
28
|
+
const throwError = (message) => {
|
|
29
|
+
throw new Error(`DSControlledRadio:: ${message}
|
|
30
|
+
`);
|
|
31
|
+
};
|
|
32
|
+
const useValidateProps = (props, propTypes) => {
|
|
33
|
+
(0, import_ds_utilities.useValidateTypescriptPropTypes)(props, propTypes);
|
|
34
|
+
if (typeof props.label === "undefined" && typeof props["aria-label"] === "undefined") {
|
|
35
|
+
throwError(`Please provide a label or ariaLabel property to use this component.`);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useValidateProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSControlledRadioT } from '../react-desc-prop-types';\n\nconst throwError = (message: string): void => {\n throw new Error(\n `DSControlledRadio:: ${message}\n `,\n );\n};\n\nexport const useValidateProps = (props: DSControlledRadioT.Props, propTypes: DSControlledRadioT.Props): void => {\n useValidateTypescriptPropTypes(props, propTypes);\n if (typeof props.label === 'undefined' && typeof props['aria-label'] === 'undefined') {\n throwError(`Please provide a label or ariaLabel property to use this component.`);\n }\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA+C;AAG/C,MAAM,aAAa,CAAC,YAA0B;AAC5C,QAAM,IAAI,MACR,uBAAuB;AAAA,GAEzB;AACF;AAEO,MAAM,mBAAmB,CAAC,OAAiC,cAA8C;AAC9G,0DAA+B,OAAO,SAAS;AAC/C,MAAI,OAAO,MAAM,UAAU,eAAe,OAAO,MAAM,kBAAkB,aAAa;AACpF,eAAW,qEAAqE;AAAA,EAClF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var data_test_ids_exports = {};
|
|
22
|
+
__export(data_test_ids_exports, {
|
|
23
|
+
DSRadioDataTestIds: () => DSRadioDataTestIds
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(data_test_ids_exports);
|
|
26
|
+
var React = __toESM(require("react"));
|
|
27
|
+
const DSRadioDataTestIds = {
|
|
28
|
+
CONTAINER: "ds-radio-container",
|
|
29
|
+
INPUT: "ds-radio"
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=data-test-ids.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/exported-related/data-test-ids.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSRadioDataTestIds = {\n CONTAINER: 'ds-radio-container',\n INPUT: 'ds-radio',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,OAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var exported_related_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(exported_related_exports);
|
|
20
|
+
var React = __toESM(require("react"));
|
|
21
|
+
__reExport(exported_related_exports, require("./data-test-ids"), module.exports);
|
|
22
|
+
__reExport(exported_related_exports, require("./theming"), module.exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/exported-related/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './data-test-ids';\nexport * from './theming';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,qCAAc,4BAAd;AACA,qCAAc,sBADd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var theming_exports = {};
|
|
22
|
+
__export(theming_exports, {
|
|
23
|
+
DSRadioName: () => DSRadioName,
|
|
24
|
+
DSRadioSlots: () => DSRadioSlots
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(theming_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
28
|
+
const DSRadioName = "DS-Radio";
|
|
29
|
+
const DSRadioSlots = {
|
|
30
|
+
CONTAINER: "root",
|
|
31
|
+
INPUT: "input",
|
|
32
|
+
LABEL: "label"
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=theming.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/exported-related/theming.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSRadioName = 'DS-Radio';\n\nexport const DSRadioSlots = {\n CONTAINER: 'root',\n INPUT: 'input',\n LABEL: 'label',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,cAAc;AAEpB,MAAM,eAAe;AAAA,EAC1B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
DSControlledRadio: () => import_ControlledRadio.DSControlledRadio,
|
|
24
|
+
DSControlledRadioWithSchema: () => import_ControlledRadio.DSControlledRadioWithSchema
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
28
|
+
var import_ControlledRadio = require("./ControlledRadio");
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { DSControlledRadio, DSControlledRadioWithSchema } from './ControlledRadio';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,6BAA+D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var react_desc_prop_types_exports = {};
|
|
39
|
+
__export(react_desc_prop_types_exports, {
|
|
40
|
+
defaultProps: () => defaultProps,
|
|
41
|
+
propTypes: () => propTypes
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
44
|
+
var React = __toESM(require("react"));
|
|
45
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
46
|
+
const defaultProps = {
|
|
47
|
+
wrapLabel: false,
|
|
48
|
+
hasError: false,
|
|
49
|
+
checked: false
|
|
50
|
+
};
|
|
51
|
+
const propTypes = __spreadProps(__spreadValues(__spreadValues({}, import_ds_utilities.globalAttributesPropTypes), import_ds_utilities.xstyledPropTypes), {
|
|
52
|
+
value: import_ds_utilities.PropTypes.string.description("Radio value"),
|
|
53
|
+
onChange: import_ds_utilities.PropTypes.func.description("Radio onchange callback").signature("((newValue: string,e: React.ChangeEvent) => void)"),
|
|
54
|
+
label: import_ds_utilities.PropTypes.string.description("Radio Label property. This label is also going to be used as an aria-label for screen readers."),
|
|
55
|
+
checked: import_ds_utilities.PropTypes.bool.description("Whether the radio is checked or not"),
|
|
56
|
+
hasError: import_ds_utilities.PropTypes.bool.description("Whether the radio has error or not."),
|
|
57
|
+
innerRef: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.func, import_ds_utilities.PropTypes.object]).description("Radio input ref."),
|
|
58
|
+
wrapLabel: import_ds_utilities.PropTypes.bool.description("Whether to wrap or truncate the label")
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { ChangeEvent, MouseEvent } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes, GlobalAttributesT } from '@elliemae/ds-utilities';\nexport declare namespace DSControlledRadioT {\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n }\n\n export interface OptionalProps {\n value?: string;\n onChange?: (newValue: string, e: ChangeEvent | MouseEvent<HTMLLabelElement>) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface Props extends DefaultProps, OptionalProps, GlobalAttributesT {}\n\n export interface StyledRadioT {\n checked?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n disabled?: boolean;\n }\n\n export interface StyledLabelT {\n disabled?: boolean;\n readOnly?: boolean;\n checked: boolean;\n wrapLabel: boolean;\n onClick?: React.MouseEventHandler<HTMLLabelElement>;\n }\n}\n\nexport const defaultProps: Partial<DSControlledRadioT.Props> = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Radio value'),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent) => void)'),\n label: PropTypes.string.description(\n 'Radio Label property. This label is also going to be used as an aria-label for screen readers.',\n ),\n checked: PropTypes.bool.description('Whether the radio is checked or not'),\n hasError: PropTypes.bool.description('Whether the radio has error or not.'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Radio input ref.'),\n wrapLabel: PropTypes.bool.description('Whether to wrap or truncate the label'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAA0F;AAkCnF,MAAM,eAAkD;AAAA,EAC7D,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AACX;AAEO,MAAM,YAAY,gDACpB,gDACA,uCAFoB;AAAA,EAGvB,OAAO,8BAAU,OAAO,YAAY,aAAa;AAAA,EACjD,UAAU,8BAAU,KACjB,YAAY,yBAAyB,EACrC,UAAU,mDAAmD;AAAA,EAChE,OAAO,8BAAU,OAAO,YACtB,gGACF;AAAA,EACA,SAAS,8BAAU,KAAK,YAAY,qCAAqC;AAAA,EACzE,UAAU,8BAAU,KAAK,YAAY,qCAAqC;AAAA,EAC1E,UAAU,8BAAU,UAAU,CAAC,8BAAU,MAAM,8BAAU,MAAM,CAAC,EAAE,YAAY,kBAAkB;AAAA,EAChG,WAAW,8BAAU,KAAK,YAAY,uCAAuC;AAC/E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var styles_exports = {};
|
|
22
|
+
__export(styles_exports, {
|
|
23
|
+
StyledContainer: () => StyledContainer,
|
|
24
|
+
StyledInput: () => StyledInput,
|
|
25
|
+
StyledLabel: () => StyledLabel,
|
|
26
|
+
StyledRadio: () => StyledRadio,
|
|
27
|
+
StyledWrapLabel: () => StyledWrapLabel
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(styles_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
32
|
+
var import_styleHelpers = require("./utils/styleHelpers");
|
|
33
|
+
var import_exported_related = require("./exported-related");
|
|
34
|
+
const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
35
|
+
name: import_exported_related.DSRadioName,
|
|
36
|
+
slot: import_exported_related.DSRadioSlots.CONTAINER
|
|
37
|
+
})`
|
|
38
|
+
display: inline-grid;
|
|
39
|
+
grid-template-rows: min-content;
|
|
40
|
+
grid-template-columns: ${({ theme }) => theme.space.xs} auto;
|
|
41
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
42
|
+
grid-template-columns: 24px auto;
|
|
43
|
+
}
|
|
44
|
+
align-items: center;
|
|
45
|
+
`;
|
|
46
|
+
const StyledRadio = (0, import_ds_system.styled)("span")`
|
|
47
|
+
width: ${({ theme }) => theme.space.xs};
|
|
48
|
+
height: ${({ theme }) => theme.space.xs};
|
|
49
|
+
@media (max-width: ${(props) => props.theme.breakpoints.small}) {
|
|
50
|
+
width: 24px;
|
|
51
|
+
height: 24px;
|
|
52
|
+
}
|
|
53
|
+
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
|
54
|
+
border-radius: 50px;
|
|
55
|
+
position: relative;
|
|
56
|
+
background: ${({ theme, disabled }) => (0, import_styleHelpers.handleBackgroundColor)(theme, disabled)};
|
|
57
|
+
${({ theme, checked, disabled, readOnly, hasError }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, disabled, readOnly, hasError)}
|
|
58
|
+
&:focus-within {
|
|
59
|
+
${({ theme, hasError, disabled }) => !disabled ? `border: 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]}; outline : 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]} ` : void 0};
|
|
60
|
+
&:hover {
|
|
61
|
+
${({ theme, checked, disabled, readOnly, hasError }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, disabled, readOnly, hasError, true)}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
&:hover {
|
|
65
|
+
background: ${({ theme, disabled }) => !disabled ? theme.colors.brand[200] : void 0};
|
|
66
|
+
${({ theme, hasError, disabled, readOnly }) => !hasError && !disabled && !readOnly ? ` border: 1px solid ${theme.colors.brand[600]}` : void 0};
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const radioStyles = import_ds_system.css`
|
|
70
|
+
&:hover {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 0;
|
|
77
|
+
left: 0;
|
|
78
|
+
opacity: 0;
|
|
79
|
+
`;
|
|
80
|
+
const StyledInput = (0, import_ds_system.styled)("input", {
|
|
81
|
+
name: import_exported_related.DSRadioName,
|
|
82
|
+
slot: import_exported_related.DSRadioSlots.INPUT
|
|
83
|
+
})`
|
|
84
|
+
${radioStyles}
|
|
85
|
+
&:disabled {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
const StyledLabel = (0, import_ds_system.styled)("label", {
|
|
90
|
+
name: import_exported_related.DSRadioName,
|
|
91
|
+
slot: import_exported_related.DSRadioSlots.LABEL
|
|
92
|
+
})`
|
|
93
|
+
${({ wrapLabel, theme }) => wrapLabel ? "padding: 8px 0px 8px 8px;" : `padding-left: ${theme.space.xxs}`};
|
|
94
|
+
|
|
95
|
+
color: ${({ theme, disabled, readOnly }) => disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
96
|
+
font-size: 13px;
|
|
97
|
+
line-height: 13px;
|
|
98
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
99
|
+
font-size: 16px;
|
|
100
|
+
line-height: 16px;
|
|
101
|
+
${({ wrapLabel, theme }) => wrapLabel ? `padding: ${theme.space.xs} 0px ${theme.space.xs} ${theme.space.xs};` : `padding-left: ${theme.space.xs}`};
|
|
102
|
+
}
|
|
103
|
+
display: inherit;
|
|
104
|
+
|
|
105
|
+
${({ disabled }) => disabled ? `&:hover {
|
|
106
|
+
cursor: not-allowed;
|
|
107
|
+
}` : `&:hover {
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
}`}
|
|
110
|
+
`;
|
|
111
|
+
const StyledWrapLabel = (0, import_ds_system.styled)("span")``;
|
|
112
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { DSControlledRadioT } from './react-desc-prop-types';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers';\nimport { DSRadioName, DSRadioSlots } from './exported-related';\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})`\n display: inline-grid;\n grid-template-rows: min-content;\n grid-template-columns: ${({ theme }) => theme.space.xs} auto;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n grid-template-columns: 24px auto;\n }\n align-items: center;\n`;\n\nexport const StyledRadio = styled('span')<DSControlledRadioT.StyledRadioT>`\n width: ${({ theme }) => theme.space.xs};\n height: ${({ theme }) => theme.space.xs};\n @media (max-width: ${(props) => props.theme.breakpoints.small}) {\n width: 24px;\n height: 24px;\n }\n border: 1px solid ${({ theme, hasError }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n border-radius: 50px;\n position: relative;\n background: ${({ theme, disabled }) => handleBackgroundColor(theme, disabled)};\n ${({ theme, checked, disabled, readOnly, hasError }) => handleCheckmark(theme, checked, disabled, readOnly, hasError)}\n &:focus-within {\n ${({ theme, hasError, disabled }) =>\n !disabled\n ? `border: 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]}; outline : 1px solid ${\n hasError ? theme.colors.danger[900] : theme.colors.brand[700]\n } `\n : undefined};\n &:hover {\n ${({ theme, checked, disabled, readOnly, hasError }) =>\n handleCheckmark(theme, checked, disabled, readOnly, hasError, true)}\n }\n }\n &:hover {\n background: ${({ theme, disabled }) => (!disabled ? theme.colors.brand[200] : undefined)};\n ${({ theme, hasError, disabled, readOnly }) =>\n !hasError && !disabled && !readOnly ? ` border: 1px solid ${theme.colors.brand[600]}` : undefined};\n }\n`;\n\nconst radioStyles = css`\n &:hover {\n cursor: pointer;\n }\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n`;\n\nexport const StyledInput = styled('input', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT,\n})`\n ${radioStyles}\n &:disabled {\n cursor: not-allowed;\n }\n`;\n\nexport const StyledLabel = styled('label', {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL,\n})<DSControlledRadioT.StyledLabelT>`\n ${({ wrapLabel, theme }) => (wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`)};\n\n color: ${({ theme, disabled, readOnly }) =>\n disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};\n font-size: 13px;\n line-height: 13px;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: 16px;\n line-height: 16px;\n ${({ wrapLabel, theme }) =>\n wrapLabel\n ? `padding: ${theme.space.xs} 0px ${theme.space.xs} ${theme.space.xs};`\n : `padding-left: ${theme.space.xs}`};\n }\n display: inherit;\n\n ${({ disabled }) =>\n disabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : `&:hover {\n cursor: pointer;\n }`}\n`;\n\nexport const StyledWrapLabel = styled('span')``;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAE5B,0BAAuD;AACvD,8BAA0C;AACnC,MAAM,kBAAkB,6BAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAAA;AAAA;AAAA,2BAG0B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,uBAC/B,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAMjD,MAAM,cAAc,6BAAO,MAAM;AAAA,WAC7B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,YAC1B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,uBAChB,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,sBAIpC,CAAC,EAAE,OAAO,eAAgB,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,gBAG3F,CAAC,EAAE,OAAO,eAAe,+CAAsB,OAAO,QAAQ;AAAA,IAC1E,CAAC,EAAE,OAAO,SAAS,UAAU,UAAU,eAAe,yCAAgB,OAAO,SAAS,UAAU,UAAU,QAAQ;AAAA;AAAA,MAEhH,CAAC,EAAE,OAAO,UAAU,eACpB,CAAC,WACG,qBAAqB,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,6BAC5E,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,UAE3D;AAAA;AAAA,QAEF,CAAC,EAAE,OAAO,SAAS,UAAU,UAAU,eACvC,yCAAgB,OAAO,SAAS,UAAU,UAAU,UAAU,IAAI;AAAA;AAAA;AAAA;AAAA,kBAIxD,CAAC,EAAE,OAAO,eAAgB,CAAC,WAAW,MAAM,OAAO,MAAM,OAAO;AAAA,MAC5E,CAAC,EAAE,OAAO,UAAU,UAAU,eAC9B,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,uBAAuB,MAAM,OAAO,MAAM,SAAS;AAAA;AAAA;AAI/F,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYb,MAAM,cAAc,6BAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAAA,IACG;AAAA;AAAA;AAAA;AAAA;AAMG,MAAM,cAAc,6BAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAAA,IACG,CAAC,EAAE,WAAW,YAAa,YAAY,8BAA8B,iBAAiB,MAAM,MAAM;AAAA;AAAA,WAE3F,CAAC,EAAE,OAAO,UAAU,eAC3B,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,uBAGrD,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAAA;AAAA,MAGlD,CAAC,EAAE,WAAW,YACd,YACI,YAAY,MAAM,MAAM,UAAU,MAAM,MAAM,MAAM,MAAM,MAAM,QAChE,iBAAiB,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA,IAInC,CAAC,EAAE,eACH,WACI;AAAA;AAAA,OAGA;AAAA;AAAA;AAAA;AAKD,MAAM,kBAAkB,6BAAO,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var styleHelpers_exports = {};
|
|
22
|
+
__export(styleHelpers_exports, {
|
|
23
|
+
handleBackgroundColor: () => handleBackgroundColor,
|
|
24
|
+
handleCheckMarkColor: () => handleCheckMarkColor,
|
|
25
|
+
handleCheckmark: () => handleCheckmark
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(styleHelpers_exports);
|
|
28
|
+
var React = __toESM(require("react"));
|
|
29
|
+
const handleCheckMarkColor = ({ colors }, checked, isHovering, disabled, readOnly, hasError) => {
|
|
30
|
+
if (hasError) {
|
|
31
|
+
return colors.danger[900];
|
|
32
|
+
}
|
|
33
|
+
if (disabled || readOnly) {
|
|
34
|
+
return colors.neutral[500];
|
|
35
|
+
}
|
|
36
|
+
return colors.brand[600];
|
|
37
|
+
};
|
|
38
|
+
const handleCheckmark = (theme, checked, disabled, readOnly, hasError, isHovering = false) => {
|
|
39
|
+
if (checked) {
|
|
40
|
+
return `
|
|
41
|
+
&:before {
|
|
42
|
+
content:"";
|
|
43
|
+
width: ${theme.space.xxs};
|
|
44
|
+
height: ${theme.space.xxs};
|
|
45
|
+
@media (max-width: ${theme.breakpoints.small}) {
|
|
46
|
+
width: 12px;
|
|
47
|
+
height: 12px;
|
|
48
|
+
margin: 5px;
|
|
49
|
+
}
|
|
50
|
+
border-radius:50%;
|
|
51
|
+
display:inline-block;
|
|
52
|
+
margin:3px;
|
|
53
|
+
background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
return "";
|
|
58
|
+
};
|
|
59
|
+
const handleBackgroundColor = ({ colors }, disabled) => {
|
|
60
|
+
if (disabled) {
|
|
61
|
+
return colors.neutral["080"];
|
|
62
|
+
}
|
|
63
|
+
return colors.neutral["000"];
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=styleHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/styleHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-params */\nimport type { Theme } from '@elliemae/pui-theme';\n\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean,\n isHovering: boolean,\n disabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (disabled || readOnly) {\n return colors.neutral[500];\n }\n\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked?: boolean,\n disabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n): string => {\n if (checked) {\n return `\n &:before {\n content:\"\";\n width: ${theme.space.xxs};\n height: ${theme.space.xxs};\n @media (max-width: ${theme.breakpoints.small}) {\n width: 12px;\n height: 12px;\n margin: 5px;\n }\n border-radius:50%;\n display:inline-block;\n margin:3px;\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};\n }\n `;\n }\n return '';\n};\n\nexport const handleBackgroundColor = ({ colors }: Theme, disabled?: boolean): string => {\n if (disabled) {\n return colors.neutral['080'];\n }\n\n return colors.neutral['000'];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGhB,MAAM,uBAAuB,CAClC,EAAE,UACF,SACA,YACA,UACA,UACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,OAAO;AAAA,EACvB;AACA,MAAI,YAAY,UAAU;AACxB,WAAO,OAAO,QAAQ;AAAA,EACxB;AAEA,SAAO,OAAO,MAAM;AACtB;AAEO,MAAM,kBAAkB,CAC7B,OACA,SACA,UACA,UACA,UACA,aAAa,UACF;AACX,MAAI,SAAS;AACX,WAAO;AAAA;AAAA;AAAA,eAGI,MAAM,MAAM;AAAA,gBACX,MAAM,MAAM;AAAA,2BACD,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAQzB,qBAAqB,OAAO,SAAS,YAAY,UAAU,UAAU,QAAQ;AAAA;AAAA;AAAA,EAG/F;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,CAAC,EAAE,UAAiB,aAA+B;AACtF,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ;AAAA,EACxB;AAEA,SAAO,OAAO,QAAQ;AACxB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import React2, { useCallback } from "react";
|
|
34
|
+
import {
|
|
35
|
+
describe,
|
|
36
|
+
useGetGlobalAttributes,
|
|
37
|
+
useGetXstyledProps,
|
|
38
|
+
useMemoMergePropsWithDefault
|
|
39
|
+
} from "@elliemae/ds-utilities";
|
|
40
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
41
|
+
import { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio } from "./styles";
|
|
42
|
+
import { propTypes, defaultProps } from "./react-desc-prop-types";
|
|
43
|
+
import { useValidateProps } from "./config/useValidateProps";
|
|
44
|
+
const DSControlledRadio = (props) => {
|
|
45
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
46
|
+
useValidateProps(props, propTypes);
|
|
47
|
+
const { checked, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;
|
|
48
|
+
const _a = useGetGlobalAttributes(propsWithDefault), { id, disabled, readOnly, label, className, tabIndex } = _a, restGlobals = __objRest(_a, ["id", "disabled", "readOnly", "label", "className", "tabIndex"]);
|
|
49
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
50
|
+
const handleOnChange = useCallback((e) => {
|
|
51
|
+
if (onChange)
|
|
52
|
+
onChange(value, e);
|
|
53
|
+
}, [onChange, value]);
|
|
54
|
+
const handleOnLabelClick = useCallback((e) => {
|
|
55
|
+
if (onChange)
|
|
56
|
+
onChange(value, e);
|
|
57
|
+
}, [onChange, value]);
|
|
58
|
+
return /* @__PURE__ */ React2.createElement(StyledContainer, __spreadValues({
|
|
59
|
+
"data-testid": "ds-radio-container",
|
|
60
|
+
className
|
|
61
|
+
}, xstyledProps), /* @__PURE__ */ React2.createElement(StyledRadio, {
|
|
62
|
+
checked,
|
|
63
|
+
hasError,
|
|
64
|
+
disabled,
|
|
65
|
+
readOnly
|
|
66
|
+
}, /* @__PURE__ */ React2.createElement(StyledInput, __spreadProps(__spreadValues({
|
|
67
|
+
"data-testid": "ds-radio"
|
|
68
|
+
}, restGlobals), {
|
|
69
|
+
id,
|
|
70
|
+
ref: innerRef,
|
|
71
|
+
type: "radio",
|
|
72
|
+
checked,
|
|
73
|
+
disabled,
|
|
74
|
+
onChange: handleOnChange
|
|
75
|
+
}))), label && /* @__PURE__ */ React2.createElement(StyledLabel, __spreadValues({
|
|
76
|
+
htmlFor: id,
|
|
77
|
+
disabled,
|
|
78
|
+
readOnly,
|
|
79
|
+
checked,
|
|
80
|
+
"data-testid": "ds-radio-label",
|
|
81
|
+
wrapLabel
|
|
82
|
+
}, !disabled ? { onClick: handleOnLabelClick } : {}), wrapLabel ? /* @__PURE__ */ React2.createElement(StyledWrapLabel, null, label) : /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
83
|
+
value: label
|
|
84
|
+
})));
|
|
85
|
+
};
|
|
86
|
+
DSControlledRadio.propTypes = propTypes;
|
|
87
|
+
DSControlledRadio.displayName = "DSControlledRadio";
|
|
88
|
+
const DSControlledRadioWithSchema = describe(DSControlledRadio);
|
|
89
|
+
DSControlledRadioWithSchema.propTypes = propTypes;
|
|
90
|
+
export {
|
|
91
|
+
DSControlledRadio,
|
|
92
|
+
DSControlledRadioWithSchema
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=ControlledRadio.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledRadio.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, WeakValidationMap } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-utilities';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio } from './styles';\nimport { DSControlledRadioT, propTypes, defaultProps } from './react-desc-prop-types';\nimport { useValidateProps } from './config/useValidateProps';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateProps(props, propTypes);\n\n const { checked, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;\n\n const { id, disabled, readOnly, label, className, tabIndex, ...restGlobals } =\n useGetGlobalAttributes<DSControlledRadioT.Props>(propsWithDefault);\n\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (onChange) onChange(value, e);\n },\n [onChange, value],\n );\n\n const handleOnLabelClick: React.MouseEventHandler<HTMLLabelElement> = useCallback(\n (e) => {\n if (onChange) onChange(value, e);\n },\n [onChange, value],\n );\n return (\n <StyledContainer data-testid=\"ds-radio-container\" className={className} {...xstyledProps}>\n <StyledRadio checked={checked} hasError={hasError} disabled={disabled} readOnly={readOnly}>\n <StyledInput\n data-testid=\"ds-radio\"\n {...restGlobals}\n id={id}\n ref={innerRef}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={handleOnChange}\n />\n </StyledRadio>\n {label && (\n <StyledLabel\n htmlFor={id}\n disabled={disabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n wrapLabel={wrapLabel}\n {...(!disabled ? { onClick: handleOnLabelClick } : {})}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n </StyledContainer>\n );\n};\n\nDSControlledRadio.propTypes = propTypes as WeakValidationMap<unknown>;\nDSControlledRadio.displayName = 'DSControlledRadio';\nconst DSControlledRadioWithSchema = describe(DSControlledRadio);\nDSControlledRadioWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSControlledRadio, DSControlledRadioWithSchema };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AACA;AACA;AACA;AAEA,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,mBAAmB,6BAA6B,OAAO,YAAY;AACzE,mBAAiB,OAAO,SAAS;AAEjC,QAAM,EAAE,SAAS,UAAU,UAAU,OAAO,WAAW,aAAa;AAEpE,QACE,4BAAiD,gBAAgB,GAD3D,MAAI,UAAU,UAAU,OAAO,WAAW,aAChD,IAD6D,wBAC7D,IAD6D,CAAvD,MAAI,YAAU,YAAU,SAAO,aAAW;AAGlD,QAAM,eAAe,mBAAmB,gBAAgB;AAExD,QAAM,iBAAiB,YACrB,CAAC,MAAyB;AACxB,QAAI;AAAU,eAAS,OAAO,CAAC;AAAA,EACjC,GACA,CAAC,UAAU,KAAK,CAClB;AAEA,QAAM,qBAAgE,YACpE,CAAC,MAAM;AACL,QAAI;AAAU,eAAS,OAAO,CAAC;AAAA,EACjC,GACA,CAAC,UAAU,KAAK,CAClB;AACA,SACE,qCAAC;AAAA,IAAgB,eAAY;AAAA,IAAqB;AAAA,KAA0B,eAC1E,qCAAC;AAAA,IAAY;AAAA,IAAkB;AAAA,IAAoB;AAAA,IAAoB;AAAA,KACrE,qCAAC;AAAA,IACC,eAAY;AAAA,KACR,cAFL;AAAA,IAGC;AAAA,IACA,KAAK;AAAA,IACL,MAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACZ,CACF,GACC,SACC,qCAAC;AAAA,IACC,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAY;AAAA,IACZ;AAAA,KACK,CAAC,WAAW,EAAE,SAAS,mBAAmB,IAAI,CAAC,IAEnD,YAAY,qCAAC,uBAAiB,KAAM,IAAqB,qCAAC;AAAA,IAA2B,OAAO;AAAA,GAAO,CACtG,CAEJ;AAEJ;AAEA,kBAAkB,YAAY;AAC9B,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
const throwError = (message) => {
|
|
4
|
+
throw new Error(`DSControlledRadio:: ${message}
|
|
5
|
+
`);
|
|
6
|
+
};
|
|
7
|
+
const useValidateProps = (props, propTypes) => {
|
|
8
|
+
useValidateTypescriptPropTypes(props, propTypes);
|
|
9
|
+
if (typeof props.label === "undefined" && typeof props["aria-label"] === "undefined") {
|
|
10
|
+
throwError(`Please provide a label or ariaLabel property to use this component.`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
useValidateProps
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSControlledRadioT } from '../react-desc-prop-types';\n\nconst throwError = (message: string): void => {\n throw new Error(\n `DSControlledRadio:: ${message}\n `,\n );\n};\n\nexport const useValidateProps = (props: DSControlledRadioT.Props, propTypes: DSControlledRadioT.Props): void => {\n useValidateTypescriptPropTypes(props, propTypes);\n if (typeof props.label === 'undefined' && typeof props['aria-label'] === 'undefined') {\n throwError(`Please provide a label or ariaLabel property to use this component.`);\n }\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAGA,MAAM,aAAa,CAAC,YAA0B;AAC5C,QAAM,IAAI,MACR,uBAAuB;AAAA,GAEzB;AACF;AAEO,MAAM,mBAAmB,CAAC,OAAiC,cAA8C;AAC9G,iCAA+B,OAAO,SAAS;AAC/C,MAAI,OAAO,MAAM,UAAU,eAAe,OAAO,MAAM,kBAAkB,aAAa;AACpF,eAAW,qEAAqE;AAAA,EAClF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/data-test-ids.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSRadioDataTestIds = {\n CONTAINER: 'ds-radio-container',\n INPUT: 'ds-radio',\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,OAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './data-test-ids';\nexport * from './theming';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/theming.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSRadioName = 'DS-Radio';\n\nexport const DSRadioSlots = {\n CONTAINER: 'root',\n INPUT: 'input',\n LABEL: 'label',\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,cAAc;AAEpB,MAAM,eAAe;AAAA,EAC1B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSControlledRadio, DSControlledRadioWithSchema } from './ControlledRadio';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-utilities";
|
|
22
|
+
const defaultProps = {
|
|
23
|
+
wrapLabel: false,
|
|
24
|
+
hasError: false,
|
|
25
|
+
checked: false
|
|
26
|
+
};
|
|
27
|
+
const propTypes = __spreadProps(__spreadValues(__spreadValues({}, globalAttributesPropTypes), xstyledPropTypes), {
|
|
28
|
+
value: PropTypes.string.description("Radio value"),
|
|
29
|
+
onChange: PropTypes.func.description("Radio onchange callback").signature("((newValue: string,e: React.ChangeEvent) => void)"),
|
|
30
|
+
label: PropTypes.string.description("Radio Label property. This label is also going to be used as an aria-label for screen readers."),
|
|
31
|
+
checked: PropTypes.bool.description("Whether the radio is checked or not"),
|
|
32
|
+
hasError: PropTypes.bool.description("Whether the radio has error or not."),
|
|
33
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Radio input ref."),
|
|
34
|
+
wrapLabel: PropTypes.bool.description("Whether to wrap or truncate the label")
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
defaultProps,
|
|
38
|
+
propTypes
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { ChangeEvent, MouseEvent } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes, GlobalAttributesT } from '@elliemae/ds-utilities';\nexport declare namespace DSControlledRadioT {\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n }\n\n export interface OptionalProps {\n value?: string;\n onChange?: (newValue: string, e: ChangeEvent | MouseEvent<HTMLLabelElement>) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface Props extends DefaultProps, OptionalProps, GlobalAttributesT {}\n\n export interface StyledRadioT {\n checked?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n disabled?: boolean;\n }\n\n export interface StyledLabelT {\n disabled?: boolean;\n readOnly?: boolean;\n checked: boolean;\n wrapLabel: boolean;\n onClick?: React.MouseEventHandler<HTMLLabelElement>;\n }\n}\n\nexport const defaultProps: Partial<DSControlledRadioT.Props> = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Radio value'),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent) => void)'),\n label: PropTypes.string.description(\n 'Radio Label property. This label is also going to be used as an aria-label for screen readers.',\n ),\n checked: PropTypes.bool.description('Whether the radio is checked or not'),\n hasError: PropTypes.bool.description('Whether the radio has error or not.'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Radio input ref.'),\n wrapLabel: PropTypes.bool.description('Whether to wrap or truncate the label'),\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACCA;AAkCO,MAAM,eAAkD;AAAA,EAC7D,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AACX;AAEO,MAAM,YAAY,gDACpB,4BACA,mBAFoB;AAAA,EAGvB,OAAO,UAAU,OAAO,YAAY,aAAa;AAAA,EACjD,UAAU,UAAU,KACjB,YAAY,yBAAyB,EACrC,UAAU,mDAAmD;AAAA,EAChE,OAAO,UAAU,OAAO,YACtB,gGACF;AAAA,EACA,SAAS,UAAU,KAAK,YAAY,qCAAqC;AAAA,EACzE,UAAU,UAAU,KAAK,YAAY,qCAAqC;AAAA,EAC1E,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,EAAE,YAAY,kBAAkB;AAAA,EAChG,WAAW,UAAU,KAAK,YAAY,uCAAuC;AAC/E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styled, css } from "@elliemae/ds-system";
|
|
3
|
+
import { handleBackgroundColor, handleCheckmark } from "./utils/styleHelpers";
|
|
4
|
+
import { DSRadioName, DSRadioSlots } from "./exported-related";
|
|
5
|
+
const StyledContainer = styled("div", {
|
|
6
|
+
name: DSRadioName,
|
|
7
|
+
slot: DSRadioSlots.CONTAINER
|
|
8
|
+
})`
|
|
9
|
+
display: inline-grid;
|
|
10
|
+
grid-template-rows: min-content;
|
|
11
|
+
grid-template-columns: ${({ theme }) => theme.space.xs} auto;
|
|
12
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
13
|
+
grid-template-columns: 24px auto;
|
|
14
|
+
}
|
|
15
|
+
align-items: center;
|
|
16
|
+
`;
|
|
17
|
+
const StyledRadio = styled("span")`
|
|
18
|
+
width: ${({ theme }) => theme.space.xs};
|
|
19
|
+
height: ${({ theme }) => theme.space.xs};
|
|
20
|
+
@media (max-width: ${(props) => props.theme.breakpoints.small}) {
|
|
21
|
+
width: 24px;
|
|
22
|
+
height: 24px;
|
|
23
|
+
}
|
|
24
|
+
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
|
25
|
+
border-radius: 50px;
|
|
26
|
+
position: relative;
|
|
27
|
+
background: ${({ theme, disabled }) => handleBackgroundColor(theme, disabled)};
|
|
28
|
+
${({ theme, checked, disabled, readOnly, hasError }) => handleCheckmark(theme, checked, disabled, readOnly, hasError)}
|
|
29
|
+
&:focus-within {
|
|
30
|
+
${({ theme, hasError, disabled }) => !disabled ? `border: 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]}; outline : 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]} ` : void 0};
|
|
31
|
+
&:hover {
|
|
32
|
+
${({ theme, checked, disabled, readOnly, hasError }) => handleCheckmark(theme, checked, disabled, readOnly, hasError, true)}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&:hover {
|
|
36
|
+
background: ${({ theme, disabled }) => !disabled ? theme.colors.brand[200] : void 0};
|
|
37
|
+
${({ theme, hasError, disabled, readOnly }) => !hasError && !disabled && !readOnly ? ` border: 1px solid ${theme.colors.brand[600]}` : void 0};
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const radioStyles = css`
|
|
41
|
+
&:hover {
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
opacity: 0;
|
|
50
|
+
`;
|
|
51
|
+
const StyledInput = styled("input", {
|
|
52
|
+
name: DSRadioName,
|
|
53
|
+
slot: DSRadioSlots.INPUT
|
|
54
|
+
})`
|
|
55
|
+
${radioStyles}
|
|
56
|
+
&:disabled {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const StyledLabel = styled("label", {
|
|
61
|
+
name: DSRadioName,
|
|
62
|
+
slot: DSRadioSlots.LABEL
|
|
63
|
+
})`
|
|
64
|
+
${({ wrapLabel, theme }) => wrapLabel ? "padding: 8px 0px 8px 8px;" : `padding-left: ${theme.space.xxs}`};
|
|
65
|
+
|
|
66
|
+
color: ${({ theme, disabled, readOnly }) => disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
67
|
+
font-size: 13px;
|
|
68
|
+
line-height: 13px;
|
|
69
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
${({ wrapLabel, theme }) => wrapLabel ? `padding: ${theme.space.xs} 0px ${theme.space.xs} ${theme.space.xs};` : `padding-left: ${theme.space.xs}`};
|
|
73
|
+
}
|
|
74
|
+
display: inherit;
|
|
75
|
+
|
|
76
|
+
${({ disabled }) => disabled ? `&:hover {
|
|
77
|
+
cursor: not-allowed;
|
|
78
|
+
}` : `&:hover {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}`}
|
|
81
|
+
`;
|
|
82
|
+
const StyledWrapLabel = styled("span")``;
|
|
83
|
+
export {
|
|
84
|
+
StyledContainer,
|
|
85
|
+
StyledInput,
|
|
86
|
+
StyledLabel,
|
|
87
|
+
StyledRadio,
|
|
88
|
+
StyledWrapLabel
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 } from '@elliemae/ds-system';\nimport { DSControlledRadioT } from './react-desc-prop-types';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers';\nimport { DSRadioName, DSRadioSlots } from './exported-related';\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})`\n display: inline-grid;\n grid-template-rows: min-content;\n grid-template-columns: ${({ theme }) => theme.space.xs} auto;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n grid-template-columns: 24px auto;\n }\n align-items: center;\n`;\n\nexport const StyledRadio = styled('span')<DSControlledRadioT.StyledRadioT>`\n width: ${({ theme }) => theme.space.xs};\n height: ${({ theme }) => theme.space.xs};\n @media (max-width: ${(props) => props.theme.breakpoints.small}) {\n width: 24px;\n height: 24px;\n }\n border: 1px solid ${({ theme, hasError }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n border-radius: 50px;\n position: relative;\n background: ${({ theme, disabled }) => handleBackgroundColor(theme, disabled)};\n ${({ theme, checked, disabled, readOnly, hasError }) => handleCheckmark(theme, checked, disabled, readOnly, hasError)}\n &:focus-within {\n ${({ theme, hasError, disabled }) =>\n !disabled\n ? `border: 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.brand[700]}; outline : 1px solid ${\n hasError ? theme.colors.danger[900] : theme.colors.brand[700]\n } `\n : undefined};\n &:hover {\n ${({ theme, checked, disabled, readOnly, hasError }) =>\n handleCheckmark(theme, checked, disabled, readOnly, hasError, true)}\n }\n }\n &:hover {\n background: ${({ theme, disabled }) => (!disabled ? theme.colors.brand[200] : undefined)};\n ${({ theme, hasError, disabled, readOnly }) =>\n !hasError && !disabled && !readOnly ? ` border: 1px solid ${theme.colors.brand[600]}` : undefined};\n }\n`;\n\nconst radioStyles = css`\n &:hover {\n cursor: pointer;\n }\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n`;\n\nexport const StyledInput = styled('input', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT,\n})`\n ${radioStyles}\n &:disabled {\n cursor: not-allowed;\n }\n`;\n\nexport const StyledLabel = styled('label', {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL,\n})<DSControlledRadioT.StyledLabelT>`\n ${({ wrapLabel, theme }) => (wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`)};\n\n color: ${({ theme, disabled, readOnly }) =>\n disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};\n font-size: 13px;\n line-height: 13px;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: 16px;\n line-height: 16px;\n ${({ wrapLabel, theme }) =>\n wrapLabel\n ? `padding: ${theme.space.xs} 0px ${theme.space.xs} ${theme.space.xs};`\n : `padding-left: ${theme.space.xs}`};\n }\n display: inherit;\n\n ${({ disabled }) =>\n disabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : `&:hover {\n cursor: pointer;\n }`}\n`;\n\nexport const StyledWrapLabel = styled('span')``;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA;AACA;AACO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAAA;AAAA;AAAA,2BAG0B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,uBAC/B,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAMjD,MAAM,cAAc,OAAO,MAAM;AAAA,WAC7B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,YAC1B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,uBAChB,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,sBAIpC,CAAC,EAAE,OAAO,eAAgB,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,gBAG3F,CAAC,EAAE,OAAO,eAAe,sBAAsB,OAAO,QAAQ;AAAA,IAC1E,CAAC,EAAE,OAAO,SAAS,UAAU,UAAU,eAAe,gBAAgB,OAAO,SAAS,UAAU,UAAU,QAAQ;AAAA;AAAA,MAEhH,CAAC,EAAE,OAAO,UAAU,eACpB,CAAC,WACG,qBAAqB,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,6BAC5E,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,UAE3D;AAAA;AAAA,QAEF,CAAC,EAAE,OAAO,SAAS,UAAU,UAAU,eACvC,gBAAgB,OAAO,SAAS,UAAU,UAAU,UAAU,IAAI;AAAA;AAAA;AAAA;AAAA,kBAIxD,CAAC,EAAE,OAAO,eAAgB,CAAC,WAAW,MAAM,OAAO,MAAM,OAAO;AAAA,MAC5E,CAAC,EAAE,OAAO,UAAU,UAAU,eAC9B,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,uBAAuB,MAAM,OAAO,MAAM,SAAS;AAAA;AAAA;AAI/F,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYb,MAAM,cAAc,OAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAAA,IACG;AAAA;AAAA;AAAA;AAAA;AAMG,MAAM,cAAc,OAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAAA,IACG,CAAC,EAAE,WAAW,YAAa,YAAY,8BAA8B,iBAAiB,MAAM,MAAM;AAAA;AAAA,WAE3F,CAAC,EAAE,OAAO,UAAU,eAC3B,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,uBAGrD,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAAA;AAAA,MAGlD,CAAC,EAAE,WAAW,YACd,YACI,YAAY,MAAM,MAAM,UAAU,MAAM,MAAM,MAAM,MAAM,MAAM,QAChE,iBAAiB,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA,IAInC,CAAC,EAAE,eACH,WACI;AAAA;AAAA,OAGA;AAAA;AAAA;AAAA;AAKD,MAAM,kBAAkB,OAAO,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const handleCheckMarkColor = ({ colors }, checked, isHovering, disabled, readOnly, hasError) => {
|
|
3
|
+
if (hasError) {
|
|
4
|
+
return colors.danger[900];
|
|
5
|
+
}
|
|
6
|
+
if (disabled || readOnly) {
|
|
7
|
+
return colors.neutral[500];
|
|
8
|
+
}
|
|
9
|
+
return colors.brand[600];
|
|
10
|
+
};
|
|
11
|
+
const handleCheckmark = (theme, checked, disabled, readOnly, hasError, isHovering = false) => {
|
|
12
|
+
if (checked) {
|
|
13
|
+
return `
|
|
14
|
+
&:before {
|
|
15
|
+
content:"";
|
|
16
|
+
width: ${theme.space.xxs};
|
|
17
|
+
height: ${theme.space.xxs};
|
|
18
|
+
@media (max-width: ${theme.breakpoints.small}) {
|
|
19
|
+
width: 12px;
|
|
20
|
+
height: 12px;
|
|
21
|
+
margin: 5px;
|
|
22
|
+
}
|
|
23
|
+
border-radius:50%;
|
|
24
|
+
display:inline-block;
|
|
25
|
+
margin:3px;
|
|
26
|
+
background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
return "";
|
|
31
|
+
};
|
|
32
|
+
const handleBackgroundColor = ({ colors }, disabled) => {
|
|
33
|
+
if (disabled) {
|
|
34
|
+
return colors.neutral["080"];
|
|
35
|
+
}
|
|
36
|
+
return colors.neutral["000"];
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
handleBackgroundColor,
|
|
40
|
+
handleCheckMarkColor,
|
|
41
|
+
handleCheckmark
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=styleHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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", "/* eslint-disable max-params */\nimport type { Theme } from '@elliemae/pui-theme';\n\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean,\n isHovering: boolean,\n disabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (disabled || readOnly) {\n return colors.neutral[500];\n }\n\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked?: boolean,\n disabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n): string => {\n if (checked) {\n return `\n &:before {\n content:\"\";\n width: ${theme.space.xxs};\n height: ${theme.space.xxs};\n @media (max-width: ${theme.breakpoints.small}) {\n width: 12px;\n height: 12px;\n margin: 5px;\n }\n border-radius:50%;\n display:inline-block;\n margin:3px;\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};\n }\n `;\n }\n return '';\n};\n\nexport const handleBackgroundColor = ({ colors }: Theme, disabled?: boolean): string => {\n if (disabled) {\n return colors.neutral['080'];\n }\n\n return colors.neutral['000'];\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACGO,MAAM,uBAAuB,CAClC,EAAE,UACF,SACA,YACA,UACA,UACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,OAAO;AAAA,EACvB;AACA,MAAI,YAAY,UAAU;AACxB,WAAO,OAAO,QAAQ;AAAA,EACxB;AAEA,SAAO,OAAO,MAAM;AACtB;AAEO,MAAM,kBAAkB,CAC7B,OACA,SACA,UACA,UACA,UACA,aAAa,UACF;AACX,MAAI,SAAS;AACX,WAAO;AAAA;AAAA;AAAA,eAGI,MAAM,MAAM;AAAA,gBACX,MAAM,MAAM;AAAA,2BACD,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAQzB,qBAAqB,OAAO,SAAS,YAAY,UAAU,UAAU,QAAQ;AAAA;AAAA;AAAA,EAG/F;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,CAAC,EAAE,UAAiB,aAA+B;AACtF,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ;AAAA,EACxB;AAEA,SAAO,OAAO,QAAQ;AACxB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-form-radio",
|
|
3
|
+
"version": "3.1.0-next.20",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - Controlled Form Radio",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"*.scss"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"pnpm": ">=6",
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"author": "ICE MT",
|
|
31
|
+
"jestSonar": {
|
|
32
|
+
"sonar56x": true,
|
|
33
|
+
"reportPath": "reports",
|
|
34
|
+
"reportFile": "tests.xml",
|
|
35
|
+
"indent": 4
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@elliemae/ds-system": "3.1.0-next.20",
|
|
39
|
+
"@elliemae/ds-truncated-tooltip-text": "3.1.0-next.20",
|
|
40
|
+
"@elliemae/ds-utilities": "3.1.0-next.20"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@elliemae/pui-theme": "~2.6.0",
|
|
44
|
+
"@testing-library/dom": "~8.13.0",
|
|
45
|
+
"@testing-library/jest-dom": "~5.16.4",
|
|
46
|
+
"@testing-library/react": "~12.1.3",
|
|
47
|
+
"@testing-library/user-event": "~13.5.0",
|
|
48
|
+
"styled-components": "~5.3.5"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@elliemae/pui-theme": "~2.6.0",
|
|
52
|
+
"react": "^17.0.2",
|
|
53
|
+
"react-dom": "^17.0.2",
|
|
54
|
+
"styled-components": "^5.3.5",
|
|
55
|
+
"styled-system": "^5.1.5"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"typeSafety": false
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
63
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
64
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
65
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
66
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
67
|
+
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
68
|
+
}
|
|
69
|
+
}
|