@elliemae/ds-pills 2.3.1 → 3.0.0-alpha.3

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 (216) hide show
  1. package/dist/cjs/components/Pill.js +72 -0
  2. package/dist/cjs/components/Pill.js.map +7 -0
  3. package/dist/cjs/components/PillButton.js +86 -0
  4. package/dist/cjs/components/PillButton.js.map +7 -0
  5. package/dist/cjs/components/PillGroup.js +100 -0
  6. package/dist/cjs/components/PillGroup.js.map +7 -0
  7. package/dist/cjs/components/index.js +30 -0
  8. package/dist/cjs/components/index.js.map +7 -0
  9. package/dist/cjs/components/styled.js +235 -0
  10. package/dist/cjs/components/styled.js.map +7 -0
  11. package/dist/cjs/components/types/DropdownPill.js +105 -0
  12. package/dist/cjs/components/types/DropdownPill.js.map +7 -0
  13. package/dist/cjs/components/types/InputPill.js +84 -0
  14. package/dist/cjs/components/types/InputPill.js.map +7 -0
  15. package/dist/cjs/components/types/LabelPill.js +52 -0
  16. package/dist/cjs/components/types/LabelPill.js.map +7 -0
  17. package/dist/cjs/components/types/ReadOnlyPill.js +55 -0
  18. package/dist/cjs/components/types/ReadOnlyPill.js.map +7 -0
  19. package/dist/cjs/components/types/RemovablePill.js +90 -0
  20. package/dist/cjs/components/types/RemovablePill.js.map +7 -0
  21. package/dist/cjs/components/types/ValuePill.js +59 -0
  22. package/dist/cjs/components/types/ValuePill.js.map +7 -0
  23. package/dist/cjs/components/types/index.js +33 -0
  24. package/dist/cjs/components/types/index.js.map +7 -0
  25. package/dist/cjs/deprecated/DropdownPill.js +128 -0
  26. package/dist/cjs/deprecated/DropdownPill.js.map +7 -0
  27. package/dist/cjs/deprecated/InputPill.js +114 -0
  28. package/dist/cjs/deprecated/InputPill.js.map +7 -0
  29. package/dist/cjs/deprecated/LabeledDropdownPills.js +140 -0
  30. package/dist/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
  31. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +169 -0
  32. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  33. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +181 -0
  34. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  35. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +190 -0
  36. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  37. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +44 -0
  38. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  39. package/dist/cjs/deprecated/LabeledPills.js +75 -0
  40. package/dist/cjs/deprecated/LabeledPills.js.map +7 -0
  41. package/dist/cjs/deprecated/OverflowPill.js +79 -0
  42. package/dist/cjs/deprecated/OverflowPill.js.map +7 -0
  43. package/dist/cjs/deprecated/Pill.js +107 -0
  44. package/dist/cjs/deprecated/Pill.js.map +7 -0
  45. package/dist/cjs/deprecated/PillGroup.js +84 -0
  46. package/dist/cjs/deprecated/PillGroup.js.map +7 -0
  47. package/dist/cjs/deprecated/ReadOnlyPill.js +100 -0
  48. package/dist/cjs/deprecated/ReadOnlyPill.js.map +7 -0
  49. package/dist/cjs/deprecated/RemovablePill.js +78 -0
  50. package/dist/cjs/deprecated/RemovablePill.js.map +7 -0
  51. package/dist/cjs/deprecated/index.js +43 -0
  52. package/dist/cjs/deprecated/index.js.map +7 -0
  53. package/dist/cjs/index.d.js +27 -0
  54. package/dist/cjs/index.d.js.map +7 -0
  55. package/dist/cjs/index.js +37 -0
  56. package/dist/cjs/index.js.map +7 -0
  57. package/dist/cjs/props.js +96 -0
  58. package/dist/cjs/props.js.map +7 -0
  59. package/dist/cjs/utils.js +46 -0
  60. package/dist/cjs/utils.js.map +7 -0
  61. package/dist/esm/components/Pill.js +45 -0
  62. package/dist/esm/components/Pill.js.map +7 -0
  63. package/dist/esm/components/PillButton.js +59 -0
  64. package/dist/esm/components/PillButton.js.map +7 -0
  65. package/dist/esm/components/PillGroup.js +78 -0
  66. package/dist/esm/components/PillGroup.js.map +7 -0
  67. package/dist/esm/components/index.js +5 -0
  68. package/dist/esm/components/index.js.map +7 -0
  69. package/dist/esm/components/styled.js +206 -0
  70. package/dist/esm/components/styled.js.map +7 -0
  71. package/dist/esm/components/types/DropdownPill.js +78 -0
  72. package/dist/esm/components/types/DropdownPill.js.map +7 -0
  73. package/dist/esm/components/types/InputPill.js +55 -0
  74. package/dist/esm/components/types/InputPill.js.map +7 -0
  75. package/dist/esm/components/types/LabelPill.js +23 -0
  76. package/dist/esm/components/types/LabelPill.js.map +7 -0
  77. package/dist/esm/components/types/ReadOnlyPill.js +26 -0
  78. package/dist/esm/components/types/ReadOnlyPill.js.map +7 -0
  79. package/dist/esm/components/types/RemovablePill.js +61 -0
  80. package/dist/esm/components/types/RemovablePill.js.map +7 -0
  81. package/dist/esm/components/types/ValuePill.js +30 -0
  82. package/dist/esm/components/types/ValuePill.js.map +7 -0
  83. package/dist/esm/components/types/index.js +8 -0
  84. package/dist/esm/components/types/index.js.map +7 -0
  85. package/dist/esm/deprecated/DropdownPill.js +101 -0
  86. package/dist/esm/deprecated/DropdownPill.js.map +7 -0
  87. package/dist/esm/deprecated/InputPill.js +87 -0
  88. package/dist/esm/deprecated/InputPill.js.map +7 -0
  89. package/dist/esm/deprecated/LabeledDropdownPills.js +113 -0
  90. package/dist/esm/deprecated/LabeledDropdownPills.js.map +7 -0
  91. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +142 -0
  92. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  93. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +154 -0
  94. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  95. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +163 -0
  96. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  97. package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js +15 -0
  98. package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  99. package/dist/esm/deprecated/LabeledPills.js +46 -0
  100. package/dist/esm/deprecated/LabeledPills.js.map +7 -0
  101. package/dist/esm/deprecated/OverflowPill.js +50 -0
  102. package/dist/esm/deprecated/OverflowPill.js.map +7 -0
  103. package/dist/esm/deprecated/Pill.js +80 -0
  104. package/dist/esm/deprecated/Pill.js.map +7 -0
  105. package/dist/esm/deprecated/PillGroup.js +57 -0
  106. package/dist/esm/deprecated/PillGroup.js.map +7 -0
  107. package/dist/esm/deprecated/ReadOnlyPill.js +71 -0
  108. package/dist/esm/deprecated/ReadOnlyPill.js.map +7 -0
  109. package/dist/esm/deprecated/RemovablePill.js +49 -0
  110. package/dist/esm/deprecated/RemovablePill.js.map +7 -0
  111. package/dist/esm/deprecated/index.js +14 -0
  112. package/dist/esm/deprecated/index.js.map +7 -0
  113. package/dist/esm/index.d.js +2 -0
  114. package/dist/esm/index.d.js.map +7 -0
  115. package/dist/esm/index.js +8 -0
  116. package/dist/esm/index.js.map +7 -0
  117. package/dist/esm/props.js +67 -0
  118. package/dist/esm/props.js.map +7 -0
  119. package/dist/esm/utils.js +17 -0
  120. package/dist/esm/utils.js.map +7 -0
  121. package/package.json +94 -85
  122. package/cjs/components/Pill.js +0 -53
  123. package/cjs/components/PillButton.js +0 -56
  124. package/cjs/components/PillGroup.js +0 -87
  125. package/cjs/components/index.js +0 -17
  126. package/cjs/components/styled.js +0 -85
  127. package/cjs/components/types/DropdownPill.js +0 -86
  128. package/cjs/components/types/InputPill.js +0 -74
  129. package/cjs/components/types/LabelPill.js +0 -46
  130. package/cjs/components/types/ReadOnlyPill.js +0 -50
  131. package/cjs/components/types/RemovablePill.js +0 -85
  132. package/cjs/components/types/ValuePill.js +0 -54
  133. package/cjs/components/types/index.js +0 -19
  134. package/cjs/deprecated/DropdownPill.js +0 -113
  135. package/cjs/deprecated/InputPill.js +0 -84
  136. package/cjs/deprecated/LabeledDropdownPills.js +0 -106
  137. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -134
  138. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -153
  139. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -162
  140. package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +0 -20
  141. package/cjs/deprecated/LabeledPills.js +0 -62
  142. package/cjs/deprecated/OverflowPill.js +0 -73
  143. package/cjs/deprecated/Pill.js +0 -88
  144. package/cjs/deprecated/PillGroup.js +0 -72
  145. package/cjs/deprecated/ReadOnlyPill.js +0 -101
  146. package/cjs/deprecated/RemovablePill.js +0 -74
  147. package/cjs/deprecated/index.js +0 -33
  148. package/cjs/index.d.js +0 -2
  149. package/cjs/index.js +0 -43
  150. package/cjs/props.js +0 -70
  151. package/cjs/utils.js +0 -28
  152. package/esm/components/Pill.js +0 -44
  153. package/esm/components/PillButton.js +0 -46
  154. package/esm/components/PillGroup.js +0 -75
  155. package/esm/components/index.js +0 -3
  156. package/esm/components/styled.js +0 -67
  157. package/esm/components/types/DropdownPill.js +0 -76
  158. package/esm/components/types/InputPill.js +0 -65
  159. package/esm/components/types/LabelPill.js +0 -37
  160. package/esm/components/types/ReadOnlyPill.js +0 -41
  161. package/esm/components/types/RemovablePill.js +0 -76
  162. package/esm/components/types/ValuePill.js +0 -45
  163. package/esm/components/types/index.js +0 -6
  164. package/esm/deprecated/DropdownPill.js +0 -100
  165. package/esm/deprecated/InputPill.js +0 -74
  166. package/esm/deprecated/LabeledDropdownPills.js +0 -95
  167. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -126
  168. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -145
  169. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -154
  170. package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +0 -16
  171. package/esm/deprecated/LabeledPills.js +0 -53
  172. package/esm/deprecated/OverflowPill.js +0 -62
  173. package/esm/deprecated/Pill.js +0 -76
  174. package/esm/deprecated/PillGroup.js +0 -60
  175. package/esm/deprecated/ReadOnlyPill.js +0 -90
  176. package/esm/deprecated/RemovablePill.js +0 -64
  177. package/esm/deprecated/index.js +0 -8
  178. package/esm/index.d.js +0 -1
  179. package/esm/index.js +0 -11
  180. package/esm/props.js +0 -61
  181. package/esm/utils.js +0 -24
  182. package/types/components/Pill.d.ts +0 -5
  183. package/types/components/PillButton.d.ts +0 -5
  184. package/types/components/PillGroup.d.ts +0 -9
  185. package/types/components/index.d.ts +0 -3
  186. package/types/components/styled.d.ts +0 -20
  187. package/types/components/types/DropdownPill.d.ts +0 -3
  188. package/types/components/types/InputPill.d.ts +0 -3
  189. package/types/components/types/LabelPill.d.ts +0 -3
  190. package/types/components/types/ReadOnlyPill.d.ts +0 -3
  191. package/types/components/types/RemovablePill.d.ts +0 -3
  192. package/types/components/types/ValuePill.d.ts +0 -3
  193. package/types/components/types/index.d.ts +0 -6
  194. package/types/deprecated/DropdownPill.d.ts +0 -66
  195. package/types/deprecated/InputPill.d.ts +0 -10
  196. package/types/deprecated/LabeledDropdownPills.d.ts +0 -82
  197. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +0 -15
  198. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +0 -13
  199. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +0 -28
  200. package/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +0 -1
  201. package/types/deprecated/LabeledPills.d.ts +0 -52
  202. package/types/deprecated/OverflowPill.d.ts +0 -33
  203. package/types/deprecated/Pill.d.ts +0 -59
  204. package/types/deprecated/PillGroup.d.ts +0 -50
  205. package/types/deprecated/ReadOnlyPill.d.ts +0 -56
  206. package/types/deprecated/RemovablePill.d.ts +0 -49
  207. package/types/deprecated/index.d.ts +0 -9
  208. package/types/index.d.ts +0 -3
  209. package/types/props.d.ts +0 -93
  210. package/types/tests/DSPill.test.d.ts +0 -1
  211. package/types/tests/DSPillGroup.test.d.ts +0 -1
  212. package/types/tests/events/DSPill.events.keyboard.test.d.ts +0 -1
  213. package/types/tests/events/DSPill.events.test.d.ts +0 -1
  214. package/types/tests/events/DSPillGroup.events.keyboard.test.d.ts +0 -1
  215. package/types/tests/events/DSPillGroup.events.test.d.ts +0 -1
  216. package/types/utils.d.ts +0 -4
