@elliemae/ds-pills-v2 3.62.1 → 3.70.0-alpha.9
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/TruncatedTooltipText.js +112 -0
- package/dist/cjs/TruncatedTooltipText.js.map +7 -0
- package/dist/cjs/components/Pill.js +2 -1
- package/dist/cjs/components/Pill.js.map +2 -2
- package/dist/cjs/components/TextComponent.js +2 -2
- package/dist/cjs/components/TextComponent.js.map +2 -2
- package/dist/cjs/components/styled.js +62 -20
- package/dist/cjs/components/styled.js.map +2 -2
- package/dist/cjs/components/types/DropdownPill.js +55 -53
- package/dist/cjs/components/types/DropdownPill.js.map +2 -2
- package/dist/cjs/components/types/InputPill.js +91 -61
- package/dist/cjs/components/types/InputPill.js.map +2 -2
- package/dist/cjs/components/types/LabelOnlyPill.js +22 -2
- package/dist/cjs/components/types/LabelOnlyPill.js.map +2 -2
- package/dist/cjs/components/types/LabelPill.js +11 -2
- package/dist/cjs/components/types/LabelPill.js.map +2 -2
- package/dist/cjs/components/types/MenuButtonPill.js +11 -2
- package/dist/cjs/components/types/MenuButtonPill.js.map +2 -2
- package/dist/cjs/components/types/ReadOnlyPill.js +11 -2
- package/dist/cjs/components/types/ReadOnlyPill.js.map +2 -2
- package/dist/cjs/components/types/RemovablePill.js +15 -5
- package/dist/cjs/components/types/RemovablePill.js.map +2 -2
- package/dist/cjs/components/types/ValuePill.js +22 -1
- package/dist/cjs/components/types/ValuePill.js.map +2 -2
- package/dist/cjs/config/useValidateProps.js +63 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +3 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/DSPillButton/react-desc-prop-types.js +8 -2
- package/dist/cjs/parts/DSPillButton/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/parts/DSPillGroup/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +19 -9
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +42 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-pills-v2-valid.js +1 -1
- package/dist/cjs/typescript-testing/typescript-pills-v2-valid.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +86 -0
- package/dist/esm/TruncatedTooltipText.js.map +7 -0
- package/dist/esm/components/Pill.js +3 -2
- package/dist/esm/components/Pill.js.map +2 -2
- package/dist/esm/components/TextComponent.js +2 -2
- package/dist/esm/components/TextComponent.js.map +2 -2
- package/dist/esm/components/styled.js +62 -20
- package/dist/esm/components/styled.js.map +2 -2
- package/dist/esm/components/types/DropdownPill.js +55 -53
- package/dist/esm/components/types/DropdownPill.js.map +2 -2
- package/dist/esm/components/types/InputPill.js +92 -62
- package/dist/esm/components/types/InputPill.js.map +2 -2
- package/dist/esm/components/types/LabelOnlyPill.js +22 -2
- package/dist/esm/components/types/LabelOnlyPill.js.map +2 -2
- package/dist/esm/components/types/LabelPill.js +11 -2
- package/dist/esm/components/types/LabelPill.js.map +2 -2
- package/dist/esm/components/types/MenuButtonPill.js +11 -2
- package/dist/esm/components/types/MenuButtonPill.js.map +2 -2
- package/dist/esm/components/types/ReadOnlyPill.js +11 -2
- package/dist/esm/components/types/ReadOnlyPill.js.map +2 -2
- package/dist/esm/components/types/RemovablePill.js +15 -5
- package/dist/esm/components/types/RemovablePill.js.map +2 -2
- package/dist/esm/components/types/ValuePill.js +22 -1
- package/dist/esm/components/types/ValuePill.js.map +2 -2
- package/dist/esm/config/useValidateProps.js +33 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +3 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/DSPillButton/react-desc-prop-types.js +8 -2
- package/dist/esm/parts/DSPillButton/react-desc-prop-types.js.map +2 -2
- package/dist/esm/parts/DSPillGroup/react-desc-prop-types.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +20 -10
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +19 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-pills-v2-valid.js +1 -1
- package/dist/esm/typescript-testing/typescript-pills-v2-valid.js.map +2 -2
- package/dist/types/TruncatedTooltipText.d.ts +10 -0
- package/dist/types/components/TextComponent.d.ts +2 -0
- package/dist/types/components/styled.d.ts +5 -4
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +3 -0
- package/dist/types/parts/DSPillGroup/config/usePillGroup.d.ts +91 -91
- package/dist/types/parts/DSPillGroup/react-desc-prop-types.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +11 -2
- package/package.json +20 -18
- package/dist/types/parts/DSPillButton/tests/DSPillButton.test.d.ts +0 -1
- package/dist/types/parts/DSPillGroup/tests/DSPillGroup.test.d.ts +0 -1
- package/dist/types/tests/DSPill.a11y.test.d.ts +0 -1
- package/dist/types/tests/DSPill.exports.test.d.ts +0 -1
- package/dist/types/tests/DSPill.get-owner-props.test.d.ts +0 -1
- package/dist/types/tests/DSPill.test.d.ts +0 -1
- package/dist/types/tests/DSPillGroup.test.d.ts +0 -1
- package/dist/types/tests/events/DSPill.events.keyboard.test.d.ts +0 -1
- package/dist/types/tests/events/DSPill.events.test.d.ts +0 -1
- package/dist/types/tests/events/DSPillGroup.events.keyboard.test.d.ts +0 -1
- package/dist/types/tests/events/DSPillGroup.events.test.d.ts +0 -1
- package/dist/types/typescript-testing/typescript-pills-v2-valid.d.ts +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/TextComponent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { TruncatedTooltipText } from '../TruncatedTooltipText.js';\nimport type { DSPillT } from '../react-desc-prop-types.js';\nimport { StyledTextWrapper } from './styled.js';\n\nexport const TextComponent = React.memo<{\n labelTruncated: DSPillT.InternalProps['labelTruncated'];\n disableTruncationTooltip: DSPillT.InternalProps['disableTruncationTooltip'];\n label: DSPillT.InternalProps['label'];\n pillSize: DSPillT.InternalProps['size'];\n getOwnerProps?: () => object;\n}>(({ labelTruncated, disableTruncationTooltip, label, pillSize, getOwnerProps }) => (\n <StyledTextWrapper pillSize={pillSize} variant=\"b2\" component=\"span\" getOwnerProps={getOwnerProps}>\n {labelTruncated ? <TruncatedTooltipText value={label} disableTooltip={disableTruncationTooltip} /> : label}\n </StyledTextWrapper>\n));\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACaD;AAbtB,OAAOA,YAAW;AAClB,SAAS,4BAA4B;AAErC,SAAS,yBAAyB;AAE3B,MAAM,gBAAgBA,OAAM,KAMhC,CAAC,EAAE,gBAAgB,0BAA0B,OAAO,UAAU,cAAc,MAC7E,oBAAC,qBAAkB,UAAoB,SAAQ,MAAK,WAAU,QAAO,eAClE,2BAAiB,oBAAC,wBAAqB,OAAO,OAAO,gBAAgB,0BAA0B,IAAK,OACvG,CACD;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DSButtonV3 } from "@elliemae/ds-button-v2";
|
|
3
|
+
import { DSInputText } from "@elliemae/ds-form-input-text";
|
|
3
4
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
5
|
import { DSMenuButton } from "@elliemae/ds-menu-button";
|
|
5
6
|
import { css, styled } from "@elliemae/ds-system";
|
|
7
|
+
import { DSTypography } from "@elliemae/ds-typography";
|
|
6
8
|
import { PILL_V2_SLOTS, DSPillV2Name } from "../constants/index.js";
|
|
7
9
|
import { PILL_BUTTON_SLOTS } from "../parts/DSPillButton/constants/index.js";
|
|
8
10
|
import { PILL_GROUP_SLOTS } from "../parts/DSPillGroup/constants/index.js";
|
|
@@ -28,9 +30,14 @@ const borderOutside = ({
|
|
|
28
30
|
z-index: ${zIndex || ""};
|
|
29
31
|
}
|
|
30
32
|
`;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const b2FontMirror = css`
|
|
34
|
+
font-size: 0.8125rem;
|
|
35
|
+
line-height: 1rem;
|
|
36
|
+
@media (min-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
37
|
+
font-size: 1rem;
|
|
38
|
+
line-height: 1.2307692308rem;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
34
41
|
const commonPillWrapperCss = css`
|
|
35
42
|
position: relative;
|
|
36
43
|
|
|
@@ -47,15 +54,9 @@ const commonPillWrapperCss = css`
|
|
|
47
54
|
height: fit-content;
|
|
48
55
|
place-items: start normal;
|
|
49
56
|
|
|
50
|
-
font-size
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
font-size: 1rem;
|
|
54
|
-
}
|
|
55
|
-
line-height: ${lineHeight17Base16}rem;
|
|
56
|
-
@media (min-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
57
|
-
line-height: ${lineHeight17Base13}rem;
|
|
58
|
-
}
|
|
57
|
+
/** PUI typography: the pill label owns b2 via styled(DSTypography); font-size/line-height no
|
|
58
|
+
* longer live here. Only the InputPill wrapper re-adds b2 (see b2FontMirror) for its
|
|
59
|
+
* consumer-rendered input. color + font-weight stay here for inheritance into the label. */
|
|
59
60
|
user-select: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "none" : "auto"};
|
|
60
61
|
color: ${({ theme }) => theme.colors.brand["800"]};
|
|
61
62
|
word-break: break-word;
|
|
@@ -92,6 +93,9 @@ const StyledInputPillWrapper = styled(Grid, {
|
|
|
92
93
|
slot: PILL_V2_SLOTS.WRAPPER
|
|
93
94
|
})`
|
|
94
95
|
${commonPillWrapperCss}
|
|
96
|
+
/** The only place the b2 mirror is still needed: the input is a consumer render-prop, not a
|
|
97
|
+
* DSTypography component. All other pill text nodes own b2 via styled(DSTypography). */
|
|
98
|
+
${b2FontMirror}
|
|
95
99
|
|
|
96
100
|
background: ${(props) => props.theme.colors.neutral["000"]};
|
|
97
101
|
padding: 0;
|
|
@@ -109,22 +113,55 @@ const StyledInputPillWrapper = styled(Grid, {
|
|
|
109
113
|
${(props) => props.inputHasFocus ? borderOutside({ color: props.theme.colors.brand[500] }) : ""}
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
|
|
116
|
+
/** DSInputText renders its own bordered wrapper (StyledInputWrapper, slot "root"). The pill owns the
|
|
117
|
+
* border/background/focus-ring, so strip the wrapper's chrome and let it size to the input. */
|
|
118
|
+
& .DSInputtext-root {
|
|
119
|
+
border: none !important;
|
|
120
|
+
/* DSInputText draws its own focus ring as an inset outline on this wrapper; suppress it so only
|
|
121
|
+
* the pill's :focus-within border (below) shows, exactly as the legacy DSInput did. */
|
|
122
|
+
outline: none !important;
|
|
123
|
+
border-radius: 0 !important;
|
|
124
|
+
background: transparent !important;
|
|
125
|
+
min-height: 0 !important;
|
|
126
|
+
padding: 0 !important;
|
|
127
|
+
width: 100%;
|
|
128
|
+
/* Fill the pill row so the input stretches to the full height (as the legacy wrapper did),
|
|
129
|
+
* keeping the typed value vertically centered when the clear button grows the row. */
|
|
130
|
+
height: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The input is a consumer render-prop (DSInputText's native input by default). Match the legacy
|
|
134
|
+
* visual exactly: transparent, borderless, pill-controlled width, no padding, 8px left margin.
|
|
135
|
+
* DSInputText adds its own padding, themed font-family and an italic placeholder — neutralize those
|
|
136
|
+
* so the typed value and placeholder render identically to the previous DSInput. */
|
|
137
|
+
& input {
|
|
113
138
|
outline: none !important;
|
|
114
139
|
border: none !important;
|
|
115
140
|
box-shadow: none !important;
|
|
116
141
|
border-radius: 0 !important;
|
|
117
142
|
height: 100%;
|
|
118
143
|
background: transparent;
|
|
119
|
-
width: ${(props) => `${props.inputWidth
|
|
144
|
+
width: ${(props) => `${props.inputWidth}px`};
|
|
120
145
|
padding: 0;
|
|
121
146
|
margin: 0 0 0 8px;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
height:
|
|
147
|
+
/* Inherit the wrapper's b2 line-height so the empty field keeps its previous height; revert
|
|
148
|
+
* DSInputText's themed font-family/color/placeholder back to the UA defaults the legacy DSInput
|
|
149
|
+
* rendered with, so the typed value and placeholder look identical. */
|
|
150
|
+
line-height: inherit;
|
|
151
|
+
font-family: revert;
|
|
152
|
+
color: revert;
|
|
153
|
+
|
|
154
|
+
::placeholder {
|
|
155
|
+
color: revert;
|
|
156
|
+
font-style: revert;
|
|
157
|
+
font-weight: revert;
|
|
158
|
+
}
|
|
126
159
|
}
|
|
127
160
|
`;
|
|
161
|
+
const StyledDSInputText = styled(DSInputText, {
|
|
162
|
+
name: DSPillV2Name,
|
|
163
|
+
slot: PILL_V2_SLOTS.PILL_INPUT
|
|
164
|
+
})``;
|
|
128
165
|
const StyledDropdownPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })`
|
|
129
166
|
${commonPillWrapperCss}
|
|
130
167
|
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
@@ -218,8 +255,10 @@ const StyledPillGroup = styled(Grid, { name: DSPillV2Name, slot: PILL_GROUP_SLOT
|
|
|
218
255
|
}
|
|
219
256
|
}
|
|
220
257
|
`;
|
|
221
|
-
const StyledSpanWithTooltip = styled.
|
|
258
|
+
const StyledSpanWithTooltip = styled(DSTypography, { name: DSPillV2Name, slot: PILL_V2_SLOTS.LABEL })`
|
|
222
259
|
${commonSpanStyles}
|
|
260
|
+
/** b2 hardcodes font-weight 400; inherit so the per-pill-type weight (semibold/regular) wins. */
|
|
261
|
+
font-weight: inherit;
|
|
223
262
|
outline: none;
|
|
224
263
|
:focus {
|
|
225
264
|
${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 3 })}
|
|
@@ -307,11 +346,14 @@ const StyledAgnosticPillRegion = styled.div`
|
|
|
307
346
|
display: flex;
|
|
308
347
|
padding: 2px;
|
|
309
348
|
`;
|
|
310
|
-
const StyledTextWrapper = styled.
|
|
349
|
+
const StyledTextWrapper = styled(DSTypography, { name: DSPillV2Name, slot: PILL_V2_SLOTS.LABEL })`
|
|
311
350
|
${commonSpanStyles}
|
|
351
|
+
/** b2 hardcodes font-weight 400; inherit so the per-pill-type weight (semibold/regular) wins. */
|
|
352
|
+
font-weight: inherit;
|
|
312
353
|
`;
|
|
313
354
|
export {
|
|
314
355
|
StyledAgnosticPillRegion,
|
|
356
|
+
StyledDSInputText,
|
|
315
357
|
StyledDropdownPillWrapper,
|
|
316
358
|
StyledInputPillWrapper,
|
|
317
359
|
StyledLabelOnlyPillWrapper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSMenuButton } from '@elliemae/ds-menu-button';\nimport { css, styled } from '@elliemae/ds-system';\nimport { PILL_V2_SLOTS, DSPillV2Name } from '../constants/index.js';\nimport { PILL_BUTTON_SLOTS } from '../parts/DSPillButton/constants/index.js';\nimport { PILL_GROUP_SLOTS } from '../parts/DSPillGroup/constants/index.js';\n\n// =============================================================================\n// Common CSS\n// =============================================================================\n\nexport const borderOutside = ({\n color,\n size = 1,\n zIndex = 0,\n borderRadius = '12px',\n}: {\n color: string;\n size?: number;\n zIndex?: number;\n borderRadius?: string;\n}) => css<{ disabled?: boolean; applyAriaDisabled?: boolean; readOnly?: boolean }>`\n :after {\n content: ' ';\n position: absolute;\n top: -${size}px;\n left: -${size}px;\n right: -${size}px;\n bottom: -${size}px;\n border: ${size}px solid ${color};\n border-top-left-radius: ${borderRadius};\n border-top-right-radius: ${borderRadius};\n border-bottom-left-radius: ${borderRadius};\n border-bottom-right-radius: ${borderRadius};\n pointer-events: none;\n z-index: ${zIndex || ''};\n }\n`;\n\nconst fontSize13Base16 = 13 / 16;\nconst lineHeight17Base13 = 17 / 13;\nconst lineHeight17Base16 = 17 / 16;\nconst commonPillWrapperCss = css<{\n pillSize: 'm' | 's';\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n}>`\n position: relative;\n\n width: fit-content;\n\n background-color: ${({ theme }) => theme.colors.brand[250]};\n\n outline: none;\n\n padding: 0px 12px 0 12px;\n\n border-radius: 12px;\n\n height: fit-content;\n place-items: start normal;\n\n font-size: 1rem;\n font-size: ${fontSize13Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: 1rem;\n }\n line-height: ${lineHeight17Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n line-height: ${lineHeight17Base13}rem;\n }\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : 'auto')};\n color: ${({ theme }) => theme.colors.brand['800']};\n word-break: break-word;\n`;\n\nconst commonSpanStyles = css<{ pillSize: 'm' | 's' }>`\n display: grid;\n padding: ${(props) => (props?.pillSize === 'm' ? '4px 0' : '1px 0')};\n align-self: center;\n`;\n\ninterface InputPillWrapperProps {\n value: string;\n inputWidth: number;\n inputHasFocus: boolean;\n hasError: boolean;\n pillSize: 'm' | 's';\n disabled?: boolean;\n}\n\n// =============================================================================\n// Pills wrappers\n// =============================================================================\n\nexport const StyledLabelPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n hasIcon: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n}>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\nexport const StyledLabelOnlyPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n hasIcon: boolean;\n applyAriaDisabled?: boolean;\n}>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\ntype StyledValuePillWrapperPropsT = {\n pillSize: 'm' | 's';\n hasIcon: boolean;\n hasIconRight: boolean;\n applyAriaDisabled: boolean;\n};\n\nexport const StyledValuePillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledValuePillWrapperPropsT>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n padding-right: ${(props) => (props.hasIconRight ? '0px !important' : '12px')};\n`;\n\nexport const StyledInputPillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<InputPillWrapperProps>`\n ${commonPillWrapperCss}\n\n background: ${(props) => props.theme.colors.neutral['000']};\n padding: 0;\n\n ${({ theme, hasError }) => {\n if (hasError) return borderOutside({ color: theme.colors.danger[900] });\n return borderOutside({ color: theme.colors.brand[500] });\n }}\n\n :focus-within {\n ${(props) => (props.inputHasFocus ? borderOutside({ color: props.theme.colors.brand[700], size: 2 }) : '')}\n }\n\n :active {\n ${(props) => (props.inputHasFocus ? borderOutside({ color: props.theme.colors.brand[500] }) : '')}\n }\n\n & .em-ds-input {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n border-radius: 0 !important;\n height: 100%;\n background: transparent;\n width: ${(props) => `${props.inputWidth + (props.value === '' ? 24 : 0)}px`};\n padding: 0;\n margin: 0 0 0 8px;\n }\n\n & .em-ds-input__tooltip-ref {\n height: 100%;\n }\n`;\n\nexport const StyledDropdownPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n}>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n\n padding: 0 0 0 12px;\n`;\n\ntype StyledMenuButtonPillWrapperPropsT = {\n pillSize: 'm' | 's';\n hasIconRight: boolean;\n hasIconLeft: boolean;\n disabled?: boolean;\n};\n\nexport const StyledReadonlyPillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledMenuButtonPillWrapperPropsT>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-right: ${(props) => (props.hasIconRight ? '0 !important' : '12px')};\n padding-left: ${(props) => (props.hasIconLeft ? '0 !important' : '12px')};\n`;\n\ntype StyledRemovablePillWrapperPropsT = {\n pillSize: 'm' | 's';\n disabled: boolean;\n applyAriaDisabled: boolean;\n hasIcon: boolean;\n};\n\nexport const StyledRemovablePillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledRemovablePillWrapperPropsT>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n padding-right: 0px;\n`;\n\n// =============================================================================\n// Pill group\n// =============================================================================\n\nexport const StyledPillGroup = styled(Grid, { name: DSPillV2Name, slot: PILL_GROUP_SLOTS.PILL_GROUP })`\n width: ${({ width }) => width};\n display: flex;\n flex-wrap: wrap;\n row-gap: 8px;\n\n // Pill edges\n & .ds-pill-wrapper {\n &:not(:first-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n &:not(:last-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n\n // Pill paddings to the left / right\n & .ds-pill-wrapper-label,\n & .ds-pill-wrapper-value,\n & .ds-pill-wrapper-readonly {\n &:not(:first-of-type) {\n padding-left: 8px;\n }\n &:not(:last-of-type) {\n padding-right: 8px;\n }\n }\n\n & .ds-pill-wrapper-removable:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper-dropdown:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper {\n :not(:first-of-type) {\n .ds-pill-button-left {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n :not(:last-of-type) {\n .ds-pill-button-right {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n`;\n\n// =============================================================================\n// Extra stuff\n// =============================================================================\n\nexport const StyledSpanWithTooltip = styled.span<{ pillSize: 'm' | 's' }>`\n ${commonSpanStyles}\n outline: none;\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 3 })}\n }\n`;\n\nexport const StyledPillButton = styled(DSButtonV3, {\n name: DSPillV2Name,\n slot: PILL_BUTTON_SLOTS.PILL_BUTTON,\n preserveLegacyDataTestId: true,\n})<{\n width: string | number;\n height: string | number;\n}>`\n display: grid;\n place-items: center;\n\n position: relative;\n\n padding: 0;\n ${({ width, height, theme }) => {\n if (String(width).includes('px') && String(height).includes('px'))\n return `\n width: ${parseInt(width as string, 10) / 13}rem;\n height: ${parseInt(height as string, 10) / 13}rem;\n\n @media (max-width: ${theme.breakpoints?.small}) {\n width: ${parseInt(width as string, 10) / 16}rem;\n height: ${parseInt(height as string, 10) / 16}rem;\n }`;\n\n return `\n width: ${width};\n height: ${height};\n `;\n }}\n\n border-radius: 12px;\n\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 1, borderRadius: 'inherit' })}\n }\n\n cursor: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'not-allowed' : 'default')};\n\n :hover {\n background-color: ${({ disabled, applyAriaDisabled, theme }) =>\n disabled || applyAriaDisabled ? 'transparent' : theme.colors.brand[200]};\n }\n\n & svg {\n fill: ${({ disabled, applyAriaDisabled, theme }) => {\n if (disabled) return '#5C6574';\n if (applyAriaDisabled) return theme.colors.neutral[500];\n return theme.colors.brand[700];\n }};\n }\n`;\n\nexport const StyledPillMenuButton = styled(DSMenuButton, { name: DSPillV2Name, slot: PILL_V2_SLOTS.PILL_MENU_BUTTON })<{\n width: string;\n height: string;\n}>`\n display: grid;\n place-items: center;\n\n position: relative;\n\n padding: 0;\n ${({ width, height, theme }) => {\n if (String(width).includes('px') && String(height).includes('px'))\n return `\n width: ${parseInt(width, 10) / 13}rem;\n height: ${parseInt(height, 10) / 13}rem;\n\n @media (max-width: ${theme.breakpoints?.small}) {\n width: ${parseInt(width, 10) / 16}rem;\n height: ${parseInt(height, 10) / 16}rem;\n }`;\n\n return `\n width: ${width};\n height: ${height};\n `;\n }}\n\n border-radius: 12px;\n\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 1, borderRadius: 'inherit' })}\n }\n\n cursor: pointer;\n`;\n\nexport const StyledAgnosticPillRegion = styled.div`\n display: flex;\n padding: 2px;\n`;\n\nexport const StyledTextWrapper = styled.span<{ pillSize: 'm' | 's' }>`\n ${commonSpanStyles}\n`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,KAAK,cAAc;AAC5B,SAAS,eAAe,oBAAoB;AAC5C,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAM1B,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AACjB,MAKM;AAAA;AAAA;AAAA;AAAA,YAIM,IAAI;AAAA,aACH,IAAI;AAAA,cACH,IAAI;AAAA,eACH,IAAI;AAAA,cACL,IAAI,YAAY,KAAK;AAAA,8BACL,YAAY;AAAA,+BACX,YAAY;AAAA,iCACV,YAAY;AAAA,kCACX,YAAY;AAAA;AAAA,eAE/B,UAAU,EAAE;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSMenuButton } from '@elliemae/ds-menu-button';\nimport { css, styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { PILL_V2_SLOTS, DSPillV2Name } from '../constants/index.js';\nimport { PILL_BUTTON_SLOTS } from '../parts/DSPillButton/constants/index.js';\nimport { PILL_GROUP_SLOTS } from '../parts/DSPillGroup/constants/index.js';\n\n// =============================================================================\n// Common CSS\n// =============================================================================\n\nexport const borderOutside = ({\n color,\n size = 1,\n zIndex = 0,\n borderRadius = '12px',\n}: {\n color: string;\n size?: number;\n zIndex?: number;\n borderRadius?: string;\n}) => css<{ disabled?: boolean; applyAriaDisabled?: boolean; readOnly?: boolean }>`\n :after {\n content: ' ';\n position: absolute;\n top: -${size}px;\n left: -${size}px;\n right: -${size}px;\n bottom: -${size}px;\n border: ${size}px solid ${color};\n border-top-left-radius: ${borderRadius};\n border-top-right-radius: ${borderRadius};\n border-bottom-left-radius: ${borderRadius};\n border-bottom-right-radius: ${borderRadius};\n pointer-events: none;\n z-index: ${zIndex || ''};\n }\n`;\n\n/**\n * b2 typography mirrored as raw CSS \u2014 kept ONLY for the InputPill, whose input is a consumer\n * render-prop (`inputRender`) and cannot be a DSTypography component. Every other pill text node\n * renders via `styled(DSTypography)` variant=\"b2\". Keep in sync with ds-typography b2 (font-size\n * 13px, line-height 16px at both the mobile 16px and desktop 13px roots). End-state: consume an\n * exported ds-typography b2 css mixin instead of mirroring.\n */\nconst b2FontMirror = css`\n font-size: 0.8125rem;\n line-height: 1rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: 1rem;\n line-height: 1.2307692308rem;\n }\n`;\nconst commonPillWrapperCss = css<{\n pillSize: 'm' | 's';\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n}>`\n position: relative;\n\n width: fit-content;\n\n background-color: ${({ theme }) => theme.colors.brand[250]};\n\n outline: none;\n\n padding: 0px 12px 0 12px;\n\n border-radius: 12px;\n\n height: fit-content;\n place-items: start normal;\n\n /** PUI typography: the pill label owns b2 via styled(DSTypography); font-size/line-height no\n * longer live here. Only the InputPill wrapper re-adds b2 (see b2FontMirror) for its\n * consumer-rendered input. color + font-weight stay here for inheritance into the label. */\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : 'auto')};\n color: ${({ theme }) => theme.colors.brand['800']};\n word-break: break-word;\n`;\n\nconst commonSpanStyles = css<{ pillSize: 'm' | 's' }>`\n display: grid;\n padding: ${(props) => (props?.pillSize === 'm' ? '4px 0' : '1px 0')};\n align-self: center;\n`;\n\ninterface InputPillWrapperProps {\n value: string;\n inputWidth: number;\n inputHasFocus: boolean;\n hasError: boolean;\n pillSize: 'm' | 's';\n disabled?: boolean;\n}\n\n// =============================================================================\n// Pills wrappers\n// =============================================================================\n\nexport const StyledLabelPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n hasIcon: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n}>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\nexport const StyledLabelOnlyPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n hasIcon: boolean;\n applyAriaDisabled?: boolean;\n}>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\ntype StyledValuePillWrapperPropsT = {\n pillSize: 'm' | 's';\n hasIcon: boolean;\n hasIconRight: boolean;\n applyAriaDisabled: boolean;\n};\n\nexport const StyledValuePillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledValuePillWrapperPropsT>`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n padding-right: ${(props) => (props.hasIconRight ? '0px !important' : '12px')};\n`;\n\nexport const StyledInputPillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<InputPillWrapperProps>`\n ${commonPillWrapperCss}\n /** The only place the b2 mirror is still needed: the input is a consumer render-prop, not a\n * DSTypography component. All other pill text nodes own b2 via styled(DSTypography). */\n ${b2FontMirror}\n\n background: ${(props) => props.theme.colors.neutral['000']};\n padding: 0;\n\n ${({ theme, hasError }) => {\n if (hasError) return borderOutside({ color: theme.colors.danger[900] });\n return borderOutside({ color: theme.colors.brand[500] });\n }}\n\n :focus-within {\n ${(props) => (props.inputHasFocus ? borderOutside({ color: props.theme.colors.brand[700], size: 2 }) : '')}\n }\n\n :active {\n ${(props) => (props.inputHasFocus ? borderOutside({ color: props.theme.colors.brand[500] }) : '')}\n }\n\n /** DSInputText renders its own bordered wrapper (StyledInputWrapper, slot \"root\"). The pill owns the\n * border/background/focus-ring, so strip the wrapper's chrome and let it size to the input. */\n & .DSInputtext-root {\n border: none !important;\n /* DSInputText draws its own focus ring as an inset outline on this wrapper; suppress it so only\n * the pill's :focus-within border (below) shows, exactly as the legacy DSInput did. */\n outline: none !important;\n border-radius: 0 !important;\n background: transparent !important;\n min-height: 0 !important;\n padding: 0 !important;\n width: 100%;\n /* Fill the pill row so the input stretches to the full height (as the legacy wrapper did),\n * keeping the typed value vertically centered when the clear button grows the row. */\n height: 100%;\n }\n\n /** The input is a consumer render-prop (DSInputText's native input by default). Match the legacy\n * visual exactly: transparent, borderless, pill-controlled width, no padding, 8px left margin.\n * DSInputText adds its own padding, themed font-family and an italic placeholder \u2014 neutralize those\n * so the typed value and placeholder render identically to the previous DSInput. */\n & input {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n border-radius: 0 !important;\n height: 100%;\n background: transparent;\n width: ${(props) => `${props.inputWidth}px`};\n padding: 0;\n margin: 0 0 0 8px;\n /* Inherit the wrapper's b2 line-height so the empty field keeps its previous height; revert\n * DSInputText's themed font-family/color/placeholder back to the UA defaults the legacy DSInput\n * rendered with, so the typed value and placeholder look identical. */\n line-height: inherit;\n font-family: revert;\n color: revert;\n\n ::placeholder {\n color: revert;\n font-style: revert;\n font-weight: revert;\n }\n }\n`;\n\n// Only wraps the default input (no consumer `inputRender`) \u2014 that's the one case where the target is\n// a known, stable component and `styled(Component, {name, slot})` can apply, exposing `dsPillInput`.\nexport const StyledDSInputText = styled(DSInputText, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.PILL_INPUT,\n})``;\n\nexport const StyledDropdownPillWrapper = styled(Grid, { name: DSPillV2Name, slot: PILL_V2_SLOTS.WRAPPER })<{\n pillSize: 'm' | 's';\n}>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n\n padding: 0 0 0 12px;\n`;\n\ntype StyledMenuButtonPillWrapperPropsT = {\n pillSize: 'm' | 's';\n hasIconRight: boolean;\n hasIconLeft: boolean;\n disabled?: boolean;\n};\n\nexport const StyledReadonlyPillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledMenuButtonPillWrapperPropsT>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-right: ${(props) => (props.hasIconRight ? '0 !important' : '12px')};\n padding-left: ${(props) => (props.hasIconLeft ? '0 !important' : '12px')};\n`;\n\ntype StyledRemovablePillWrapperPropsT = {\n pillSize: 'm' | 's';\n disabled: boolean;\n applyAriaDisabled: boolean;\n hasIcon: boolean;\n};\n\nexport const StyledRemovablePillWrapper = styled(Grid, {\n name: DSPillV2Name,\n slot: PILL_V2_SLOTS.WRAPPER,\n})<StyledRemovablePillWrapperPropsT>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n padding-right: 0px;\n`;\n\n// =============================================================================\n// Pill group\n// =============================================================================\n\nexport const StyledPillGroup = styled(Grid, { name: DSPillV2Name, slot: PILL_GROUP_SLOTS.PILL_GROUP })`\n width: ${({ width }) => width};\n display: flex;\n flex-wrap: wrap;\n row-gap: 8px;\n\n // Pill edges\n & .ds-pill-wrapper {\n &:not(:first-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n &:not(:last-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n\n // Pill paddings to the left / right\n & .ds-pill-wrapper-label,\n & .ds-pill-wrapper-value,\n & .ds-pill-wrapper-readonly {\n &:not(:first-of-type) {\n padding-left: 8px;\n }\n &:not(:last-of-type) {\n padding-right: 8px;\n }\n }\n\n & .ds-pill-wrapper-removable:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper-dropdown:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper {\n :not(:first-of-type) {\n .ds-pill-button-left {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n :not(:last-of-type) {\n .ds-pill-button-right {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n`;\n\n// =============================================================================\n// Extra stuff\n// =============================================================================\n\nexport const StyledSpanWithTooltip = styled(DSTypography, { name: DSPillV2Name, slot: PILL_V2_SLOTS.LABEL })<{\n pillSize: 'm' | 's';\n}>`\n ${commonSpanStyles}\n /** b2 hardcodes font-weight 400; inherit so the per-pill-type weight (semibold/regular) wins. */\n font-weight: inherit;\n outline: none;\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 3 })}\n }\n`;\n\nexport const StyledPillButton = styled(DSButtonV3, {\n name: DSPillV2Name,\n slot: PILL_BUTTON_SLOTS.PILL_BUTTON,\n preserveLegacyDataTestId: true,\n})<{\n width: string | number;\n height: string | number;\n}>`\n display: grid;\n place-items: center;\n\n position: relative;\n\n padding: 0;\n ${({ width, height, theme }) => {\n if (String(width).includes('px') && String(height).includes('px'))\n return `\n width: ${parseInt(width as string, 10) / 13}rem;\n height: ${parseInt(height as string, 10) / 13}rem;\n\n @media (max-width: ${theme.breakpoints?.small}) {\n width: ${parseInt(width as string, 10) / 16}rem;\n height: ${parseInt(height as string, 10) / 16}rem;\n }`;\n\n return `\n width: ${width};\n height: ${height};\n `;\n }}\n\n border-radius: 12px;\n\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 1, borderRadius: 'inherit' })}\n }\n\n cursor: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'not-allowed' : 'default')};\n\n :hover {\n background-color: ${({ disabled, applyAriaDisabled, theme }) =>\n disabled || applyAriaDisabled ? 'transparent' : theme.colors.brand[200]};\n }\n\n & svg {\n fill: ${({ disabled, applyAriaDisabled, theme }) => {\n if (disabled) return '#5C6574';\n if (applyAriaDisabled) return theme.colors.neutral[500];\n return theme.colors.brand[700];\n }};\n }\n`;\n\nexport const StyledPillMenuButton = styled(DSMenuButton, { name: DSPillV2Name, slot: PILL_V2_SLOTS.PILL_MENU_BUTTON })<{\n width: string;\n height: string;\n}>`\n display: grid;\n place-items: center;\n\n position: relative;\n\n padding: 0;\n ${({ width, height, theme }) => {\n if (String(width).includes('px') && String(height).includes('px'))\n return `\n width: ${parseInt(width, 10) / 13}rem;\n height: ${parseInt(height, 10) / 13}rem;\n\n @media (max-width: ${theme.breakpoints?.small}) {\n width: ${parseInt(width, 10) / 16}rem;\n height: ${parseInt(height, 10) / 16}rem;\n }`;\n\n return `\n width: ${width};\n height: ${height};\n `;\n }}\n\n border-radius: 12px;\n\n :focus {\n ${(props) => borderOutside({ color: props.theme.colors.brand[700], size: 2, zIndex: 1, borderRadius: 'inherit' })}\n }\n\n cursor: pointer;\n`;\n\nexport const StyledAgnosticPillRegion = styled.div`\n display: flex;\n padding: 2px;\n`;\n\nexport const StyledTextWrapper = styled(DSTypography, { name: DSPillV2Name, slot: PILL_V2_SLOTS.LABEL })<{\n pillSize: 'm' | 's';\n}>`\n ${commonSpanStyles}\n /** b2 hardcodes font-weight 400; inherit so the per-pill-type weight (semibold/regular) wins. */\n font-weight: inherit;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,KAAK,cAAc;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,eAAe,oBAAoB;AAC5C,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAM1B,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AACjB,MAKM;AAAA;AAAA;AAAA;AAAA,YAIM,IAAI;AAAA,aACH,IAAI;AAAA,cACH,IAAI;AA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ClD,MAAI,SAAU,QAAO;AACrB,MAAI,kBAAmB,QAAO,MAAM,OAAO,QAAQ,GAAG;AACtD,SAAO,MAAM,OAAO,MAAM,GAAG;AAC/B,CAAC;AAAA;AAAA;AAIE,MAAM,uBAAuB,OAAO,cAAc,EAAE,MAAM,cAAc,MAAM,cAAc,iBAAiB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUjH,CAAC,EAAE,OAAO,QAAQ,MAAM,MAAM;AAC9B,MAAI,OAAO,KAAK,EAAE,SAAS,IAAI,KAAK,OAAO,MAAM,EAAE,SAAS,IAAI;AAC9D,WAAO;AAAA,eACE,SAAS,OAAO,EAAE,IAAI,EAAE;AAAA,cACzB,SAAS,QAAQ,EAAE,IAAI,EAAE;AAAA;AAAA,yBAEd,MAAM,aAAa,KAAK;AAAA,eAClC,SAAS,OAAO,EAAE,IAAI,EAAE;AAAA,gBACvB,SAAS,QAAQ,EAAE,IAAI,EAAE;AAAA;AAGrC,SAAO;AAAA,aACE,KAAK;AAAA,cACJ,MAAM;AAAA;AAElB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,MAKG,CAAC,UAAU,cAAc,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,GAAG,GAAG,MAAM,GAAG,QAAQ,GAAG,cAAc,UAAU,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAM9G,MAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA;AAKxC,MAAM,oBAAoB,OAAO,cAAc,EAAE,MAAM,cAAc,MAAM,cAAc,MAAM,CAAC;AAAA,IAGnG,gBAAgB;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,65 +3,67 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { DSDropdownMenuV2 } from "@elliemae/ds-dropdownmenu-v2";
|
|
4
4
|
import { ChevronSmallDown } from "@elliemae/ds-icons";
|
|
5
5
|
import { mergeRefs } from "@elliemae/ds-system";
|
|
6
|
+
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
6
7
|
import React2, { useMemo, useRef } from "react";
|
|
7
8
|
import { uid } from "uid";
|
|
8
9
|
import { DSPillButton } from "../../parts/DSPillButton/DSPillButton.js";
|
|
9
10
|
import { TextComponent } from "../TextComponent.js";
|
|
10
11
|
import { StyledAgnosticPillRegion, StyledDropdownPillWrapper } from "../styled.js";
|
|
11
12
|
import { PILL_V2_DATA_TESTID } from "../../constants/index.js";
|
|
12
|
-
const DropdownPill = React2.memo(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
13
|
+
const DropdownPill = React2.memo((props) => {
|
|
14
|
+
const { label, size, labelTruncated, disableTruncationTooltip, dropdownProps, innerRef, ariaLabel, onDropdownClick } = props;
|
|
15
|
+
const ownerProps = useOwnerProps(props);
|
|
16
|
+
const chevronRef = useRef(null);
|
|
17
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
StyledDropdownPillWrapper,
|
|
20
|
+
{
|
|
21
|
+
pillSize: size,
|
|
22
|
+
id: pillUid,
|
|
23
|
+
className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
|
|
24
|
+
cols: ["auto", "minmax(24px, auto)"],
|
|
25
|
+
gutter: "2px",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyItems: "center",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
TextComponent,
|
|
31
|
+
{
|
|
32
|
+
pillSize: size,
|
|
33
|
+
getOwnerProps: ownerProps.getOwnerProps,
|
|
34
|
+
labelTruncated,
|
|
35
|
+
disableTruncationTooltip,
|
|
36
|
+
label
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
DSDropdownMenuV2,
|
|
41
|
+
{
|
|
42
|
+
placementOrderPreference: ["bottom-start", "bottom", "bottom-end", "right-end", "top-start", "top", "top-end"],
|
|
43
|
+
...dropdownProps,
|
|
44
|
+
onClickOutside: (e) => {
|
|
45
|
+
if ("code" in e && e.code === "Escape") chevronRef.current?.focus();
|
|
46
|
+
if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);
|
|
47
|
+
},
|
|
48
|
+
wrapperStyles: { w: "100%", h: "100%" },
|
|
49
|
+
children: /* @__PURE__ */ jsx(StyledAgnosticPillRegion, { children: /* @__PURE__ */ jsx(
|
|
50
|
+
DSPillButton,
|
|
51
|
+
{
|
|
52
|
+
className: "ds-pill-focus-point",
|
|
53
|
+
"data-testid": PILL_V2_DATA_TESTID.PILL_DROPDOWN_CHEVRON,
|
|
54
|
+
innerRef: mergeRefs(chevronRef, innerRef),
|
|
55
|
+
"aria-label": ariaLabel || label,
|
|
56
|
+
type: "right",
|
|
57
|
+
onClick: onDropdownClick,
|
|
58
|
+
children: /* @__PURE__ */ jsx(ChevronSmallDown, { color: ["brand-primary", "800"], width: 20, height: 20 })
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
});
|
|
65
67
|
export {
|
|
66
68
|
DropdownPill
|
|
67
69
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/DropdownPill.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useMemo, useRef } from 'react';\nimport { uid } from 'uid';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { DSPillButton } from '../../parts/DSPillButton/DSPillButton.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledAgnosticPillRegion, StyledDropdownPillWrapper } from '../styled.js';\nimport { PILL_V2_DATA_TESTID } from '../../constants/index.js';\n\nexport const DropdownPill = React.memo<DSPillT.InternalProps>(\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useMemo, useRef } from 'react';\nimport { uid } from 'uid';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { DSPillButton } from '../../parts/DSPillButton/DSPillButton.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledAgnosticPillRegion, StyledDropdownPillWrapper } from '../styled.js';\nimport { PILL_V2_DATA_TESTID } from '../../constants/index.js';\n\nexport const DropdownPill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, labelTruncated, disableTruncationTooltip, dropdownProps, innerRef, ariaLabel, onDropdownClick } =\n props;\n const ownerProps = useOwnerProps(props);\n const chevronRef = useRef<HTMLButtonElement | null>(null);\n\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n return (\n <StyledDropdownPillWrapper\n pillSize={size}\n id={pillUid}\n className=\"ds-pill-wrapper ds-pill-wrapper-dropdown\"\n cols={['auto', 'minmax(24px, auto)']}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n >\n <TextComponent\n pillSize={size}\n getOwnerProps={ownerProps.getOwnerProps}\n labelTruncated={labelTruncated}\n disableTruncationTooltip={disableTruncationTooltip}\n label={label}\n />\n <DSDropdownMenuV2\n placementOrderPreference={['bottom-start', 'bottom', 'bottom-end', 'right-end', 'top-start', 'top', 'top-end']}\n {...dropdownProps}\n onClickOutside={(e) => {\n if ('code' in e && e.code === 'Escape') chevronRef.current?.focus();\n if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);\n }}\n wrapperStyles={{ w: '100%', h: '100%' }}\n >\n <StyledAgnosticPillRegion>\n <DSPillButton\n className=\"ds-pill-focus-point\"\n data-testid={PILL_V2_DATA_TESTID.PILL_DROPDOWN_CHEVRON}\n innerRef={mergeRefs(chevronRef, innerRef as TypescriptHelpersT.AnyRef<HTMLButtonElement>)}\n aria-label={ariaLabel || label}\n type=\"right\"\n onClick={onDropdownClick}\n >\n <ChevronSmallDown color={['brand-primary', '800']} width={20} height={20} />\n </DSPillButton>\n </StyledAgnosticPillRegion>\n </DSDropdownMenuV2>\n </StyledDropdownPillWrapper>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuBnB,SASE,KATF;AAtBJ,SAAS,wBAAwB;AACjC,SAA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MAAK;AAAA,gBACL,SAAS;AAAA,gBAET,8BAAC,oBAAiB,OAAO,CAAC,iBAAiB,KAAK,GAAG,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,YAC5E,GACF;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React2, { useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import { uid } from "uid";
|
|
5
6
|
import { CloseXsmall } from "@elliemae/ds-icons";
|
|
6
|
-
import { StyledAgnosticPillRegion, StyledInputPillWrapper } from "../styled.js";
|
|
7
|
+
import { StyledAgnosticPillRegion, StyledDSInputText, StyledInputPillWrapper } from "../styled.js";
|
|
7
8
|
import { DSPillButton } from "../../parts/DSPillButton/DSPillButton.js";
|
|
8
9
|
import { PILL_V2_DATA_TESTID } from "../../constants/index.js";
|
|
9
|
-
const InputPill = React2.memo(
|
|
10
|
-
|
|
10
|
+
const InputPill = React2.memo((props) => {
|
|
11
|
+
const {
|
|
11
12
|
label,
|
|
12
13
|
size,
|
|
13
14
|
inputPlaceholder,
|
|
@@ -18,66 +19,95 @@ const InputPill = React2.memo(
|
|
|
18
19
|
innerRef,
|
|
19
20
|
hasError,
|
|
20
21
|
inputId
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
[onInputClear]
|
|
34
|
-
);
|
|
35
|
-
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
36
|
-
return /* @__PURE__ */ jsxs(
|
|
37
|
-
StyledInputPillWrapper,
|
|
38
|
-
{
|
|
39
|
-
pillSize: size,
|
|
40
|
-
className: "ds-pill-wrapper",
|
|
41
|
-
cols: label === "" ? ["auto"] : ["auto", "24px"],
|
|
42
|
-
inputWidth,
|
|
43
|
-
value: label ?? "",
|
|
44
|
-
inputHasFocus,
|
|
45
|
-
hasError,
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
InputComponent,
|
|
49
|
-
{
|
|
50
|
-
id: pillUid,
|
|
51
|
-
className: "ds-pill-focus-point",
|
|
52
|
-
"data-testid": PILL_V2_DATA_TESTID.PILL_INPUT,
|
|
53
|
-
innerRef: (_ref) => {
|
|
54
|
-
ref.current = _ref;
|
|
55
|
-
},
|
|
56
|
-
value: label,
|
|
57
|
-
onChange: onInputChange,
|
|
58
|
-
placeholder: inputPlaceholder,
|
|
59
|
-
onFocus: () => setInputHasFocus(true),
|
|
60
|
-
onBlur: () => setInputHasFocus(false),
|
|
61
|
-
disableTooltip: false
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
label !== "" && /* @__PURE__ */ jsx(StyledAgnosticPillRegion, { children: /* @__PURE__ */ jsx(
|
|
65
|
-
DSPillButton,
|
|
66
|
-
{
|
|
67
|
-
id: pillUid,
|
|
68
|
-
"data-testid": PILL_V2_DATA_TESTID.PILL_CLEAR_ICON,
|
|
69
|
-
innerRef,
|
|
70
|
-
onClick: onCloseIconClick,
|
|
71
|
-
"aria-label": "Clear input",
|
|
72
|
-
type: "right",
|
|
73
|
-
children: /* @__PURE__ */ jsx(CloseXsmall, { size: "s", color: ["brand-primary", "700"] })
|
|
74
|
-
}
|
|
75
|
-
) })
|
|
76
|
-
]
|
|
22
|
+
} = props;
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
const ownerProps = useOwnerProps(props);
|
|
25
|
+
const pillUid = useMemo(() => inputId ?? `ds-pill-${uid()}`, [inputId]);
|
|
26
|
+
const onCloseIconClick = useCallback(
|
|
27
|
+
(e) => {
|
|
28
|
+
if ("code" in e && ["Enter", "Space"].includes(e.code) || !("code" in e)) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
onInputClear?.(e);
|
|
31
|
+
ref.current?.focus();
|
|
77
32
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
);
|
|
33
|
+
},
|
|
34
|
+
[onInputClear]
|
|
35
|
+
);
|
|
36
|
+
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
37
|
+
const handleValueChange = useCallback(
|
|
38
|
+
(newValue, e) => {
|
|
39
|
+
onInputChange?.(e, newValue);
|
|
40
|
+
},
|
|
41
|
+
[onInputChange]
|
|
42
|
+
);
|
|
43
|
+
const InputComponent = inputRender;
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
StyledInputPillWrapper,
|
|
46
|
+
{
|
|
47
|
+
pillSize: size,
|
|
48
|
+
className: "ds-pill-wrapper",
|
|
49
|
+
cols: ["auto", "auto"],
|
|
50
|
+
inputWidth,
|
|
51
|
+
value: label ?? "",
|
|
52
|
+
inputHasFocus,
|
|
53
|
+
hasError,
|
|
54
|
+
...ownerProps,
|
|
55
|
+
children: [
|
|
56
|
+
InputComponent ? /* @__PURE__ */ jsx(
|
|
57
|
+
InputComponent,
|
|
58
|
+
{
|
|
59
|
+
id: pillUid,
|
|
60
|
+
"data-testid": PILL_V2_DATA_TESTID.PILL_INPUT,
|
|
61
|
+
hasError,
|
|
62
|
+
dsInputtextInput: { className: "ds-pill-focus-point", "aria-describedby": null },
|
|
63
|
+
innerRef: (_ref) => {
|
|
64
|
+
ref.current = _ref;
|
|
65
|
+
},
|
|
66
|
+
value: label,
|
|
67
|
+
onValueChange: handleValueChange,
|
|
68
|
+
placeholder: inputPlaceholder,
|
|
69
|
+
onFocus: () => setInputHasFocus(true),
|
|
70
|
+
onBlur: () => setInputHasFocus(false),
|
|
71
|
+
autoComplete: "off",
|
|
72
|
+
maxLength: 255
|
|
73
|
+
}
|
|
74
|
+
) : /* @__PURE__ */ jsx(
|
|
75
|
+
StyledDSInputText,
|
|
76
|
+
{
|
|
77
|
+
id: pillUid,
|
|
78
|
+
"data-testid": PILL_V2_DATA_TESTID.PILL_INPUT,
|
|
79
|
+
hasError,
|
|
80
|
+
dsInputtextInput: { "aria-describedby": null },
|
|
81
|
+
innerRef: (_ref) => {
|
|
82
|
+
ref.current = _ref;
|
|
83
|
+
_ref?.classList.add("ds-pill-focus-point");
|
|
84
|
+
},
|
|
85
|
+
value: label,
|
|
86
|
+
onValueChange: handleValueChange,
|
|
87
|
+
placeholder: inputPlaceholder,
|
|
88
|
+
onFocus: () => setInputHasFocus(true),
|
|
89
|
+
onBlur: () => setInputHasFocus(false),
|
|
90
|
+
autoComplete: "off",
|
|
91
|
+
maxLength: 255,
|
|
92
|
+
...ownerProps
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(StyledAgnosticPillRegion, { style: label === "" ? { visibility: "hidden" } : void 0, children: /* @__PURE__ */ jsx(
|
|
96
|
+
DSPillButton,
|
|
97
|
+
{
|
|
98
|
+
id: `${pillUid}-clear`,
|
|
99
|
+
"data-testid": PILL_V2_DATA_TESTID.PILL_CLEAR_ICON,
|
|
100
|
+
innerRef,
|
|
101
|
+
onClick: onCloseIconClick,
|
|
102
|
+
"aria-label": "Clear input",
|
|
103
|
+
type: "right",
|
|
104
|
+
children: /* @__PURE__ */ jsx(CloseXsmall, { size: "s", color: ["brand-primary", "700"] })
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
});
|
|
81
111
|
export {
|
|
82
112
|
InputPill
|
|
83
113
|
};
|