@elliemae/ds-form-checkbox 3.50.0-next.2 → 3.50.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/parts/ControlledCheckBoxContent.js +2 -1
- package/dist/cjs/parts/ControlledCheckBoxContent.js.map +2 -2
- package/dist/cjs/parts/MainInput.js +6 -4
- package/dist/cjs/parts/MainInput.js.map +2 -2
- package/dist/cjs/styles.js +15 -5
- package/dist/cjs/styles.js.map +2 -2
- package/dist/cjs/utils/styleHelpers.js +5 -2
- package/dist/cjs/utils/styleHelpers.js.map +2 -2
- package/dist/esm/parts/ControlledCheckBoxContent.js +3 -2
- package/dist/esm/parts/ControlledCheckBoxContent.js.map +2 -2
- package/dist/esm/parts/MainInput.js +6 -4
- package/dist/esm/parts/MainInput.js.map +2 -2
- package/dist/esm/styles.js +15 -5
- package/dist/esm/styles.js.map +2 -2
- package/dist/esm/utils/styleHelpers.js +5 -2
- package/dist/esm/utils/styleHelpers.js.map +2 -2
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/utils/styleHelpers.d.ts +1 -1
- package/package.json +11 -9
@@ -95,7 +95,8 @@ const ControlledCheckBoxContent = () => {
|
|
95
95
|
getOwnerPropsArguments,
|
96
96
|
children: wrapLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledWrapLabel, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_truncated_tooltip_text.SimpleTruncatedTooltipText, { value: label })
|
97
97
|
}
|
98
|
-
)
|
98
|
+
),
|
99
|
+
readOnly ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledHiddenP, { id: `${instanceUid}-read-only-helper-msg`, children: "Read only" }) : null
|
99
100
|
]
|
100
101
|
}
|
101
102
|
);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/parts/ControlledCheckBoxContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox } from '../styles.js';\nimport { MainInput } from './MainInput.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const ControlledCheckBoxContent = () => {\n const { propsWithDefault, globalProps, instanceUid, xstyledProps, handleOnChange } =\n React.useContext(ControlledCheckBoxContext);\n const {\n checked,\n device,\n label,\n hasError,\n wrapLabel,\n ariaControls: legacyAriaControls,\n applyAriaDisabled,\n } = propsWithDefault;\n const { disabled, readOnly, 'aria-controls': ariaControls, className } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n wrapLabel={wrapLabel}\n device={device}\n data-testid=\"ds-checkbox-container\"\n className={className}\n hasLabel={Boolean(label)}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCheckBox\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MainInput />\n </StyledCheckBox>\n {label && (\n <StyledLabel\n id={`${instanceUid}_label`}\n htmlFor={instanceUid}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-checkbox-label\"\n wrapLabel={wrapLabel}\n device={device}\n {...(!disabled && (ariaControls || legacyAriaControls) ? { onClick: handleOnChange } : {})}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n </StyledContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBnB;AAxBJ,mBAAkB;AAClB,uCAA2C;AAC3C,8BAA8B;AAC9B,
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox, StyledHiddenP } from '../styles.js';\nimport { MainInput } from './MainInput.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const ControlledCheckBoxContent = () => {\n const { propsWithDefault, globalProps, instanceUid, xstyledProps, handleOnChange } =\n React.useContext(ControlledCheckBoxContext);\n const {\n checked,\n device,\n label,\n hasError,\n wrapLabel,\n ariaControls: legacyAriaControls,\n applyAriaDisabled,\n } = propsWithDefault;\n const { disabled, readOnly, 'aria-controls': ariaControls, className } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n wrapLabel={wrapLabel}\n device={device}\n data-testid=\"ds-checkbox-container\"\n className={className}\n hasLabel={Boolean(label)}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCheckBox\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MainInput />\n </StyledCheckBox>\n {label && (\n <StyledLabel\n id={`${instanceUid}_label`}\n htmlFor={instanceUid}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-checkbox-label\"\n wrapLabel={wrapLabel}\n device={device}\n {...(!disabled && (ariaControls || legacyAriaControls) ? { onClick: handleOnChange } : {})}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n {readOnly ? <StyledHiddenP id={`${instanceUid}-read-only-helper-msg`}>Read only</StyledHiddenP> : null}\n </StyledContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBnB;AAxBJ,mBAAkB;AAClB,uCAA2C;AAC3C,8BAA8B;AAC9B,oBAA6F;AAC7F,uBAA0B;AAC1B,mCAA0C;AAEnC,MAAM,4BAA4B,MAAM;AAC7C,QAAM,EAAE,kBAAkB,aAAa,aAAa,cAAc,eAAe,IAC/E,aAAAA,QAAM,WAAW,sDAAyB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,UAAU,UAAU,iBAAiB,cAAc,UAAU,IAAI;AAEzE,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,gBAAgB;AAEhF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAY;AAAA,MACZ;AAAA,MACA,UAAU,QAAQ,KAAK;AAAA,MACtB,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEA,sDAAC,8BAAU;AAAA;AAAA,QACb;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,GAAG,WAAW;AAAA,YAClB,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACC,GAAI,CAAC,aAAa,gBAAgB,sBAAsB,EAAE,SAAS,eAAe,IAAI,CAAC;AAAA,YACxF;AAAA,YACA;AAAA,YAEC,sBAAY,4CAAC,iCAAiB,iBAAM,IAAqB,4CAAC,+DAA2B,OAAO,OAAO;AAAA;AAAA,QACtG;AAAA,QAED,WAAW,4CAAC,+BAAc,IAAI,GAAG,WAAW,yBAAyB,uBAAS,IAAmB;AAAA;AAAA;AAAA,EACpG;AAEJ;",
|
6
6
|
"names": ["React"]
|
7
7
|
}
|
@@ -76,7 +76,7 @@ const MainInput = () => {
|
|
76
76
|
...mainInputProps,
|
77
77
|
role: "checkbox",
|
78
78
|
"aria-controls": ariaControls || camelCaseAriaControls,
|
79
|
-
"aria-disabled": disabled || applyAriaDisabled,
|
79
|
+
"aria-disabled": disabled || applyAriaDisabled || readOnly,
|
80
80
|
"aria-invalid": hasError,
|
81
81
|
onClick: !disabled && !readOnly ? handleOnChange : void 0,
|
82
82
|
onKeyDown: handleMixedCheckboxOnKeyDown,
|
@@ -85,6 +85,7 @@ const MainInput = () => {
|
|
85
85
|
onMouseDown: (e) => {
|
86
86
|
if (disabled) e.preventDefault();
|
87
87
|
},
|
88
|
+
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
88
89
|
getOwnerProps,
|
89
90
|
getOwnerPropsArguments
|
90
91
|
}
|
@@ -100,10 +101,11 @@ const MainInput = () => {
|
|
100
101
|
disabled,
|
101
102
|
tabIndex,
|
102
103
|
innerRef,
|
103
|
-
getOwnerProps,
|
104
|
-
getOwnerPropsArguments,
|
105
104
|
"aria-invalid": hasError,
|
106
|
-
"aria-disabled": applyAriaDisabled
|
105
|
+
"aria-disabled": applyAriaDisabled || readOnly,
|
106
|
+
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
107
|
+
getOwnerProps,
|
108
|
+
getOwnerPropsArguments
|
107
109
|
}
|
108
110
|
);
|
109
111
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/parts/MainInput.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledInput, StyledInputMixed } from '../styles.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const MainInput = () => {\n const { propsWithDefault, globalProps, instanceUid, handleOnChange, handleMixedCheckboxOnKeyDown } =\n React.useContext(ControlledCheckBoxContext);\n const {\n disabled,\n readOnly,\n // label,\n tabIndex,\n innerRef,\n checked,\n visualOnly,\n ariaControls: camelCaseAriaControls,\n withRelatedBlockLabel,\n // ariaLabel: camelCaseAriaLabel,\n // externalLabel,\n hasError,\n applyAriaDisabled,\n } = propsWithDefault;\n const { 'aria-controls': ariaControls } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n // if components doesn't define 'aria-controls' it would be \"a11y invalid\" to allow 'mixed' state\n // so\n // if they are NOT provided we use <input type='checkbox' /> that has no 'mixed' state support in html5\n // if they ARE provided we use <input /> (no type checkbox) in which we super-charge the 'mixed' state via css\n // props slightly differ because of this\n // also, because of this, \"onChange\" may be an onClick (or keyboard activation) or the native \"onChange\"\n const canShowMixedState = ariaControls || camelCaseAriaControls;\n // if aria-label is provided we are probably printing a 'label-less' checkbox (like data-table, or mixed parent in a group)\n // in such scenarios having the aria-labelledby may results in 'referencing a non-existing element' error\n const outOfTheBoxAriaLabelledBy = !globalProps['aria-label']\n ? `${instanceUid}_label${withRelatedBlockLabel ? ` ${instanceUid}_block_label` : ''}`\n : undefined;\n\n const mainInputProps = {\n id: instanceUid,\n 'data-testid': 'ds-checkbox',\n 'aria-checked': checked, // if user doesn't provide aria-checked, we make this the same as the actual value\n 'aria-labelledby': outOfTheBoxAriaLabelledBy,\n // if the user provides an aria-labelledby we still do print it anyway, so this should work for both internal scenarios and final integrations\n ...globalProps, // any props provided by the user will over-ride ours\n };\n\n if (visualOnly) return null;\n\n if (canShowMixedState)\n return (\n <StyledInputMixed\n {...mainInputProps}\n role=\"checkbox\"\n aria-controls={ariaControls || camelCaseAriaControls}\n aria-disabled={disabled || applyAriaDisabled}\n aria-invalid={hasError}\n onClick={!disabled && !readOnly ? handleOnChange : undefined}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n tabIndex={disabled ? -1 : tabIndex}\n innerRef={innerRef}\n onMouseDown={(e: React.MouseEvent) => {\n if (disabled) e.preventDefault();\n }}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n return (\n <StyledInput\n {...mainInputProps}\n type=\"checkbox\"\n checked={checked as boolean | undefined}\n onChange={handleOnChange}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n disabled={disabled}\n tabIndex={tabIndex}\n innerRef={innerRef}\n
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsDjB;AArDN,mBAAkB;AAClB,8BAA8B;AAC9B,oBAA8C;AAC9C,mCAA0C;AAEnC,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,kBAAkB,aAAa,aAAa,gBAAgB,6BAA6B,IAC/F,aAAAA,QAAM,WAAW,sDAAyB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA;AAAA;AAAA,IAGA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,iBAAiB,aAAa,IAAI;AAE1C,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,gBAAgB;AAQhF,QAAM,oBAAoB,gBAAgB;AAG1C,QAAM,4BAA4B,CAAC,YAAY,YAAY,IACvD,GAAG,WAAW,SAAS,wBAAwB,IAAI,WAAW,iBAAiB,EAAE,KACjF;AAEJ,QAAM,iBAAiB;AAAA,IACrB,IAAI;AAAA,IACJ,eAAe;AAAA,IACf,gBAAgB;AAAA;AAAA,IAChB,mBAAmB;AAAA;AAAA,IAEnB,GAAG;AAAA;AAAA,EACL;AAEA,MAAI,WAAY,QAAO;AAEvB,MAAI;AACF,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,MAAK;AAAA,QACL,iBAAe,gBAAgB;AAAA,QAC/B,iBAAe,YAAY;AAAA,
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledInput, StyledInputMixed } from '../styles.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const MainInput = () => {\n const { propsWithDefault, globalProps, instanceUid, handleOnChange, handleMixedCheckboxOnKeyDown } =\n React.useContext(ControlledCheckBoxContext);\n const {\n disabled,\n readOnly,\n // label,\n tabIndex,\n innerRef,\n checked,\n visualOnly,\n ariaControls: camelCaseAriaControls,\n withRelatedBlockLabel,\n // ariaLabel: camelCaseAriaLabel,\n // externalLabel,\n hasError,\n applyAriaDisabled,\n } = propsWithDefault;\n const { 'aria-controls': ariaControls } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n // if components doesn't define 'aria-controls' it would be \"a11y invalid\" to allow 'mixed' state\n // so\n // if they are NOT provided we use <input type='checkbox' /> that has no 'mixed' state support in html5\n // if they ARE provided we use <input /> (no type checkbox) in which we super-charge the 'mixed' state via css\n // props slightly differ because of this\n // also, because of this, \"onChange\" may be an onClick (or keyboard activation) or the native \"onChange\"\n const canShowMixedState = ariaControls || camelCaseAriaControls;\n // if aria-label is provided we are probably printing a 'label-less' checkbox (like data-table, or mixed parent in a group)\n // in such scenarios having the aria-labelledby may results in 'referencing a non-existing element' error\n const outOfTheBoxAriaLabelledBy = !globalProps['aria-label']\n ? `${instanceUid}_label${withRelatedBlockLabel ? ` ${instanceUid}_block_label` : ''}`\n : undefined;\n\n const mainInputProps = {\n id: instanceUid,\n 'data-testid': 'ds-checkbox',\n 'aria-checked': checked, // if user doesn't provide aria-checked, we make this the same as the actual value\n 'aria-labelledby': outOfTheBoxAriaLabelledBy,\n // if the user provides an aria-labelledby we still do print it anyway, so this should work for both internal scenarios and final integrations\n ...globalProps, // any props provided by the user will over-ride ours\n };\n\n if (visualOnly) return null;\n\n if (canShowMixedState)\n return (\n <StyledInputMixed\n {...mainInputProps}\n role=\"checkbox\"\n aria-controls={ariaControls || camelCaseAriaControls}\n aria-disabled={disabled || applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n onClick={!disabled && !readOnly ? handleOnChange : undefined}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n tabIndex={disabled ? -1 : tabIndex}\n innerRef={innerRef}\n onMouseDown={(e: React.MouseEvent) => {\n if (disabled) e.preventDefault();\n }}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n return (\n <StyledInput\n {...mainInputProps}\n type=\"checkbox\"\n checked={checked as boolean | undefined}\n onChange={handleOnChange}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n disabled={disabled}\n tabIndex={tabIndex}\n innerRef={innerRef}\n aria-invalid={hasError}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsDjB;A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A,MACL;AAAA,MACA,UAAU;AAAA,MACV,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAc;AAAA,MACd,iBAAe,qBAAqB;AAAA,MACpC,oBAAkB,WAAW,GAAG,WAAW,0BAA0B;AAAA,MACrE;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
|
6
6
|
"names": ["React"]
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
@@ -30,6 +30,7 @@ var styles_exports = {};
|
|
30
30
|
__export(styles_exports, {
|
31
31
|
StyledCheckBox: () => StyledCheckBox,
|
32
32
|
StyledContainer: () => StyledContainer,
|
33
|
+
StyledHiddenP: () => StyledHiddenP,
|
33
34
|
StyledInput: () => StyledInput,
|
34
35
|
StyledInputMixed: () => StyledInputMixed,
|
35
36
|
StyledLabel: () => StyledLabel,
|
@@ -45,7 +46,7 @@ const StyledCheckBox = (0, import_ds_system.styled)("span", {
|
|
45
46
|
slot: import_exported_related.DSCheckboxSlots.INPUT_WRAPPER
|
46
47
|
})`
|
47
48
|
position: relative;
|
48
|
-
background: ${({ theme, disabled, applyAriaDisabled }) => (0, import_styleHelpers.handleBackgroundColor)(theme, disabled, applyAriaDisabled)};
|
49
|
+
background: ${({ theme, disabled, applyAriaDisabled, readOnly }) => (0, import_styleHelpers.handleBackgroundColor)(theme, disabled, applyAriaDisabled, readOnly)};
|
49
50
|
|
50
51
|
${({ device, theme }) => {
|
51
52
|
if (device === "mobile") {
|
@@ -90,10 +91,16 @@ const StyledCheckBox = (0, import_ds_system.styled)("span", {
|
|
90
91
|
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
91
92
|
}
|
92
93
|
&:hover {
|
93
|
-
background: ${({ theme, applyAriaDisabled, disabled }) => !disabled && !applyAriaDisabled ? theme.colors.brand[200] : void 0};
|
94
|
+
background: ${({ theme, applyAriaDisabled, disabled, readOnly }) => !disabled && !applyAriaDisabled && !readOnly ? theme.colors.brand[200] : void 0};
|
94
95
|
|
95
96
|
&:after {
|
96
|
-
border: 1px solid
|
97
|
+
border: 1px solid
|
98
|
+
${({ theme, hasError, disabled, applyAriaDisabled, readOnly }) => {
|
99
|
+
if (hasError) return theme.colors.danger[900];
|
100
|
+
if (applyAriaDisabled || readOnly) return theme.colors.brand[700];
|
101
|
+
if (disabled) return theme.colors.neutral[400];
|
102
|
+
return theme.colors.brand[600];
|
103
|
+
}};
|
97
104
|
}
|
98
105
|
}
|
99
106
|
&:focus-within {
|
@@ -106,7 +113,7 @@ const StyledCheckBox = (0, import_ds_system.styled)("span", {
|
|
106
113
|
}
|
107
114
|
&:active {
|
108
115
|
&:after {
|
109
|
-
border:
|
116
|
+
border: ${({ disabled, theme }) => disabled ? `1px solid ${theme.colors.neutral[400]}` : `2px solid ${theme.colors.brand[600]}`};
|
110
117
|
}
|
111
118
|
}
|
112
119
|
`;
|
@@ -153,7 +160,7 @@ const StyledLabel = (0, import_ds_system.styled)("label", {
|
|
153
160
|
word-break: break-word;
|
154
161
|
`};
|
155
162
|
width: fit-content;
|
156
|
-
color: ${({ theme, disabled
|
163
|
+
color: ${({ theme, disabled }) => disabled ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
157
164
|
line-height: 1.2307rem;
|
158
165
|
@media (max-width: ${import_ds_system.th.breakpoint("small")}) {
|
159
166
|
line-height: 1rem; /* 13px / 16 */
|
@@ -223,4 +230,7 @@ const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
223
230
|
align-items: ${({ wrapLabel }) => wrapLabel ? "flex-start" : "center"};
|
224
231
|
${import_ds_system.xStyledCommonProps}
|
225
232
|
`;
|
233
|
+
const StyledHiddenP = import_ds_system.styled.p`
|
234
|
+
display: none;
|
235
|
+
`;
|
226
236
|
//# sourceMappingURL=styles.js.map
|
package/dist/cjs/styles.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { styled, th, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { DSControlledCheckboxT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSCheckboxName, DSCheckboxSlots } from './exported-related/index.js';\n\nexport const StyledCheckBox = styled('span', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT_WRAPPER,\n})<DSControlledCheckboxT.StyledCheckBoxT>`\n position: relative;\n background: ${({ theme, disabled, applyAriaDisabled })
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAoD;AAEpD,0BAAuD;AACvD,8BAAgD;AAEzC,MAAM,qBAAiB,yBAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wCAAgB;AACxB,CAAC;AAAA;AAAA,gBAEe,CAAC,EAAE,OAAO,UAAU,
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { styled, th, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { DSControlledCheckboxT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSCheckboxName, DSCheckboxSlots } from './exported-related/index.js';\n\nexport const StyledCheckBox = styled('span', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT_WRAPPER,\n})<DSControlledCheckboxT.StyledCheckBoxT>`\n position: relative;\n background: ${({ theme, disabled, applyAriaDisabled, readOnly }) =>\n handleBackgroundColor(theme, disabled, applyAriaDisabled, readOnly)};\n\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return ` \n @media (max-width: ${theme.breakpoints.small}) {\n width: 1.5rem; /* 24px / 16 */\n height: 1.5rem; /* 24px / 16 */\n }\n width: 1.846rem; /* 24px / 13 */\n height: 1.846rem; /* 24px / 13 */`;\n }\n if (device === undefined) {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n width: 1.5rem; /* 24px / 16 */\n height: 1.5rem; /* 24px / 16 */\n }\n width: 1.2307rem;\n height: 1.2307rem;\n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n width: 1rem; /* 16px / 16 */\n height: 1rem; /* 16px / 16 */\n }\n width: 1.2307rem; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\n `;\n }}\n\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled, applyAriaDisabled, readOnly, hasError, false, device)}\n\n &:after {\n content: '';\n border-radius: 2px;\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n border: 1px solid ${({ theme, hasError }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n }\n &:hover {\n background: ${({ theme, applyAriaDisabled, disabled, readOnly }) =>\n !disabled && !applyAriaDisabled && !readOnly ? theme.colors.brand[200] : undefined};\n\n &:after {\n border: 1px solid\n ${({ theme, hasError, disabled, applyAriaDisabled, readOnly }) => {\n if (hasError) return theme.colors.danger[900];\n if (applyAriaDisabled || readOnly) return theme.colors.brand[700];\n if (disabled) return theme.colors.neutral[400];\n return theme.colors.brand[600];\n }};\n }\n }\n &:focus-within {\n &:hover {\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled, applyAriaDisabled, readOnly, hasError, true, device)}\n }\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n }\n &:active {\n &:after {\n border: ${({ disabled, theme }) =>\n disabled ? `1px solid ${theme.colors.neutral[400]}` : `2px solid ${theme.colors.brand[600]}`};\n }\n }\n`;\n\nconst checkboxStyles = 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 z-index: 1;\n`;\n\nexport const StyledInput = styled('input', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT,\n})`\n ${checkboxStyles}\n &:disabled {\n cursor: not-allowed;\n }\n &[aria-disabled='true'] {\n cursor: not-allowed;\n }\n`;\n\nexport const StyledInputMixed = styled('div', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT,\n})`\n ${checkboxStyles}\n ${({ 'aria-disabled': disabled }) =>\n disabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : ''}\n`;\n\nexport const StyledLabel = styled('label', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.LABEL,\n})<DSControlledCheckboxT.StyledLabelT>`\n ${({ wrapLabel }) =>\n wrapLabel &&\n `\n overflow-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n`};\n width: fit-content;\n color: ${({ theme, disabled }) => (disabled ? theme.colors.neutral[500] : theme.colors.neutral[800])};\n line-height: 1.2307rem;\n @media (max-width: ${th.breakpoint('small')}) {\n line-height: 1rem; /* 13px / 16 */\n }\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n font-size: 1rem; /* 16px / 16 */\n }\n font-size: 1.2307rem; /* 16px / 13 */\n `;\n }\n if (device === undefined) {\n return `\n font-size: 1rem; \n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n font-size: 0.8125rem; /* 13px / 16 */\n }\n\n font-size: 1rem; /* 13px / 13 */\n `;\n }}\n display: inherit;\n ${({ disabled, applyAriaDisabled }) =>\n disabled || applyAriaDisabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : `&:hover {\n cursor: pointer;\n }`}\n`;\n\nexport const StyledWrapLabel = styled('span')``;\n\nexport const StyledContainer = styled('div', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.CONTAINER,\n})<{ device?: 'mobile' | 'desktop'; wrapLabel?: boolean; hasLabel: boolean }>`\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return ` \n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1.5rem auto; /* 24px / 16px */\n }\n grid-template-columns: 1.846rem auto;\n `;\n }\n if (device === undefined) {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1.5rem auto;\n }\n grid-template-columns: 1.23rem auto;\n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1rem auto; /* 16px / 16px */\n }\n grid-template-columns: 1.2307rem auto; /* 16px / 13 */\n\n `;\n }}\n column-gap: ${({ hasLabel }) => (hasLabel ? '8px' : '0px}')};\n display: inline-grid;\n grid-template-rows: min-content;\n align-items: ${({ wrapLabel }) => (wrapLabel ? 'flex-start' : 'center')};\n ${xStyledCommonProps}\n`;\n\nexport const StyledHiddenP = styled.p`\n display: none;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAoD;AAEpD,0BAAuD;AACvD,8BAAgD;AAEzC,MAAM,qBAAiB,yBAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wCAAgB;AACxB,CAAC;AAAA;AAAA,gBAEe,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,UAC5D,2CAAsB,OAAO,UAAU,mBAAmB,QAAQ,CAAC;AAAA;AAAA,IAEnE,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,WAAW,UAAU;AACvB,WAAO;AAAA,2BACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C;AACA,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,6BACgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhD;AACA,SAAO;AAAA,yBACc,MAAM,YAAY,KAAK;A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N,MAAM,wCAAgB;AACxB,CAAC;AAAA,IACG,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,WAAW,UAAU;AACvB,WAAO;AAAA,2BACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9C;AACA,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,6BACgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhD;AACA,SAAO;AAAA,yBACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAM9C,CAAC;AAAA,gBACa,CAAC,EAAE,SAAS,MAAO,WAAW,QAAQ,MAAO;AAAA;AAAA;AAAA,iBAG5C,CAAC,EAAE,UAAU,MAAO,YAAY,eAAe,QAAS;AAAA,IACrE,mCAAkB;AAAA;AAGf,MAAM,gBAAgB,wBAAO;AAAA;AAAA;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -183,12 +183,15 @@ transform: rotate(-45deg);
|
|
183
183
|
}
|
184
184
|
return "";
|
185
185
|
};
|
186
|
-
const handleBackgroundColor = ({ colors }, disabled, applyAriaDisabled) => {
|
186
|
+
const handleBackgroundColor = ({ colors }, disabled, applyAriaDisabled, readOnly) => {
|
187
187
|
if (disabled) {
|
188
188
|
return colors.neutral["080"];
|
189
189
|
}
|
190
190
|
if (applyAriaDisabled) {
|
191
|
-
return colors.neutral["
|
191
|
+
return colors.neutral["050"];
|
192
|
+
}
|
193
|
+
if (readOnly) {
|
194
|
+
return colors.neutral["050"];
|
192
195
|
}
|
193
196
|
return colors.neutral["000"];
|
194
197
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/utils/styleHelpers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable max-params */\n\nimport type { Theme } from '@elliemae/pui-theme';\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean | 'mixed',\n isHovering: boolean,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (readOnly) {\n return colors.neutral[500];\n }\n if (disabled) {\n return colors.neutral[500];\n }\n if (applyAriaDisabled) {\n return colors.neutral[500];\n }\n if (isHovering) {\n return colors.brand[600];\n }\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked: boolean | 'mixed',\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n device: string | undefined = undefined,\n): string => {\n const commonStyles = `\n position: absolute;\n content: '';\n border-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n border-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n `;\n const desktopMixedCheckmark = `\n position: absolute;\n content: '';\n top: 0.538rem; /* 7px / baseFontSize */\n left: 0.308rem; /* 4px / baseFontSize */\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, applyAriaDisabled, readOnly, hasError)};\n width: 0.615rem; /* theme.space.xxs / baseFontSize */\n height: 0.154rem; /* 2px / baseFontSize */\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.4375rem; /* 7px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.125rem; /* 8px / 16 */\n width: 0.5rem;/* 2px / 16 */\n }\n`;\n\n const normalMixedCheckmark = `\n ${desktopMixedCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n`;\n const mobileMixedCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n top: 0.8461rem; /* 11px / 13 */\n left: 0.4615rem; /* 6px / 13 */\n height: 0.1538rem; /* 2px / 13 */\n width: 0.9231rem; /* 12px / 13 */\n\n`;\n const desktopCheckmark = `\nposition: absolute;\ncontent: '';\ntop: 0.308rem; /* 4px / baseFontSize */\nleft: 0.231rem; /* 3px / baseFontSize */\nborder-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nborder-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nheight: 0.385rem; /* 5px / baseFontSize */\nwidth: 0.769rem; /* 10px / baseFontSize */\ntransform: rotate(-45deg);\n\n@media (max-width: ${theme.breakpoints.small}) {\n top: 0.25rem; /* 4px / 16 */\n left: 0.1875rem; /* 3px / 16 */\n height: 0.3125rem; /* 5px / 16 */\n width: 0.625rem; /* 10px / 16 */\n}\n`;\n\n const normalCheckmark = `\n\n ${desktopCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n`;\n const mobileCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n top: 0.4615rem; /* 6px / 13 */\n left: 0.3077rem; /* 4px / 13 */\n height: 0.6154rem; /* 8px / 13 */\n width: 1.3077rem; /* 17px / 13 */\n transform: rotate(-45deg);\n`;\n\n if (checked === 'mixed') {\n return `&:before {\n ${device === undefined ? normalMixedCheckmark : device === 'mobile' ? mobileMixedCheckmark : desktopMixedCheckmark}\n}`;\n }\n if (checked) {\n return `&:before {\n ${device === undefined ? normalCheckmark : device === 'mobile' ? mobileCheckmark : desktopCheckmark}\n}`;\n }\n return '';\n};\n\nexport const handleBackgroundColor = ({ colors }: Theme
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKhB,MAAM,uBAAuB,CAClC,EAAE,OAAO,GACT,SACA,YACA,UACA,mBACA,UACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,OAAO,GAAG;AAAA,EAC1B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,mBAAmB;AACrB,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,YAAY;AACd,WAAO,OAAO,MAAM,GAAG;AAAA,EACzB;AACA,SAAO,OAAO,MAAM,GAAG;AACzB;AAEO,MAAM,kBAAkB,CAC7B,OACA,SACA,UACA,mBACA,UACA,UACA,aAAa,OACb,SAA6B,WAClB;AACX,QAAM,eAAe;AAAA;AAAA;AAAA,kCAGW;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,oCAC+B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA;AAEH,QAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKhB,qBAAqB,OAAO,SAAS,YAAY,UAAU,mBAAmB,UAAU,QAAQ,CAAC;AAAA;AAAA;AAAA,u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ary */\n/* eslint-disable max-params */\n\nimport type { Theme } from '@elliemae/pui-theme';\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean | 'mixed',\n isHovering: boolean,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (readOnly) {\n return colors.neutral[500];\n }\n if (disabled) {\n return colors.neutral[500];\n }\n if (applyAriaDisabled) {\n return colors.neutral[500];\n }\n if (isHovering) {\n return colors.brand[600];\n }\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked: boolean | 'mixed',\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n device: string | undefined = undefined,\n): string => {\n const commonStyles = `\n position: absolute;\n content: '';\n border-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n border-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n `;\n const desktopMixedCheckmark = `\n position: absolute;\n content: '';\n top: 0.538rem; /* 7px / baseFontSize */\n left: 0.308rem; /* 4px / baseFontSize */\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, applyAriaDisabled, readOnly, hasError)};\n width: 0.615rem; /* theme.space.xxs / baseFontSize */\n height: 0.154rem; /* 2px / baseFontSize */\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.4375rem; /* 7px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.125rem; /* 8px / 16 */\n width: 0.5rem;/* 2px / 16 */\n }\n`;\n\n const normalMixedCheckmark = `\n ${desktopMixedCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n`;\n const mobileMixedCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n top: 0.8461rem; /* 11px / 13 */\n left: 0.4615rem; /* 6px / 13 */\n height: 0.1538rem; /* 2px / 13 */\n width: 0.9231rem; /* 12px / 13 */\n\n`;\n const desktopCheckmark = `\nposition: absolute;\ncontent: '';\ntop: 0.308rem; /* 4px / baseFontSize */\nleft: 0.231rem; /* 3px / baseFontSize */\nborder-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nborder-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nheight: 0.385rem; /* 5px / baseFontSize */\nwidth: 0.769rem; /* 10px / baseFontSize */\ntransform: rotate(-45deg);\n\n@media (max-width: ${theme.breakpoints.small}) {\n top: 0.25rem; /* 4px / 16 */\n left: 0.1875rem; /* 3px / 16 */\n height: 0.3125rem; /* 5px / 16 */\n width: 0.625rem; /* 10px / 16 */\n}\n`;\n\n const normalCheckmark = `\n\n ${desktopCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n`;\n const mobileCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n top: 0.4615rem; /* 6px / 13 */\n left: 0.3077rem; /* 4px / 13 */\n height: 0.6154rem; /* 8px / 13 */\n width: 1.3077rem; /* 17px / 13 */\n transform: rotate(-45deg);\n`;\n\n if (checked === 'mixed') {\n return `&:before {\n ${device === undefined ? normalMixedCheckmark : device === 'mobile' ? mobileMixedCheckmark : desktopMixedCheckmark}\n}`;\n }\n if (checked) {\n return `&:before {\n ${device === undefined ? normalCheckmark : device === 'mobile' ? mobileCheckmark : desktopCheckmark}\n}`;\n }\n return '';\n};\n\nexport const handleBackgroundColor = (\n { colors }: Theme,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n): string => {\n if (disabled) {\n return colors.neutral['080'];\n }\n\n if (applyAriaDisabled) {\n return colors.neutral['050'];\n }\n\n if (readOnly) {\n return colors.neutral['050'];\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;ADKhB,MAAM,uBAAuB,CAClC,EAAE,OAAO,GACT,SACA,YACA,UACA,mBACA,UACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,OAAO,GAAG;AAAA,EAC1B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,mBAAmB;AACrB,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,YAAY;AACd,WAAO,OAAO,MAAM,GAAG;AAAA,EACzB;AACA,SAAO,OAAO,MAAM,GAAG;AACzB;AAEO,MAAM,kBAAkB,CAC7B,OACA,SACA,UACA,mBACA,UACA,UACA,aAAa,OACb,SAA6B,WAClB;AACX,QAAM,eAAe;AAAA;AAAA;AAAA,kCAGW;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAC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W,SAAY,uBAAuB,WAAW,WAAW,uBAAuB,qBAAqB;AAAA;AAAA,EAElH;AACA,MAAI,SAAS;AACX,WAAO;AAAA,MACL,WAAW,SAAY,kBAAkB,WAAW,WAAW,kBAAkB,gBAAgB;AAAA;AAAA,EAErG;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,CACnC,EAAE,OAAO,GACT,UACA,mBACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,KAAK;AAAA,EAC7B;AAEA,MAAI,mBAAmB;AACrB,WAAO,OAAO,QAAQ,KAAK;AAAA,EAC7B;AAEA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,KAAK;AAAA,EAC7B;AAEA,SAAO,OAAO,QAAQ,KAAK;AAC7B;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React2 from "react";
|
4
4
|
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
5
5
|
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
6
|
-
import { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox } from "../styles.js";
|
6
|
+
import { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox, StyledHiddenP } from "../styles.js";
|
7
7
|
import { MainInput } from "./MainInput.js";
|
8
8
|
import { ControlledCheckBoxContext } from "../ControlledCheckboxCTX.js";
|
9
9
|
const ControlledCheckBoxContent = () => {
|
@@ -62,7 +62,8 @@ const ControlledCheckBoxContent = () => {
|
|
62
62
|
getOwnerPropsArguments,
|
63
63
|
children: wrapLabel ? /* @__PURE__ */ jsx(StyledWrapLabel, { children: label }) : /* @__PURE__ */ jsx(SimpleTruncatedTooltipText, { value: label })
|
64
64
|
}
|
65
|
-
)
|
65
|
+
),
|
66
|
+
readOnly ? /* @__PURE__ */ jsx(StyledHiddenP, { id: `${instanceUid}-read-only-helper-msg`, children: "Read only" }) : null
|
66
67
|
]
|
67
68
|
}
|
68
69
|
);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ControlledCheckBoxContent.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox } from '../styles.js';\nimport { MainInput } from './MainInput.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const ControlledCheckBoxContent = () => {\n const { propsWithDefault, globalProps, instanceUid, xstyledProps, handleOnChange } =\n React.useContext(ControlledCheckBoxContext);\n const {\n checked,\n device,\n label,\n hasError,\n wrapLabel,\n ariaControls: legacyAriaControls,\n applyAriaDisabled,\n } = propsWithDefault;\n const { disabled, readOnly, 'aria-controls': ariaControls, className } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n wrapLabel={wrapLabel}\n device={device}\n data-testid=\"ds-checkbox-container\"\n className={className}\n hasLabel={Boolean(label)}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCheckBox\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MainInput />\n </StyledCheckBox>\n {label && (\n <StyledLabel\n id={`${instanceUid}_label`}\n htmlFor={instanceUid}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-checkbox-label\"\n wrapLabel={wrapLabel}\n device={device}\n {...(!disabled && (ariaControls || legacyAriaControls) ? { onClick: handleOnChange } : {})}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n </StyledContainer>\n );\n};\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACwBnB,SAoBI,KApBJ;AAxBJ,OAAOA,YAAW;AAClB,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB,iBAAiB,aAAa,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledContainer, StyledWrapLabel, StyledLabel, StyledCheckBox, StyledHiddenP } from '../styles.js';\nimport { MainInput } from './MainInput.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const ControlledCheckBoxContent = () => {\n const { propsWithDefault, globalProps, instanceUid, xstyledProps, handleOnChange } =\n React.useContext(ControlledCheckBoxContext);\n const {\n checked,\n device,\n label,\n hasError,\n wrapLabel,\n ariaControls: legacyAriaControls,\n applyAriaDisabled,\n } = propsWithDefault;\n const { disabled, readOnly, 'aria-controls': ariaControls, className } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n wrapLabel={wrapLabel}\n device={device}\n data-testid=\"ds-checkbox-container\"\n className={className}\n hasLabel={Boolean(label)}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledCheckBox\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MainInput />\n </StyledCheckBox>\n {label && (\n <StyledLabel\n id={`${instanceUid}_label`}\n htmlFor={instanceUid}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-checkbox-label\"\n wrapLabel={wrapLabel}\n device={device}\n {...(!disabled && (ariaControls || legacyAriaControls) ? { onClick: handleOnChange } : {})}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\n </StyledLabel>\n )}\n {readOnly ? <StyledHiddenP id={`${instanceUid}-read-only-helper-msg`}>Read only</StyledHiddenP> : null}\n </StyledContainer>\n );\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwBnB,SAoBI,KApBJ;AAxBJ,OAAOA,YAAW;AAClB,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB,iBAAiB,aAAa,gBAAgB,qBAAqB;AAC7F,SAAS,iBAAiB;AAC1B,SAAS,iCAAiC;AAEnC,MAAM,4BAA4B,MAAM;AAC7C,QAAM,EAAE,kBAAkB,aAAa,aAAa,cAAc,eAAe,IAC/EA,OAAM,WAAW,yBAAyB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,UAAU,UAAU,iBAAiB,cAAc,UAAU,IAAI;AAEzE,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAEhF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAY;AAAA,MACZ;AAAA,MACA,UAAU,QAAQ,KAAK;AAAA,MACtB,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEA,8BAAC,aAAU;AAAA;AAAA,QACb;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,GAAG,WAAW;AAAA,YAClB,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACC,GAAI,CAAC,aAAa,gBAAgB,sBAAsB,EAAE,SAAS,eAAe,IAAI,CAAC;AAAA,YACxF;AAAA,YACA;AAAA,YAEC,sBAAY,oBAAC,mBAAiB,iBAAM,IAAqB,oBAAC,8BAA2B,OAAO,OAAO;AAAA;AAAA,QACtG;AAAA,QAED,WAAW,oBAAC,iBAAc,IAAI,GAAG,WAAW,yBAAyB,uBAAS,IAAmB;AAAA;AAAA;AAAA,EACpG;AAEJ;",
|
6
6
|
"names": ["React"]
|
7
7
|
}
|
@@ -43,7 +43,7 @@ const MainInput = () => {
|
|
43
43
|
...mainInputProps,
|
44
44
|
role: "checkbox",
|
45
45
|
"aria-controls": ariaControls || camelCaseAriaControls,
|
46
|
-
"aria-disabled": disabled || applyAriaDisabled,
|
46
|
+
"aria-disabled": disabled || applyAriaDisabled || readOnly,
|
47
47
|
"aria-invalid": hasError,
|
48
48
|
onClick: !disabled && !readOnly ? handleOnChange : void 0,
|
49
49
|
onKeyDown: handleMixedCheckboxOnKeyDown,
|
@@ -52,6 +52,7 @@ const MainInput = () => {
|
|
52
52
|
onMouseDown: (e) => {
|
53
53
|
if (disabled) e.preventDefault();
|
54
54
|
},
|
55
|
+
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
55
56
|
getOwnerProps,
|
56
57
|
getOwnerPropsArguments
|
57
58
|
}
|
@@ -67,10 +68,11 @@ const MainInput = () => {
|
|
67
68
|
disabled,
|
68
69
|
tabIndex,
|
69
70
|
innerRef,
|
70
|
-
getOwnerProps,
|
71
|
-
getOwnerPropsArguments,
|
72
71
|
"aria-invalid": hasError,
|
73
|
-
"aria-disabled": applyAriaDisabled
|
72
|
+
"aria-disabled": applyAriaDisabled || readOnly,
|
73
|
+
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
74
|
+
getOwnerProps,
|
75
|
+
getOwnerPropsArguments
|
74
76
|
}
|
75
77
|
);
|
76
78
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/MainInput.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledInput, StyledInputMixed } from '../styles.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const MainInput = () => {\n const { propsWithDefault, globalProps, instanceUid, handleOnChange, handleMixedCheckboxOnKeyDown } =\n React.useContext(ControlledCheckBoxContext);\n const {\n disabled,\n readOnly,\n // label,\n tabIndex,\n innerRef,\n checked,\n visualOnly,\n ariaControls: camelCaseAriaControls,\n withRelatedBlockLabel,\n // ariaLabel: camelCaseAriaLabel,\n // externalLabel,\n hasError,\n applyAriaDisabled,\n } = propsWithDefault;\n const { 'aria-controls': ariaControls } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n // if components doesn't define 'aria-controls' it would be \"a11y invalid\" to allow 'mixed' state\n // so\n // if they are NOT provided we use <input type='checkbox' /> that has no 'mixed' state support in html5\n // if they ARE provided we use <input /> (no type checkbox) in which we super-charge the 'mixed' state via css\n // props slightly differ because of this\n // also, because of this, \"onChange\" may be an onClick (or keyboard activation) or the native \"onChange\"\n const canShowMixedState = ariaControls || camelCaseAriaControls;\n // if aria-label is provided we are probably printing a 'label-less' checkbox (like data-table, or mixed parent in a group)\n // in such scenarios having the aria-labelledby may results in 'referencing a non-existing element' error\n const outOfTheBoxAriaLabelledBy = !globalProps['aria-label']\n ? `${instanceUid}_label${withRelatedBlockLabel ? ` ${instanceUid}_block_label` : ''}`\n : undefined;\n\n const mainInputProps = {\n id: instanceUid,\n 'data-testid': 'ds-checkbox',\n 'aria-checked': checked, // if user doesn't provide aria-checked, we make this the same as the actual value\n 'aria-labelledby': outOfTheBoxAriaLabelledBy,\n // if the user provides an aria-labelledby we still do print it anyway, so this should work for both internal scenarios and final integrations\n ...globalProps, // any props provided by the user will over-ride ours\n };\n\n if (visualOnly) return null;\n\n if (canShowMixedState)\n return (\n <StyledInputMixed\n {...mainInputProps}\n role=\"checkbox\"\n aria-controls={ariaControls || camelCaseAriaControls}\n aria-disabled={disabled || applyAriaDisabled}\n aria-invalid={hasError}\n onClick={!disabled && !readOnly ? handleOnChange : undefined}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n tabIndex={disabled ? -1 : tabIndex}\n innerRef={innerRef}\n onMouseDown={(e: React.MouseEvent) => {\n if (disabled) e.preventDefault();\n }}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n return (\n <StyledInput\n {...mainInputProps}\n type=\"checkbox\"\n checked={checked as boolean | undefined}\n onChange={handleOnChange}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n disabled={disabled}\n tabIndex={tabIndex}\n innerRef={innerRef}\n
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACsDjB;AArDN,OAAOA,YAAW;AAClB,SAAS,qBAAqB;AAC9B,SAAS,aAAa,wBAAwB;AAC9C,SAAS,iCAAiC;AAEnC,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,kBAAkB,aAAa,aAAa,gBAAgB,6BAA6B,IAC/FA,OAAM,WAAW,yBAAyB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA;AAAA;AAAA,IAGA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,iBAAiB,aAAa,IAAI;AAE1C,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,gBAAgB;AAQhF,QAAM,oBAAoB,gBAAgB;AAG1C,QAAM,4BAA4B,CAAC,YAAY,YAAY,IACvD,GAAG,WAAW,SAAS,wBAAwB,IAAI,WAAW,iBAAiB,EAAE,KACjF;AAEJ,QAAM,iBAAiB;AAAA,IACrB,IAAI;AAAA,IACJ,eAAe;AAAA,IACf,gBAAgB;AAAA;AAAA,IAChB,mBAAmB;AAAA;AAAA,IAEnB,GAAG;AAAA;AAAA,EACL;AAEA,MAAI,WAAY,QAAO;AAEvB,MAAI;AACF,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,MAAK;AAAA,QACL,iBAAe,gBAAgB;AAAA,QAC/B,iBAAe,YAAY;AAAA,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledInput, StyledInputMixed } from '../styles.js';\nimport { ControlledCheckBoxContext } from '../ControlledCheckboxCTX.js';\n\nexport const MainInput = () => {\n const { propsWithDefault, globalProps, instanceUid, handleOnChange, handleMixedCheckboxOnKeyDown } =\n React.useContext(ControlledCheckBoxContext);\n const {\n disabled,\n readOnly,\n // label,\n tabIndex,\n innerRef,\n checked,\n visualOnly,\n ariaControls: camelCaseAriaControls,\n withRelatedBlockLabel,\n // ariaLabel: camelCaseAriaLabel,\n // externalLabel,\n hasError,\n applyAriaDisabled,\n } = propsWithDefault;\n const { 'aria-controls': ariaControls } = globalProps;\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n // if components doesn't define 'aria-controls' it would be \"a11y invalid\" to allow 'mixed' state\n // so\n // if they are NOT provided we use <input type='checkbox' /> that has no 'mixed' state support in html5\n // if they ARE provided we use <input /> (no type checkbox) in which we super-charge the 'mixed' state via css\n // props slightly differ because of this\n // also, because of this, \"onChange\" may be an onClick (or keyboard activation) or the native \"onChange\"\n const canShowMixedState = ariaControls || camelCaseAriaControls;\n // if aria-label is provided we are probably printing a 'label-less' checkbox (like data-table, or mixed parent in a group)\n // in such scenarios having the aria-labelledby may results in 'referencing a non-existing element' error\n const outOfTheBoxAriaLabelledBy = !globalProps['aria-label']\n ? `${instanceUid}_label${withRelatedBlockLabel ? ` ${instanceUid}_block_label` : ''}`\n : undefined;\n\n const mainInputProps = {\n id: instanceUid,\n 'data-testid': 'ds-checkbox',\n 'aria-checked': checked, // if user doesn't provide aria-checked, we make this the same as the actual value\n 'aria-labelledby': outOfTheBoxAriaLabelledBy,\n // if the user provides an aria-labelledby we still do print it anyway, so this should work for both internal scenarios and final integrations\n ...globalProps, // any props provided by the user will over-ride ours\n };\n\n if (visualOnly) return null;\n\n if (canShowMixedState)\n return (\n <StyledInputMixed\n {...mainInputProps}\n role=\"checkbox\"\n aria-controls={ariaControls || camelCaseAriaControls}\n aria-disabled={disabled || applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n onClick={!disabled && !readOnly ? handleOnChange : undefined}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n tabIndex={disabled ? -1 : tabIndex}\n innerRef={innerRef}\n onMouseDown={(e: React.MouseEvent) => {\n if (disabled) e.preventDefault();\n }}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n return (\n <StyledInput\n {...mainInputProps}\n type=\"checkbox\"\n checked={checked as boolean | undefined}\n onChange={handleOnChange}\n onKeyDown={handleMixedCheckboxOnKeyDown}\n disabled={disabled}\n tabIndex={tabIndex}\n innerRef={innerRef}\n aria-invalid={hasError}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper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ACA,oBAAkB,WAAW,GAAG,WAAW,0BAA0B;AAAA,QACrE;AAAA,QACA;AAAA;AAAA,IACF;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL;AAAA,MACA,UAAU;AAAA,MACV,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAc;AAAA,MACd,iBAAe,qBAAqB;AAAA,MACpC,oBAAkB,WAAW,GAAG,WAAW,0BAA0B;AAAA,MACrE;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
|
6
6
|
"names": ["React"]
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
@@ -7,7 +7,7 @@ const StyledCheckBox = styled("span", {
|
|
7
7
|
slot: DSCheckboxSlots.INPUT_WRAPPER
|
8
8
|
})`
|
9
9
|
position: relative;
|
10
|
-
background: ${({ theme, disabled, applyAriaDisabled }) => handleBackgroundColor(theme, disabled, applyAriaDisabled)};
|
10
|
+
background: ${({ theme, disabled, applyAriaDisabled, readOnly }) => handleBackgroundColor(theme, disabled, applyAriaDisabled, readOnly)};
|
11
11
|
|
12
12
|
${({ device, theme }) => {
|
13
13
|
if (device === "mobile") {
|
@@ -52,10 +52,16 @@ const StyledCheckBox = styled("span", {
|
|
52
52
|
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
53
53
|
}
|
54
54
|
&:hover {
|
55
|
-
background: ${({ theme, applyAriaDisabled, disabled }) => !disabled && !applyAriaDisabled ? theme.colors.brand[200] : void 0};
|
55
|
+
background: ${({ theme, applyAriaDisabled, disabled, readOnly }) => !disabled && !applyAriaDisabled && !readOnly ? theme.colors.brand[200] : void 0};
|
56
56
|
|
57
57
|
&:after {
|
58
|
-
border: 1px solid
|
58
|
+
border: 1px solid
|
59
|
+
${({ theme, hasError, disabled, applyAriaDisabled, readOnly }) => {
|
60
|
+
if (hasError) return theme.colors.danger[900];
|
61
|
+
if (applyAriaDisabled || readOnly) return theme.colors.brand[700];
|
62
|
+
if (disabled) return theme.colors.neutral[400];
|
63
|
+
return theme.colors.brand[600];
|
64
|
+
}};
|
59
65
|
}
|
60
66
|
}
|
61
67
|
&:focus-within {
|
@@ -68,7 +74,7 @@ const StyledCheckBox = styled("span", {
|
|
68
74
|
}
|
69
75
|
&:active {
|
70
76
|
&:after {
|
71
|
-
border:
|
77
|
+
border: ${({ disabled, theme }) => disabled ? `1px solid ${theme.colors.neutral[400]}` : `2px solid ${theme.colors.brand[600]}`};
|
72
78
|
}
|
73
79
|
}
|
74
80
|
`;
|
@@ -115,7 +121,7 @@ const StyledLabel = styled("label", {
|
|
115
121
|
word-break: break-word;
|
116
122
|
`};
|
117
123
|
width: fit-content;
|
118
|
-
color: ${({ theme, disabled
|
124
|
+
color: ${({ theme, disabled }) => disabled ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
119
125
|
line-height: 1.2307rem;
|
120
126
|
@media (max-width: ${th.breakpoint("small")}) {
|
121
127
|
line-height: 1rem; /* 13px / 16 */
|
@@ -185,9 +191,13 @@ const StyledContainer = styled("div", {
|
|
185
191
|
align-items: ${({ wrapLabel }) => wrapLabel ? "flex-start" : "center"};
|
186
192
|
${xStyledCommonProps}
|
187
193
|
`;
|
194
|
+
const StyledHiddenP = styled.p`
|
195
|
+
display: none;
|
196
|
+
`;
|
188
197
|
export {
|
189
198
|
StyledCheckBox,
|
190
199
|
StyledContainer,
|
200
|
+
StyledHiddenP,
|
191
201
|
StyledInput,
|
192
202
|
StyledInputMixed,
|
193
203
|
StyledLabel,
|
package/dist/esm/styles.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { styled, th, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { DSControlledCheckboxT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSCheckboxName, DSCheckboxSlots } from './exported-related/index.js';\n\nexport const StyledCheckBox = styled('span', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT_WRAPPER,\n})<DSControlledCheckboxT.StyledCheckBoxT>`\n position: relative;\n background: ${({ theme, disabled, applyAriaDisabled })
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,IAAI,KAAK,0BAA0B;AAEpD,SAAS,uBAAuB,uBAAuB;AACvD,SAAS,gBAAgB,uBAAuB;AAEzC,MAAM,iBAAiB,OAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA,gBAEe,CAAC,EAAE,OAAO,UAAU,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { styled, th, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { DSControlledCheckboxT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSCheckboxName, DSCheckboxSlots } from './exported-related/index.js';\n\nexport const StyledCheckBox = styled('span', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT_WRAPPER,\n})<DSControlledCheckboxT.StyledCheckBoxT>`\n position: relative;\n background: ${({ theme, disabled, applyAriaDisabled, readOnly }) =>\n handleBackgroundColor(theme, disabled, applyAriaDisabled, readOnly)};\n\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return ` \n @media (max-width: ${theme.breakpoints.small}) {\n width: 1.5rem; /* 24px / 16 */\n height: 1.5rem; /* 24px / 16 */\n }\n width: 1.846rem; /* 24px / 13 */\n height: 1.846rem; /* 24px / 13 */`;\n }\n if (device === undefined) {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n width: 1.5rem; /* 24px / 16 */\n height: 1.5rem; /* 24px / 16 */\n }\n width: 1.2307rem;\n height: 1.2307rem;\n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n width: 1rem; /* 16px / 16 */\n height: 1rem; /* 16px / 16 */\n }\n width: 1.2307rem; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\n `;\n }}\n\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled, applyAriaDisabled, readOnly, hasError, false, device)}\n\n &:after {\n content: '';\n border-radius: 2px;\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n border: 1px solid ${({ theme, hasError }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n }\n &:hover {\n background: ${({ theme, applyAriaDisabled, disabled, readOnly }) =>\n !disabled && !applyAriaDisabled && !readOnly ? theme.colors.brand[200] : undefined};\n\n &:after {\n border: 1px solid\n ${({ theme, hasError, disabled, applyAriaDisabled, readOnly }) => {\n if (hasError) return theme.colors.danger[900];\n if (applyAriaDisabled || readOnly) return theme.colors.brand[700];\n if (disabled) return theme.colors.neutral[400];\n return theme.colors.brand[600];\n }};\n }\n }\n &:focus-within {\n &:hover {\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled, applyAriaDisabled, readOnly, hasError, true, device)}\n }\n &:after {\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n }\n &:active {\n &:after {\n border: ${({ disabled, theme }) =>\n disabled ? `1px solid ${theme.colors.neutral[400]}` : `2px solid ${theme.colors.brand[600]}`};\n }\n }\n`;\n\nconst checkboxStyles = 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 z-index: 1;\n`;\n\nexport const StyledInput = styled('input', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT,\n})`\n ${checkboxStyles}\n &:disabled {\n cursor: not-allowed;\n }\n &[aria-disabled='true'] {\n cursor: not-allowed;\n }\n`;\n\nexport const StyledInputMixed = styled('div', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.INPUT,\n})`\n ${checkboxStyles}\n ${({ 'aria-disabled': disabled }) =>\n disabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : ''}\n`;\n\nexport const StyledLabel = styled('label', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.LABEL,\n})<DSControlledCheckboxT.StyledLabelT>`\n ${({ wrapLabel }) =>\n wrapLabel &&\n `\n overflow-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n`};\n width: fit-content;\n color: ${({ theme, disabled }) => (disabled ? theme.colors.neutral[500] : theme.colors.neutral[800])};\n line-height: 1.2307rem;\n @media (max-width: ${th.breakpoint('small')}) {\n line-height: 1rem; /* 13px / 16 */\n }\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n font-size: 1rem; /* 16px / 16 */\n }\n font-size: 1.2307rem; /* 16px / 13 */\n `;\n }\n if (device === undefined) {\n return `\n font-size: 1rem; \n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n font-size: 0.8125rem; /* 13px / 16 */\n }\n\n font-size: 1rem; /* 13px / 13 */\n `;\n }}\n display: inherit;\n ${({ disabled, applyAriaDisabled }) =>\n disabled || applyAriaDisabled\n ? `&:hover {\n cursor: not-allowed;\n }`\n : `&:hover {\n cursor: pointer;\n }`}\n`;\n\nexport const StyledWrapLabel = styled('span')``;\n\nexport const StyledContainer = styled('div', {\n name: DSCheckboxName,\n slot: DSCheckboxSlots.CONTAINER,\n})<{ device?: 'mobile' | 'desktop'; wrapLabel?: boolean; hasLabel: boolean }>`\n ${({ device, theme }) => {\n if (device === 'mobile') {\n return ` \n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1.5rem auto; /* 24px / 16px */\n }\n grid-template-columns: 1.846rem auto;\n `;\n }\n if (device === undefined) {\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1.5rem auto;\n }\n grid-template-columns: 1.23rem auto;\n `;\n }\n return `\n @media (max-width: ${theme.breakpoints.small}) {\n grid-template-columns: 1rem auto; /* 16px / 16px */\n }\n grid-template-columns: 1.2307rem auto; /* 16px / 13 */\n\n `;\n }}\n column-gap: ${({ hasLabel }) => (hasLabel ? '8px' : '0px}')};\n display: inline-grid;\n grid-template-rows: min-content;\n align-items: ${({ wrapLabel }) => (wrapLabel ? 'flex-start' : 'center')};\n ${xStyledCommonProps}\n`;\n\nexport const StyledHiddenP = styled.p`\n display: none;\n`;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,IAAI,KAAK,0BAA0B;AAEpD,SAAS,uBAAuB,uBAAuB;AACvD,SAAS,gBAAgB,uBAAuB;AAEzC,MAAM,iBAAiB,OAAO,QAAQ;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA,gBAEe,CAAC,EAAE,OAAO,UAAU,mBAAmB,SAAS,MAC5D,sBAAsB,OAAO,UAAU,mBAAmB,QAAQ,CAAC;AAAA;AAAA,IAEnE,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,WAAW,UAAU;AACvB,WAAO;AAAA,2BACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C;AACA,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,6BACgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhD;AACA,SAAO;AAAA,yBACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,CAAC;AAAA;AAAA,IAEC,CAAC,EAAE,OAAO,SAAS,UAAU,mBAAmB,UAAU,UAAU,OAAO,MAC3E,gBAAgB,OAAO,SAAS,UAAU,mBAAmB,UAAU,UAAU,OAAO,MAAM,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ACxB,WAAO;AAAA,6BACgB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhD;AACA,SAAO;AAAA,yBACc,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAM9C,CAAC;AAAA,gBACa,CAAC,EAAE,SAAS,MAAO,WAAW,QAAQ,MAAO;AAAA;AAAA;AAAA,iBAG5C,CAAC,EAAE,UAAU,MAAO,YAAY,eAAe,QAAS;AAAA,IACrE,kBAAkB;AAAA;AAGf,MAAM,gBAAgB,OAAO;AAAA;AAAA;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -148,12 +148,15 @@ transform: rotate(-45deg);
|
|
148
148
|
}
|
149
149
|
return "";
|
150
150
|
};
|
151
|
-
const handleBackgroundColor = ({ colors }, disabled, applyAriaDisabled) => {
|
151
|
+
const handleBackgroundColor = ({ colors }, disabled, applyAriaDisabled, readOnly) => {
|
152
152
|
if (disabled) {
|
153
153
|
return colors.neutral["080"];
|
154
154
|
}
|
155
155
|
if (applyAriaDisabled) {
|
156
|
-
return colors.neutral["
|
156
|
+
return colors.neutral["050"];
|
157
|
+
}
|
158
|
+
if (readOnly) {
|
159
|
+
return colors.neutral["050"];
|
157
160
|
}
|
158
161
|
return colors.neutral["000"];
|
159
162
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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 indent */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable max-params */\n\nimport type { Theme } from '@elliemae/pui-theme';\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean | 'mixed',\n isHovering: boolean,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (readOnly) {\n return colors.neutral[500];\n }\n if (disabled) {\n return colors.neutral[500];\n }\n if (applyAriaDisabled) {\n return colors.neutral[500];\n }\n if (isHovering) {\n return colors.brand[600];\n }\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked: boolean | 'mixed',\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n device: string | undefined = undefined,\n): string => {\n const commonStyles = `\n position: absolute;\n content: '';\n border-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n border-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n `;\n const desktopMixedCheckmark = `\n position: absolute;\n content: '';\n top: 0.538rem; /* 7px / baseFontSize */\n left: 0.308rem; /* 4px / baseFontSize */\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, applyAriaDisabled, readOnly, hasError)};\n width: 0.615rem; /* theme.space.xxs / baseFontSize */\n height: 0.154rem; /* 2px / baseFontSize */\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.4375rem; /* 7px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.125rem; /* 8px / 16 */\n width: 0.5rem;/* 2px / 16 */\n }\n`;\n\n const normalMixedCheckmark = `\n ${desktopMixedCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n`;\n const mobileMixedCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n top: 0.8461rem; /* 11px / 13 */\n left: 0.4615rem; /* 6px / 13 */\n height: 0.1538rem; /* 2px / 13 */\n width: 0.9231rem; /* 12px / 13 */\n\n`;\n const desktopCheckmark = `\nposition: absolute;\ncontent: '';\ntop: 0.308rem; /* 4px / baseFontSize */\nleft: 0.231rem; /* 3px / baseFontSize */\nborder-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nborder-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nheight: 0.385rem; /* 5px / baseFontSize */\nwidth: 0.769rem; /* 10px / baseFontSize */\ntransform: rotate(-45deg);\n\n@media (max-width: ${theme.breakpoints.small}) {\n top: 0.25rem; /* 4px / 16 */\n left: 0.1875rem; /* 3px / 16 */\n height: 0.3125rem; /* 5px / 16 */\n width: 0.625rem; /* 10px / 16 */\n}\n`;\n\n const normalCheckmark = `\n\n ${desktopCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n`;\n const mobileCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n top: 0.4615rem; /* 6px / 13 */\n left: 0.3077rem; /* 4px / 13 */\n height: 0.6154rem; /* 8px / 13 */\n width: 1.3077rem; /* 17px / 13 */\n transform: rotate(-45deg);\n`;\n\n if (checked === 'mixed') {\n return `&:before {\n ${device === undefined ? normalMixedCheckmark : device === 'mobile' ? mobileMixedCheckmark : desktopMixedCheckmark}\n}`;\n }\n if (checked) {\n return `&:before {\n ${device === undefined ? normalCheckmark : device === 'mobile' ? mobileCheckmark :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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY5C,QAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,8BAKG;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,gCAC6B;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKkB,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ1C,QAAM,kBAAkB;AAAA;AAAA,IAEtB,gBAAgB;AAAA,uBACG,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO5C,QAAM,kBAAkB;AAAA,MACpB,YAAY;AAAA,yBACO,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa9C,MAAI,YAAY,SAAS;AACvB,WAAO;AAAA,IACP,WAAW,SAAY,uBAAuB,WAAW,WAAW,uBAAuB,qBAAqB;AAAA;AAAA,EAElH;AACA,MAAI,SAAS;AACX,WAAO;AAAA,MACL,WAAW,SAAY,kBAAkB,WAAW,WAAW,kBAAkB,gBAAgB;AAAA;AAAA,EAErG;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable max-params */\n\nimport type { Theme } from '@elliemae/pui-theme';\nexport const handleCheckMarkColor = (\n { colors }: Theme,\n checked: boolean | 'mixed',\n isHovering: boolean,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n): string => {\n if (hasError) {\n return colors.danger[900];\n }\n if (readOnly) {\n return colors.neutral[500];\n }\n if (disabled) {\n return colors.neutral[500];\n }\n if (applyAriaDisabled) {\n return colors.neutral[500];\n }\n if (isHovering) {\n return colors.brand[600];\n }\n return colors.brand[600];\n};\n\nexport const handleCheckmark = (\n theme: Theme,\n checked: boolean | 'mixed',\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n hasError?: boolean,\n isHovering = false,\n device: string | undefined = undefined,\n): string => {\n const commonStyles = `\n position: absolute;\n content: '';\n border-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n border-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\n `;\n const desktopMixedCheckmark = `\n position: absolute;\n content: '';\n top: 0.538rem; /* 7px / baseFontSize */\n left: 0.308rem; /* 4px / baseFontSize */\n background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, applyAriaDisabled, readOnly, hasError)};\n width: 0.615rem; /* theme.space.xxs / baseFontSize */\n height: 0.154rem; /* 2px / baseFontSize */\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.4375rem; /* 7px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.125rem; /* 8px / 16 */\n width: 0.5rem;/* 2px / 16 */\n }\n`;\n\n const normalMixedCheckmark = `\n ${desktopMixedCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n`;\n const mobileMixedCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.6875rem; /* 11px / 16 */\n left: 0.375rem; /* 6px / 16 */\n height: 0.125rem; /* 2px / 16 */\n width: 0.75rem; /* 12px / 16 */\n }\n top: 0.8461rem; /* 11px / 13 */\n left: 0.4615rem; /* 6px / 13 */\n height: 0.1538rem; /* 2px / 13 */\n width: 0.9231rem; /* 12px / 13 */\n\n`;\n const desktopCheckmark = `\nposition: absolute;\ncontent: '';\ntop: 0.308rem; /* 4px / baseFontSize */\nleft: 0.231rem; /* 3px / baseFontSize */\nborder-left: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nborder-bottom: 0.154rem solid ${handleCheckMarkColor(\n theme,\n checked,\n isHovering,\n disabled,\n applyAriaDisabled,\n readOnly,\n hasError,\n )};\nheight: 0.385rem; /* 5px / baseFontSize */\nwidth: 0.769rem; /* 10px / baseFontSize */\ntransform: rotate(-45deg);\n\n@media (max-width: ${theme.breakpoints.small}) {\n top: 0.25rem; /* 4px / 16 */\n left: 0.1875rem; /* 3px / 16 */\n height: 0.3125rem; /* 5px / 16 */\n width: 0.625rem; /* 10px / 16 */\n}\n`;\n\n const normalCheckmark = `\n\n ${desktopCheckmark}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n`;\n const mobileCheckmark = `\n ${commonStyles}\n @media (max-width: ${theme.breakpoints.small}) {\n top: 0.375rem; /* 6px / 16 */\n left: 0.25rem; /* 4px / 16 */\n height: 0.5rem; /* 8px / 16 */\n width: 1.0625rem; /* 17px / 16 */\n }\n top: 0.4615rem; /* 6px / 13 */\n left: 0.3077rem; /* 4px / 13 */\n height: 0.6154rem; /* 8px / 13 */\n width: 1.3077rem; /* 17px / 13 */\n transform: rotate(-45deg);\n`;\n\n if (checked === 'mixed') {\n return `&:before {\n ${device === undefined ? normalMixedCheckmark : device === 'mobile' ? mobileMixedCheckmark : desktopMixedCheckmark}\n}`;\n }\n if (checked) {\n return `&:before {\n ${device === undefined ? normalCheckmark : device === 'mobile' ? mobileCheckmark : desktopCheckmark}\n}`;\n }\n return '';\n};\n\nexport const handleBackgroundColor = (\n { colors }: Theme,\n disabled?: boolean,\n applyAriaDisabled?: boolean,\n readOnly?: boolean,\n): string => {\n if (disabled) {\n return colors.neutral['080'];\n }\n\n if (applyAriaDisabled) {\n return colors.neutral['050'];\n }\n\n if (readOnly) {\n return colors.neutral['050'];\n }\n\n return colors.neutral['000'];\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACKhB,MAAM,uBAAuB,CAClC,EAAE,OAAO,GACT,SACA,YACA,UACA,mBACA,UACA,aACW;AACX,MAAI,UAAU;AACZ,WAAO,OAAO,OAAO,GAAG;AAAA,EAC1B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,mBAAmB;AACrB,WAAO,OAAO,QAAQ,GAAG;AAAA,EAC3B;AACA,MAAI,YAAY;AACd,WAAO,OAAO,MAAM,GAAG;AAAA,EACzB;AACA,SAAO,OAAO,MAAM,GAAG;AACzB;AAEO,MAAM,kBAAkB,CAC7B,OACA,SACA,UACA,mBACA,UACA,UACA,aAAa,OACb,SAA6B,WAClB;AACX,QAAM,eAAe;AAAA;AAAA;AAAA,kCAGW;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,oCAC+B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA;AAEH,QAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKhB,qBAAqB,OAAO,SAAS,YAAY,UAAU,mBAAmB,UAAU,QAAQ,CAAC;AAAA;AAAA;AAAA,uBAG1F,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;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mBAAmB;AACrB,WAAO,OAAO,QAAQ,KAAK;AAAA,EAC7B;AAEA,MAAI,UAAU;AACZ,WAAO,OAAO,QAAQ,KAAK;AAAA,EAC7B;AAEA,SAAO,OAAO,QAAQ,KAAK;AAC7B;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/types/styles.d.ts
CHANGED
@@ -9,3 +9,4 @@ export declare const StyledContainer: import("styled-components").StyledComponen
|
|
9
9
|
wrapLabel?: boolean | undefined;
|
10
10
|
hasLabel: boolean;
|
11
11
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
12
|
+
export declare const StyledHiddenP: import("styled-components").StyledComponent<"p", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"p">, never>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { Theme } from '@elliemae/pui-theme';
|
2
2
|
export declare const handleCheckMarkColor: ({ colors }: Theme, checked: boolean | 'mixed', isHovering: boolean, disabled?: boolean, applyAriaDisabled?: boolean, readOnly?: boolean, hasError?: boolean) => string;
|
3
3
|
export declare const handleCheckmark: (theme: Theme, checked: boolean | 'mixed', disabled?: boolean, applyAriaDisabled?: boolean, readOnly?: boolean, hasError?: boolean, isHovering?: boolean, device?: string | undefined) => string;
|
4
|
-
export declare const handleBackgroundColor: ({ colors }: Theme, disabled?: boolean, applyAriaDisabled?: boolean) => string;
|
4
|
+
export declare const handleBackgroundColor: ({ colors }: Theme, disabled?: boolean, applyAriaDisabled?: boolean, readOnly?: boolean) => string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-form-checkbox",
|
3
|
-
"version": "3.50.0-
|
3
|
+
"version": "3.50.0-rc.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Checkbox",
|
6
6
|
"files": [
|
@@ -25,8 +25,8 @@
|
|
25
25
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
26
26
|
},
|
27
27
|
"engines": {
|
28
|
-
"pnpm": ">=
|
29
|
-
"node": ">=
|
28
|
+
"pnpm": ">=9",
|
29
|
+
"node": ">=22"
|
30
30
|
},
|
31
31
|
"author": "ICE MT",
|
32
32
|
"jestSonar": {
|
@@ -37,16 +37,18 @@
|
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"uid": "~2.0.1",
|
40
|
-
"@elliemae/ds-props-helpers": "3.50.0-
|
41
|
-
"@elliemae/ds-system": "3.50.0-
|
42
|
-
"@elliemae/ds-
|
43
|
-
"@elliemae/ds-
|
40
|
+
"@elliemae/ds-props-helpers": "3.50.0-rc.1",
|
41
|
+
"@elliemae/ds-system": "3.50.0-rc.1",
|
42
|
+
"@elliemae/ds-typescript-helpers": "3.50.0-rc.1",
|
43
|
+
"@elliemae/ds-truncated-tooltip-text": "3.50.0-rc.1"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
|
-
"@elliemae/pui-cli": "9.0.0-next.
|
46
|
+
"@elliemae/pui-cli": "9.0.0-next.50",
|
47
47
|
"@elliemae/pui-theme": "~2.10.0",
|
48
|
+
"jest": "~29.7.0",
|
49
|
+
"jest-cli": "~29.7.0",
|
48
50
|
"styled-components": "~5.3.9",
|
49
|
-
"@elliemae/ds-monorepo-devops": "3.50.0-
|
51
|
+
"@elliemae/ds-monorepo-devops": "3.50.0-rc.1"
|
50
52
|
},
|
51
53
|
"peerDependencies": {
|
52
54
|
"@elliemae/pui-theme": "~2.10.0",
|