@@ -1,46 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
8
- import 'react';
9
- import { describe } from 'react-desc';
10
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
11
- import { StyledPillButton } from './styled.js';
12
- import { DSPillButtonPropTypes, DSPillButtonDefaultProps } from '../props.js';
13
- import { jsx } from 'react/jsx-runtime';
14
-
15
- const _excluded = ["type", "children"];
16
-
17
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
-
19
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
- const typeToClassName = {
21
- only: 'ds-pill-button-only',
22
- left: 'ds-pill-button-left',
23
- right: 'ds-pill-button-right'
24
- };
25
-
26
- const DSPillButton = props => {
27
- const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillButtonDefaultProps);
28
- useValidateTypescriptPropTypes(propsWithDefaults, DSPillButtonPropTypes);
29
-
30
- const {
31
- type,
32
- children
33
- } = propsWithDefaults,
34
- rest = _objectWithoutProperties(propsWithDefaults, _excluded);
35
-
36
- return /*#__PURE__*/jsx(StyledPillButton, _objectSpread(_objectSpread({}, rest), {}, {
37
- buttonType: "raw",
38
- className: "".concat(typeToClassName[type], " ").concat(rest.className),
39
- children: children
40
- }));
41
- };
42
-
43
- const DSPillButtonWithSchema = describe(DSPillButton).description('Pill button');
44
- DSPillButtonWithSchema.propTypes = DSPillButtonPropTypes;
45
-
46
- export { DSPillButton, DSPillButtonWithSchema };
@@ -1,75 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
- import 'core-js/modules/web.dom-collections.iterator.js';
4
- import 'core-js/modules/esnext.async-iterator.map.js';
5
- import 'core-js/modules/esnext.iterator.map.js';
6
- import 'core-js/modules/esnext.async-iterator.filter.js';
7
- import 'core-js/modules/esnext.iterator.constructor.js';
8
- import 'core-js/modules/esnext.iterator.filter.js';
9
- import 'core-js/modules/esnext.async-iterator.for-each.js';
10
- import 'core-js/modules/esnext.iterator.for-each.js';
11
- import React, { createContext, useMemo, useCallback } from 'react';
12
- import { uid } from 'uid';
13
- import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
14
- import { DSPillGroupPropTypes, DSPillGroupDefaultProps } from '../props.js';
15
- import { StyledPillGroup } from './styled.js';
16
- import { jsx } from 'react/jsx-runtime';
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
- const DSPillGroupV2Context = /*#__PURE__*/createContext({
22
- onKeyboardRemove: () => null,
23
- onKeyboardNavigation: () => null
24
- });
25
-
26
- const DSPillGroupV2 = props => {
27
- const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillGroupDefaultProps);
28
- useValidateTypescriptPropTypes(propsWithDefaults, DSPillGroupPropTypes);
29
- const globalAttrs = useGetGlobalAttributes(propsWithDefaults);
30
- const pillGroupUid = useMemo(() => "ds-pill-group-".concat(uid()), []);
31
- const {
32
- children,
33
- width,
34
- innerRef
35
- } = propsWithDefaults;
36
- const onKeyboardRemove = useCallback(pillUid => {
37
- const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
38
- const pillIndex = elems.findIndex(elem => elem.id === pillUid);
39
-
40
- if (pillIndex > 0) {
41
- elems[pillIndex - 1].focus();
42
- } else if (pillIndex + 1 < elems.length) {
43
- elems[pillIndex + 1].focus();
44
- }
45
- }, [pillGroupUid]);
46
- const onKeyboardNavigation = useCallback((pillUid, step, e) => {
47
- const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
48
- const pillIndex = elems.findIndex(elem => elem.id === pillUid);
49
-
50
- if (pillIndex >= 0) {
51
- if (elems[pillIndex + step]) {
52
- e.stopPropagation();
53
- elems[pillIndex + step].focus();
54
- }
55
- }
56
- }, [pillGroupUid]);
57
- return /*#__PURE__*/_jsx(DSPillGroupV2Context.Provider, {
58
- value: {
59
- onKeyboardRemove,
60
- onKeyboardNavigation
61
- }
62
- }, void 0, /*#__PURE__*/jsx(StyledPillGroup, _objectSpread(_objectSpread({}, globalAttrs), {}, {
63
- width: width,
64
- id: pillGroupUid,
65
- cols: React.Children.map(children, () => 'auto'),
66
- gutter: "2px",
67
- ref: innerRef,
68
- children: children
69
- })));
70
- };
71
-
72
- const DSPillGroupV2WithSchema = describe(DSPillGroupV2);
73
- DSPillGroupV2WithSchema.propTypes = DSPillGroupPropTypes;
74
-
75
- export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema };
@@ -1,3 +0,0 @@
1
- export { DSPillV2, DSPillV2WithSchema } from './Pill.js';
2
- export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema } from './PillGroup.js';
3
- export { DSPillButton, DSPillButtonWithSchema } from './PillButton.js';
@@ -1,67 +0,0 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
- import styled from 'styled-components';
3
- import { css } from '@elliemae/ds-system';
4
- import Grid from '@elliemae/ds-grid';
5
- import { DSButtonV2 } from '@elliemae/ds-button';
6
-
7
- var _templateObject, _templateObject2;
8
- // Common CSS
9
- // =============================================================================
10
-
11
- const borderOutside = function (color) {
12
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
13
- let zIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
14
- let borderRadius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '12px';
15
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :after {\n content: ' ';\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n border: ", "px solid ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n pointer-events: none;\n z-index: ", ";\n }\n"])), size, color, borderRadius, borderRadius, borderRadius, borderRadius, zIndex);
16
- };
17
-
18
- const commonPillWrapperCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: ", ";\n\n position: relative;\n\n width: fit-content;\n\n background-color: ", ";\n\n outline: none;\n\n white-space: nowrap;\n\n padding: 0px 12px 0 12px;\n border-radius: 12px;\n\n font-size: 13px;\n line-height: 1;\n color: ", ";\n ", ";\n"])), props => (props === null || props === void 0 ? void 0 : props.size) === 'm' ? '24px' : '18px', props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => borderOutside(props.theme.colors.brand[300])); // =============================================================================
19
- // Pills wrappers
20
- // =============================================================================
21
-
22
- const StyledLabelPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
23
- componentId: "sc-j0tlch-0"
24
- })(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIcon ? '0px !important' : '12px');
25
- const StyledValuePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
26
- componentId: "sc-j0tlch-1"
27
- })(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.regular, props => props.hasIcon ? '0px !important' : '12px');
28
- const StyledInputPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
29
- componentId: "sc-j0tlch-2"
30
- })(["", " background:", ";padding:0;", ":focus-within{", "}:active{", "}& .em-ds-input{outline:none !important;border:none !important;box-shadow:none !important;border-radius:0 !important;height:100%;background:transparent;width:", ";padding:0;margin:0 0 0 8px;}& .em-ds-input__tooltip-ref{height:100%;}"], commonPillWrapperCss, props => props.theme.colors.neutral['000'], _ref => {
31
- let {
32
- value,
33
- theme
34
- } = _ref;
35
- return borderOutside(value === '' ? theme.colors.neutral[400] : theme.colors.brand[500]);
36
- }, props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '', props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '', props => "".concat(props.inputWidth + (props.value === '' ? 24 : 0), "px"));
37
- const StyledDropdownPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
38
- componentId: "sc-j0tlch-3"
39
- })(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.semibold);
40
- const StyledReadonlyPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
41
- componentId: "sc-j0tlch-4"
42
- })(["", " font-weight:", ";padding-right:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIconRight ? '0 !important' : '12px', props => props.hasIconLeft ? '0 !important' : '12px');
43
- const StyledRemovablePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
44
- componentId: "sc-j0tlch-5"
45
- })(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.regular); // =============================================================================
46
- // Pill group
47
- // =============================================================================
48
-
49
- const StyledPillGroup = /*#__PURE__*/styled(Grid).withConfig({
50
- componentId: "sc-j0tlch-6"
51
- })(["width:", ";& .ds-pill-wrapper{&:not(:first-of-type){&,:after,:before,.ds-pill-tooltip-value:after{border-top-left-radius:0px;border-bottom-left-radius:0px;}}&:not(:last-of-type){&,:after,:before,.ds-pill-tooltip-value:after{border-top-right-radius:0px;border-bottom-right-radius:0px;}}}& .ds-pill-wrapper-label,& .ds-pill-wrapper-value,& .ds-pill-wrapper-readonly{&:not(:first-of-type){padding-left:8px;}&:not(:last-of-type){padding-right:8px;}}& .ds-pill-wrapper-removable:not(:first-of-type){padding-left:8px;}& .ds-pill-wrapper-dropdown:not(:first-of-type){padding-left:8px;}& .ds-pill-wrapper{:not(:first-of-type){.ds-pill-button-left{border-radius:0px;}.ds-pill-button-only{border-top-left-radius:0px;border-bottom-left-radius:0px;}}:not(:last-of-type){.ds-pill-button-right{border-radius:0px;}.ds-pill-button-only{border-top-right-radius:0px;border-bottom-right-radius:0px;}}}"], _ref2 => {
52
- let {
53
- width
54
- } = _ref2;
55
- return width;
56
- }); // =============================================================================
57
- // Extra stuff
58
- // =============================================================================
59
-
60
- const StyledSpanWithTooltip = /*#__PURE__*/styled.span.withConfig({
61
- componentId: "sc-j0tlch-7"
62
- })(["outline:none;:focus{", "}"], props => borderOutside(props.theme.colors.brand[700], 2, 3));
63
- const StyledPillButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
64
- componentId: "sc-j0tlch-8"
65
- })(["display:grid;place-items:center;position:relative;padding:0;width:", ";height:", ";border-radius:12px;:focus{", "}cursor:pointer;"], props => props.width, props => props.height, props => borderOutside(props.theme.colors.brand[700], 2, 3, 'inherit'));
66
-
67
- export { StyledDropdownPillWrapper, StyledInputPillWrapper, StyledLabelPillWrapper, StyledPillButton, StyledPillGroup, StyledReadonlyPillWrapper, StyledRemovablePillWrapper, StyledSpanWithTooltip, StyledValuePillWrapper };
@@ -1,76 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import React, { useRef, useMemo } from 'react';
9
- import { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';
10
- import { uid } from 'uid';
11
- import { ChevronSmallDown } from '@elliemae/ds-icons';
12
- import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
13
- import { StyledDropdownPillWrapper } from '../styled.js';
14
- import { setMultipleRefs } from '../../utils.js';
15
- import { DSPillButton } from '../PillButton.js';
16
- import { jsx } from 'react/jsx-runtime';
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
- const DropdownPill = /*#__PURE__*/React.memo(_ref => {
22
- let {
23
- label,
24
- size,
25
- labelTruncated,
26
- dropdownProps,
27
- innerRef,
28
- ariaLabel,
29
- onDropdownClick
30
- } = _ref;
31
- const chevronRef = useRef(null);
32
- const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
33
- const TextComponent = labelTruncated ? _ref2 => {
34
- let {
35
- children
36
- } = _ref2;
37
- return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
38
- value: children
39
- });
40
- } : React.Fragment;
41
- return /*#__PURE__*/_jsx(StyledDropdownPillWrapper, {
42
- size: size,
43
- id: pillUid,
44
- className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
45
- "data-testid": "ds-pill-wrapper",
46
- cols: ['auto', '24px'],
47
- gutter: "2px",
48
- alignItems: "center",
49
- justifyItems: "center"
50
- }, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/jsx(DSDropdownMenuV2, _objectSpread(_objectSpread({
51
- placementOrderPreference: ['bottom-start', 'bottom', 'bottom-end', 'right-end', 'top-start', 'top', 'top-end']
52
- }, dropdownProps), {}, {
53
- onClickOutside: e => {
54
- if (e.code === 'Escape') chevronRef.current.focus();
55
- if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);
56
- },
57
- wrapperStyles: {
58
- w: '100%',
59
- h: '100%'
60
- },
61
- children: /*#__PURE__*/_jsx(DSPillButton, {
62
- className: "ds-pill-focus-point",
63
- "data-testid": "ds-pill-dropdown-chevron",
64
- innerRef: setMultipleRefs(chevronRef, innerRef),
65
- "aria-label": ariaLabel || label,
66
- type: "right",
67
- onClick: onDropdownClick
68
- }, void 0, /*#__PURE__*/_jsx(ChevronSmallDown, {
69
- color: ['brand-primary', '800'],
70
- width: 20,
71
- height: 20
72
- }))
73
- })));
74
- });
75
-
76
- export { DropdownPill };
@@ -1,65 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import React, { useRef, useMemo, useCallback, useState } from 'react';
4
- import { uid } from 'uid';
5
- import { CloseXsmall } from '@elliemae/ds-icons';
6
- import { StyledInputPillWrapper } from '../styled.js';
7
- import { setMultipleRefs } from '../../utils.js';
8
- import { DSPillButton } from '../PillButton.js';
9
-
10
- const InputPill = /*#__PURE__*/React.memo(_ref => {
11
- let {
12
- label,
13
- size,
14
- inputPlaceholder,
15
- inputWidth,
16
- inputRender,
17
- onInputChange,
18
- onInputClear,
19
- innerRef
20
- } = _ref;
21
- const ref = useRef(null);
22
- const InputComponent = useMemo(() => inputRender, [inputRender]);
23
- const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
24
- const onCloseIconClick = useCallback(e => {
25
- if ([undefined, 'Enter', 'Space'].includes(e.code)) {
26
- e.preventDefault();
27
- onInputClear(e);
28
- ref.current.focus();
29
- }
30
- }, [onInputClear]);
31
- const [inputHasFocus, setInputHasFocus] = useState(false);
32
- return /*#__PURE__*/_jsx(StyledInputPillWrapper, {
33
- size: size,
34
- className: "ds-pill-wrapper",
35
- "data-testid": "ds-pill-wrapper",
36
- cols: label === '' ? ['auto'] : ['auto', '24px'],
37
- inputWidth: inputWidth,
38
- value: label,
39
- inputHasFocus: inputHasFocus
40
- }, void 0, /*#__PURE__*/_jsx(InputComponent, {
41
- id: pillUid,
42
- className: "ds-pill-focus-point",
43
- "data-testid": "ds-pill-input",
44
- innerRef: setMultipleRefs(ref, innerRef),
45
- value: label,
46
- onChange: onInputChange,
47
- placeholder: inputPlaceholder,
48
- onFocus: () => setInputHasFocus(true),
49
- onBlur: () => setInputHasFocus(false),
50
- disableTooltip: false
51
- }), label !== '' && /*#__PURE__*/_jsx(DSPillButton, {
52
- id: pillUid,
53
- "data-testid": "ds-pill-clear-icon",
54
- innerRef: innerRef,
55
- onClick: onCloseIconClick,
56
- onKeyDown: onCloseIconClick,
57
- "aria-label": "Clear input",
58
- type: "right"
59
- }, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
60
- size: "s",
61
- color: ['brand-primary', '700']
62
- })));
63
- });
64
-
65
- export { InputPill };
@@ -1,37 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.filter.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.filter.js';
5
- import React from 'react';
6
- import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
7
- import { StyledLabelPillWrapper } from '../styled.js';
8
-
9
- const LabelPill = /*#__PURE__*/React.memo(_ref => {
10
- let {
11
- label,
12
- size,
13
- labelTruncated,
14
- iconLeft,
15
- ariaLabel
16
- } = _ref;
17
- const TextComponent = labelTruncated ? _ref2 => {
18
- let {
19
- children
20
- } = _ref2;
21
- return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
22
- value: children
23
- });
24
- } : React.Fragment;
25
- return /*#__PURE__*/_jsx(StyledLabelPillWrapper, {
26
- size: size,
27
- alignItems: "center",
28
- className: "ds-pill-wrapper ds-pill-wrapper-label",
29
- "data-testid": "ds-pill-wrapper",
30
- "aria-label": ariaLabel || label,
31
- cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
32
- gutter: "xxxs",
33
- hasIcon: iconLeft !== null
34
- }, void 0, iconLeft, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label));
35
- });
36
-
37
- export { LabelPill };
@@ -1,41 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.filter.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.filter.js';
5
- import React from 'react';
6
- import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
7
- import { StyledReadonlyPillWrapper } from '../styled.js';
8
-
9
- const ReadOnlyPill = /*#__PURE__*/React.memo(_ref => {
10
- let {
11
- label,
12
- size,
13
- labelTruncated,
14
- iconLeft,
15
- iconRight,
16
- ariaLabel
17
- } = _ref;
18
- const hasIconLeft = iconLeft !== null || iconRight !== null && label === '';
19
- const hasIconRight = iconRight !== null || iconLeft !== null && label === '';
20
- const TextComponent = labelTruncated ? _ref2 => {
21
- let {
22
- children
23
- } = _ref2;
24
- return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
25
- value: children
26
- });
27
- } : React.Fragment;
28
- return /*#__PURE__*/_jsx(StyledReadonlyPillWrapper, {
29
- size: size,
30
- alignItems: "center",
31
- className: "ds-pill-wrapper ds-pill-wrapper-readonly",
32
- "data-testid": "ds-pill-wrapper",
33
- "aria-label": ariaLabel || label,
34
- cols: [iconLeft && 'min-content', label && 'auto', iconRight && 'min-content'].filter(notFalse => notFalse),
35
- gutter: "xxxs",
36
- hasIconRight: hasIconRight,
37
- hasIconLeft: hasIconLeft
38
- }, void 0, iconLeft, label ? /*#__PURE__*/_jsx(TextComponent, {}, void 0, label) : null, iconRight);
39
- });
40
-
41
- export { ReadOnlyPill };
@@ -1,76 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import React, { useContext, useMemo, useCallback } from 'react';
3
- import { uid } from 'uid';
4
- import { CloseXsmall } from '@elliemae/ds-icons';
5
- import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
6
- import { StyledRemovablePillWrapper } from '../styled.js';
7
- import { DSPillGroupV2Context } from '../PillGroup.js';
8
- import { DSPillButton } from '../PillButton.js';
9
-
10
- const RemovablePill = /*#__PURE__*/React.memo(_ref => {
11
- let {
12
- label,
13
- size,
14
- labelTruncated,
15
- onRemove,
16
- innerRef,
17
- ariaLabel,
18
- tabIndex
19
- } = _ref;
20
- const {
21
- onKeyboardRemove,
22
- onKeyboardNavigation
23
- } = useContext(DSPillGroupV2Context);
24
- const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
25
- const TextComponent = labelTruncated ? _ref2 => {
26
- let {
27
- children
28
- } = _ref2;
29
- return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
30
- value: children
31
- });
32
- } : React.Fragment;
33
- const onKeyDown = useCallback(e => {
34
- if (['Enter', 'Space'].includes(e.code)) {
35
- e.preventDefault();
36
- if (onKeyboardRemove) onKeyboardRemove(pillUid);
37
- onRemove(e);
38
- }
39
-
40
- if (e.code === 'ArrowLeft') {
41
- e.preventDefault();
42
- if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);
43
- }
44
-
45
- if (e.code === 'ArrowRight') {
46
- e.preventDefault();
47
- if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);
48
- }
49
- }, [onKeyboardRemove, onRemove, onKeyboardNavigation, pillUid]);
50
- return /*#__PURE__*/_jsx(StyledRemovablePillWrapper, {
51
- size: size,
52
- cols: ['auto', '24px'],
53
- gutter: "2px",
54
- alignItems: "center",
55
- justifyItems: "center",
56
- className: "ds-pill-wrapper ds-pill-wrapper-removable",
57
- "data-testid": "ds-pill-wrapper",
58
- "aria-label": ariaLabel || label
59
- }, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/_jsx(DSPillButton, {
60
- className: "ds-pill-focus-point",
61
- id: pillUid,
62
- "data-testid": "ds-pill-close-icon",
63
- innerRef: innerRef,
64
- onClick: onRemove,
65
- onKeyDown: onKeyDown,
66
- "aria-label": "Remove ".concat(label),
67
- type: "right",
68
- tabIndex: tabIndex
69
- }, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
70
- width: size === 's' ? 18 : 22.65,
71
- height: size === 's' ? 18 : 22.65,
72
- color: ['brand-primary', '700']
73
- })));
74
- });
75
-
76
- export { RemovablePill };
@@ -1,45 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.filter.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.filter.js';
5
- import React from 'react';
6
- import { DSTooltipV2 } from '@elliemae/ds-tooltip';
7
- import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
8
- import { StyledValuePillWrapper, StyledSpanWithTooltip } from '../styled.js';
9
-
10
- const ValuePill = /*#__PURE__*/React.memo(_ref => {
11
- let {
12
- label,
13
- size,
14
- labelTruncated,
15
- tooltipValue,
16
- iconLeft,
17
- ariaLabel
18
- } = _ref;
19
- const TextComponent = labelTruncated ? _ref2 => {
20
- let {
21
- children
22
- } = _ref2;
23
- return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
24
- value: children
25
- });
26
- } : React.Fragment;
27
- return /*#__PURE__*/_jsx(StyledValuePillWrapper, {
28
- size: size,
29
- alignItems: "center",
30
- className: "ds-pill-wrapper ds-pill-wrapper-value",
31
- "data-testid": "ds-pill-wrapper",
32
- "aria-label": ariaLabel || label,
33
- cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
34
- gutter: "xxxs",
35
- hasIcon: iconLeft !== null
36
- }, void 0, iconLeft, tooltipValue !== '' ? /*#__PURE__*/_jsx(DSTooltipV2, {
37
- title: tooltipValue,
38
- triggerComponent: /*#__PURE__*/_jsx(StyledSpanWithTooltip, {
39
- className: "ds-pill-tooltip-value",
40
- tabIndex: 0
41
- }, void 0, label)
42
- }) : /*#__PURE__*/_jsx(TextComponent, {}, void 0, label));
43
- });
44
-
45
- export { ValuePill };
@@ -1,6 +0,0 @@
1
- export { DropdownPill } from './DropdownPill.js';
2
- export { InputPill } from './InputPill.js';
3
- export { LabelPill } from './LabelPill.js';
4
- export { ReadOnlyPill } from './ReadOnlyPill.js';
5
- export { RemovablePill } from './RemovablePill.js';
6
- export { ValuePill } from './ValuePill.js';
@@ -1,100 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
- import 'core-js/modules/web.dom-collections.iterator.js';
5
- import 'core-js/modules/esnext.async-iterator.filter.js';
6
- import 'core-js/modules/esnext.iterator.constructor.js';
7
- import 'core-js/modules/esnext.iterator.filter.js';
8
- import 'core-js/modules/esnext.async-iterator.for-each.js';
9
- import 'core-js/modules/esnext.iterator.for-each.js';
10
- import { useRef, useState } from 'react';
11
- import { PropTypes, describe } from 'react-desc';
12
- import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
13
- import { ChevronDown } from '@elliemae/ds-icons';
14
- import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
15
- import { Pill } from './Pill.js';
16
- import { jsx } from 'react/jsx-runtime';
17
-
18
- var _ChevronDown;
19
-
20
- const _excluded = ["containerProps", "label", "variant", "tabIndex", "closeMenuOnItemSelection", "maxWidth", "minWidth"];
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- function DropdownPill(_ref) {
27
- let {
28
- containerProps = {},
29
- label = '',
30
- variant,
31
- tabIndex = -1,
32
- closeMenuOnItemSelection = false,
33
- maxWidth,
34
- minWidth
35
- } = _ref,
36
- dropdownProps = _objectWithoutProperties(_ref, _excluded);
37
-
38
- const ref = useRef(null);
39
- const [chevronEl, chevronRef] = useState();
40
- const {
41
- focusFirst
42
- } = useFocusGroupItem(ref);
43
- return /*#__PURE__*/jsx(DSDropdownMenu, _objectSpread(_objectSpread({}, dropdownProps), {}, {
44
- closeMenuOnItemSelection: closeMenuOnItemSelection,
45
- maxWidth: maxWidth,
46
- hideIfNotVisible: true,
47
- menuProps: {
48
- className: 'dropdown-pill-menu',
49
- zIndex: 100
50
- },
51
- minWidth: minWidth,
52
- onClose: focusFirst,
53
- referenceNode: chevronEl,
54
- triggerComponent: /*#__PURE__*/_jsx(Pill, {
55
- "data-testid": "dropdown-pill",
56
- className: "dropdown-pill",
57
- containerProps: _objectSpread({
58
- role: 'listbox'
59
- }, containerProps),
60
- innerRef: ref,
61
- label: label,
62
- rightAddon: /*#__PURE__*/jsx("div", {
63
- ref: chevronRef,
64
- children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx(ChevronDown, {
65
- className: "dropdown-pill-chevron-down",
66
- "data-testid": "dropdown-pill-button"
67
- }))
68
- }),
69
- tabIndex: tabIndex,
70
- variant: variant
71
- })
72
- }));
73
- }
74
-
75
- const props = {
76
- /** props injected to component wrapper */
77
- containerProps: PropTypes.object.description('props injected to component wrapper'),
78
-
79
- /** labeled pill text label */
80
- label: PropTypes.string.isRequired.description('pill text label'),
81
-
82
- /** pill variant */
83
- variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),
84
-
85
- /** html focus border */
86
- tabIndex: PropTypes.number.description('html focus order'),
87
-
88
- /** close menu on item selection */
89
- closeMenuOnItemSelection: PropTypes.bool.description('close menu on item selection'),
90
-
91
- /** pill max width */
92
- maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),
93
-
94
- /** pill min width */
95
- minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width')
96
- };
97
- const DSDropdownPillWithSchema = describe(DropdownPill);
98
- DSDropdownPillWithSchema.propTypes = props;
99
-
100
- export { DSDropdownPillWithSchema, DropdownPill };