@elliemae/ds-form-radio 3.70.0-next.2 → 3.70.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
37
37
  var import_react = __toESM(require("react"));
38
38
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
39
  var import_uid = require("uid");
40
- var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
40
+ var import_TruncatedTooltipText = require("./TruncatedTooltipText.js");
41
41
  var import_styles = require("./styles.js");
42
42
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
43
43
  var import_useValidateProps = require("./config/useValidateProps.js");
@@ -119,7 +119,7 @@ const DSControlledRadio = (props) => {
119
119
  readOnly,
120
120
  checked,
121
121
  "data-testid": "ds-radio-label",
122
- 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 })
122
+ children: wrapLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledWrapLabel, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedTooltipText.TruncatedTooltipText, { value: label })
123
123
  }
124
124
  ),
125
125
  readOnly ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledHiddenP, { "data-testid": import_data_test_ids.DSRadioDataTestIds.READONLY_HELPER_MSG, id: `${instanceUid}-read-only-helper-msg`, children: "Read only" }) : null
@@ -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} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio, StyledHiddenP } 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 && !applyAriaDisabled) onChange(value, e);\n },\n [applyAriaDisabled, onChange, value],\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') handleOnChange(e);\n },\n [handleOnChange],\n );\n\n const sharedListeners = React.useMemo(\n () => ({\n onKeyDown: handleKeyDown,\n // we can't declare onChange here, we are \"overwriting\" the event,\n // if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones\n // onChange: handleOnChange,\n }),\n [handleKeyDown],\n );\n const { id, disabled, readOnly, label, className, ...restGlobals } = useGetGlobalAttributes<DSControlledRadioT.Props>(\n propsWithDefault,\n sharedListeners,\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(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 >\n <StyledRadio\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n >\n {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...sharedListeners}\n {...restGlobals}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n checked={checked}\n disabled={disabled}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsDnB;AArDJ,mBAA4C;AAC5C,8BAKO;AACP,iBAAoB;AACpB,uCAA2C;AAC3C,oBAAuG;AAEvG,mCAA2F;AAC3F,8BAAiC;AACjC,2BAAmC;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,uBAAmB,sDAA+D,OAAO,yCAAY;AAC3G,gDAAiB,OAAO,uDAA0B;AAClD,QAAM,EAAE,SAAS,mBAAmB,YAAY,QAAQ,UAAU,UAAU,O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AAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,SAAS;AAAA,YACT,UAAU,YAAY;AAAA,YACtB;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YAEX,sBAAY,4CAAC,iCAAiB,iBAAM,IAAqB,4CAAC,+DAA2B,OAAO,OAAO;AAAA;AAAA,QACtG;AAAA,QAED,WACC,4CAAC,+BAAc,eAAa,wCAAmB,qBAAqB,IAAI,GAAG,WAAW,yBAAyB,uBAE/G,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
4
+ "sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio, StyledHiddenP } 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 && !applyAriaDisabled) onChange(value, e);\n },\n [applyAriaDisabled, onChange, value],\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') handleOnChange(e);\n },\n [handleOnChange],\n );\n\n const sharedListeners = React.useMemo(\n () => ({\n onKeyDown: handleKeyDown,\n // we can't declare onChange here, we are \"overwriting\" the event,\n // if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones\n // onChange: handleOnChange,\n }),\n [handleKeyDown],\n );\n const { id, disabled, readOnly, label, className, ...restGlobals } = useGetGlobalAttributes<DSControlledRadioT.Props>(\n propsWithDefault,\n sharedListeners,\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(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 >\n <StyledRadio\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n >\n {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...sharedListeners}\n {...restGlobals}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n checked={checked}\n disabled={disabled}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <TruncatedTooltipText value={label} />}\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsDnB;AArDJ,mBAA4C;AAC5C,8BAKO;AACP,iBAAoB;AACpB,kCAAqC;AACrC,oBAAuG;AAEvG,mCAA2F;AAC3F,8BAAiC;AACjC,2BAAmC;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,uBAAmB,sDAA+D,OAAO,yCAAY;AAC3G,gDAAiB,OAAO,uDAA0B;AAClD,QAAM,EAAE,SAAS,mBAAmB,YAAY,QAAQ,UAAU,UAAU,OAAO,WAAW,SAAS,IACrG;AAEF,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAA+C;AAC9C,UAAI,YAAY,SAAS,CAAC,kBAAmB,UAAS,OAAO,CAAC;AAAA,IAChE;AAAA,IACA,CAAC,mBAAmB,UAAU,KAAK;AAAA,EACrC;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,MAA2B;AAC1B,UAAI,EAAE,QAAQ,QAAS,gBAAe,CAAC;AAAA,IACzC;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,kBAAkB,aAAAA,QAAM;AAAA,IAC5B,OAAO;AAAA,MACL,WAAW;AAAA;AAAA;AAAA;AAAA,IAIb;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AACA,QAAM,EAAE,IAAI,UAAU,UAAU,OAAO,WAAW,GAAG,YAAY,QAAI;AAAA,IACnE;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAAc,sBAAQ,MAAM,MAAM,qBAAiB,gBAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACvE,QAAM,mBAAe,4CAAmB,gBAAgB;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAY;AAAA,MACZ,UAAU,QAAQ,KAAK;AAAA,MACvB;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEC,WAAC,aACA;AAAA,cAAC;AAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,MAAK;AAAA,gBACJ,GAAG;AAAA,gBACH,GAAG;AAAA,gBACJ,IAAI;AAAA,gBACJ;AAAA,gBACA,UAAU;AAAA,gBACV;AAAA,gBACA;AAAA,gBACA,iBAAe,qBAAqB;AAAA,gBACpC,gBAAc;AAAA,gBACd,oBAAkB,WAAW,GAAG,WAAW,0BAA0B;AAAA;AAAA,YACvE,IACE;AAAA;AAAA,QACN;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,SAAS;AAAA,YACT,UAAU,YAAY;AAAA,YACtB;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YAEX,sBAAY,4CAAC,iCAAiB,iBAAM,IAAqB,4CAAC,oDAAqB,OAAO,OAAO;AAAA;AAAA,QAChG;AAAA,QAED,WACC,4CAAC,+BAAc,eAAa,wCAAmB,qBAAqB,IAAI,GAAG,WAAW,yBAAyB,uBAE/G,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var TruncatedTooltipText_exports = {};
30
+ __export(TruncatedTooltipText_exports, {
31
+ TruncatedTooltipText: () => TruncatedTooltipText,
32
+ default: () => TruncatedTooltipText_default
33
+ });
34
+ module.exports = __toCommonJS(TruncatedTooltipText_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_react = require("react");
38
+ var import_ds_system = require("@elliemae/ds-system");
39
+ var import_ds_floating_context = require("@elliemae/ds-floating-context");
40
+ const TruncatedSpan = import_ds_system.styled.span`
41
+ text-overflow: ellipsis;
42
+ white-space: nowrap;
43
+ overflow: hidden;
44
+ display: inline-block;
45
+ max-width: 100%;
46
+ `;
47
+ const TooltipContainer = import_ds_system.styled.div`
48
+ text-align: left;
49
+ min-width: ${({ theme }) => theme.space.l};
50
+ max-width: 250px;
51
+ min-height: 30px;
52
+ display: grid;
53
+ align-items: center;
54
+ padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
55
+ position: relative;
56
+ background-color: white;
57
+ border-radius: 2px;
58
+ font-size: 13px;
59
+ color: ${({ theme }) => theme.colors.neutral[600]};
60
+ pointer-events: none;
61
+ `;
62
+ const TruncatedTooltipText = ({ value = "", placement = "top" }) => {
63
+ const [showTooltip, setShowTooltip] = (0, import_react.useState)(false);
64
+ const { refs, floatingStyles, arrowStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
65
+ placement,
66
+ externallyControlledIsOpen: showTooltip,
67
+ withoutAnimation: true
68
+ });
69
+ const handleMouseEnter = (0, import_react.useCallback)((e) => {
70
+ const el = e.currentTarget;
71
+ setShowTooltip(el.offsetWidth < el.scrollWidth);
72
+ }, []);
73
+ const handleMouseLeave = (0, import_react.useCallback)(() => {
74
+ setShowTooltip(false);
75
+ }, []);
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TruncatedSpan, { innerRef: refs.setReference, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: value }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ import_ds_floating_context.FloatingWrapper,
80
+ {
81
+ innerRef: refs.setFloating,
82
+ isOpen: showTooltip,
83
+ floatingStyles,
84
+ context,
85
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipContainer, { children: [
86
+ value,
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
88
+ ] })
89
+ }
90
+ )
91
+ ] });
92
+ };
93
+ var TruncatedTooltipText_default = TruncatedTooltipText;
94
+ //# sourceMappingURL=TruncatedTooltipText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\n\nconst TruncatedSpan = styled.span`\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 text-align: left;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n}\n\nconst TruncatedTooltipText = ({ value = '', placement = 'top' }: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: showTooltip,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback((e: React.MouseEvent<HTMLSpanElement>) => {\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan innerRef={refs.setReference} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={showTooltip}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer>\n {value}\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,Y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
package/dist/cjs/index.js CHANGED
@@ -41,6 +41,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
41
41
  var import_ControlledRadio = require("./ControlledRadio.js");
