@elliemae/ds-pills-v2 3.60.0-next.1 → 3.60.0-next.2

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.
Files changed (142) hide show
  1. package/dist/cjs/components/Pill.js +3 -3
  2. package/dist/cjs/components/Pill.js.map +2 -2
  3. package/dist/cjs/components/index.js +0 -2
  4. package/dist/cjs/components/index.js.map +2 -2
  5. package/dist/cjs/components/styled.js +29 -10
  6. package/dist/cjs/components/styled.js.map +3 -3
  7. package/dist/cjs/components/types/DropdownPill.js +2 -2
  8. package/dist/cjs/components/types/DropdownPill.js.map +2 -2
  9. package/dist/cjs/components/types/InputPill.js +2 -2
  10. package/dist/cjs/components/types/InputPill.js.map +2 -2
  11. package/dist/cjs/components/types/LabelOnlyPill.js +8 -4
  12. package/dist/cjs/components/types/LabelOnlyPill.js.map +2 -2
  13. package/dist/cjs/components/types/LabelPill.js +8 -4
  14. package/dist/cjs/components/types/LabelPill.js.map +2 -2
  15. package/dist/cjs/components/types/MenuButtonPill.js +60 -57
  16. package/dist/cjs/components/types/MenuButtonPill.js.map +3 -3
  17. package/dist/cjs/components/types/ReadOnlyPill.js +31 -29
  18. package/dist/cjs/components/types/ReadOnlyPill.js.map +2 -2
  19. package/dist/cjs/components/types/RemovablePill.js +78 -76
  20. package/dist/cjs/components/types/RemovablePill.js.map +2 -2
  21. package/dist/cjs/components/types/ValuePill.js +9 -5
  22. package/dist/cjs/components/types/ValuePill.js.map +2 -2
  23. package/dist/cjs/constants/index.js +51 -0
  24. package/dist/cjs/constants/index.js.map +7 -0
  25. package/dist/cjs/index.js +14 -9
  26. package/dist/cjs/index.js.map +2 -2
  27. package/dist/cjs/{components/PillButton.js → parts/DSPillButton/DSPillButton.js} +15 -16
  28. package/dist/cjs/parts/DSPillButton/DSPillButton.js.map +7 -0
  29. package/dist/cjs/parts/DSPillButton/config/usePillButton.js +53 -0
  30. package/dist/cjs/parts/DSPillButton/config/usePillButton.js.map +7 -0
  31. package/dist/cjs/parts/DSPillButton/config/useValidateProps.js +40 -0
  32. package/dist/cjs/parts/DSPillButton/config/useValidateProps.js.map +7 -0
  33. package/dist/cjs/parts/DSPillButton/constants/index.js +48 -0
  34. package/dist/cjs/parts/DSPillButton/constants/index.js.map +7 -0
  35. package/dist/cjs/parts/DSPillButton/index.js +40 -0
  36. package/dist/cjs/parts/DSPillButton/index.js.map +7 -0
  37. package/dist/cjs/parts/DSPillButton/react-desc-prop-types.js +58 -0
  38. package/dist/cjs/parts/DSPillButton/react-desc-prop-types.js.map +7 -0
  39. package/dist/cjs/parts/DSPillGroup/DSPillGroup.js +69 -0
  40. package/dist/cjs/parts/DSPillGroup/DSPillGroup.js.map +7 -0
  41. package/dist/cjs/{DSPillDefinitions.js → parts/DSPillGroup/PillGroupCTX.js} +10 -10
  42. package/dist/cjs/parts/DSPillGroup/PillGroupCTX.js.map +7 -0
  43. package/dist/cjs/{components/PillGroup.js → parts/DSPillGroup/config/usePillGroup.js} +35 -37
  44. package/dist/cjs/parts/DSPillGroup/config/usePillGroup.js.map +7 -0
  45. package/dist/cjs/parts/DSPillGroup/config/useValidateProps.js +40 -0
  46. package/dist/cjs/parts/DSPillGroup/config/useValidateProps.js.map +7 -0
  47. package/dist/cjs/parts/DSPillGroup/constants/index.js +45 -0
  48. package/dist/cjs/parts/DSPillGroup/constants/index.js.map +7 -0
  49. package/dist/cjs/parts/DSPillGroup/index.js +42 -0
  50. package/dist/cjs/parts/DSPillGroup/index.js.map +7 -0
  51. package/dist/cjs/parts/DSPillGroup/react-desc-prop-types.js +52 -0
  52. package/dist/cjs/parts/DSPillGroup/react-desc-prop-types.js.map +7 -0
  53. package/dist/cjs/react-desc-prop-types.js +2 -35
  54. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  55. package/dist/cjs/typescript-testing/typescript-pills-v2-valid.js.map +2 -2
  56. package/dist/esm/components/Pill.js +1 -1
  57. package/dist/esm/components/Pill.js.map +1 -1
  58. package/dist/esm/components/index.js +0 -2
  59. package/dist/esm/components/index.js.map +2 -2
  60. package/dist/esm/components/styled.js +29 -10
  61. package/dist/esm/components/styled.js.map +2 -2
  62. package/dist/esm/components/types/DropdownPill.js +1 -1
  63. package/dist/esm/components/types/DropdownPill.js.map +1 -1
  64. package/dist/esm/components/types/InputPill.js +1 -1
  65. package/dist/esm/components/types/InputPill.js.map +1 -1
  66. package/dist/esm/components/types/LabelOnlyPill.js +8 -4
  67. package/dist/esm/components/types/LabelOnlyPill.js.map +2 -2
  68. package/dist/esm/components/types/LabelPill.js +8 -4
  69. package/dist/esm/components/types/LabelPill.js.map +2 -2
  70. package/dist/esm/components/types/MenuButtonPill.js +60 -57
  71. package/dist/esm/components/types/MenuButtonPill.js.map +2 -2
  72. package/dist/esm/components/types/ReadOnlyPill.js +31 -29
  73. package/dist/esm/components/types/ReadOnlyPill.js.map +2 -2
  74. package/dist/esm/components/types/RemovablePill.js +78 -76
  75. package/dist/esm/components/types/RemovablePill.js.map +2 -2
  76. package/dist/esm/components/types/ValuePill.js +9 -5
  77. package/dist/esm/components/types/ValuePill.js.map +2 -2
  78. package/dist/esm/constants/index.js +21 -0
  79. package/dist/esm/constants/index.js.map +7 -0
  80. package/dist/esm/index.js +8 -10
  81. package/dist/esm/index.js.map +2 -2
  82. package/dist/esm/{components/PillButton.js → parts/DSPillButton/DSPillButton.js} +12 -13
  83. package/dist/esm/parts/DSPillButton/DSPillButton.js.map +7 -0
  84. package/dist/esm/parts/DSPillButton/config/usePillButton.js +23 -0
  85. package/dist/esm/parts/DSPillButton/config/usePillButton.js.map +7 -0
  86. package/dist/esm/parts/DSPillButton/config/useValidateProps.js +10 -0
  87. package/dist/esm/parts/DSPillButton/config/useValidateProps.js.map +7 -0
  88. package/dist/esm/parts/DSPillButton/constants/index.js +18 -0
  89. package/dist/esm/parts/DSPillButton/constants/index.js.map +7 -0
  90. package/dist/esm/parts/DSPillButton/index.js +10 -0
  91. package/dist/esm/parts/DSPillButton/index.js.map +7 -0
  92. package/dist/esm/parts/DSPillButton/react-desc-prop-types.js +33 -0
  93. package/dist/esm/parts/DSPillButton/react-desc-prop-types.js.map +7 -0
  94. package/dist/esm/parts/DSPillGroup/DSPillGroup.js +39 -0
  95. package/dist/esm/parts/DSPillGroup/DSPillGroup.js.map +7 -0
  96. package/dist/esm/parts/DSPillGroup/PillGroupCTX.js +10 -0
  97. package/dist/esm/parts/DSPillGroup/PillGroupCTX.js.map +7 -0
  98. package/dist/esm/parts/DSPillGroup/config/usePillGroup.js +74 -0
  99. package/dist/esm/parts/DSPillGroup/config/usePillGroup.js.map +7 -0
  100. package/dist/esm/parts/DSPillGroup/config/useValidateProps.js +10 -0
  101. package/dist/esm/parts/DSPillGroup/config/useValidateProps.js.map +7 -0
  102. package/dist/esm/parts/DSPillGroup/constants/index.js +15 -0
  103. package/dist/esm/parts/DSPillGroup/constants/index.js.map +7 -0
  104. package/dist/esm/parts/DSPillGroup/index.js +12 -0
  105. package/dist/esm/parts/DSPillGroup/index.js.map +7 -0
  106. package/dist/esm/parts/DSPillGroup/react-desc-prop-types.js +27 -0
  107. package/dist/esm/parts/DSPillGroup/react-desc-prop-types.js.map +7 -0
  108. package/dist/esm/react-desc-prop-types.js +8 -36
  109. package/dist/esm/react-desc-prop-types.js.map +2 -2
  110. package/dist/esm/typescript-testing/typescript-pills-v2-valid.js.map +2 -2
  111. package/dist/types/components/index.d.ts +0 -2
  112. package/dist/types/constants/index.d.ts +14 -0
  113. package/dist/types/index.d.ts +4 -2
  114. package/dist/types/{components/PillButton.d.ts → parts/DSPillButton/DSPillButton.d.ts} +3 -3
  115. package/dist/types/parts/DSPillButton/config/usePillButton.d.ts +9 -0
  116. package/dist/types/parts/DSPillButton/config/useValidateProps.d.ts +3 -0
  117. package/dist/types/parts/DSPillButton/constants/index.d.ts +9 -0
  118. package/dist/types/parts/DSPillButton/index.d.ts +2 -0
  119. package/dist/types/parts/DSPillButton/react-desc-prop-types.d.ts +24 -0
  120. package/dist/types/parts/DSPillButton/tests/DSPillButton.test.d.ts +1 -0
  121. package/dist/types/parts/DSPillGroup/DSPillGroup.d.ts +5 -0
  122. package/dist/types/parts/DSPillGroup/PillGroupCTX.d.ts +4 -0
  123. package/dist/types/parts/DSPillGroup/config/usePillGroup.d.ts +386 -0
  124. package/dist/types/parts/DSPillGroup/config/useValidateProps.d.ts +3 -0
  125. package/dist/types/parts/DSPillGroup/constants/index.d.ts +9 -0
  126. package/dist/types/parts/DSPillGroup/index.d.ts +3 -0
  127. package/dist/types/parts/DSPillGroup/react-desc-prop-types.d.ts +21 -0
  128. package/dist/types/parts/DSPillGroup/tests/DSPillGroup.test.d.ts +1 -0
  129. package/dist/types/react-desc-prop-types.d.ts +2 -7
  130. package/dist/types/tests/DSPill.exports.test.d.ts +1 -0
  131. package/dist/types/tests/DSPill.get-owner-props.test.d.ts +1 -0
  132. package/package.json +15 -15
  133. package/dist/cjs/DSPillDefinitions.js.map +0 -7
  134. package/dist/cjs/components/PillButton.js.map +0 -7
  135. package/dist/cjs/components/PillGroup.js.map +0 -7
  136. package/dist/esm/DSPillDefinitions.js +0 -10
  137. package/dist/esm/DSPillDefinitions.js.map +0 -7
  138. package/dist/esm/components/PillButton.js.map +0 -7
  139. package/dist/esm/components/PillGroup.js +0 -76
  140. package/dist/esm/components/PillGroup.js.map +0 -7
  141. package/dist/types/DSPillDefinitions.d.ts +0 -3
  142. package/dist/types/components/PillGroup.d.ts +0 -9
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/InputPill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { StyledInputPillWrapper } from '../styled.js';\nimport { DSPillButton } from '../PillButton.js';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\n\nexport const InputPill = React.memo<DSPillT.InternalProps>(\n ({\n label,\n size,\n inputPlaceholder,\n inputWidth,\n inputRender,\n onInputChange,\n onInputClear,\n innerRef,\n hasError,\n inputId,\n }) => {\n const ref = useRef<HTMLInputElement | null>(null);\n\n const InputComponent = useMemo(() => inputRender, [inputRender]);\n\n const pillUid = useMemo(() => inputId ?? `ds-pill-${uid()}`, [inputId]);\n\n const onCloseIconClick = useCallback(\n (e: React.KeyboardEvent | React.MouseEvent) => {\n if (('code' in e && ['Enter', 'Space'].includes(e.code)) || !('code' in e)) {\n e.preventDefault();\n onInputClear?.(e);\n ref.current?.focus();\n }\n },\n [onInputClear],\n );\n\n const [inputHasFocus, setInputHasFocus] = useState(false);\n\n return (\n <StyledInputPillWrapper\n pillSize={size}\n className=\"ds-pill-wrapper\"\n data-testid=\"ds-pill-wrapper\"\n cols={label === '' ? ['auto'] : ['auto', '24px']}\n inputWidth={inputWidth}\n value={label ?? ''}\n inputHasFocus={inputHasFocus}\n hasError={hasError}\n >\n <InputComponent\n id={pillUid}\n className=\"ds-pill-focus-point\"\n data-testid=\"ds-pill-input\"\n innerRef={(_ref: HTMLInputElement | null) => {\n ref.current = _ref;\n }}\n value={label}\n onChange={onInputChange}\n placeholder={inputPlaceholder}\n onFocus={() => setInputHasFocus(true)}\n onBlur={() => setInputHasFocus(false)}\n disableTooltip={false}\n />\n {label !== '' && (\n <DSPillButton\n id={pillUid}\n data-testid=\"ds-pill-clear-icon\"\n innerRef={innerRef as TypescriptHelpersT.AnyRef<HTMLButtonElement>}\n onClick={onCloseIconClick}\n // onKeyDown={onCloseIconClick} // button v2 now triggers click on key down already\n aria-label=\"Clear input\"\n type=\"right\"\n >\n <CloseXsmall size=\"s\" color={['brand-primary', '700']} />\n </DSPillButton>\n )}\n </StyledInputPillWrapper>\n );\n },\n);\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { StyledInputPillWrapper } from '../styled.js';\nimport { DSPillButton } from '../../parts/DSPillButton/DSPillButton.js';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\n\nexport const InputPill = React.memo<DSPillT.InternalProps>(\n ({\n label,\n size,\n inputPlaceholder,\n inputWidth,\n inputRender,\n onInputChange,\n onInputClear,\n innerRef,\n hasError,\n inputId,\n }) => {\n const ref = useRef<HTMLInputElement | null>(null);\n\n const InputComponent = useMemo(() => inputRender, [inputRender]);\n\n const pillUid = useMemo(() => inputId ?? `ds-pill-${uid()}`, [inputId]);\n\n const onCloseIconClick = useCallback(\n (e: React.KeyboardEvent | React.MouseEvent) => {\n if (('code' in e && ['Enter', 'Space'].includes(e.code)) || !('code' in e)) {\n e.preventDefault();\n onInputClear?.(e);\n ref.current?.focus();\n }\n },\n [onInputClear],\n );\n\n const [inputHasFocus, setInputHasFocus] = useState(false);\n\n return (\n <StyledInputPillWrapper\n pillSize={size}\n className=\"ds-pill-wrapper\"\n data-testid=\"ds-pill-wrapper\"\n cols={label === '' ? ['auto'] : ['auto', '24px']}\n inputWidth={inputWidth}\n value={label ?? ''}\n inputHasFocus={inputHasFocus}\n hasError={hasError}\n >\n <InputComponent\n id={pillUid}\n className=\"ds-pill-focus-point\"\n data-testid=\"ds-pill-input\"\n innerRef={(_ref: HTMLInputElement | null) => {\n ref.current = _ref;\n }}\n value={label}\n onChange={onInputChange}\n placeholder={inputPlaceholder}\n onFocus={() => setInputHasFocus(true)}\n onBlur={() => setInputHasFocus(false)}\n disableTooltip={false}\n />\n {label !== '' && (\n <DSPillButton\n id={pillUid}\n data-testid=\"ds-pill-clear-icon\"\n innerRef={innerRef as TypescriptHelpersT.AnyRef<HTMLButtonElement>}\n onClick={onCloseIconClick}\n // onKeyDown={onCloseIconClick} // button v2 now triggers click on key down already\n aria-label=\"Clear input\"\n type=\"right\"\n >\n <CloseXsmall size=\"s\" color={['brand-primary', '700']} />\n </DSPillButton>\n )}\n </StyledInputPillWrapper>\n );\n },\n);\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;AC0CjB,SAUE,KAVF;AAzCN,OAAOA,UAAS,aAAa,SAAS,QAAQ,gBAAgB;AAE9D,SAAS,WAAW;AACpB,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AACvC,SAAS,oBAAoB;AAGtB,MAAM,YAAYA,OAAM;AAAA,EAC7B,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAM;AACJ,UAAM,MAAM,OAAgC,IAAI;AAEhD,UAAM,iBAAiB,QAAQ,MAAM,aAAa,CAAC,WAAW,CAAC;AAE/D,UAAM,UAAU,QAAQ,MAAM,WAAW,WAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AAEtE,UAAM,mBAAmB;AAAA,MACvB,CAAC,MAA8C;AAC7C,YAAK,UAAU,KAAK,CAAC,SAAS,OAAO,EAAE,SAAS,EAAE,IAAI,KAAM,EAAE,UAAU,IAAI;AAC1E,YAAE,eAAe;AACjB,yBAAe,CAAC;AAChB,cAAI,SAAS,MAAM;AAAA,QACrB;AAAA,MACF;AAAA,MACA,CAAC,YAAY;AAAA,IACf;AAEA,UAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,WAAU;AAAA,QACV,eAAY;AAAA,QACZ,MAAM,UAAU,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,MAAM;AAAA,QAC/C;AAAA,QACA,OAAO,SAAS;AAAA,QAChB;AAAA,QACA;AAAA,QAEA;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,WAAU;AAAA,cACV,eAAY;AAAA,cACZ,UAAU,CAAC,SAAkC;AAC3C,oBAAI,UAAU;AAAA,cAChB;AAAA,cACA,OAAO;AAAA,cACP,UAAU;AAAA,cACV,aAAa;AAAA,cACb,SAAS,MAAM,iBAAiB,IAAI;AAAA,cACpC,QAAQ,MAAM,iBAAiB,KAAK;AAAA,cACpC,gBAAgB;AAAA;AAAA,UAClB;AAAA,UACC,UAAU,MACT;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,eAAY;AAAA,cACZ;AAAA,cACA,SAAS;AAAA,cAET,cAAW;AAAA,cACX,MAAK;AAAA,cAEL,8BAAC,eAAY,MAAK,KAAI,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,UACzD;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,10 +1,13 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
3
4
  import React2 from "react";
4
5
  import { TextComponent } from "../TextComponent.js";
5
6
  import { StyledLabelOnlyPillWrapper } from "../styled.js";
6
- const LabelOnlyPill = React2.memo(
7
- ({ label, size, labelTruncated, iconLeft, IconLeft, ariaLabel, applyAriaDisabled, readOnly, trailingComma }) => /* @__PURE__ */ jsxs(
7
+ const LabelOnlyPill = React2.memo((props) => {
8
+ const { label, size, labelTruncated, iconLeft, IconLeft, ariaLabel, applyAriaDisabled, readOnly, trailingComma } = props;
9
+ const ownerProps = useOwnerProps(props);
10
+ return /* @__PURE__ */ jsxs(
8
11
  StyledLabelOnlyPillWrapper,
9
12
  {
10
13
  pillSize: size,
@@ -19,13 +22,14 @@ const LabelOnlyPill = React2.memo(
19
22
  "aria-label": label,
20
23
  applyAriaDisabled,
21
24
  readOnly,
25
+ ...ownerProps,
22
26
  children: [
23
27
  IconLeft ? /* @__PURE__ */ jsx(IconLeft, { label }) : iconLeft,
24
28
  /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label: `${label}${trailingComma ? "," : ""}` })
25
29
  ]
26
30
  }
27
- )
28
- );
31
+ );
32
+ });
29
33
  export {
30
34
  LabelOnlyPill
31
35
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/LabelOnlyPill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledLabelOnlyPillWrapper } from '../styled.js';\n\nexport const LabelOnlyPill = React.memo<DSPillT.InternalProps>(\n ({ label, size, labelTruncated, iconLeft, IconLeft, ariaLabel, applyAriaDisabled, readOnly, trailingComma }) => (\n <StyledLabelOnlyPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={[(iconLeft || IconLeft) && 'min-content', 'auto'].filter((notFalse) => notFalse) as string[]}\n gutter=\"xxxs\"\n hasIcon={(iconLeft || IconLeft) !== null}\n role=\"group\"\n aria-label={label}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n <TextComponent labelTruncated={labelTruncated} label={`${label}${trailingComma ? ',' : ''}`} />\n </StyledLabelOnlyPillWrapper>\n ),\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACQnB,SAcc,KAdd;AAPJ,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAEpC,MAAM,gBAAgBA,OAAM;AAAA,EACjC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,WAAW,mBAAmB,UAAU,cAAc,MACxG;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACzB,MAAM,EAAE,YAAY,aAAa,eAAe,MAAM,EAAE,OAAO,CAAC,aAAa,QAAQ;AAAA,MACrF,QAAO;AAAA,MACP,UAAU,YAAY,cAAc;AAAA,MACpC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MAEC;AAAA,mBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,QACzC,oBAAC,iBAAc,gBAAgC,OAAO,GAAG,KAAK,GAAG,gBAAgB,MAAM,EAAE,IAAI;AAAA;AAAA;AAAA,EAC/F;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledLabelOnlyPillWrapper } from '../styled.js';\n\nexport const LabelOnlyPill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, labelTruncated, iconLeft, IconLeft, ariaLabel, applyAriaDisabled, readOnly, trailingComma } =\n props;\n const ownerProps = useOwnerProps(props);\n return (\n <StyledLabelOnlyPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={[(iconLeft || IconLeft) && 'min-content', 'auto'].filter((notFalse) => notFalse) as string[]}\n gutter=\"xxxs\"\n hasIcon={(iconLeft || IconLeft) !== null}\n role=\"group\"\n aria-label={label}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n {...ownerProps}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n <TextComponent labelTruncated={labelTruncated} label={`${label}${trailingComma ? ',' : ''}`} />\n </StyledLabelOnlyPillWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACYnB,SAec,KAfd;AAXJ,SAAS,qBAAqB;AAC9B,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAEpC,MAAM,gBAAgBA,OAAM,KAA4B,CAAC,UAAU;AACxE,QAAM,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,WAAW,mBAAmB,UAAU,cAAc,IAC7G;AACF,QAAM,aAAa,cAAc,KAAK;AACtC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACzB,MAAM,EAAE,YAAY,aAAa,eAAe,MAAM,EAAE,OAAO,CAAC,aAAa,QAAQ;AAAA,MACrF,QAAO;AAAA,MACP,UAAU,YAAY,cAAc;AAAA,MACpC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,mBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,QACzC,oBAAC,iBAAc,gBAAgC,OAAO,GAAG,KAAK,GAAG,gBAAgB,MAAM,EAAE,IAAI;AAAA;AAAA;AAAA,EAC/F;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,10 +1,13 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
3
4
  import React2 from "react";
4
5
  import { TextComponent } from "../TextComponent.js";
5
6
  import { StyledLabelPillWrapper } from "../styled.js";
6
- const LabelPill = React2.memo(
7
- ({ label, size, labelTruncated, iconLeft, IconLeft, ariaLabel }) => /* @__PURE__ */ jsxs(
7
+ const LabelPill = React2.memo((props) => {
8
+ const { label, size, labelTruncated, iconLeft, IconLeft, ariaLabel } = props;
9
+ const ownerProps = useOwnerProps(props);
10
+ return /* @__PURE__ */ jsxs(
8
11
  StyledLabelPillWrapper,
9
12
  {
10
13
  pillSize: size,
@@ -17,13 +20,14 @@ const LabelPill = React2.memo(
17
20
  hasIcon: (iconLeft || IconLeft) !== null,
18
21
  role: "group",
19
22
  "aria-label": label,
23
+ ...ownerProps,
20
24
  children: [
21
25
  IconLeft ? /* @__PURE__ */ jsx(IconLeft, { label }) : iconLeft,
22
26
  /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label })
23
27
  ]
24
28
  }
25
- )
26
- );
29
+ );
30
+ });
27
31
  export {
28
32
  LabelPill
29
33
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/LabelPill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledLabelPillWrapper } from '../styled.js';\n\nexport const LabelPill = React.memo<DSPillT.InternalProps>(\n ({ label, size, labelTruncated, iconLeft, IconLeft, ariaLabel }) => (\n <StyledLabelPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={[(iconLeft || IconLeft) && 'min-content', 'auto'].filter((notFalse) => notFalse) as string[]}\n gutter=\"xxxs\"\n hasIcon={(iconLeft || IconLeft) !== null}\n role=\"group\"\n aria-label={label}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n <TextComponent labelTruncated={labelTruncated} label={label} />\n </StyledLabelPillWrapper>\n ),\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACQnB,SAYc,KAZd;AAPJ,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAEhC,MAAM,YAAYA,OAAM;AAAA,EAC7B,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,UAAU,MAC5D;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACzB,MAAM,EAAE,YAAY,aAAa,eAAe,MAAM,EAAE,OAAO,CAAC,aAAa,QAAQ;AAAA,MACrF,QAAO;AAAA,MACP,UAAU,YAAY,cAAc;AAAA,MACpC,MAAK;AAAA,MACL,cAAY;AAAA,MAEX;AAAA,mBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,QACzC,oBAAC,iBAAc,gBAAgC,OAAc;AAAA;AAAA;AAAA,EAC/D;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledLabelPillWrapper } from '../styled.js';\n\nexport const LabelPill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, labelTruncated, iconLeft, IconLeft, ariaLabel } = props;\n const ownerProps = useOwnerProps(props);\n return (\n <StyledLabelPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={[(iconLeft || IconLeft) && 'min-content', 'auto'].filter((notFalse) => notFalse) as string[]}\n gutter=\"xxxs\"\n hasIcon={(iconLeft || IconLeft) !== null}\n role=\"group\"\n aria-label={label}\n {...ownerProps}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n <TextComponent labelTruncated={labelTruncated} label={label} />\n </StyledLabelPillWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACWnB,SAac,KAbd;AAVJ,SAAS,qBAAqB;AAC9B,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAEhC,MAAM,YAAYA,OAAM,KAA4B,CAAC,UAAU;AACpE,QAAM,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,UAAU,IAAI;AACvE,QAAM,aAAa,cAAc,KAAK;AACtC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACzB,MAAM,EAAE,YAAY,aAAa,eAAe,MAAM,EAAE,OAAO,CAAC,aAAa,QAAQ;AAAA,MACrF,QAAO;AAAA,MACP,UAAU,YAAY,cAAc;AAAA,MACpC,MAAK;AAAA,MACL,cAAY;AAAA,MACX,GAAG;AAAA,MAEH;AAAA,mBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,QACzC,oBAAC,iBAAc,gBAAgC,OAAc;AAAA;AAAA;AAAA,EAC/D;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,70 +1,73 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { ChevronSmallDown } from "@elliemae/ds-icons";
4
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
4
5
  import React2, { useMemo } from "react";
5
6
  import { uid } from "uid";
6
- import { DSPillButtonDefaultProps } from "../../react-desc-prop-types.js";
7
+ import { defaultProps as DSPillButtonDefaultProps } from "../../parts/DSPillButton/react-desc-prop-types.js";
7
8
  import { TextComponent } from "../TextComponent.js";
8
9
  import { StyledDropdownPillWrapper, StyledPillMenuButton } from "../styled.js";
9
10
  const rowsForDsButtonV3 = (size) => size === "m" ? { small: ["1.5rem"], medium: ["1.846rem"] } : { small: ["1.125rem"], medium: ["1.3846rem"] };
10
11
  const colsForDsButtonV3 = (size) => size === "m" ? { small: ["auto", "minmax(1.5rem, auto)"], medium: ["auto", "minmax(1.846rem, auto)"] } : { small: ["auto", "minmax(1.125rem, auto)"], medium: ["auto", "minmax(1.3846rem, auto)"] };
11
- const MenuButtonPill = React2.memo(
12
- ({ label, size, labelTruncated, innerRef, ariaLabel, menuButtonProps }) => {
13
- const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
14
- if (!menuButtonProps) {
15
- console.log("menuButtonProps", menuButtonProps);
16
- throw new Error("menuButtonProps was not provided");
17
- }
18
- if (Object.keys(menuButtonProps).length === 0) {
19
- console.log("menuButtonProps", menuButtonProps);
20
- throw new Error("menuButtonProps is empty");
21
- }
22
- const { width = DSPillButtonDefaultProps.width, height = DSPillButtonDefaultProps.height } = menuButtonProps;
23
- const memoizedRows = useMemo(() => rowsForDsButtonV3(size), [size]);
24
- const memoizedCols = useMemo(() => colsForDsButtonV3(size), [size]);
25
- const dsMenubuttonRootProps = useMemo(
26
- () => ({
27
- width: `${width}`,
28
- height: `${height}`
29
- }),
30
- [height, width]
31
- );
32
- const finalAriaLabel = ariaLabel || label;
33
- return /* @__PURE__ */ jsxs(
34
- StyledDropdownPillWrapper,
35
- {
36
- pillSize: size,
37
- id: pillUid,
38
- className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
39
- "data-testid": "ds-pill-wrapper",
40
- cols: memoizedCols,
41
- rows: memoizedRows,
42
- gutter: "2px",
43
- alignItems: "center",
44
- justifyItems: "center",
45
- children: [
46
- /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }),
47
- /* @__PURE__ */ jsx(
48
- StyledPillMenuButton,
49
- {
50
- innerRef,
51
- "aria-label": finalAriaLabel,
52
- dsMenubuttonRoot: dsMenubuttonRootProps,
53
- ...menuButtonProps,
54
- "data-testid": "ds-pill-menu-button-chevron",
55
- buttonType: "raw",
56
- className: "ds-pill-button-right ds-pill-focus-point",
57
- type: "button",
58
- width: `${width}`,
59
- height: `${height}`,
60
- children: /* @__PURE__ */ jsx(ChevronSmallDown, { color: ["brand-primary", "800"] })
61
- }
62
- )
63
- ]
64
- }
65
- );
12
+ const MenuButtonPill = React2.memo((props) => {
13
+ const { label, size, labelTruncated, innerRef, ariaLabel, menuButtonProps } = props;
14
+ const ownerProps = useOwnerProps(props);
15
+ const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
16
+ if (!menuButtonProps) {
17
+ console.log("menuButtonProps", menuButtonProps);
18
+ throw new Error("menuButtonProps was not provided");
66
19
  }
67
- );
20
+ if (Object.keys(menuButtonProps).length === 0) {
21
+ console.log("menuButtonProps", menuButtonProps);
22
+ throw new Error("menuButtonProps is empty");
23
+ }
24
+ const { width = DSPillButtonDefaultProps.width, height = DSPillButtonDefaultProps.height } = menuButtonProps;
25
+ const memoizedRows = useMemo(() => rowsForDsButtonV3(size), [size]);
26
+ const memoizedCols = useMemo(() => colsForDsButtonV3(size), [size]);
27
+ const dsMenubuttonRootProps = useMemo(
28
+ () => ({
29
+ width: `${width}`,
30
+ height: `${height}`
31
+ }),
32
+ [height, width]
33
+ );
34
+ const finalAriaLabel = ariaLabel || label;
35
+ return /* @__PURE__ */ jsxs(
36
+ StyledDropdownPillWrapper,
37
+ {
38
+ pillSize: size,
39
+ id: pillUid,
40
+ className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
41
+ "data-testid": "ds-pill-wrapper",
42
+ cols: memoizedCols,
43
+ rows: memoizedRows,
44
+ gutter: "2px",
45
+ alignItems: "center",
46
+ justifyItems: "center",
47
+ ...ownerProps,
48
+ children: [
49
+ /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }),
50
+ /* @__PURE__ */ jsx(
51
+ StyledPillMenuButton,
52
+ {
53
+ innerRef,
54
+ "aria-label": finalAriaLabel,
55
+ dsMenubuttonRoot: dsMenubuttonRootProps,
56
+ ...menuButtonProps,
57
+ "data-testid": "ds-pill-menu-button-chevron",
58
+ buttonType: "raw",
59
+ className: "ds-pill-button-right ds-pill-focus-point",
60
+ type: "button",
61
+ width: `${width}`,
62
+ height: `${height}`,
63
+ ...ownerProps,
64
+ children: /* @__PURE__ */ jsx(ChevronSmallDown, { color: ["brand-primary", "800"] })
65
+ }
66
+ )
67
+ ]
68
+ }
69
+ );
70
+ });
68
71
  export {
69
72
  MenuButtonPill
70
73
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/MenuButtonPill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { type DSMenuButtonT } from '@elliemae/ds-menu-button';\nimport React, { useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { DSPillButtonDefaultProps } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledDropdownPillWrapper, StyledPillMenuButton } from '../styled.js';\n\n/* ************************************************************************************************************\n* Regarding magic numbers, default width and height and why this is different from \"StyledPillButton\" implementation\n* 1 - StyledPillButton is based on DSButtonV2\n* StyledPillMenuButton is based on DSMenuButton (which is DSButtonV3)\n* DSButtonV2 and DSButtonV3 have different stylings.\n* 2 - as per \"commonPillWrapperCss\" in \"styled.js\" (relevant code at comment writing time is below)\nconst commonPillWrapperCss = css<{ pillSize: 'm' | 's'; disabled?: boolean; applyAriaDisabled?: boolean }>`\n height: ${(props) => (props?.pillSize === 'm' ? '1.846rem' : '1.3846rem')};\n @media (max-width: ${(props) => props.theme.breakpoints?.small}) {\n height: ${(props) => (props?.pillSize === 'm' ? '1.5rem' : '1.125rem')};\n }\n [...]\n`\n* The Wrapper is setting an height to the whole pill based on the prop \"pillSize\" (which corresponds to \"size\" in the component)\n* the \"magic\" values are actually 24px RT for \"m\" and 18px RT for \"s\"\n***************************************************************************************************************\n* Given the above, this iteration of StyledDropdownPillWrapper needs to have different styles/cols/rows to accomodate DSButtonV3\n* and I'm basing the styles on the same assumptions for width/height magic values.\n************************************************************************************************************* */\nconst rowsForDsButtonV3 = (size: 'm' | 's') =>\n size === 'm' ? { small: ['1.5rem'], medium: ['1.846rem'] } : { small: ['1.125rem'], medium: ['1.3846rem'] };\nconst colsForDsButtonV3 = (size: 'm' | 's') =>\n size === 'm'\n ? { small: ['auto', 'minmax(1.5rem, auto)'], medium: ['auto', 'minmax(1.846rem, auto)'] }\n : { small: ['auto', 'minmax(1.125rem, auto)'], medium: ['auto', 'minmax(1.3846rem, auto)'] };\n\nexport const MenuButtonPill = React.memo<DSPillT.InternalProps>(\n ({ label, size, labelTruncated, innerRef, ariaLabel, menuButtonProps }) => {\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n if (!menuButtonProps) {\n // eslint-disable-next-line no-console\n console.log('menuButtonProps', menuButtonProps);\n throw new Error('menuButtonProps was not provided');\n }\n if (Object.keys(menuButtonProps).length === 0) {\n // eslint-disable-next-line no-console\n console.log('menuButtonProps', menuButtonProps);\n throw new Error('menuButtonProps is empty');\n }\n const { width = DSPillButtonDefaultProps.width, height = DSPillButtonDefaultProps.height } = menuButtonProps;\n\n const memoizedRows = useMemo(() => rowsForDsButtonV3(size), [size]);\n const memoizedCols = useMemo(() => colsForDsButtonV3(size), [size]);\n const dsMenubuttonRootProps = useMemo(\n () => ({\n width: `${width}`,\n height: `${height}`,\n }),\n [height, width],\n );\n\n const finalAriaLabel = ariaLabel || label;\n\n return (\n <StyledDropdownPillWrapper\n pillSize={size}\n id={pillUid}\n className=\"ds-pill-wrapper ds-pill-wrapper-dropdown\"\n data-testid=\"ds-pill-wrapper\"\n cols={memoizedCols}\n rows={memoizedRows}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n >\n <TextComponent labelTruncated={labelTruncated} label={label} />\n <StyledPillMenuButton\n innerRef={innerRef as DSMenuButtonT.Props['innerRef']}\n aria-label={finalAriaLabel}\n dsMenubuttonRoot={dsMenubuttonRootProps}\n {...menuButtonProps}\n // the styles that makes the circle visual behave correctly in \"circle\"/\"square\"/\"pill group\"\n // are based on the button having the following props:\n data-testid=\"ds-pill-menu-button-chevron\"\n buttonType=\"raw\"\n className=\"ds-pill-button-right ds-pill-focus-point\"\n type=\"button\"\n width={`${width}`}\n height={`${height}`}\n // end of props for correcr circle/square/pill group visual behavior\n >\n <ChevronSmallDown color={['brand-primary', '800']} />\n </StyledPillMenuButton>\n </StyledDropdownPillWrapper>\n );\n },\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACgEjB,SAWE,KAXF;AA/DN,SAAS,wBAAwB;AAEjC,OAAOA,UAAS,eAAe;AAC/B,SAAS,WAAW;AAEpB,SAAS,gCAAgC;AACzC,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B,4BAA4B;AAqBhE,MAAM,oBAAoB,CAAC,SACzB,SAAS,MAAM,EAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE;AAC5G,MAAM,oBAAoB,CAAC,SACzB,SAAS,MACL,EAAE,OAAO,CAAC,QAAQ,sBAAsB,GAAG,QAAQ,CAAC,QAAQ,wBAAwB,EAAE,IACtF,EAAE,OAAO,CAAC,QAAQ,wBAAwB,GAAG,QAAQ,CAAC,QAAQ,yBAAyB,EAAE;AAExF,MAAM,iBAAiBA,OAAM;AAAA,EAClC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,gBAAgB,MAAM;AACzE,UAAM,UAAU,QAAQ,MAAM,WAAW,IAAI,CAAC,IAAI,CAAC,CAAC;AACpD,QAAI,CAAC,iBAAiB;AAEpB,cAAQ,IAAI,mBAAmB,eAAe;AAC9C,YAAM,IAAI,MAAM,kCAAkC;AAAA,IACpD;AACA,QAAI,OAAO,KAAK,eAAe,EAAE,WAAW,GAAG;AAE7C,cAAQ,IAAI,mBAAmB,eAAe;AAC9C,YAAM,IAAI,MAAM,0BAA0B;AAAA,IAC5C;AACA,UAAM,EAAE,QAAQ,yBAAyB,OAAO,SAAS,yBAAyB,OAAO,IAAI;AAE7F,UAAM,eAAe,QAAQ,MAAM,kBAAkB,IAAI,GAAG,CAAC,IAAI,CAAC;AAClE,UAAM,eAAe,QAAQ,MAAM,kBAAkB,IAAI,GAAG,CAAC,IAAI,CAAC;AAClE,UAAM,wBAAwB;AAAA,MAC5B,OAAO;AAAA,QACL,OAAO,GAAG,KAAK;AAAA,QACf,QAAQ,GAAG,MAAM;AAAA,MACnB;AAAA,MACA,CAAC,QAAQ,KAAK;AAAA,IAChB;AAEA,UAAM,iBAAiB,aAAa;AAEpC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,IAAI;AAAA,QACJ,WAAU;AAAA,QACV,eAAY;AAAA,QACZ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,QAAO;AAAA,QACP,YAAW;AAAA,QACX,cAAa;AAAA,QAEb;AAAA,8BAAC,iBAAc,gBAAgC,OAAc;AAAA,UAC7D;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,cAAY;AAAA,cACZ,kBAAkB;AAAA,cACjB,GAAG;AAAA,cAGJ,eAAY;AAAA,cACZ,YAAW;AAAA,cACX,WAAU;AAAA,cACV,MAAK;AAAA,cACL,OAAO,GAAG,KAAK;AAAA,cACf,QAAQ,GAAG,MAAM;AAAA,cAGjB,8BAAC,oBAAiB,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,UACrD;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { type DSMenuButtonT } from '@elliemae/ds-menu-button';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { defaultProps as DSPillButtonDefaultProps } from '../../parts/DSPillButton/react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledDropdownPillWrapper, StyledPillMenuButton } from '../styled.js';\n\n/* ************************************************************************************************************\n* Regarding magic numbers, default width and height and why this is different from \"StyledPillButton\" implementation\n* 1 - StyledPillButton is based on DSButtonV2\n* StyledPillMenuButton is based on DSMenuButton (which is DSButtonV3)\n* DSButtonV2 and DSButtonV3 have different stylings.\n* 2 - as per \"commonPillWrapperCss\" in \"styled.js\" (relevant code at comment writing time is below)\nconst commonPillWrapperCss = css<{ pillSize: 'm' | 's'; disabled?: boolean; applyAriaDisabled?: boolean }>`\n height: ${(props) => (props?.pillSize === 'm' ? '1.846rem' : '1.3846rem')};\n @media (max-width: ${(props) => props.theme.breakpoints?.small}) {\n height: ${(props) => (props?.pillSize === 'm' ? '1.5rem' : '1.125rem')};\n }\n [...]\n`\n* The Wrapper is setting an height to the whole pill based on the prop \"pillSize\" (which corresponds to \"size\" in the component)\n* the \"magic\" values are actually 24px RT for \"m\" and 18px RT for \"s\"\n***************************************************************************************************************\n* Given the above, this iteration of StyledDropdownPillWrapper needs to have different styles/cols/rows to accomodate DSButtonV3\n* and I'm basing the styles on the same assumptions for width/height magic values.\n************************************************************************************************************* */\nconst rowsForDsButtonV3 = (size: 'm' | 's') =>\n size === 'm' ? { small: ['1.5rem'], medium: ['1.846rem'] } : { small: ['1.125rem'], medium: ['1.3846rem'] };\nconst colsForDsButtonV3 = (size: 'm' | 's') =>\n size === 'm'\n ? { small: ['auto', 'minmax(1.5rem, auto)'], medium: ['auto', 'minmax(1.846rem, auto)'] }\n : { small: ['auto', 'minmax(1.125rem, auto)'], medium: ['auto', 'minmax(1.3846rem, auto)'] };\n\nexport const MenuButtonPill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, labelTruncated, innerRef, ariaLabel, menuButtonProps } = props;\n const ownerProps = useOwnerProps(props);\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n if (!menuButtonProps) {\n // eslint-disable-next-line no-console\n console.log('menuButtonProps', menuButtonProps);\n throw new Error('menuButtonProps was not provided');\n }\n if (Object.keys(menuButtonProps).length === 0) {\n // eslint-disable-next-line no-console\n console.log('menuButtonProps', menuButtonProps);\n throw new Error('menuButtonProps is empty');\n }\n const { width = DSPillButtonDefaultProps.width, height = DSPillButtonDefaultProps.height } = menuButtonProps;\n\n const memoizedRows = useMemo(() => rowsForDsButtonV3(size), [size]);\n const memoizedCols = useMemo(() => colsForDsButtonV3(size), [size]);\n const dsMenubuttonRootProps = useMemo(\n () => ({\n width: `${width}`,\n height: `${height}`,\n }),\n [height, width],\n );\n\n const finalAriaLabel = ariaLabel || label;\n\n return (\n <StyledDropdownPillWrapper\n pillSize={size}\n id={pillUid}\n className=\"ds-pill-wrapper ds-pill-wrapper-dropdown\"\n data-testid=\"ds-pill-wrapper\"\n cols={memoizedCols}\n rows={memoizedRows}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n {...ownerProps}\n >\n <TextComponent labelTruncated={labelTruncated} label={label} />\n <StyledPillMenuButton\n innerRef={innerRef as DSMenuButtonT.Props['innerRef']}\n aria-label={finalAriaLabel}\n dsMenubuttonRoot={dsMenubuttonRootProps}\n {...menuButtonProps}\n // the styles that makes the circle visual behave correctly in \"circle\"/\"square\"/\"pill group\"\n // are based on the button having the following props:\n data-testid=\"ds-pill-menu-button-chevron\"\n buttonType=\"raw\"\n className=\"ds-pill-button-right ds-pill-focus-point\"\n type=\"button\"\n width={`${width}`}\n height={`${height}`}\n // end of props for correcr circle/square/pill group visual behavior\n {...ownerProps}\n >\n <ChevronSmallDown color={['brand-primary', '800']} />\n </StyledPillMenuButton>\n </StyledDropdownPillWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACkEnB,SAYE,KAZF;AAjEJ,SAAS,wBAAwB;AAEjC,SAAS,qBAAqB;AAC9B,OAAOA,UAAS,eAAe;AAC/B,SAAS,WAAW;AAEpB,SAAS,gBAAgB,gCAAgC;AACzD,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B,4BAA4B;AAqBhE,MAAM,oBAAoB,CAAC,SACzB,SAAS,MAAM,EAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE;AAC5G,MAAM,oBAAoB,CAAC,SACzB,SAAS,MACL,EAAE,OAAO,CAAC,QAAQ,sBAAsB,GAAG,QAAQ,CAAC,QAAQ,wBAAwB,EAAE,IACtF,EAAE,OAAO,CAAC,QAAQ,wBAAwB,GAAG,QAAQ,CAAC,QAAQ,yBAAyB,EAAE;AAExF,MAAM,iBAAiBA,OAAM,KAA4B,CAAC,UAAU;AACzE,QAAM,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,gBAAgB,IAAI;AAC9E,QAAM,aAAa,cAAc,KAAK;AACtC,QAAM,UAAU,QAAQ,MAAM,WAAW,IAAI,CAAC,IAAI,CAAC,CAAC;AACpD,MAAI,CAAC,iBAAiB;AAEpB,YAAQ,IAAI,mBAAmB,eAAe;AAC9C,UAAM,IAAI,MAAM,kCAAkC;AAAA,EACpD;AACA,MAAI,OAAO,KAAK,eAAe,EAAE,WAAW,GAAG;AAE7C,YAAQ,IAAI,mBAAmB,eAAe;AAC9C,UAAM,IAAI,MAAM,0BAA0B;AAAA,EAC5C;AACA,QAAM,EAAE,QAAQ,yBAAyB,OAAO,SAAS,yBAAyB,OAAO,IAAI;AAE7F,QAAM,eAAe,QAAQ,MAAM,kBAAkB,IAAI,GAAG,CAAC,IAAI,CAAC;AAClE,QAAM,eAAe,QAAQ,MAAM,kBAAkB,IAAI,GAAG,CAAC,IAAI,CAAC;AAClE,QAAM,wBAAwB;AAAA,IAC5B,OAAO;AAAA,MACL,OAAO,GAAG,KAAK;AAAA,MACf,QAAQ,GAAG,MAAM;AAAA,IACnB;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AAEA,QAAM,iBAAiB,aAAa;AAEpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAO;AAAA,MACP,YAAW;AAAA,MACX,cAAa;AAAA,MACZ,GAAG;AAAA,MAEJ;AAAA,4BAAC,iBAAc,gBAAgC,OAAc;AAAA,QAC7D;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,cAAY;AAAA,YACZ,kBAAkB;AAAA,YACjB,GAAG;AAAA,YAGJ,eAAY;AAAA,YACZ,YAAW;AAAA,YACX,WAAU;AAAA,YACV,MAAK;AAAA,YACL,OAAO,GAAG,KAAK;AAAA,YACf,QAAQ,GAAG,MAAM;AAAA,YAEhB,GAAG;AAAA,YAEJ,8BAAC,oBAAiB,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,QACrD;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,37 +1,39 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
3
4
  import React2 from "react";
4
5
  import { TextComponent } from "../TextComponent.js";
5
6
  import { StyledReadonlyPillWrapper } from "../styled.js";
6
- const ReadOnlyPill = React2.memo(
7
- ({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel, IconLeft, IconRight }) => {
8
- const hasIconLeft = iconLeft !== null || iconRight !== null && label === "";
9
- const hasIconRight = iconRight !== null || iconLeft !== null && label === "";
10
- const hasIconLeftNew = IconLeft !== null || IconRight !== null && label === "";
11
- const hasIconRightNew = IconRight !== null || IconLeft !== null && label === "";
12
- return /* @__PURE__ */ jsxs(
13
- StyledReadonlyPillWrapper,
14
- {
15
- pillSize: size,
16
- alignItems: "center",
17
- className: "ds-pill-wrapper ds-pill-wrapper-readonly",
18
- "data-testid": "ds-pill-wrapper",
19
- "data-label": ariaLabel || label,
20
- cols: [(iconLeft || IconLeft) && "min-content", label && "auto", (iconRight || IconRight) && "min-content"].filter(
21
- (notFalse) => notFalse
22
- ),
23
- gutter: "xxxs",
24
- hasIconRight: hasIconRight || hasIconRightNew,
25
- hasIconLeft: hasIconLeft || hasIconLeftNew,
26
- children: [
27
- IconLeft ? /* @__PURE__ */ jsx(IconLeft, { label }) : iconLeft,
28
- label ? /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }) : null,
29
- IconRight ? /* @__PURE__ */ jsx(IconRight, { label }) : iconRight
30
- ]
31
- }
32
- );
33
- }
34
- );
7
+ const ReadOnlyPill = React2.memo((props) => {
8
+ const { label, size, labelTruncated, iconLeft, iconRight, ariaLabel, IconLeft, IconRight } = props;
9
+ const ownerProps = useOwnerProps(props);
10
+ const hasIconLeft = iconLeft !== null || iconRight !== null && label === "";
11
+ const hasIconRight = iconRight !== null || iconLeft !== null && label === "";
12
+ const hasIconLeftNew = IconLeft !== null || IconRight !== null && label === "";
13
+ const hasIconRightNew = IconRight !== null || IconLeft !== null && label === "";
14
+ return /* @__PURE__ */ jsxs(
15
+ StyledReadonlyPillWrapper,
16
+ {
17
+ pillSize: size,
18
+ alignItems: "center",
19
+ className: "ds-pill-wrapper ds-pill-wrapper-readonly",
20
+ "data-testid": "ds-pill-wrapper",
21
+ "data-label": ariaLabel || label,
22
+ cols: [(iconLeft || IconLeft) && "min-content", label && "auto", (iconRight || IconRight) && "min-content"].filter(
23
+ (notFalse) => notFalse
24
+ ),
25
+ gutter: "xxxs",
26
+ hasIconRight: hasIconRight || hasIconRightNew,
27
+ hasIconLeft: hasIconLeft || hasIconLeftNew,
28
+ ...ownerProps,
29
+ children: [
30
+ IconLeft ? /* @__PURE__ */ jsx(IconLeft, { label }) : iconLeft,
31
+ label ? /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }) : null,
32
+ IconRight ? /* @__PURE__ */ jsx(IconRight, { label }) : iconRight
33
+ ]
34
+ }
35
+ );
36
+ });
35
37
  export {
36
38
  ReadOnlyPill
37
39
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/ReadOnlyPill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledReadonlyPillWrapper } from '../styled.js';\n\nexport const ReadOnlyPill = React.memo<DSPillT.InternalProps>(\n ({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel, IconLeft, IconRight }) => {\n const hasIconLeft = iconLeft !== null || (iconRight !== null && label === '');\n const hasIconRight = iconRight !== null || (iconLeft !== null && label === '');\n\n const hasIconLeftNew = IconLeft !== null || (IconRight !== null && label === '');\n const hasIconRightNew = IconRight !== null || (IconLeft !== null && label === '');\n\n return (\n <StyledReadonlyPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-readonly\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={\n [(iconLeft || IconLeft) && 'min-content', label && 'auto', (iconRight || IconRight) && 'min-content'].filter(\n (notFalse) => notFalse,\n ) as string[]\n }\n gutter=\"xxxs\"\n hasIconRight={hasIconRight || hasIconRightNew}\n hasIconLeft={hasIconLeft || hasIconLeftNew}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n {label ? <TextComponent labelTruncated={labelTruncated} label={label} /> : null}\n {IconRight ? <IconRight label={label} /> : iconRight}\n </StyledReadonlyPillWrapper>\n );\n },\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACejB,SAec,KAfd;AAdN,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAEnC,MAAM,eAAeA,OAAM;AAAA,EAChC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,WAAW,UAAU,UAAU,MAAM;AACxF,UAAM,cAAc,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC1E,UAAM,eAAe,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE3E,UAAM,iBAAiB,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC7E,UAAM,kBAAkB,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE9E,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,YAAW;AAAA,QACX,WAAU;AAAA,QACV,eAAY;AAAA,QACZ,cAAY,aAAa;AAAA,QACzB,MACE,EAAE,YAAY,aAAa,eAAe,SAAS,SAAS,aAAa,cAAc,aAAa,EAAE;AAAA,UACpG,CAAC,aAAa;AAAA,QAChB;AAAA,QAEF,QAAO;AAAA,QACP,cAAc,gBAAgB;AAAA,QAC9B,aAAa,eAAe;AAAA,QAE3B;AAAA,qBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,UACxC,QAAQ,oBAAC,iBAAc,gBAAgC,OAAc,IAAK;AAAA,UAC1E,YAAY,oBAAC,aAAU,OAAc,IAAK;AAAA;AAAA;AAAA,IAC7C;AAAA,EAEJ;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledReadonlyPillWrapper } from '../styled.js';\n\nexport const ReadOnlyPill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, labelTruncated, iconLeft, iconRight, ariaLabel, IconLeft, IconRight } = props;\n const ownerProps = useOwnerProps(props);\n const hasIconLeft = iconLeft !== null || (iconRight !== null && label === '');\n const hasIconRight = iconRight !== null || (iconLeft !== null && label === '');\n\n const hasIconLeftNew = IconLeft !== null || (IconRight !== null && label === '');\n const hasIconRightNew = IconRight !== null || (IconLeft !== null && label === '');\n\n return (\n <StyledReadonlyPillWrapper\n pillSize={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-readonly\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n cols={\n [(iconLeft || IconLeft) && 'min-content', label && 'auto', (iconRight || IconRight) && 'min-content'].filter(\n (notFalse) => notFalse,\n ) as string[]\n }\n gutter=\"xxxs\"\n hasIconRight={hasIconRight || hasIconRightNew}\n hasIconLeft={hasIconLeft || hasIconLeftNew}\n {...ownerProps}\n >\n {IconLeft ? <IconLeft label={label} /> : iconLeft}\n {label ? <TextComponent labelTruncated={labelTruncated} label={label} /> : null}\n {IconRight ? <IconRight label={label} /> : iconRight}\n </StyledReadonlyPillWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiBnB,SAgBc,KAhBd;AAhBJ,SAAS,qBAAqB;AAC9B,OAAOA,YAAW;AAElB,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAEnC,MAAM,eAAeA,OAAM,KAA4B,CAAC,UAAU;AACvE,QAAM,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,WAAW,UAAU,UAAU,IAAI;AAC7F,QAAM,aAAa,cAAc,KAAK;AACtC,QAAM,cAAc,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC1E,QAAM,eAAe,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE3E,QAAM,iBAAiB,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC7E,QAAM,kBAAkB,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE9E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAW;AAAA,MACX,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACzB,MACE,EAAE,YAAY,aAAa,eAAe,SAAS,SAAS,aAAa,cAAc,aAAa,EAAE;AAAA,QACpG,CAAC,aAAa;AAAA,MAChB;AAAA,MAEF,QAAO;AAAA,MACP,cAAc,gBAAgB;AAAA,MAC9B,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA,MAEH;AAAA,mBAAW,oBAAC,YAAS,OAAc,IAAK;AAAA,QACxC,QAAQ,oBAAC,iBAAc,gBAAgC,OAAc,IAAK;AAAA,QAC1E,YAAY,oBAAC,aAAU,OAAc,IAAK;AAAA;AAAA;AAAA,EAC7C;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }
@@ -3,86 +3,88 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CloseXsmall } from "@elliemae/ds-icons";
4
4
  import React2, { useCallback, useContext, useMemo } from "react";
5
5
  import { uid } from "uid";
6
- import { DSPillButton } from "../PillButton.js";
7
- import { DSPillGroupV2Context } from "../PillGroup.js";
6
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
7
+ import { DSPillButton } from "../../parts/DSPillButton/DSPillButton.js";
8
+ import { DSPillGroupV2Context } from "../../parts/DSPillGroup/index.js";
8
9
  import { TextComponent } from "../TextComponent.js";
9
10
  import { StyledRemovablePillWrapper } from "../styled.js";
10
- const RemovablePill = React2.memo(
11
- ({ label, size, disabled, labelTruncated, onRemove, innerRef, ariaLabel, tabIndex, applyAriaDisabled }) => {
12
- const { onKeyboardRemove, onKeyboardNavigation } = useContext(DSPillGroupV2Context);
13
- const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
14
- const onKeyDown = useCallback(
15
- (e) => {
16
- if (["Enter", "Space"].includes(e.code)) {
17
- if (applyAriaDisabled) return;
18
- e.preventDefault();
19
- if (onKeyboardRemove) onKeyboardRemove(pillUid);
20
- }
21
- if (e.code === "ArrowLeft") {
22
- e.preventDefault();
23
- if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);
24
- }
25
- if (e.code === "ArrowRight") {
26
- e.preventDefault();
27
- if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);
28
- }
29
- },
30
- [onKeyboardRemove, onKeyboardNavigation, pillUid, applyAriaDisabled]
31
- );
32
- const handleOnRemove = useCallback(
33
- (e) => {
11
+ const RemovablePill = React2.memo((props) => {
12
+ const { label, size, disabled, labelTruncated, onRemove, innerRef, ariaLabel, tabIndex, applyAriaDisabled } = props;
13
+ const { onKeyboardRemove, onKeyboardNavigation } = useContext(DSPillGroupV2Context);
14
+ const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
15
+ const ownerProps = useOwnerProps(props);
16
+ const onKeyDown = useCallback(
17
+ (e) => {
18
+ if (["Enter", "Space"].includes(e.code)) {
34
19
  if (applyAriaDisabled) return;
35
- if (onRemove) onRemove(e);
36
- },
37
- [onRemove, applyAriaDisabled]
38
- );
39
- const colsConfig = useMemo(
40
- () => disabled || applyAriaDisabled ? ["auto"] : ["auto", "minmax(24px, auto)"],
41
- [disabled, applyAriaDisabled]
42
- );
43
- return /* @__PURE__ */ jsxs(
44
- StyledRemovablePillWrapper,
45
- {
46
- pillSize: size,
47
- cols: colsConfig,
48
- disabled,
49
- applyAriaDisabled,
50
- gutter: "2px",
51
- alignItems: "center",
52
- justifyItems: "center",
53
- className: "ds-pill-wrapper ds-pill-wrapper-removable",
54
- "data-testid": "ds-pill-wrapper",
55
- "data-label": ariaLabel || label,
56
- children: [
57
- /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }),
58
- !disabled && !applyAriaDisabled ? /* @__PURE__ */ jsx(
59
- DSPillButton,
60
- {
61
- className: "ds-pill-focus-point",
62
- id: pillUid,
63
- "data-testid": "ds-pill-close-icon",
64
- innerRef,
65
- onClick: handleOnRemove,
66
- onKeyDown,
67
- "aria-label": `Remove ${label}`,
68
- type: "right",
69
- tabIndex,
70
- applyAriaDisabled,
71
- children: /* @__PURE__ */ jsx(
72
- CloseXsmall,
73
- {
74
- width: size === "s" ? 18 : 22.65,
75
- height: size === "s" ? 18 : 22.65,
76
- color: ["brand-primary", "700"]
77
- }
78
- )
79
- }
80
- ) : null
81
- ]
20
+ e.preventDefault();
21
+ if (onKeyboardRemove) onKeyboardRemove(pillUid);
82
22
  }
83
- );
84
- }
85
- );
23
+ if (e.code === "ArrowLeft") {
24
+ e.preventDefault();
25
+ if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);
26
+ }
27
+ if (e.code === "ArrowRight") {
28
+ e.preventDefault();
29
+ if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);
30
+ }
31
+ },
32
+ [onKeyboardRemove, onKeyboardNavigation, pillUid, applyAriaDisabled]
33
+ );
34
+ const handleOnRemove = useCallback(
35
+ (e) => {
36
+ if (applyAriaDisabled) return;
37
+ if (onRemove) onRemove(e);
38
+ },
39
+ [onRemove, applyAriaDisabled]
40
+ );
41
+ const colsConfig = useMemo(
42
+ () => disabled || applyAriaDisabled ? ["auto"] : ["auto", "minmax(24px, auto)"],
43
+ [disabled, applyAriaDisabled]
44
+ );
45
+ return /* @__PURE__ */ jsxs(
46
+ StyledRemovablePillWrapper,
47
+ {
48
+ pillSize: size,
49
+ cols: colsConfig,
50
+ disabled,
51
+ applyAriaDisabled,
52
+ gutter: "2px",
53
+ alignItems: "center",
54
+ justifyItems: "center",
55
+ className: "ds-pill-wrapper ds-pill-wrapper-removable",
56
+ "data-testid": "ds-pill-wrapper",
57
+ "data-label": ariaLabel || label,
58
+ ...ownerProps,
59
+ children: [
60
+ /* @__PURE__ */ jsx(TextComponent, { labelTruncated, label }),
61
+ !disabled && !applyAriaDisabled ? /* @__PURE__ */ jsx(
62
+ DSPillButton,
63
+ {
64
+ className: "ds-pill-focus-point",
65
+ id: pillUid,
66
+ "data-testid": "ds-pill-close-icon",
67
+ innerRef,
68
+ onClick: handleOnRemove,
69
+ onKeyDown,
70
+ "aria-label": `Remove ${label}`,
71
+ type: "right",
72
+ tabIndex,
73
+ applyAriaDisabled,
74
+ children: /* @__PURE__ */ jsx(
75
+ CloseXsmall,
76
+ {
77
+ width: size === "s" ? 18 : 22.65,
78
+ height: size === "s" ? 18 : 22.65,
79
+ color: ["brand-primary", "700"]
80
+ }
81
+ )
82
+ }
83
+ ) : null
84
+ ]
85
+ }
86
+ );
87
+ });
86
88
  export {
87
89
  RemovablePill
88
90
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/RemovablePill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { CloseXsmall } from '@elliemae/ds-icons';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\nimport { DSPillButton } from '../PillButton.js';\nimport { DSPillGroupV2Context } from '../PillGroup.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledRemovablePillWrapper } from '../styled.js';\n\nexport const RemovablePill = React.memo<DSPillT.InternalProps>(\n ({ label, size, disabled, labelTruncated, onRemove, innerRef, ariaLabel, tabIndex, applyAriaDisabled }) => {\n const { onKeyboardRemove, onKeyboardNavigation } = useContext(DSPillGroupV2Context);\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (['Enter', 'Space'].includes(e.code)) {\n if (applyAriaDisabled) return;\n e.preventDefault();\n if (onKeyboardRemove) onKeyboardRemove(pillUid);\n }\n if (e.code === 'ArrowLeft') {\n e.preventDefault();\n if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);\n }\n if (e.code === 'ArrowRight') {\n e.preventDefault();\n if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);\n }\n },\n [onKeyboardRemove, onKeyboardNavigation, pillUid, applyAriaDisabled],\n );\n\n const handleOnRemove = useCallback(\n (e: React.KeyboardEvent | React.MouseEvent) => {\n if (applyAriaDisabled) return;\n if (onRemove) onRemove(e);\n },\n [onRemove, applyAriaDisabled],\n );\n\n const colsConfig = useMemo(\n () => (disabled || applyAriaDisabled ? ['auto'] : ['auto', 'minmax(24px, auto)']),\n [disabled, applyAriaDisabled],\n );\n\n return (\n <StyledRemovablePillWrapper\n pillSize={size}\n cols={colsConfig}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-removable\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n >\n <TextComponent labelTruncated={labelTruncated} label={label} />\n {!disabled && !applyAriaDisabled ? (\n <DSPillButton\n className=\"ds-pill-focus-point\"\n id={pillUid}\n data-testid=\"ds-pill-close-icon\"\n innerRef={innerRef as TypescriptHelpersT.AnyRef<HTMLButtonElement>}\n onClick={handleOnRemove}\n onKeyDown={onKeyDown}\n aria-label={`Remove ${label}`}\n type=\"right\"\n tabIndex={tabIndex}\n applyAriaDisabled={applyAriaDisabled}\n >\n <CloseXsmall\n width={size === 's' ? 18 : 22.65}\n height={size === 's' ? 18 : 22.65}\n color={['brand-primary', '700']}\n />\n </DSPillButton>\n ) : null}\n </StyledRemovablePillWrapper>\n );\n },\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACgDjB,SAYE,KAZF;AAhDN,SAAS,mBAAmB;AAE5B,OAAOA,UAAS,aAAa,YAAY,eAAe;AACxD,SAAS,WAAW;AAEpB,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAEpC,MAAM,gBAAgBA,OAAM;AAAA,EACjC,CAAC,EAAE,OAAO,MAAM,UAAU,gBAAgB,UAAU,UAAU,WAAW,UAAU,kBAAkB,MAAM;AACzG,UAAM,EAAE,kBAAkB,qBAAqB,IAAI,WAAW,oBAAoB;AAClF,UAAM,UAAU,QAAQ,MAAM,WAAW,IAAI,CAAC,IAAI,CAAC,CAAC;AAEpD,UAAM,YAAY;AAAA,MAChB,CAAC,MAA2B;AAC1B,YAAI,CAAC,SAAS,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG;AACvC,cAAI,kBAAmB;AACvB,YAAE,eAAe;AACjB,cAAI,iBAAkB,kBAAiB,OAAO;AAAA,QAChD;AACA,YAAI,EAAE,SAAS,aAAa;AAC1B,YAAE,eAAe;AACjB,cAAI,qBAAsB,sBAAqB,SAAS,IAAI,CAAC;AAAA,QAC/D;AACA,YAAI,EAAE,SAAS,cAAc;AAC3B,YAAE,eAAe;AACjB,cAAI,qBAAsB,sBAAqB,SAAS,GAAG,CAAC;AAAA,QAC9D;AAAA,MACF;AAAA,MACA,CAAC,kBAAkB,sBAAsB,SAAS,iBAAiB;AAAA,IACrE;AAEA,UAAM,iBAAiB;AAAA,MACrB,CAAC,MAA8C;AAC7C,YAAI,kBAAmB;AACvB,YAAI,SAAU,UAAS,CAAC;AAAA,MAC1B;AAAA,MACA,CAAC,UAAU,iBAAiB;AAAA,IAC9B;AAEA,UAAM,aAAa;AAAA,MACjB,MAAO,YAAY,oBAAoB,CAAC,MAAM,IAAI,CAAC,QAAQ,oBAAoB;AAAA,MAC/E,CAAC,UAAU,iBAAiB;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,QAAO;AAAA,QACP,YAAW;AAAA,QACX,cAAa;AAAA,QACb,WAAU;AAAA,QACV,eAAY;AAAA,QACZ,cAAY,aAAa;AAAA,QAEzB;AAAA,8BAAC,iBAAc,gBAAgC,OAAc;AAAA,UAC5D,CAAC,YAAY,CAAC,oBACb;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,IAAI;AAAA,cACJ,eAAY;AAAA,cACZ;AAAA,cACA,SAAS;AAAA,cACT;AAAA,cACA,cAAY,UAAU,KAAK;AAAA,cAC3B,MAAK;AAAA,cACL;AAAA,cACA;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO,SAAS,MAAM,KAAK;AAAA,kBAC3B,QAAQ,SAAS,MAAM,KAAK;AAAA,kBAC5B,OAAO,CAAC,iBAAiB,KAAK;AAAA;AAAA,cAChC;AAAA;AAAA,UACF,IACE;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { CloseXsmall } from '@elliemae/ds-icons';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { uid } from 'uid';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { DSPillButton } from '../../parts/DSPillButton/DSPillButton.js';\nimport type { DSPillT } from '../../react-desc-prop-types.js';\n\nimport { DSPillGroupV2Context } from '../../parts/DSPillGroup/index.js';\nimport { TextComponent } from '../TextComponent.js';\nimport { StyledRemovablePillWrapper } from '../styled.js';\n\nexport const RemovablePill = React.memo<DSPillT.InternalProps>((props) => {\n const { label, size, disabled, labelTruncated, onRemove, innerRef, ariaLabel, tabIndex, applyAriaDisabled } = props;\n const { onKeyboardRemove, onKeyboardNavigation } = useContext(DSPillGroupV2Context);\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n const ownerProps = useOwnerProps(props);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (['Enter', 'Space'].includes(e.code)) {\n if (applyAriaDisabled) return;\n e.preventDefault();\n if (onKeyboardRemove) onKeyboardRemove(pillUid);\n }\n if (e.code === 'ArrowLeft') {\n e.preventDefault();\n if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);\n }\n if (e.code === 'ArrowRight') {\n e.preventDefault();\n if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);\n }\n },\n [onKeyboardRemove, onKeyboardNavigation, pillUid, applyAriaDisabled],\n );\n\n const handleOnRemove = useCallback(\n (e: React.KeyboardEvent | React.MouseEvent) => {\n if (applyAriaDisabled) return;\n if (onRemove) onRemove(e);\n },\n [onRemove, applyAriaDisabled],\n );\n\n const colsConfig = useMemo(\n () => (disabled || applyAriaDisabled ? ['auto'] : ['auto', 'minmax(24px, auto)']),\n [disabled, applyAriaDisabled],\n );\n\n return (\n <StyledRemovablePillWrapper\n pillSize={size}\n cols={colsConfig}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-removable\"\n data-testid=\"ds-pill-wrapper\"\n data-label={ariaLabel || label}\n {...ownerProps}\n >\n <TextComponent labelTruncated={labelTruncated} label={label} />\n {!disabled && !applyAriaDisabled ? (\n <DSPillButton\n className=\"ds-pill-focus-point\"\n id={pillUid}\n data-testid=\"ds-pill-close-icon\"\n innerRef={innerRef as TypescriptHelpersT.AnyRef<HTMLButtonElement>}\n onClick={handleOnRemove}\n onKeyDown={onKeyDown}\n aria-label={`Remove ${label}`}\n type=\"right\"\n tabIndex={tabIndex}\n applyAriaDisabled={applyAriaDisabled}\n >\n <CloseXsmall\n width={size === 's' ? 18 : 22.65}\n height={size === 's' ? 18 : 22.65}\n color={['brand-primary', '700']}\n />\n </DSPillButton>\n ) : null}\n </StyledRemovablePillWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmDnB,SAaE,KAbF;AAnDJ,SAAS,mBAAmB;AAE5B,OAAOA,UAAS,aAAa,YAAY,eAAe;AACxD,SAAS,WAAW;AACpB,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAG7B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAEpC,MAAM,gBAAgBA,OAAM,KAA4B,CAAC,UAAU;AACxE,QAAM,EAAE,OAAO,MAAM,UAAU,gBAAgB,UAAU,UAAU,WAAW,UAAU,kBAAkB,IAAI;AAC9G,QAAM,EAAE,kBAAkB,qBAAqB,IAAI,WAAW,oBAAoB;AAClF,QAAM,UAAU,QAAQ,MAAM,WAAW,IAAI,CAAC,IAAI,CAAC,CAAC;AACpD,QAAM,aAAa,cAAc,KAAK;AAEtC,QAAM,YAAY;AAAA,IAChB,CAAC,MAA2B;AAC1B,UAAI,CAAC,SAAS,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG;AACvC,YAAI,kBAAmB;AACvB,UAAE,eAAe;AACjB,YAAI,iBAAkB,kBAAiB,OAAO;AAAA,MAChD;AACA,UAAI,EAAE,SAAS,aAAa;AAC1B,UAAE,eAAe;AACjB,YAAI,qBAAsB,sBAAqB,SAAS,IAAI,CAAC;AAAA,MAC/D;AACA,UAAI,EAAE,SAAS,cAAc;AAC3B,UAAE,eAAe;AACjB,YAAI,qBAAsB,sBAAqB,SAAS,GAAG,CAAC;AAAA,MAC9D;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,sBAAsB,SAAS,iBAAiB;AAAA,EACrE;AAEA,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAA8C;AAC7C,UAAI,kBAAmB;AACvB,UAAI,SAAU,UAAS,CAAC;AAAA,IAC1B;AAAA,IACA,CAAC,UAAU,iBAAiB;AAAA,EAC9B;AAEA,QAAM,aAAa;AAAA,IACjB,MAAO,YAAY,oBAAoB,CAAC,MAAM,IAAI,CAAC,QAAQ,oBAAoB;AAAA,IAC/E,CAAC,UAAU,iBAAiB;AAAA,EAC9B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA,QAAO;AAAA,MACP,YAAW;AAAA,MACX,cAAa;AAAA,MACb,WAAU;AAAA,MACV,eAAY;AAAA,MACZ,cAAY,aAAa;AAAA,MACxB,GAAG;AAAA,MAEJ;AAAA,4BAAC,iBAAc,gBAAgC,OAAc;AAAA,QAC5D,CAAC,YAAY,CAAC,oBACb;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI;AAAA,YACJ,eAAY;AAAA,YACZ;AAAA,YACA,SAAS;AAAA,YACT;AAAA,YACA,cAAY,UAAU,KAAK;AAAA,YAC3B,MAAK;AAAA,YACL;AAAA,YACA;AAAA,YAEA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO,SAAS,MAAM,KAAK;AAAA,gBAC3B,QAAQ,SAAS,MAAM,KAAK;AAAA,gBAC5B,OAAO,CAAC,iBAAiB,KAAK;AAAA;AAAA,YAChC;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }