@elliemae/ds-form-radio 3.80.0-next.8 → 3.80.0-next.80
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 +29 -25
- package/dist/cjs/ControlledRadio.js.map +3 -3
- package/dist/cjs/TruncatedTooltipText.js +12 -6
- package/dist/cjs/TruncatedTooltipText.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +1 -1
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/cjs/styles.js +12 -18
- package/dist/cjs/styles.js.map +2 -2
- package/dist/esm/ControlledRadio.js +33 -26
- package/dist/esm/ControlledRadio.js.map +3 -3
- package/dist/esm/TruncatedTooltipText.js +12 -6
- package/dist/esm/TruncatedTooltipText.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +1 -1
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/dist/esm/styles.js +13 -19
- package/dist/esm/styles.js.map +2 -2
- package/dist/types/TruncatedTooltipText.d.ts +3 -1
- package/dist/types/react-desc-prop-types.d.ts +3 -3
- package/dist/types/styles.d.ts +4 -3
- package/package.json +8 -8
|
@@ -34,7 +34,7 @@ __export(ControlledRadio_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(ControlledRadio_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react =
|
|
37
|
+
var import_react = require("react");
|
|
38
38
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
39
|
var import_uid = require("uid");
|
|
40
40
|
var import_TruncatedTooltipText = require("./TruncatedTooltipText.js");
|
|
@@ -46,30 +46,28 @@ const DSControlledRadio = (props) => {
|
|
|
46
46
|
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
47
47
|
(0, import_useValidateProps.useValidateProps)(props, import_react_desc_prop_types.DSControlledRadioPropTypes);
|
|
48
48
|
const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;
|
|
49
|
+
const {
|
|
50
|
+
id,
|
|
51
|
+
disabled,
|
|
52
|
+
readOnly,
|
|
53
|
+
label,
|
|
54
|
+
className,
|
|
55
|
+
onKeyDown: consumerOnKeyDown,
|
|
56
|
+
...restGlobals
|
|
57
|
+
} = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault);
|
|
58
|
+
const locked = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
|
|
49
59
|
const handleOnChange = (0, import_react.useCallback)(
|
|
50
60
|
(e) => {
|
|
51
|
-
if (onChange && value && !
|
|
61
|
+
if (onChange && value && !locked) onChange(value, e);
|
|
52
62
|
},
|
|
53
|
-
[
|
|
63
|
+
[locked, onChange, value]
|
|
54
64
|
);
|
|
55
65
|
const handleKeyDown = (0, import_react.useCallback)(
|
|
56
66
|
(e) => {
|
|
67
|
+
consumerOnKeyDown?.(e);
|
|
57
68
|
if (e.key === "Enter") handleOnChange(e);
|
|
58
69
|
},
|
|
59
|
-
[handleOnChange]
|
|
60
|
-
);
|
|
61
|
-
const sharedListeners = import_react.default.useMemo(
|
|
62
|
-
() => ({
|
|
63
|
-
onKeyDown: handleKeyDown
|
|
64
|
-
// we can't declare onChange here, we are "overwriting" the event,
|
|
65
|
-
// if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones
|
|
66
|
-
// onChange: handleOnChange,
|
|
67
|
-
}),
|
|
68
|
-
[handleKeyDown]
|
|
69
|
-
);
|
|
70
|
-
const { id, disabled, readOnly, label, className, ...restGlobals } = (0, import_ds_props_helpers.useGetGlobalAttributes)(
|
|
71
|
-
propsWithDefault,
|
|
72
|
-
sharedListeners
|
|
70
|
+
[consumerOnKeyDown, handleOnChange]
|
|
73
71
|
);
|
|
74
72
|
const instanceUid = (0, import_react.useMemo)(() => id || `ds-form-radio-${(0, import_uid.uid)(5)}`, [id]);
|
|
75
73
|
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
@@ -91,9 +89,9 @@ const DSControlledRadio = (props) => {
|
|
|
91
89
|
device,
|
|
92
90
|
checked,
|
|
93
91
|
hasError,
|
|
94
|
-
disabled,
|
|
95
|
-
applyAriaDisabled,
|
|
96
|
-
readOnly,
|
|
92
|
+
$disabled: disabled,
|
|
93
|
+
$applyAriaDisabled: applyAriaDisabled,
|
|
94
|
+
$readOnly: readOnly,
|
|
97
95
|
getOwnerProps,
|
|
98
96
|
getOwnerPropsArguments,
|
|
99
97
|
children: !visualOnly ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -101,14 +99,18 @@ const DSControlledRadio = (props) => {
|
|
|
101
99
|
{
|
|
102
100
|
"data-testid": "ds-radio",
|
|
103
101
|
type: "radio",
|
|
104
|
-
...
|
|
105
|
-
...restGlobals,
|
|
102
|
+
...(0, import_ds_props_helpers.omitLockedHandlers)(restGlobals, locked, "change"),
|
|
106
103
|
id: instanceUid,
|
|
107
104
|
innerRef,
|
|
108
105
|
onChange: handleOnChange,
|
|
106
|
+
onKeyDown: handleKeyDown,
|
|
109
107
|
checked,
|
|
110
108
|
disabled,
|
|
111
|
-
"aria-disabled":
|
|
109
|
+
"aria-disabled": (0, import_ds_props_helpers.resolveAriaDisabled)({
|
|
110
|
+
disabled,
|
|
111
|
+
softLocked: applyAriaDisabled || readOnly,
|
|
112
|
+
consumerValue: restGlobals["aria-disabled"]
|
|
113
|
+
}),
|
|
112
114
|
"aria-invalid": hasError,
|
|
113
115
|
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
|
114
116
|
getOwnerProps,
|
|
@@ -122,8 +124,9 @@ const DSControlledRadio = (props) => {
|
|
|
122
124
|
{
|
|
123
125
|
device,
|
|
124
126
|
htmlFor: instanceUid,
|
|
125
|
-
disabled: disabled
|
|
126
|
-
|
|
127
|
+
$disabled: disabled,
|
|
128
|
+
$applyAriaDisabled: applyAriaDisabled,
|
|
129
|
+
$readOnly: readOnly,
|
|
127
130
|
checked,
|
|
128
131
|
"data-testid": "ds-radio-label",
|
|
129
132
|
getOwnerProps,
|
|
@@ -141,6 +144,7 @@ const DSControlledRadio = (props) => {
|
|
|
141
144
|
import_TruncatedTooltipText.TruncatedTooltipText,
|
|
142
145
|
{
|
|
143
146
|
value: label,
|
|
147
|
+
disabled: Boolean(disabled),
|
|
144
148
|
getOwnerProps,
|
|
145
149
|
getOwnerPropsArguments
|
|
146
150
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledRadio.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport {\n StyledContainer,\n StyledLabelTypography,\n StyledInput,\n StyledLabel,\n StyledRadio,\n StyledHiddenP,\n} from './styles.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { DSControlledRadioPropTypes, DSControlledRadioPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\nimport { useValidateProps } from './config/useValidateProps.js';\nimport { DSRadioDataTestIds } from './exported-related/data-test-ids.js';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledRadioT.InternalProps>(props, defaultProps);\n useValidateProps(props, DSControlledRadioPropTypes);\n const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } =\n propsWithDefault;\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.KeyboardEvent) => {\n if (onChange && value && !
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n omitLockedHandlers,\n isLocked,\n resolveAriaDisabled,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport {\n StyledContainer,\n StyledLabelTypography,\n StyledInput,\n StyledLabel,\n StyledRadio,\n StyledHiddenP,\n} from './styles.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { DSControlledRadioPropTypes, DSControlledRadioPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\nimport { useValidateProps } from './config/useValidateProps.js';\nimport { DSRadioDataTestIds } from './exported-related/data-test-ids.js';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledRadioT.InternalProps>(props, defaultProps);\n useValidateProps(props, DSControlledRadioPropTypes);\n const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } =\n propsWithDefault;\n\n const {\n id,\n disabled,\n readOnly,\n label,\n className,\n onKeyDown: consumerOnKeyDown,\n ...restGlobals\n } = useGetGlobalAttributes<DSControlledRadioT.Props>(propsWithDefault);\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.KeyboardEvent) => {\n if (onChange && value && !locked) onChange(value, e);\n },\n [locked, onChange, value],\n );\n\n // a radio has a change event, so the lock gates the change (`handleOnChange` does nothing while locked) and the\n // keys are only observed: the consumer onKeyDown always receives them. Enter selects the radio, as it always did.\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n consumerOnKeyDown?.(e);\n if (e.key === 'Enter') handleOnChange(e);\n },\n [consumerOnKeyDown, handleOnChange],\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n device={device}\n data-testid=\"ds-radio-container\"\n hasLabel={Boolean(label)}\n className={className}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledRadio\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 {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...omitLockedHandlers(restGlobals, locked, 'change')}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n onKeyDown={handleKeyDown}\n checked={checked}\n disabled={disabled}\n // a soft lock prints \"true\" whatever the consumer passes, a natively disabled radio prints none of its own,\n // otherwise the consumer's own aria-disabled passes through (inversion of control)\n aria-disabled={resolveAriaDisabled({\n disabled,\n softLocked: applyAriaDisabled || readOnly,\n consumerValue: restGlobals['aria-disabled'],\n })}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n $readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? (\n <StyledLabelTypography\n component=\"span\"\n variant=\"b2\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledLabelTypography>\n ) : (\n <TruncatedTooltipText\n value={label}\n disabled={Boolean(disabled)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n )}\n </StyledLabel>\n )}\n {readOnly ? (\n <StyledHiddenP data-testid={DSRadioDataTestIds.READONLY_HELPER_MSG} id={`${instanceUid}-read-only-helper-msg`}>\n Read only\n </StyledHiddenP>\n ) : null}\n </StyledContainer>\n );\n};\n\nDSControlledRadio.displayName = 'DSControlledRadio';\nconst DSControlledRadioWithSchema = describe(DSControlledRadio);\nDSControlledRadioWithSchema.propTypes = DSControlledRadioPropTypesSchema;\n\nexport { DSControlledRadio, DSControlledRadioWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -75,19 +75,25 @@ const StyledTooltipText = (0, import_ds_system.styled)(import_ds_typography.DSTy
|
|
|
75
75
|
const TruncatedTooltipText = ({
|
|
76
76
|
value = "",
|
|
77
77
|
placement = "top",
|
|
78
|
+
disabled = false,
|
|
78
79
|
getOwnerProps,
|
|
79
80
|
getOwnerPropsArguments
|
|
80
81
|
}) => {
|
|
81
82
|
const [showTooltip, setShowTooltip] = (0, import_react.useState)(false);
|
|
83
|
+
const isTooltipOpen = showTooltip && !disabled;
|
|
82
84
|
const { refs, floatingStyles, arrowStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
|
|
83
85
|
placement,
|
|
84
|
-
externallyControlledIsOpen:
|
|
86
|
+
externallyControlledIsOpen: isTooltipOpen,
|
|
85
87
|
withoutAnimation: true
|
|
86
88
|
});
|
|
87
|
-
const handleMouseEnter = (0, import_react.useCallback)(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const handleMouseEnter = (0, import_react.useCallback)(
|
|
90
|
+
(e) => {
|
|
91
|
+
if (disabled) return;
|
|
92
|
+
const el = e.currentTarget;
|
|
93
|
+
setShowTooltip(el.offsetWidth < el.scrollWidth);
|
|
94
|
+
},
|
|
95
|
+
[disabled]
|
|
96
|
+
);
|
|
91
97
|
const handleMouseLeave = (0, import_react.useCallback)(() => {
|
|
92
98
|
setShowTooltip(false);
|
|
93
99
|
}, []);
|
|
@@ -110,7 +116,7 @@ const TruncatedTooltipText = ({
|
|
|
110
116
|
import_ds_floating_context.FloatingWrapper,
|
|
111
117
|
{
|
|
112
118
|
innerRef: refs.setFloating,
|
|
113
|
-
isOpen:
|
|
119
|
+
isOpen: isTooltipOpen,
|
|
114
120
|
floatingStyles,
|
|
115
121
|
context,
|
|
116
122
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipContainer, { getOwnerProps, getOwnerPropsArguments, children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/TruncatedTooltipText.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\nimport { DSRadioName, DSRadioSlots, DSRadioDataTestIds } from './exported-related/index.js';\n\nconst TruncatedSpan = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TRUNCATED_LABEL,\n})`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_CONTAINER,\n})`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\nconst StyledTooltipText = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_TEXT,\n})``;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n getOwnerProps?: () => object;\n getOwnerPropsArguments?: () => object;\n}\n\nconst TruncatedTooltipText = ({\n value = '',\n placement = 'top',\n getOwnerProps,\n getOwnerPropsArguments,\n}: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\nimport { DSRadioName, DSRadioSlots, DSRadioDataTestIds } from './exported-related/index.js';\n\nconst TruncatedSpan = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TRUNCATED_LABEL,\n})`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_CONTAINER,\n})`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\nconst StyledTooltipText = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_TEXT,\n})``;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n /** hard lock: a disabled label has no hover behavior, so its full-value tooltip never opens */\n disabled?: boolean;\n getOwnerProps?: () => object;\n getOwnerPropsArguments?: () => object;\n}\n\nconst TruncatedTooltipText = ({\n value = '',\n placement = 'top',\n disabled = false,\n getOwnerProps,\n getOwnerPropsArguments,\n}: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n // a lock that lands while the tooltip is open closes it immediately, it does not wait for the mouseleave\n const isTooltipOpen = showTooltip && !disabled;\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: isTooltipOpen,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback(\n (e: React.MouseEvent<HTMLSpanElement>) => {\n if (disabled) return;\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n },\n [disabled],\n );\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan\n component=\"span\"\n variant=\"b2\"\n data-testid={DSRadioDataTestIds.TRUNCATED_LABEL}\n innerRef={refs.setReference}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isTooltipOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <StyledTooltipText\n component=\"span\"\n variant=\"b2-light\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {value}\n </StyledTooltipText>\n <PopoverArrow {...arrowStyles} />\n </TooltipContainer>\n </FloatingWrapper>\n </>\n );\n};\n\nexport { TruncatedTooltipText };\nexport default TruncatedTooltipText;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwFnB;AAxFJ,mBAA6C;AAC7C,uBAAuB;AACvB,2BAA6B;AAC7B,iCAKO;AACP,8BAA8D;AAE9D,MAAM,oBAAgB,yBAAO,mCAAc;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASD,MAAM,uBAAmB,yBAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAAA;AAAA,eAEc,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO9B,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,EAAE,EAAE;AAAA;AAAA;AAAA;AAAA,WAIvD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAInD,MAAM,wBAAoB,yBAAO,mCAAc;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,qCAAa;AACrB,CAAC;AAWD,MAAM,uBAAuB,CAAC;AAAA,EAC5B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AACF,MAAiC;AAC/B,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,KAAK;AAEpD,QAAM,gBAAgB,eAAe,CAAC;AAEtC,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,QAAI,+CAAmB;AAAA,IACxE;AAAA,IACA,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,uBAAmB;AAAA,IACvB,CAAC,MAAyC;AACxC,UAAI,SAAU;AACd,YAAM,KAAK,EAAE;AACb,qBAAe,GAAG,cAAc,GAAG,WAAW;AAAA,IAChD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,uBAAmB,0BAAY,MAAM;AACzC,mBAAe,KAAK;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,SAAQ;AAAA,QACR,eAAa,2CAAmB;AAAA,QAChC,UAAU,KAAK;AAAA,QACf,cAAc;AAAA,QACd,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QAEA,uDAAC,oBAAiB,eAA8B,wBAC9C;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAQ;AAAA,cACR;AAAA,cACA;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACA,4CAAC,2CAAc,GAAG,aAAa;AAAA,WACjC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAGA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -65,7 +65,7 @@ const DSControlledRadioPropTypes = {
|
|
|
65
65
|
"used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect"
|
|
66
66
|
).defaultValue("mediaquery"),
|
|
67
67
|
applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
68
|
-
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS.
|
|
68
|
+
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the checked state does not change. Clicks and keys are only observed (they still reach your handlers)"
|
|
69
69
|
).defaultValue(false)
|
|
70
70
|
};
|
|
71
71
|
const DSControlledRadioPropTypesSchema = DSControlledRadioPropTypes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSControlledRadioT {\n export type Devices = 'mobile' | 'desktop' | 'mediaquery';\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n visualOnly: boolean;\n applyAriaDisabled: boolean;\n device: Devices;\n }\n export interface RequiredProps {\n name: string;\n value: string;\n }\n\n export interface OptionalProps {\n onChange?: (newValue: string, e: React.ChangeEvent | React.KeyboardEvent) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface StyledRadioT {\n checked?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n device?: Devices;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSControlledRadioT.DefaultProps = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n disabled: false,\n visualOnly: false,\n applyAriaDisabled: false,\n device: 'mediaquery',\n};\n\n// Omit<DSControlledRadioT.Props, 'visualOnly'>\n// visualOnly is an internal only prop, so we don't want to expose it in the docs\nexport const DSControlledRadioPropTypes: DSPropTypesSchema<Omit<DSControlledRadioT.Props, 'visualOnly'>> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n name: PropTypes.string.description(\n 'Radio name attribute. Without this WCAG will fail, name is required for a bunch of success criterias',\n ),\n value: PropTypes.string.description(\n 'Radio value. Without this WCAG will fail, value is required for a bunch of success criterias',\n ),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent | React.KeyboardEvent) => 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 device: PropTypes.oneOf(['mobile', 'desktop', 'mediaquery'])\n .description(\n 'used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect',\n )\n .defaultValue('mediaquery'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS.
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSControlledRadioT {\n export type Devices = 'mobile' | 'desktop' | 'mediaquery';\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n visualOnly: boolean;\n applyAriaDisabled: boolean;\n device: Devices;\n }\n export interface RequiredProps {\n name: string;\n value: string;\n }\n\n export interface OptionalProps {\n onChange?: (newValue: string, e: React.ChangeEvent | React.KeyboardEvent) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface StyledRadioT {\n checked?: boolean;\n $readOnly?: boolean;\n hasError?: boolean;\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n device?: Devices;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSControlledRadioT.DefaultProps = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n disabled: false,\n visualOnly: false,\n applyAriaDisabled: false,\n device: 'mediaquery',\n};\n\n// Omit<DSControlledRadioT.Props, 'visualOnly'>\n// visualOnly is an internal only prop, so we don't want to expose it in the docs\nexport const DSControlledRadioPropTypes: DSPropTypesSchema<Omit<DSControlledRadioT.Props, 'visualOnly'>> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n name: PropTypes.string.description(\n 'Radio name attribute. Without this WCAG will fail, name is required for a bunch of success criterias',\n ),\n value: PropTypes.string.description(\n 'Radio value. Without this WCAG will fail, value is required for a bunch of success criterias',\n ),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent | React.KeyboardEvent) => 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 device: PropTypes.oneOf(['mobile', 'desktop', 'mediaquery'])\n .description(\n 'used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect',\n )\n .defaultValue('mediaquery'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the checked state does not change. Clicks and keys are only observed (they still reach your handlers)',\n )\n .defaultValue(false),\n};\n\nexport const DSControlledRadioPropTypesSchema =\n DSControlledRadioPropTypes as unknown as React.WeakValidationMap<DSControlledRadioT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AAiDhE,MAAM,eAAgD;AAAA,EAC3D,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,QAAQ;AACV;AAIO,MAAM,6BAA8F;AAAA,EACzG,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,OAAO,kCAAU,OAAO;AAAA,IACtB;AAAA,EACF;AAAA,EACA,UAAU,kCAAU,KACjB,YAAY,yBAAyB,EACrC,UAAU,0EAA0E;AAAA,EACvF,OAAO,kCAAU,OAAO;AAAA,IACtB;AAAA,EACF;AAAA,EACA,SAAS,kCAAU,KAAK,YAAY,qCAAqC;AAAA,EACzE,UAAU,kCAAU,KAAK,YAAY,qCAAqC;AAAA,EAC1E,UAAU,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,CAAC,EAAE,YAAY,kBAAkB;AAAA,EAChG,WAAW,kCAAU,KAAK,YAAY,uCAAuC;AAAA,EAC7E,QAAQ,kCAAU,MAAM,CAAC,UAAU,WAAW,YAAY,CAAC,EACxD;AAAA,IACC;AAAA,EACF,EACC,aAAa,YAAY;AAAA,EAC5B,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
|
@@ -113,23 +113,23 @@ const StyledRadio = (0, import_ds_system.styled)("span", {
|
|
|
113
113
|
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
|
114
114
|
border-radius: 50px;
|
|
115
115
|
position: relative;
|
|
116
|
-
background: ${({ theme, disabled, applyAriaDisabled, readOnly }) => (0, import_styleHelpers.handleBackgroundColor)(theme, disabled, readOnly || applyAriaDisabled)};
|
|
117
|
-
${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, false, device)}
|
|
116
|
+
background: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => (0, import_styleHelpers.handleBackgroundColor)(theme, $disabled, $readOnly || $applyAriaDisabled)};
|
|
117
|
+
${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, false, device)}
|
|
118
118
|
&:focus-within {
|
|
119
|
-
${({ theme, disabled }) =>
|
|
119
|
+
${({ theme, $disabled }) => !$disabled ? `border: 1px solid ${theme.colors.brand[700]};
|
|
120
120
|
outline: 1px solid ${theme.colors.brand[700]}` : void 0};
|
|
121
121
|
&:hover {
|
|
122
|
-
${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, true, device)}
|
|
122
|
+
${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) => (0, import_styleHelpers.handleCheckmark)(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, true, device)}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
&:hover {
|
|
126
|
-
background: ${({ theme, applyAriaDisabled, readOnly, disabled }) => {
|
|
127
|
-
if (applyAriaDisabled || readOnly) {
|
|
126
|
+
background: ${({ theme, $applyAriaDisabled, $readOnly, $disabled }) => {
|
|
127
|
+
if ($applyAriaDisabled || $readOnly) {
|
|
128
128
|
return theme.colors.neutral["050"];
|
|
129
129
|
}
|
|
130
|
-
return
|
|
130
|
+
return !$disabled && !$applyAriaDisabled ? theme.colors.brand[200] : void 0;
|
|
131
131
|
}};
|
|
132
|
-
${({ theme, hasError, disabled }) => !hasError &&
|
|
132
|
+
${({ theme, hasError, $disabled }) => !hasError && !$disabled ? ` border: 1px solid ${theme.colors.brand[600]}` : void 0};
|
|
133
133
|
}
|
|
134
134
|
`;
|
|
135
135
|
const radioStyles = import_ds_system.css`
|
|
@@ -148,24 +148,18 @@ const StyledInput = (0, import_ds_system.styled)("input", {
|
|
|
148
148
|
slot: import_exported_related.DSRadioSlots.INPUT
|
|
149
149
|
})`
|
|
150
150
|
${radioStyles}
|
|
151
|
-
|
|
152
|
-
cursor: not-allowed;
|
|
153
|
-
}
|
|
151
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
154
152
|
`;
|
|
155
153
|
const StyledLabel = (0, import_ds_system.styled)("label", {
|
|
156
154
|
name: import_exported_related.DSRadioName,
|
|
157
155
|
slot: import_exported_related.DSRadioSlots.LABEL
|
|
158
156
|
})`
|
|
159
|
-
color: ${({ theme, disabled, readOnly }) => disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
157
|
+
color: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => $disabled || $applyAriaDisabled || $readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
160
158
|
/* Typography metrics delegated to child DSTypography b2 */
|
|
161
159
|
display: inherit;
|
|
162
160
|
width: fit-content;
|
|
163
|
-
|
|
164
|
-
${
|
|
165
|
-
cursor: not-allowed;
|
|
166
|
-
}` : `&:hover {
|
|
167
|
-
cursor: pointer;
|
|
168
|
-
}`}
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
169
163
|
`;
|
|
170
164
|
const StyledLabelTypography = (0, import_ds_system.styled)(import_ds_typography.DSTypography, {
|
|
171
165
|
name: import_exported_related.DSRadioName,
|
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": ["import { styled, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSRadioName, DSRadioSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})<{ device?: DSControlledRadioT.Devices; 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 === 'mediaquery') {\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 ${({ hasLabel }) => (hasLabel ? 'column-gap: 8px;' : '')}\n display: inline-grid;\n grid-template-rows: min-content;\n\n align-items: center;\n ${xStyledCommonProps}\n`;\n\nexport const StyledRadio = styled('span', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT_WRAPPER,\n})<DSControlledRadioT.StyledRadioT>`\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 === 'mediaquery') {\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; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\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 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, applyAriaDisabled, readOnly }) =>\n handleBackgroundColor(theme, disabled, readOnly || applyAriaDisabled)};\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, false, device)}\n &:focus-within {\n ${({ theme, disabled }) =>\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { styled, css, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSRadioName, DSRadioSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})<{ device?: DSControlledRadioT.Devices; 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 === 'mediaquery') {\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 ${({ hasLabel }) => (hasLabel ? 'column-gap: 8px;' : '')}\n display: inline-grid;\n grid-template-rows: min-content;\n\n align-items: center;\n ${xStyledCommonProps}\n`;\n\nexport const StyledRadio = styled('span', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT_WRAPPER,\n})<DSControlledRadioT.StyledRadioT>`\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 === 'mediaquery') {\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; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\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 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, $applyAriaDisabled, $readOnly }) =>\n handleBackgroundColor(theme, $disabled, $readOnly || $applyAriaDisabled)};\n ${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, false, device)}\n &:focus-within {\n ${({ theme, $disabled }) =>\n !$disabled\n ? `border: 1px solid ${theme.colors.brand[700]};\n outline: 1px solid ${theme.colors.brand[700]}`\n : undefined};\n &:hover {\n ${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, true, device)}\n }\n }\n &:hover {\n background: ${({ theme, $applyAriaDisabled, $readOnly, $disabled }) => {\n if ($applyAriaDisabled || $readOnly) {\n return theme.colors.neutral['050'];\n }\n return !$disabled && !$applyAriaDisabled ? theme.colors.brand[200] : undefined;\n }};\n ${({ theme, hasError, $disabled }) =>\n !hasError && !$disabled ? ` 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 ${lockedStateInteractionCss}\n`;\ninterface StyledLabelT {\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n $readOnly?: boolean;\n checked: boolean;\n onClick?: React.MouseEventHandler<HTMLLabelElement>;\n device?: DSControlledRadioT.Devices;\n}\nexport const StyledLabel = styled('label', {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL,\n})<StyledLabelT>`\n color: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) =>\n $disabled || $applyAriaDisabled || $readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};\n /* Typography metrics delegated to child DSTypography b2 */\n display: inherit;\n width: fit-content;\n cursor: pointer;\n ${lockedStateInteractionCss}\n`;\n\nexport const StyledLabelTypography = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL_TYPOGRAPHY,\n})``;\n\nexport const StyledHiddenP = styled.p`\n display: none;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
4
|
import {
|
|
5
5
|
describe,
|
|
6
6
|
useGetGlobalAttributes,
|
|
7
7
|
useGetXstyledProps,
|
|
8
8
|
useMemoMergePropsWithDefault,
|
|
9
|
-
useOwnerProps
|
|
9
|
+
useOwnerProps,
|
|
10
|
+
omitLockedHandlers,
|
|
11
|
+
isLocked,
|
|
12
|
+
resolveAriaDisabled
|
|
10
13
|
} from "@elliemae/ds-props-helpers";
|
|
11
14
|
import { uid } from "uid";
|
|
12
15
|
import { TruncatedTooltipText } from "./TruncatedTooltipText.js";
|
|
@@ -25,30 +28,28 @@ const DSControlledRadio = (props) => {
|
|
|
25
28
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
26
29
|
useValidateProps(props, DSControlledRadioPropTypes);
|
|
27
30
|
const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } = propsWithDefault;
|
|
31
|
+
const {
|
|
32
|
+
id,
|
|
33
|
+
disabled,
|
|
34
|
+
readOnly,
|
|
35
|
+
label,
|
|
36
|
+
className,
|
|
37
|
+
onKeyDown: consumerOnKeyDown,
|
|
38
|
+
...restGlobals
|
|
39
|
+
} = useGetGlobalAttributes(propsWithDefault);
|
|
40
|
+
const locked = isLocked({ disabled, applyAriaDisabled, readOnly });
|
|
28
41
|
const handleOnChange = useCallback(
|
|
29
42
|
(e) => {
|
|
30
|
-
if (onChange && value && !
|
|
43
|
+
if (onChange && value && !locked) onChange(value, e);
|
|
31
44
|
},
|
|
32
|
-
[
|
|
45
|
+
[locked, onChange, value]
|
|
33
46
|
);
|
|
34
47
|
const handleKeyDown = useCallback(
|
|
35
48
|
(e) => {
|
|
49
|
+
consumerOnKeyDown?.(e);
|
|
36
50
|
if (e.key === "Enter") handleOnChange(e);
|
|
37
51
|
},
|
|
38
|
-
[handleOnChange]
|
|
39
|
-
);
|
|
40
|
-
const sharedListeners = React2.useMemo(
|
|
41
|
-
() => ({
|
|
42
|
-
onKeyDown: handleKeyDown
|
|
43
|
-
// we can't declare onChange here, we are "overwriting" the event,
|
|
44
|
-
// if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones
|
|
45
|
-
// onChange: handleOnChange,
|
|
46
|
-
}),
|
|
47
|
-
[handleKeyDown]
|
|
48
|
-
);
|
|
49
|
-
const { id, disabled, readOnly, label, className, ...restGlobals } = useGetGlobalAttributes(
|
|
50
|
-
propsWithDefault,
|
|
51
|
-
sharedListeners
|
|
52
|
+
[consumerOnKeyDown, handleOnChange]
|
|
52
53
|
);
|
|
53
54
|
const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);
|
|
54
55
|
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
@@ -70,9 +71,9 @@ const DSControlledRadio = (props) => {
|
|
|
70
71
|
device,
|
|
71
72
|
checked,
|
|
72
73
|
hasError,
|
|
73
|
-
disabled,
|
|
74
|
-
applyAriaDisabled,
|
|
75
|
-
readOnly,
|
|
74
|
+
$disabled: disabled,
|
|
75
|
+
$applyAriaDisabled: applyAriaDisabled,
|
|
76
|
+
$readOnly: readOnly,
|
|
76
77
|
getOwnerProps,
|
|
77
78
|
getOwnerPropsArguments,
|
|
78
79
|
children: !visualOnly ? /* @__PURE__ */ jsx(
|
|
@@ -80,14 +81,18 @@ const DSControlledRadio = (props) => {
|
|
|
80
81
|
{
|
|
81
82
|
"data-testid": "ds-radio",
|
|
82
83
|
type: "radio",
|
|
83
|
-
...
|
|
84
|
-
...restGlobals,
|
|
84
|
+
...omitLockedHandlers(restGlobals, locked, "change"),
|
|
85
85
|
id: instanceUid,
|
|
86
86
|
innerRef,
|
|
87
87
|
onChange: handleOnChange,
|
|
88
|
+
onKeyDown: handleKeyDown,
|
|
88
89
|
checked,
|
|
89
90
|
disabled,
|
|
90
|
-
"aria-disabled":
|
|
91
|
+
"aria-disabled": resolveAriaDisabled({
|
|
92
|
+
disabled,
|
|
93
|
+
softLocked: applyAriaDisabled || readOnly,
|
|
94
|
+
consumerValue: restGlobals["aria-disabled"]
|
|
95
|
+
}),
|
|
91
96
|
"aria-invalid": hasError,
|
|
92
97
|
"aria-describedby": readOnly ? `${instanceUid}-read-only-helper-msg` : void 0,
|
|
93
98
|
getOwnerProps,
|
|
@@ -101,8 +106,9 @@ const DSControlledRadio = (props) => {
|
|
|
101
106
|
{
|
|
102
107
|
device,
|
|
103
108
|
htmlFor: instanceUid,
|
|
104
|
-
disabled: disabled
|
|
105
|
-
|
|
109
|
+
$disabled: disabled,
|
|
110
|
+
$applyAriaDisabled: applyAriaDisabled,
|
|
111
|
+
$readOnly: readOnly,
|
|
106
112
|
checked,
|
|
107
113
|
"data-testid": "ds-radio-label",
|
|
108
114
|
getOwnerProps,
|
|
@@ -120,6 +126,7 @@ const DSControlledRadio = (props) => {
|
|
|
120
126
|
TruncatedTooltipText,
|
|
121
127
|
{
|
|
122
128
|
value: label,
|
|
129
|
+
disabled: Boolean(disabled),
|
|
123
130
|
getOwnerProps,
|
|
124
131
|
getOwnerPropsArguments
|
|
125
132
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport {\n StyledContainer,\n StyledLabelTypography,\n StyledInput,\n StyledLabel,\n StyledRadio,\n StyledHiddenP,\n} from './styles.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { DSControlledRadioPropTypes, DSControlledRadioPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\nimport { useValidateProps } from './config/useValidateProps.js';\nimport { DSRadioDataTestIds } from './exported-related/data-test-ids.js';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledRadioT.InternalProps>(props, defaultProps);\n useValidateProps(props, DSControlledRadioPropTypes);\n const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } =\n propsWithDefault;\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.KeyboardEvent) => {\n if (onChange && value && !
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n omitLockedHandlers,\n isLocked,\n resolveAriaDisabled,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport {\n StyledContainer,\n StyledLabelTypography,\n StyledInput,\n StyledLabel,\n StyledRadio,\n StyledHiddenP,\n} from './styles.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { DSControlledRadioPropTypes, DSControlledRadioPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\nimport { useValidateProps } from './config/useValidateProps.js';\nimport { DSRadioDataTestIds } from './exported-related/data-test-ids.js';\n\nconst DSControlledRadio: React.ComponentType<DSControlledRadioT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledRadioT.InternalProps>(props, defaultProps);\n useValidateProps(props, DSControlledRadioPropTypes);\n const { checked, applyAriaDisabled, visualOnly, device, hasError, innerRef, value, wrapLabel, onChange } =\n propsWithDefault;\n\n const {\n id,\n disabled,\n readOnly,\n label,\n className,\n onKeyDown: consumerOnKeyDown,\n ...restGlobals\n } = useGetGlobalAttributes<DSControlledRadioT.Props>(propsWithDefault);\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.KeyboardEvent) => {\n if (onChange && value && !locked) onChange(value, e);\n },\n [locked, onChange, value],\n );\n\n // a radio has a change event, so the lock gates the change (`handleOnChange` does nothing while locked) and the\n // keys are only observed: the consumer onKeyDown always receives them. Enter selects the radio, as it always did.\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n consumerOnKeyDown?.(e);\n if (e.key === 'Enter') handleOnChange(e);\n },\n [consumerOnKeyDown, handleOnChange],\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(propsWithDefault);\n\n return (\n <StyledContainer\n device={device}\n data-testid=\"ds-radio-container\"\n hasLabel={Boolean(label)}\n className={className}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledRadio\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 {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...omitLockedHandlers(restGlobals, locked, 'change')}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n onKeyDown={handleKeyDown}\n checked={checked}\n disabled={disabled}\n // a soft lock prints \"true\" whatever the consumer passes, a natively disabled radio prints none of its own,\n // otherwise the consumer's own aria-disabled passes through (inversion of control)\n aria-disabled={resolveAriaDisabled({\n disabled,\n softLocked: applyAriaDisabled || readOnly,\n consumerValue: restGlobals['aria-disabled'],\n })}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n $disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n $readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapLabel ? (\n <StyledLabelTypography\n component=\"span\"\n variant=\"b2\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledLabelTypography>\n ) : (\n <TruncatedTooltipText\n value={label}\n disabled={Boolean(disabled)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n )}\n </StyledLabel>\n )}\n {readOnly ? (\n <StyledHiddenP data-testid={DSRadioDataTestIds.READONLY_HELPER_MSG} id={`${instanceUid}-read-only-helper-msg`}>\n Read only\n </StyledHiddenP>\n ) : null}\n </StyledContainer>\n );\n};\n\nDSControlledRadio.displayName = 'DSControlledRadio';\nconst DSControlledRadioWithSchema = describe(DSControlledRadio);\nDSControlledRadioWithSchema.propTypes = DSControlledRadioPropTypesSchema;\n\nexport { DSControlledRadio, DSControlledRadioWithSchema };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -45,19 +45,25 @@ const StyledTooltipText = styled(DSTypography, {
|
|
|
45
45
|
const TruncatedTooltipText = ({
|
|
46
46
|
value = "",
|
|
47
47
|
placement = "top",
|
|
48
|
+
disabled = false,
|
|
48
49
|
getOwnerProps,
|
|
49
50
|
getOwnerPropsArguments
|
|
50
51
|
}) => {
|
|
51
52
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
53
|
+
const isTooltipOpen = showTooltip && !disabled;
|
|
52
54
|
const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({
|
|
53
55
|
placement,
|
|
54
|
-
externallyControlledIsOpen:
|
|
56
|
+
externallyControlledIsOpen: isTooltipOpen,
|
|
55
57
|
withoutAnimation: true
|
|
56
58
|
});
|
|
57
|
-
const handleMouseEnter = useCallback(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const handleMouseEnter = useCallback(
|
|
60
|
+
(e) => {
|
|
61
|
+
if (disabled) return;
|
|
62
|
+
const el = e.currentTarget;
|
|
63
|
+
setShowTooltip(el.offsetWidth < el.scrollWidth);
|
|
64
|
+
},
|
|
65
|
+
[disabled]
|
|
66
|
+
);
|
|
61
67
|
const handleMouseLeave = useCallback(() => {
|
|
62
68
|
setShowTooltip(false);
|
|
63
69
|
}, []);
|
|
@@ -80,7 +86,7 @@ const TruncatedTooltipText = ({
|
|
|
80
86
|
FloatingWrapper,
|
|
81
87
|
{
|
|
82
88
|
innerRef: refs.setFloating,
|
|
83
|
-
isOpen:
|
|
89
|
+
isOpen: isTooltipOpen,
|
|
84
90
|
floatingStyles,
|
|
85
91
|
context,
|
|
86
92
|
children: /* @__PURE__ */ jsxs(TooltipContainer, { getOwnerProps, getOwnerPropsArguments, children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/TruncatedTooltipText.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\nimport { DSRadioName, DSRadioSlots, DSRadioDataTestIds } from './exported-related/index.js';\n\nconst TruncatedSpan = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TRUNCATED_LABEL,\n})`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_CONTAINER,\n})`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\nconst StyledTooltipText = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_TEXT,\n})``;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n getOwnerProps?: () => object;\n getOwnerPropsArguments?: () => object;\n}\n\nconst TruncatedTooltipText = ({\n value = '',\n placement = 'top',\n getOwnerProps,\n getOwnerPropsArguments,\n}: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen:
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\nimport { DSRadioName, DSRadioSlots, DSRadioDataTestIds } from './exported-related/index.js';\n\nconst TruncatedSpan = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TRUNCATED_LABEL,\n})`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_CONTAINER,\n})`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\nconst StyledTooltipText = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.TOOLTIP_TEXT,\n})``;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n /** hard lock: a disabled label has no hover behavior, so its full-value tooltip never opens */\n disabled?: boolean;\n getOwnerProps?: () => object;\n getOwnerPropsArguments?: () => object;\n}\n\nconst TruncatedTooltipText = ({\n value = '',\n placement = 'top',\n disabled = false,\n getOwnerProps,\n getOwnerPropsArguments,\n}: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n // a lock that lands while the tooltip is open closes it immediately, it does not wait for the mouseleave\n const isTooltipOpen = showTooltip && !disabled;\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: isTooltipOpen,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback(\n (e: React.MouseEvent<HTMLSpanElement>) => {\n if (disabled) return;\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n },\n [disabled],\n );\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan\n component=\"span\"\n variant=\"b2\"\n data-testid={DSRadioDataTestIds.TRUNCATED_LABEL}\n innerRef={refs.setReference}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isTooltipOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <StyledTooltipText\n component=\"span\"\n variant=\"b2-light\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {value}\n </StyledTooltipText>\n <PopoverArrow {...arrowStyles} />\n </TooltipContainer>\n </FloatingWrapper>\n </>\n );\n};\n\nexport { TruncatedTooltipText };\nexport default TruncatedTooltipText;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwFnB,mBACE,KAkBE,YAnBJ;AAxFJ,SAAgB,aAAa,gBAAgB;AAC7C,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,cAAc,0BAA0B;AAE9D,MAAM,gBAAgB,OAAO,cAAc;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASD,MAAM,mBAAmB,OAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAAA;AAAA,eAEc,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO9B,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,EAAE,EAAE;AAAA;AAAA;AAAA;AAAA,WAIvD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAInD,MAAM,oBAAoB,OAAO,cAAc;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,aAAa;AACrB,CAAC;AAWD,MAAM,uBAAuB,CAAC;AAAA,EAC5B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AACF,MAAiC;AAC/B,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,gBAAgB,eAAe,CAAC;AAEtC,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,IAAI,mBAAmB;AAAA,IACxE;AAAA,IACA,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,mBAAmB;AAAA,IACvB,CAAC,MAAyC;AACxC,UAAI,SAAU;AACd,YAAM,KAAK,EAAE;AACb,qBAAe,GAAG,cAAc,GAAG,WAAW;AAAA,IAChD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,mBAAmB,YAAY,MAAM;AACzC,mBAAe,KAAK;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,SAAQ;AAAA,QACR,eAAa,mBAAmB;AAAA,QAChC,UAAU,KAAK;AAAA,QACf,cAAc;AAAA,QACd,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QAEA,+BAAC,oBAAiB,eAA8B,wBAC9C;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAQ;AAAA,cACR;AAAA,cACA;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACA,oBAAC,gBAAc,GAAG,aAAa;AAAA,WACjC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAGA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,7 +30,7 @@ const DSControlledRadioPropTypes = {
|
|
|
30
30
|
"used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect"
|
|
31
31
|
).defaultValue("mediaquery"),
|
|
32
32
|
applyAriaDisabled: PropTypes.bool.description(
|
|
33
|
-
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS.
|
|
33
|
+
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the checked state does not change. Clicks and keys are only observed (they still reach your handlers)"
|
|
34
34
|
).defaultValue(false)
|
|
35
35
|
};
|
|
36
36
|
const DSControlledRadioPropTypesSchema = DSControlledRadioPropTypes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSControlledRadioT {\n export type Devices = 'mobile' | 'desktop' | 'mediaquery';\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n visualOnly: boolean;\n applyAriaDisabled: boolean;\n device: Devices;\n }\n export interface RequiredProps {\n name: string;\n value: string;\n }\n\n export interface OptionalProps {\n onChange?: (newValue: string, e: React.ChangeEvent | React.KeyboardEvent) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface StyledRadioT {\n checked?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n device?: Devices;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSControlledRadioT.DefaultProps = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n disabled: false,\n visualOnly: false,\n applyAriaDisabled: false,\n device: 'mediaquery',\n};\n\n// Omit<DSControlledRadioT.Props, 'visualOnly'>\n// visualOnly is an internal only prop, so we don't want to expose it in the docs\nexport const DSControlledRadioPropTypes: DSPropTypesSchema<Omit<DSControlledRadioT.Props, 'visualOnly'>> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n name: PropTypes.string.description(\n 'Radio name attribute. Without this WCAG will fail, name is required for a bunch of success criterias',\n ),\n value: PropTypes.string.description(\n 'Radio value. Without this WCAG will fail, value is required for a bunch of success criterias',\n ),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent | React.KeyboardEvent) => 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 device: PropTypes.oneOf(['mobile', 'desktop', 'mediaquery'])\n .description(\n 'used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect',\n )\n .defaultValue('mediaquery'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS.
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSControlledRadioT {\n export type Devices = 'mobile' | 'desktop' | 'mediaquery';\n export interface DefaultProps {\n checked: boolean;\n hasError: boolean;\n wrapLabel: boolean;\n disabled: boolean;\n visualOnly: boolean;\n applyAriaDisabled: boolean;\n device: Devices;\n }\n export interface RequiredProps {\n name: string;\n value: string;\n }\n\n export interface OptionalProps {\n onChange?: (newValue: string, e: React.ChangeEvent | React.KeyboardEvent) => void;\n label?: string;\n innerRef?: React.RefObject<HTMLInputElement>;\n }\n\n export interface StyledRadioT {\n checked?: boolean;\n $readOnly?: boolean;\n hasError?: boolean;\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n device?: Devices;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSControlledRadioT.DefaultProps = {\n wrapLabel: false,\n hasError: false,\n checked: false,\n disabled: false,\n visualOnly: false,\n applyAriaDisabled: false,\n device: 'mediaquery',\n};\n\n// Omit<DSControlledRadioT.Props, 'visualOnly'>\n// visualOnly is an internal only prop, so we don't want to expose it in the docs\nexport const DSControlledRadioPropTypes: DSPropTypesSchema<Omit<DSControlledRadioT.Props, 'visualOnly'>> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n name: PropTypes.string.description(\n 'Radio name attribute. Without this WCAG will fail, name is required for a bunch of success criterias',\n ),\n value: PropTypes.string.description(\n 'Radio value. Without this WCAG will fail, value is required for a bunch of success criterias',\n ),\n onChange: PropTypes.func\n .description('Radio onchange callback')\n .signature('((newValue: string,e: React.ChangeEvent | React.KeyboardEvent) => 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 device: PropTypes.oneOf(['mobile', 'desktop', 'mediaquery'])\n .description(\n 'used for responsive designs, this controls how the styling should behave. you can force mobile/desktop styling or rely on mediaquery to auto-detect',\n )\n .defaultValue('mediaquery'),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the checked state does not change. Clicks and keys are only observed (they still reach your handlers)',\n )\n .defaultValue(false),\n};\n\nexport const DSControlledRadioPropTypesSchema =\n DSControlledRadioPropTypes as unknown as React.WeakValidationMap<DSControlledRadioT.Props>;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,WAAW,2BAA2B,wBAAwB;AAiDhE,MAAM,eAAgD;AAAA,EAC3D,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,QAAQ;AACV;AAIO,MAAM,6BAA8F;AAAA,EACzG,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,UAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO;AAAA,IACtB;AAAA,EACF;AAAA,EACA,UAAU,UAAU,KACjB,YAAY,yBAAyB,EACrC,UAAU,0EAA0E;AAAA,EACvF,OAAO,UAAU,OAAO;AAAA,IACtB;AAAA,EACF;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;AAAA,EAC7E,QAAQ,UAAU,MAAM,CAAC,UAAU,WAAW,YAAY,CAAC,EACxD;AAAA,IACC;AAAA,EACF,EACC,aAAa,YAAY;AAAA,EAC5B,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { styled, css, xStyledCommonProps } from "@elliemae/ds-system";
|
|
2
|
+
import { styled, css, xStyledCommonProps, lockedStateInteractionCss } from "@elliemae/ds-system";
|
|
3
3
|
import { DSTypography } from "@elliemae/ds-typography";
|
|
4
4
|
import { handleBackgroundColor, handleCheckmark } from "./utils/styleHelpers.js";
|
|
5
5
|
import { DSRadioName, DSRadioSlots } from "./exported-related/index.js";
|
|
@@ -75,23 +75,23 @@ const StyledRadio = styled("span", {
|
|
|
75
75
|
border: 1px solid ${({ theme, hasError }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
|
|
76
76
|
border-radius: 50px;
|
|
77
77
|
position: relative;
|
|
78
|
-
background: ${({ theme, disabled, applyAriaDisabled, readOnly }) => handleBackgroundColor(theme, disabled, readOnly || applyAriaDisabled)};
|
|
79
|
-
${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) => handleCheckmark(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, false, device)}
|
|
78
|
+
background: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => handleBackgroundColor(theme, $disabled, $readOnly || $applyAriaDisabled)};
|
|
79
|
+
${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) => handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, false, device)}
|
|
80
80
|
&:focus-within {
|
|
81
|
-
${({ theme, disabled }) =>
|
|
81
|
+
${({ theme, $disabled }) => !$disabled ? `border: 1px solid ${theme.colors.brand[700]};
|
|
82
82
|
outline: 1px solid ${theme.colors.brand[700]}` : void 0};
|
|
83
83
|
&:hover {
|
|
84
|
-
${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) => handleCheckmark(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, true, device)}
|
|
84
|
+
${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) => handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, true, device)}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
&:hover {
|
|
88
|
-
background: ${({ theme, applyAriaDisabled, readOnly, disabled }) => {
|
|
89
|
-
if (applyAriaDisabled || readOnly) {
|
|
88
|
+
background: ${({ theme, $applyAriaDisabled, $readOnly, $disabled }) => {
|
|
89
|
+
if ($applyAriaDisabled || $readOnly) {
|
|
90
90
|
return theme.colors.neutral["050"];
|
|
91
91
|
}
|
|
92
|
-
return
|
|
92
|
+
return !$disabled && !$applyAriaDisabled ? theme.colors.brand[200] : void 0;
|
|
93
93
|
}};
|
|
94
|
-
${({ theme, hasError, disabled }) => !hasError &&
|
|
94
|
+
${({ theme, hasError, $disabled }) => !hasError && !$disabled ? ` border: 1px solid ${theme.colors.brand[600]}` : void 0};
|
|
95
95
|
}
|
|
96
96
|
`;
|
|
97
97
|
const radioStyles = css`
|
|
@@ -110,24 +110,18 @@ const StyledInput = styled("input", {
|
|
|
110
110
|
slot: DSRadioSlots.INPUT
|
|
111
111
|
})`
|
|
112
112
|
${radioStyles}
|
|
113
|
-
|
|
114
|
-
cursor: not-allowed;
|
|
115
|
-
}
|
|
113
|
+
${lockedStateInteractionCss}
|
|
116
114
|
`;
|
|
117
115
|
const StyledLabel = styled("label", {
|
|
118
116
|
name: DSRadioName,
|
|
119
117
|
slot: DSRadioSlots.LABEL
|
|
120
118
|
})`
|
|
121
|
-
color: ${({ theme, disabled, readOnly }) => disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
119
|
+
color: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) => $disabled || $applyAriaDisabled || $readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};
|
|
122
120
|
/* Typography metrics delegated to child DSTypography b2 */
|
|
123
121
|
display: inherit;
|
|
124
122
|
width: fit-content;
|
|
125
|
-
|
|
126
|
-
${
|
|
127
|
-
cursor: not-allowed;
|
|
128
|
-
}` : `&:hover {
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
}`}
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
${lockedStateInteractionCss}
|
|
131
125
|
`;
|
|
132
126
|
const StyledLabelTypography = styled(DSTypography, {
|
|
133
127
|
name: DSRadioName,
|
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", "import { styled, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSRadioName, DSRadioSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})<{ device?: DSControlledRadioT.Devices; 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 === 'mediaquery') {\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 ${({ hasLabel }) => (hasLabel ? 'column-gap: 8px;' : '')}\n display: inline-grid;\n grid-template-rows: min-content;\n\n align-items: center;\n ${xStyledCommonProps}\n`;\n\nexport const StyledRadio = styled('span', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT_WRAPPER,\n})<DSControlledRadioT.StyledRadioT>`\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 === 'mediaquery') {\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; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\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 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, applyAriaDisabled, readOnly }) =>\n handleBackgroundColor(theme, disabled, readOnly || applyAriaDisabled)};\n ${({ theme, checked, disabled, applyAriaDisabled, readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, disabled || applyAriaDisabled, readOnly, hasError, false, device)}\n &:focus-within {\n ${({ theme, disabled }) =>\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,KAAK,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nimport { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';\nimport { DSRadioName, DSRadioSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSRadioName,\n slot: DSRadioSlots.CONTAINER,\n})<{ device?: DSControlledRadioT.Devices; 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 === 'mediaquery') {\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 ${({ hasLabel }) => (hasLabel ? 'column-gap: 8px;' : '')}\n display: inline-grid;\n grid-template-rows: min-content;\n\n align-items: center;\n ${xStyledCommonProps}\n`;\n\nexport const StyledRadio = styled('span', {\n name: DSRadioName,\n slot: DSRadioSlots.INPUT_WRAPPER,\n})<DSControlledRadioT.StyledRadioT>`\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 === 'mediaquery') {\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; /* 16px / 13 */\n height: 1.2307rem; /* 16px / 13 */\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 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, $applyAriaDisabled, $readOnly }) =>\n handleBackgroundColor(theme, $disabled, $readOnly || $applyAriaDisabled)};\n ${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, false, device)}\n &:focus-within {\n ${({ theme, $disabled }) =>\n !$disabled\n ? `border: 1px solid ${theme.colors.brand[700]};\n outline: 1px solid ${theme.colors.brand[700]}`\n : undefined};\n &:hover {\n ${({ theme, checked, $disabled, $applyAriaDisabled, $readOnly, hasError, device }) =>\n handleCheckmark(theme, checked, $disabled || $applyAriaDisabled, $readOnly, hasError, true, device)}\n }\n }\n &:hover {\n background: ${({ theme, $applyAriaDisabled, $readOnly, $disabled }) => {\n if ($applyAriaDisabled || $readOnly) {\n return theme.colors.neutral['050'];\n }\n return !$disabled && !$applyAriaDisabled ? theme.colors.brand[200] : undefined;\n }};\n ${({ theme, hasError, $disabled }) =>\n !hasError && !$disabled ? ` 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 ${lockedStateInteractionCss}\n`;\ninterface StyledLabelT {\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n $readOnly?: boolean;\n checked: boolean;\n onClick?: React.MouseEventHandler<HTMLLabelElement>;\n device?: DSControlledRadioT.Devices;\n}\nexport const StyledLabel = styled('label', {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL,\n})<StyledLabelT>`\n color: ${({ theme, $disabled, $applyAriaDisabled, $readOnly }) =>\n $disabled || $applyAriaDisabled || $readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800]};\n /* Typography metrics delegated to child DSTypography b2 */\n display: inherit;\n width: fit-content;\n cursor: pointer;\n ${lockedStateInteractionCss}\n`;\n\nexport const StyledLabelTypography = styled(DSTypography, {\n name: DSRadioName,\n slot: DSRadioSlots.LABEL_TYPOGRAPHY,\n})``;\n\nexport const StyledHiddenP = styled.p`\n display: none;\n`;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,9 +3,11 @@ import { type DSHookFloatingContextT } from '@elliemae/ds-floating-context';
|
|
|
3
3
|
interface TruncatedTooltipTextProps {
|
|
4
4
|
value?: string;
|
|
5
5
|
placement?: DSHookFloatingContextT.PopperPlacementsT;
|
|
6
|
+
/** hard lock: a disabled label has no hover behavior, so its full-value tooltip never opens */
|
|
7
|
+
disabled?: boolean;
|
|
6
8
|
getOwnerProps?: () => object;
|
|
7
9
|
getOwnerPropsArguments?: () => object;
|
|
8
10
|
}
|
|
9
|
-
declare const TruncatedTooltipText: ({ value, placement, getOwnerProps, getOwnerPropsArguments, }: TruncatedTooltipTextProps) => React.JSX.Element;
|
|
11
|
+
declare const TruncatedTooltipText: ({ value, placement, disabled, getOwnerProps, getOwnerPropsArguments, }: TruncatedTooltipTextProps) => React.JSX.Element;
|
|
10
12
|
export { TruncatedTooltipText };
|
|
11
13
|
export default TruncatedTooltipText;
|
|
@@ -22,10 +22,10 @@ export declare namespace DSControlledRadioT {
|
|
|
22
22
|
}
|
|
23
23
|
interface StyledRadioT {
|
|
24
24
|
checked?: boolean;
|
|
25
|
-
readOnly?: boolean;
|
|
25
|
+
$readOnly?: boolean;
|
|
26
26
|
hasError?: boolean;
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
applyAriaDisabled?: boolean;
|
|
27
|
+
$disabled?: boolean;
|
|
28
|
+
$applyAriaDisabled?: boolean;
|
|
29
29
|
device?: Devices;
|
|
30
30
|
}
|
|
31
31
|
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>, XstyledProps, RequiredProps {
|
package/dist/types/styles.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export declare const StyledContainer: import("styled-components").StyledComponen
|
|
|
4
4
|
hasLabel: boolean;
|
|
5
5
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
6
6
|
export declare const StyledRadio: import("styled-components").StyledComponent<"span", import("@elliemae/ds-system").Theme, DSControlledRadioT.StyledRadioT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"span">, never>;
|
|
7
|
-
export declare const StyledInput: import("styled-components").StyledComponent<"input", import("@elliemae/ds-system").Theme,
|
|
7
|
+
export declare const StyledInput: import("styled-components").StyledComponent<"input", import("@elliemae/ds-system").Theme, import("@elliemae/ds-system").LockedStateStyleProps & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"input">, never>;
|
|
8
8
|
interface StyledLabelT {
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
|
|
9
|
+
$disabled?: boolean;
|
|
10
|
+
$applyAriaDisabled?: boolean;
|
|
11
|
+
$readOnly?: boolean;
|
|
11
12
|
checked: boolean;
|
|
12
13
|
onClick?: React.MouseEventHandler<HTMLLabelElement>;
|
|
13
14
|
device?: DSControlledRadioT.Devices;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-radio",
|
|
3
|
-
"version": "3.80.0-next.
|
|
3
|
+
"version": "3.80.0-next.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Radio",
|
|
6
6
|
"files": [
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-
|
|
40
|
-
"@elliemae/ds-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
39
|
+
"@elliemae/ds-floating-context": "3.80.0-next.80",
|
|
40
|
+
"@elliemae/ds-props-helpers": "3.80.0-next.80",
|
|
41
|
+
"@elliemae/ds-system": "3.80.0-next.80",
|
|
42
|
+
"@elliemae/ds-typography": "3.80.0-next.80"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@elliemae/ds-monorepo-devops": "3.80.0-next.80",
|
|
46
|
+
"@elliemae/ds-test-utils": "3.80.0-next.80",
|
|
45
47
|
"@elliemae/pui-theme": "~2.13.0",
|
|
46
48
|
"jest": "^30.0.0",
|
|
47
49
|
"styled-components": "~5.3.11",
|
|
48
|
-
"uid": "^2.0.2"
|
|
49
|
-
"@elliemae/ds-monorepo-devops": "3.80.0-next.8",
|
|
50
|
-
"@elliemae/ds-test-utils": "3.80.0-next.8"
|
|
50
|
+
"uid": "^2.0.2"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@elliemae/pui-theme": "~2.13.0",
|