42
42
  var import_ControlledRadio2 = require("./ControlledRadio.js");
43
43
  var import_exported_related = require("./exported-related/index.js");
44
- const DSControlledRadio = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledRadio.DSControlledRadio, { ...props });
45
- const PresentationalRadio = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledRadio.DSControlledRadio, { ...props, visualOnly: true });
44
+ const DSControlledRadio = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledRadio.DSControlledRadio, { ...props });
45
+ const PresentationalRadio = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledRadio.DSControlledRadio, { ...props, visualOnly: true });
46
46
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { DSControlledRadio as Radio } from './ControlledRadio.js';\nexport { type DSControlledRadioT } from './react-desc-prop-types.js';\nexport const DSControlledRadio = ({ ...props }) => <Radio {...props} />;\nexport const PresentationalRadio = ({ ...props }) => <Radio {...props} visualOnly />;\nexport { DSControlledRadioWithSchema } from './ControlledRadio.js';\nexport { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from './exported-related/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADE4B;AAFnD,6BAA2C;AAI3C,IAAAA,0BAA4C;AAC5C,8BAA8D;AAHvD,MAAM,oBAAoB,CAAC,EAAE,GAAG,MAAM,MAAM,4CAAC,uBAAAC,mBAAA,EAAO,GAAG,OAAO;AAC9D,MAAM,sBAAsB,CAAC,EAAE,GAAG,MAAM,MAAM,4CAAC,uBAAAA,mBAAA,EAAO,GAAG,OAAO,YAAU,MAAC;",
4
+ "sourcesContent": ["import { DSControlledRadio as Radio } from './ControlledRadio.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nexport { type DSControlledRadioT } from './react-desc-prop-types.js';\nexport const DSControlledRadio = (props: DSControlledRadioT.Props) => <Radio {...props} />;\nexport const PresentationalRadio = (props: DSControlledRadioT.Props) => <Radio {...props} visualOnly />;\nexport { DSControlledRadioWithSchema } from './ControlledRadio.js';\nexport { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from './exported-related/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADG+C;AAHtE,6BAA2C;AAK3C,IAAAA,0BAA4C;AAC5C,8BAA8D;AAHvD,MAAM,oBAAoB,CAAC,UAAoC,4CAAC,uBAAAC,mBAAA,EAAO,GAAG,OAAO;AACjF,MAAM,sBAAsB,CAAC,UAAoC,4CAAC,uBAAAA,mBAAA,EAAO,GAAG,OAAO,YAAU,MAAC;",
6
6
  "names": ["import_ControlledRadio", "Radio"]
7
7
  }
@@ -8,7 +8,7 @@ import {
8
8
  useMemoMergePropsWithDefault
9
9
  } from "@elliemae/ds-props-helpers";
10
10
  import { uid } from "uid";
11
- import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
11
+ import { TruncatedTooltipText } from "./TruncatedTooltipText.js";
12
12
  import { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio, StyledHiddenP } from "./styles.js";
13
13
  import { DSControlledRadioPropTypes, DSControlledRadioPropTypesSchema, defaultProps } from "./react-desc-prop-types.js";
14
14
  import { useValidateProps } from "./config/useValidateProps.js";
@@ -90,7 +90,7 @@ const DSControlledRadio = (props) => {
90
90
  readOnly,
91
91
  checked,
92
92
  "data-testid": "ds-radio-label",
93
- children: wrapLabel ? /* @__PURE__ */ jsx(StyledWrapLabel, { children: label }) : /* @__PURE__ */ jsx(SimpleTruncatedTooltipText, { value: label })
93
+ children: wrapLabel ? /* @__PURE__ */ jsx(StyledWrapLabel, { children: label }) : /* @__PURE__ */ jsx(TruncatedTooltipText, { value: label })
94
94
  }
95
95
  ),
96
96
  readOnly ? /* @__PURE__ */ jsx(StyledHiddenP, { "data-testid": DSRadioDataTestIds.READONLY_HELPER_MSG, id: `${instanceUid}-read-only-helper-msg`, children: "Read only" }) : null
@@ -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} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio, StyledHiddenP } 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 && !applyAriaDisabled) onChange(value, e);\n },\n [applyAriaDisabled, onChange, value],\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') handleOnChange(e);\n },\n [handleOnChange],\n );\n\n const sharedListeners = React.useMemo(\n () => ({\n onKeyDown: handleKeyDown,\n // we can't declare onChange here, we are \"overwriting\" the event,\n // if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones\n // onChange: handleOnChange,\n }),\n [handleKeyDown],\n );\n const { id, disabled, readOnly, label, className, ...restGlobals } = useGetGlobalAttributes<DSControlledRadioT.Props>(\n propsWithDefault,\n sharedListeners,\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(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 >\n <StyledRadio\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n >\n {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...sharedListeners}\n {...restGlobals}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n checked={checked}\n disabled={disabled}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <SimpleTruncatedTooltipText value={label} />}\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": "AAAA,YAAY,WAAW;ACsDnB,SAgBM,KAhBN;AArDJ,OAAOA,UAAS,aAAa,eAAe;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AACpB,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB,iBAAiB,aAAa,aAAa,aAAa,qBAAqB;AAEvG,SAAS,4BAA4B,kCAAkC,oBAAoB;AAC3F,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,mBAAmB,6BAA+D,OAAO,YAAY;AAC3G,mBAAiB,OAAO,0BAA0B;AAClD,QAAM,EAAE,SAAS,mBAAmB,YAAY,QAAQ,UAAU,UAAU,OAAO,WAAW,SAAS,IACrG;AAEF,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAA+C;AAC9C,UAAI,YAAY,SAAS,CAAC,kBAAmB,UAAS,OAAO,CAAC;AAAA,IAChE;AAAA,IACA,CAAC,mBAAmB,UAAU,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,MAA2B;AAC1B,UAAI,EAAE,QAAQ,QAAS,gBAAe,CAAC;AAAA,IACzC;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,kBAAkBA,OAAM;AAAA,IAC5B,OAAO;AAAA,MACL,WAAW;AAAA;AAAA;AAAA;AAAA,IAIb;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AACA,QAAM,EAAE,IAAI,UAAU,UAAU,OAAO,WAAW,GAAG,YAAY,IAAI;AAAA,IACnE;AAAA,IACA;AAAA,EACF;AAEA,QAAM,cAAc,QAAQ,MAAM,MAAM,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACvE,QAAM,eAAe,mBAAmB,gBAAgB;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAY;AAAA,MACZ,UAAU,QAAQ,KAAK;AAAA,MACvB;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEC,WAAC,aACA;AAAA,cAAC;AAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,MAAK;AAAA,gBACJ,GAAG;AAAA,gBACH,GAAG;AAAA,gBACJ,IAAI;AAAA,gBACJ;AAAA,gBACA,UAAU;AAAA,gBACV;AAAA,gBACA;AAAA,gBACA,iBAAe,qBAAqB;AAAA,gBACpC,gBAAc;AAAA,gBACd,oBAAkB,WAAW,GAAG,WAAW,0BAA0B;AAAA;AAAA,YACvE,IACE;AAAA;AAAA,QACN;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,SAAS;AAAA,YACT,UAAU,YAAY;AAAA,YACtB;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YAEX,sBAAY,oBAAC,mBAAiB,iBAAM,IAAqB,oBAAC,8BAA2B,OAAO,OAAO;AAAA;AAAA,QACtG;AAAA,QAED,WACC,oBAAC,iBAAc,eAAa,mBAAmB,qBAAqB,IAAI,GAAG,WAAW,yBAAyB,uBAE/G,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
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} from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\nimport { StyledContainer, StyledWrapLabel, StyledInput, StyledLabel, StyledRadio, StyledHiddenP } 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 && !applyAriaDisabled) onChange(value, e);\n },\n [applyAriaDisabled, onChange, value],\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') handleOnChange(e);\n },\n [handleOnChange],\n );\n\n const sharedListeners = React.useMemo(\n () => ({\n onKeyDown: handleKeyDown,\n // we can't declare onChange here, we are \"overwriting\" the event,\n // if we put it here we invoke it twice, once with our overwritten arguments, once with the native ones\n // onChange: handleOnChange,\n }),\n [handleKeyDown],\n );\n const { id, disabled, readOnly, label, className, ...restGlobals } = useGetGlobalAttributes<DSControlledRadioT.Props>(\n propsWithDefault,\n sharedListeners,\n );\n\n const instanceUid = useMemo(() => id || `ds-form-radio-${uid(5)}`, [id]);\n const xstyledProps = useGetXstyledProps(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 >\n <StyledRadio\n device={device}\n checked={checked}\n hasError={hasError}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n >\n {!visualOnly ? (\n <StyledInput\n data-testid=\"ds-radio\"\n type=\"radio\"\n {...sharedListeners}\n {...restGlobals}\n id={instanceUid}\n innerRef={innerRef}\n onChange={handleOnChange}\n checked={checked}\n disabled={disabled}\n aria-disabled={applyAriaDisabled || readOnly}\n aria-invalid={hasError}\n aria-describedby={readOnly ? `${instanceUid}-read-only-helper-msg` : undefined}\n />\n ) : null}\n </StyledRadio>\n {label && (\n <StyledLabel\n device={device}\n htmlFor={instanceUid}\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n checked={checked}\n data-testid=\"ds-radio-label\"\n >\n {wrapLabel ? <StyledWrapLabel>{label}</StyledWrapLabel> : <TruncatedTooltipText value={label} />}\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": "AAAA,YAAY,WAAW;ACsDnB,SAgBM,KAhBN;AArDJ,OAAOA,UAAS,aAAa,eAAe;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AACpB,SAAS,4BAA4B;AACrC,SAAS,iBAAiB,iBAAiB,aAAa,aAAa,aAAa,qBAAqB;AAEvG,SAAS,4BAA4B,kCAAkC,oBAAoB;AAC3F,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,mBAAmB,6BAA+D,OAAO,YAAY;AAC3G,mBAAiB,OAAO,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,WAAW,0BAA0B;AAAA;AAAA,YACvE,IACE;AAAA;AAAA,QACN;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,SAAS;AAAA,YACT,UAAU,YAAY;AAAA,YACtB;AAAA,YACA;AAAA,YACA,eAAY;AAAA,YAEX,sBAAY,oBAAC,mBAAiB,iBAAM,IAAqB,oBAAC,wBAAqB,OAAO,OAAO;AAAA;AAAA,QAChG;AAAA,QAED,WACC,oBAAC,iBAAc,eAAa,mBAAmB,qBAAqB,IAAI,GAAG,WAAW,yBAAyB,uBAE/G,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useState } from "react";
4
+ import { styled } from "@elliemae/ds-system";
5
+ import {
6
+ useFloatingContext,
7
+ FloatingWrapper,
8
+ PopoverArrow
9
+ } from "@elliemae/ds-floating-context";
10
+ const TruncatedSpan = styled.span`
11
+ text-overflow: ellipsis;
12
+ white-space: nowrap;
13
+ overflow: hidden;
14
+ display: inline-block;
15
+ max-width: 100%;
16
+ `;
17
+ const TooltipContainer = styled.div`
18
+ text-align: left;
19
+ min-width: ${({ theme }) => theme.space.l};
20
+ max-width: 250px;
21
+ min-height: 30px;
22
+ display: grid;
23
+ align-items: center;
24
+ padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
25
+ position: relative;
26
+ background-color: white;
27
+ border-radius: 2px;
28
+ font-size: 13px;
29
+ color: ${({ theme }) => theme.colors.neutral[600]};
30
+ pointer-events: none;
31
+ `;
32
+ const TruncatedTooltipText = ({ value = "", placement = "top" }) => {
33
+ const [showTooltip, setShowTooltip] = useState(false);
34
+ const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({
35
+ placement,
36
+ externallyControlledIsOpen: showTooltip,
37
+ withoutAnimation: true
38
+ });
39
+ const handleMouseEnter = useCallback((e) => {
40
+ const el = e.currentTarget;
41
+ setShowTooltip(el.offsetWidth < el.scrollWidth);
42
+ }, []);
43
+ const handleMouseLeave = useCallback(() => {
44
+ setShowTooltip(false);
45
+ }, []);
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ /* @__PURE__ */ jsx(TruncatedSpan, { innerRef: refs.setReference, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: value }),
48
+ /* @__PURE__ */ jsx(
49
+ FloatingWrapper,
50
+ {
51
+ innerRef: refs.setFloating,
52
+ isOpen: showTooltip,
53
+ floatingStyles,
54
+ context,
55
+ children: /* @__PURE__ */ jsxs(TooltipContainer, { children: [
56
+ value,
57
+ /* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
58
+ ] })
59
+ }
60
+ )
61
+ ] });
62
+ };
63
+ var TruncatedTooltipText_default = TruncatedTooltipText;
64
+ export {
65
+ TruncatedTooltipText,
66
+ TruncatedTooltipText_default as default
67
+ };
68
+ //# sourceMappingURL=TruncatedTooltipText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\n\nconst TruncatedSpan = styled.span`\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 text-align: left;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n}\n\nconst TruncatedTooltipText = ({ value = '', placement = 'top' }: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: showTooltip,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback((e: React.MouseEvent<HTMLSpanElement>) => {\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan innerRef={refs.setReference} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={showTooltip}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer>\n {value}\n <PopoverArrow {...arrowStyles} />\n </TooltipContainer>\n </FloatingWrapper>\n </>\n );\n};\n\nexport { TruncatedTooltipText };\nexport default TruncatedTooltipText;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0DnB,mBACE,KASE,YAVJ;AA1DJ,SAAgB,aAAa,gBAAgB;AAC7C,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,MAAM,gBAAgB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS7B,MAAM,mBAAmB,OAAO;AAAA;AAAA,eAEjB,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,aAK9B,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,EAAE,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,WAKxD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AASnD,MAAM,uBAAuB,CAAC,EAAE,QAAQ,IAAI,YAAY,MAAM,MAAiC;AAC7F,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,IAAI,mBAAmB;AAAA,IACxE;AAAA,IACA,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,mBAAmB,YAAY,CAAC,MAAyC;AAC7E,UAAM,KAAK,EAAE;AACb,mBAAe,GAAG,cAAc,GAAG,WAAW;AAAA,EAChD,GAAG,CAAC,CAAC;AAEL,QAAM,mBAAmB,YAAY,MAAM;AACzC,mBAAe,KAAK;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SACE,iCACE;AAAA,wBAAC,iBAAc,UAAU,KAAK,cAAc,cAAc,kBAAkB,cAAc,kBACvF,iBACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QAEA,+BAAC,oBACE;AAAA;AAAA,UACD,oBAAC,gBAAc,GAAG,aAAa;AAAA,WACjC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAGA,IAAO,+BAAQ;",
6
+ "names": []
7
+ }
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { DSControlledRadio as Radio } from "./ControlledRadio.js";
4
- const DSControlledRadio = ({ ...props }) => /* @__PURE__ */ jsx(Radio, { ...props });
5
- const PresentationalRadio = ({ ...props }) => /* @__PURE__ */ jsx(Radio, { ...props, visualOnly: true });
4
+ const DSControlledRadio = (props) => /* @__PURE__ */ jsx(Radio, { ...props });
5
+ const PresentationalRadio = (props) => /* @__PURE__ */ jsx(Radio, { ...props, visualOnly: true });
6
6
  import { DSControlledRadioWithSchema } from "./ControlledRadio.js";
7
7
  import { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from "./exported-related/index.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSControlledRadio as Radio } from './ControlledRadio.js';\nexport { type DSControlledRadioT } from './react-desc-prop-types.js';\nexport const DSControlledRadio = ({ ...props }) => <Radio {...props} />;\nexport const PresentationalRadio = ({ ...props }) => <Radio {...props} visualOnly />;\nexport { DSControlledRadioWithSchema } from './ControlledRadio.js';\nexport { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from './exported-related/index.js';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACE4B;AAFnD,SAAS,qBAAqB,aAAa;AAEpC,MAAM,oBAAoB,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,SAAO,GAAG,OAAO;AAC9D,MAAM,sBAAsB,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,SAAO,GAAG,OAAO,YAAU,MAAC;AAClF,SAAS,mCAAmC;AAC5C,SAAS,oBAAoB,aAAa,oBAAoB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSControlledRadio as Radio } from './ControlledRadio.js';\nimport type { DSControlledRadioT } from './react-desc-prop-types.js';\nexport { type DSControlledRadioT } from './react-desc-prop-types.js';\nexport const DSControlledRadio = (props: DSControlledRadioT.Props) => <Radio {...props} />;\nexport const PresentationalRadio = (props: DSControlledRadioT.Props) => <Radio {...props} visualOnly />;\nexport { DSControlledRadioWithSchema } from './ControlledRadio.js';\nexport { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from './exported-related/index.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACG+C;AAHtE,SAAS,qBAAqB,aAAa;AAGpC,MAAM,oBAAoB,CAAC,UAAoC,oBAAC,SAAO,GAAG,OAAO;AACjF,MAAM,sBAAsB,CAAC,UAAoC,oBAAC,SAAO,GAAG,OAAO,YAAU,MAAC;AACrG,SAAS,mCAAmC;AAC5C,SAAS,oBAAoB,aAAa,oBAAoB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,8 @@
1
+ import { type DSHookFloatingContextT } from '@elliemae/ds-floating-context';
2
+ interface TruncatedTooltipTextProps {
3
+ value?: string;
4
+ placement?: DSHookFloatingContextT.PopperPlacementsT;
5
+ }
6
+ declare const TruncatedTooltipText: ({ value, placement }: TruncatedTooltipTextProps) => import("react/jsx-runtime").JSX.Element;
7
+ export { TruncatedTooltipText };
8
+ export default TruncatedTooltipText;
@@ -1,9 +1,6 @@
1
+ import type { DSControlledRadioT } from './react-desc-prop-types.js';
1
2
  export { type DSControlledRadioT } from './react-desc-prop-types.js';
2
- export declare const DSControlledRadio: ({ ...props }: {
3
- [x: string]: any;
4
- }) => import("react/jsx-runtime.js").JSX.Element;
5
- export declare const PresentationalRadio: ({ ...props }: {
6
- [x: string]: any;
7
- }) => import("react/jsx-runtime.js").JSX.Element;
3
+ export declare const DSControlledRadio: (props: DSControlledRadioT.Props) => import("react/jsx-runtime.js").JSX.Element;
4
+ export declare const PresentationalRadio: (props: DSControlledRadioT.Props) => import("react/jsx-runtime.js").JSX.Element;
8
5
  export { DSControlledRadioWithSchema } from './ControlledRadio.js';
9
6
  export { DSRadioDataTestIds, DSRadioName, DSRadioSlots } from './exported-related/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-form-radio",
3
- "version": "3.70.0-next.2",
3
+ "version": "3.70.0-next.4",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Radio",
6
6
  "files": [
@@ -36,17 +36,17 @@
36
36
  "indent": 4
37
37
  },
38
38
  "dependencies": {
39
- "@elliemae/ds-system": "3.70.0-next.2",
40
- "@elliemae/ds-props-helpers": "3.70.0-next.2",
41
- "@elliemae/ds-truncated-tooltip-text": "3.70.0-next.2"
39
+ "@elliemae/ds-floating-context": "3.70.0-next.4",
40
+ "@elliemae/ds-props-helpers": "3.70.0-next.4",
41
+ "@elliemae/ds-system": "3.70.0-next.4"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@elliemae/pui-theme": "~2.13.0",
45
45
  "jest": "^30.0.0",
46
46
  "styled-components": "~5.3.9",
47
47
  "uid": "^2.0.2",
48
- "@elliemae/ds-test-utils": "3.70.0-next.2",
49
- "@elliemae/ds-monorepo-devops": "3.70.0-next.2"
48
+ "@elliemae/ds-test-utils": "3.70.0-next.4",
49
+ "@elliemae/ds-monorepo-devops": "3.70.0-next.4"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@elliemae/pui-theme": "~2.13.0",