@elliemae/ds-pills 2.0.0-alpha.5 → 2.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/cjs/components/Pill.js +4 -4
  2. package/cjs/components/PillButton.js +51 -0
  3. package/cjs/components/PillGroup.js +3 -3
  4. package/cjs/components/index.js +3 -0
  5. package/cjs/components/styled.js +33 -52
  6. package/cjs/components/types/DropdownPill.js +34 -32
  7. package/cjs/components/types/InputPill.js +32 -25
  8. package/cjs/components/types/LabelPill.js +14 -6
  9. package/cjs/components/types/ReadOnlyPill.js +20 -10
  10. package/cjs/components/types/RemovablePill.js +30 -19
  11. package/cjs/components/types/ValuePill.js +20 -9
  12. package/cjs/deprecated/DropdownPill.js +6 -6
  13. package/cjs/deprecated/InputPill.js +9 -9
  14. package/cjs/deprecated/LabeledDropdownPills.js +3 -3
  15. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +4 -4
  16. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +4 -4
  17. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +6 -6
  18. package/cjs/deprecated/LabeledPills.js +2 -2
  19. package/cjs/deprecated/OverflowPill.js +3 -3
  20. package/cjs/deprecated/Pill.js +4 -4
  21. package/cjs/deprecated/PillGroup.js +2 -2
  22. package/cjs/deprecated/ReadOnlyPill.js +4 -4
  23. package/cjs/deprecated/RemovablePill.js +5 -5
  24. package/cjs/index.js +4 -1
  25. package/cjs/props.js +18 -3
  26. package/esm/components/Pill.js +3 -3
  27. package/esm/components/PillButton.js +41 -0
  28. package/esm/components/index.js +1 -0
  29. package/esm/components/styled.js +28 -44
  30. package/esm/components/types/DropdownPill.js +34 -33
  31. package/esm/components/types/InputPill.js +30 -24
  32. package/esm/components/types/LabelPill.js +12 -4
  33. package/esm/components/types/ReadOnlyPill.js +20 -10
  34. package/esm/components/types/RemovablePill.js +29 -19
  35. package/esm/components/types/ValuePill.js +20 -9
  36. package/esm/deprecated/InputPill.js +2 -2
  37. package/esm/deprecated/RemovablePill.js +2 -2
  38. package/esm/index.js +1 -0
  39. package/esm/props.js +16 -3
  40. package/package.json +13 -9
  41. package/types/components/PillButton.d.ts +5 -0
  42. package/types/components/index.d.ts +1 -0
  43. package/types/components/styled.d.ts +30 -7
  44. package/types/props.d.ts +13 -0
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var React = require('react');
7
7
  var DSTooltip = require('@elliemae/ds-tooltip');
8
+ var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
8
9
  var styled = require('../styled.js');
9
10
 
10
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -12,17 +13,27 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
13
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
13
14
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
15
 
15
- const ValuePill = /*#__PURE__*/React__default['default'].memo(({
16
+ const ValuePill = /*#__PURE__*/React__default["default"].memo(({
16
17
  label,
17
- tooltipValue
18
- }) => /*#__PURE__*/_jsx__default['default'](styled.StyledValuePillWrapper, {
18
+ tooltipValue,
19
+ iconLeft,
20
+ ariaLabel
21
+ }) => /*#__PURE__*/_jsx__default["default"](styled.StyledValuePillWrapper, {
19
22
  alignItems: "center",
20
- className: "ds-pill-wrapper",
23
+ className: "ds-pill-wrapper ds-pill-wrapper-value",
21
24
  "data-testid": "ds-pill-wrapper",
22
- "aria-label": label
23
- }, void 0, tooltipValue !== '' ? /*#__PURE__*/_jsx__default['default'](DSTooltip.DSTooltipV2, {
24
- title: tooltipValue,
25
- triggerComponent: label
26
- }) : label));
25
+ "aria-label": ariaLabel || label,
26
+ cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
27
+ gutter: "xxxs",
28
+ hasIcon: iconLeft !== null
29
+ }, void 0, iconLeft, tooltipValue !== '' ? /*#__PURE__*/_jsx__default["default"](DSTooltip.DSTooltipV3, {
30
+ text: tooltipValue,
31
+ startPlacementPreference: "bottom"
32
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledSpanWithTooltip, {
33
+ className: "ds-pill-tooltip-value",
34
+ tabIndex: 0
35
+ }, void 0, label)) : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
36
+ value: label
37
+ })));
27
38
 
28
39
  exports.ValuePill = ValuePill;
@@ -28,7 +28,7 @@ const _excluded = ["containerProps", "label", "variant", "tabIndex", "closeMenuO
28
28
 
29
29
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
30
30
 
31
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
31
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
32
32
 
33
33
  function DropdownPill(_ref) {
34
34
  let {
@@ -40,14 +40,14 @@ function DropdownPill(_ref) {
40
40
  maxWidth,
41
41
  minWidth
42
42
  } = _ref,
43
- dropdownProps = _objectWithoutProperties__default['default'](_ref, _excluded);
43
+ dropdownProps = _objectWithoutProperties__default["default"](_ref, _excluded);
44
44
 
45
45
  const ref = React.useRef(null);
46
46
  const [chevronEl, chevronRef] = React.useState();
47
47
  const {
48
48
  focusFirst
49
- } = useFocusGroupItem__default['default'](ref);
50
- return /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default['default'], _objectSpread(_objectSpread({}, dropdownProps), {}, {
49
+ } = useFocusGroupItem__default["default"](ref);
50
+ return /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default["default"], _objectSpread(_objectSpread({}, dropdownProps), {}, {
51
51
  closeMenuOnItemSelection: closeMenuOnItemSelection,
52
52
  maxWidth: maxWidth,
53
53
  hideIfNotVisible: true,
@@ -58,7 +58,7 @@ function DropdownPill(_ref) {
58
58
  minWidth: minWidth,
59
59
  onClose: focusFirst,
60
60
  referenceNode: chevronEl,
61
- triggerComponent: /*#__PURE__*/_jsx__default['default'](Pill.Pill, {
61
+ triggerComponent: /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
62
62
  "data-testid": "dropdown-pill",
63
63
  className: "dropdown-pill",
64
64
  containerProps: _objectSpread({
@@ -68,7 +68,7 @@ function DropdownPill(_ref) {
68
68
  label: label,
69
69
  rightAddon: /*#__PURE__*/jsxRuntime.jsx("div", {
70
70
  ref: chevronRef,
71
- children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx__default['default'](ChevronDown__default['default'], {
71
+ children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx__default["default"](ChevronDown__default["default"], {
72
72
  className: "dropdown-pill-chevron-down",
73
73
  "data-testid": "dropdown-pill-button"
74
74
  }))
@@ -6,7 +6,7 @@ var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
7
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
8
8
  require('react');
9
- var CloseXsmall = require('@elliemae/ds-icons/CloseXsmall');
9
+ var CloseIcon = require('@elliemae/ds-icons/CloseXsmall');
10
10
  var dsClassnames = require('@elliemae/ds-classnames');
11
11
  var DSInputMask = require('@elliemae/ds-form/InputMask');
12
12
  var DSInput = require('@elliemae/ds-form/Input');
@@ -18,7 +18,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
18
18
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
19
19
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
20
20
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
21
- var CloseXsmall__default = /*#__PURE__*/_interopDefaultLegacy(CloseXsmall);
21
+ var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
22
22
  var DSInputMask__default = /*#__PURE__*/_interopDefaultLegacy(DSInputMask);
23
23
  var DSInput__default = /*#__PURE__*/_interopDefaultLegacy(DSInput);
24
24
 
@@ -26,7 +26,7 @@ const _excluded = ["containerProps", "placeholder", "onChange", "onRemove", "val
26
26
 
27
27
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
28
28
 
29
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
30
30
  const StyledInputPill = dsClassnames.aggregatedClasses(Pill.Pill)('input-pill', null, ({
31
31
  value
32
32
  }) => ({
@@ -41,22 +41,22 @@ function InputPill(_ref) {
41
41
  value,
42
42
  type
43
43
  } = _ref,
44
- otherProps = _objectWithoutProperties__default['default'](_ref, _excluded);
44
+ otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
45
45
 
46
- let TypeOfInput = DSInput__default['default']; // TODO: implement the DSTimeInput, see how because it returns a moment()
46
+ let TypeOfInput = DSInput__default["default"]; // TODO: implement the DSTimeInput, see how because it returns a moment()
47
47
  // TODO: implement the DSDateInput
48
48
 
49
49
  switch (type) {
50
50
  case 'inputText':
51
- TypeOfInput = DSInput__default['default'];
51
+ TypeOfInput = DSInput__default["default"];
52
52
  break;
53
53
 
54
54
  case 'inputMask':
55
- TypeOfInput = DSInputMask__default['default'];
55
+ TypeOfInput = DSInputMask__default["default"];
56
56
  break;
57
57
  }
58
58
 
59
- return /*#__PURE__*/_jsx__default['default'](StyledInputPill, {
59
+ return /*#__PURE__*/_jsx__default["default"](StyledInputPill, {
60
60
  className: "input-pill",
61
61
  classProps: {
62
62
  value
@@ -68,7 +68,7 @@ function InputPill(_ref) {
68
68
  placeholder: placeholder,
69
69
  value: value
70
70
  }, otherProps)),
71
- rightAddon: value && /*#__PURE__*/_jsx__default['default'](CloseXsmall__default['default'], {
71
+ rightAddon: value && /*#__PURE__*/_jsx__default["default"](CloseIcon__default["default"], {
72
72
  className: "remove-pill-button",
73
73
  "data-testid": "remove-pill-button",
74
74
  onClick: onRemove
@@ -23,7 +23,7 @@ const _excluded = ["label", "value", "type", "onFocusNextGroup", "onFocusPreviou
23
23
 
24
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25
25
 
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
27
  const DropdownPills = {
28
28
  single: LabeledDropdownSinglePill,
29
29
  multi: LabeledDropdownMultiPill,
@@ -44,10 +44,10 @@ function LabeledDropdownPills(_ref) {
44
44
  minWidth,
45
45
  fixed
46
46
  } = _ref,
47
- menuProps = _objectWithoutProperties__default['default'](_ref, _excluded);
47
+ menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
48
48
 
49
49
  const Component = createDropdownPill(type);
50
- return /*#__PURE__*/_jsx__default['default'](PillGroup.PillGroup, {
50
+ return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
51
51
  onFocusGroupSet: onFocusGroupSet,
52
52
  onFocusNextGroup: onFocusNextGroup,
53
53
  onFocusPreviousGroup: onFocusPreviousGroup
@@ -20,7 +20,7 @@ const _excluded = ["label", "options", "value", "onChange", "onRemove", "value",
20
20
 
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
22
 
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
24
 
25
25
  function renderMenuItems(options, factory) {
26
26
  return options.map((option, index) => {
@@ -68,7 +68,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
68
68
  maxWidth,
69
69
  minWidth
70
70
  } = _ref,
71
- menuProps = _objectWithoutProperties__default['default'](_ref, _excluded);
71
+ menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
72
72
 
73
73
  const selectionId = Object.keys(selection)[0];
74
74
  const selectionValues = selection[selectionId] || '';
@@ -99,7 +99,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
99
99
  onRemove(option);
100
100
  };
101
101
 
102
- return /*#__PURE__*/_jsx__default['default'](PillGroup.PillGroup, {
102
+ return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
103
103
  onFocusGroupSet: onFocusGroupSet,
104
104
  onFocusNextGroup: onFocusNextGroup,
105
105
  onFocusPreviousGroup: onFocusPreviousGroup
@@ -115,7 +115,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
115
115
  },
116
116
  singleGroupSelection: true,
117
117
  variant: "title"
118
- })), Array.isArray(selectionValues) && selectionValues.map(option => /*#__PURE__*/_jsx__default['default'](RemovablePill.RemovablePill, {
118
+ })), Array.isArray(selectionValues) && selectionValues.map(option => /*#__PURE__*/_jsx__default["default"](RemovablePill.RemovablePill, {
119
119
  label: option.label,
120
120
  onRemove: () => removeOption(option)
121
121
  }, option.id)));
@@ -22,7 +22,7 @@ const _excluded = ["label", "options", "value", "onSelect", "onRemove", "onChang
22
22
 
23
23
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
24
24
 
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
26
  function LabeledDropdownMultiPills(_ref) {
27
27
  let {
28
28
  label,
@@ -35,7 +35,7 @@ function LabeledDropdownMultiPills(_ref) {
35
35
  maxWidth,
36
36
  minWidth
37
37
  } = _ref,
38
- menuProps = _objectWithoutProperties__default['default'](_ref, _excluded);
38
+ menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
39
39
 
40
40
  const [totalDefaultOptions, setTotalDefaultOptions] = React.useState(0);
41
41
  const [selectedOptions, setSelectedOptions] = React.useState(value);
@@ -128,14 +128,14 @@ function LabeledDropdownMultiPills(_ref) {
128
128
  const TypeOfPill = typeOfPill();
129
129
 
130
130
  if (index < overflowQuantity) {
131
- return /*#__PURE__*/_jsx__default['default'](TypeOfPill, {
131
+ return /*#__PURE__*/_jsx__default["default"](TypeOfPill, {
132
132
  label: option.label,
133
133
  onRemove: () => removeOption(option)
134
134
  }, option.id);
135
135
  }
136
136
 
137
137
  return null;
138
- }), selectedOptions && selectedOptions.length > overflowQuantity && /*#__PURE__*/_jsx__default['default'](OverflowPill.OverflowPill, {
138
+ }), selectedOptions && selectedOptions.length > overflowQuantity && /*#__PURE__*/_jsx__default["default"](OverflowPill.OverflowPill, {
139
139
  label: `+ ${selectedOptions.length - overflowQuantity}`,
140
140
  options: overflowOptions
141
141
  })]
@@ -29,7 +29,7 @@ const _excluded = ["label", "labelIsValue", "options", "value", "onSelect", "onC
29
29
 
30
30
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
31
31
 
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
33
33
  function LabeledDropdownSinglePill(_ref) {
34
34
  let {
35
35
  label,
@@ -42,11 +42,11 @@ function LabeledDropdownSinglePill(_ref) {
42
42
  minWidth,
43
43
  fixed = false
44
44
  } = _ref,
45
- menuProps = _objectWithoutProperties__default['default'](_ref, _excluded);
45
+ menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
46
46
 
47
47
  const [optionValue, setOptionValue] = React.useState(value);
48
- const prevOptions = usePrevious__default['default'](options);
49
- const areOptionsEqual = useShouldRecalculate__default['default'](utils.hasOptionChanged(prevOptions, options));
48
+ const prevOptions = usePrevious__default["default"](options);
49
+ const areOptionsEqual = useShouldRecalculate__default["default"](utils.hasOptionChanged(prevOptions, options));
50
50
  React.useEffect(() => setOptionValue(value), [value]);
51
51
  React.useEffect(() => {
52
52
  const selectedValue = options.find(option => option.selected);
@@ -104,7 +104,7 @@ function LabeledDropdownSinglePill(_ref) {
104
104
  input,
105
105
  onChangeInput
106
106
  } = option,
107
- otherProps = _objectWithoutProperties__default['default'](option, _excluded2);
107
+ otherProps = _objectWithoutProperties__default["default"](option, _excluded2);
108
108
 
109
109
  let SelectedPill;
110
110
 
@@ -127,7 +127,7 @@ function LabeledDropdownSinglePill(_ref) {
127
127
  const renderSelection = () => {
128
128
  if (!labelIsValue) {
129
129
  if (optionValue) return renderPill(optionValue, fixed);
130
- return _Pill || (_Pill = /*#__PURE__*/_jsx__default['default'](Pill.Pill, {
130
+ return _Pill || (_Pill = /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
131
131
  label: "-"
132
132
  }));
133
133
  }
@@ -21,11 +21,11 @@ function LabeledPills({
21
21
  onFocusNextGroup,
22
22
  onFocusPreviousGroup
23
23
  }) {
24
- return /*#__PURE__*/_jsx__default['default'](PillGroup.PillGroup, {
24
+ return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
25
25
  onFocusGroupSet: onFocusGroupSet,
26
26
  onFocusNextGroup: onFocusNextGroup,
27
27
  onFocusPreviousGroup: onFocusPreviousGroup
28
- }, void 0, /*#__PURE__*/_jsx__default['default'](Pill.Pill, {
28
+ }, void 0, /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
29
29
  label: label,
30
30
  leftAddon: leftAddon,
31
31
  variant: "title",
@@ -34,12 +34,12 @@ function OverflowPill({
34
34
  });
35
35
  setTooltipText(text);
36
36
  }, [options]);
37
- useFocusGroupItem__default['default'](ref);
38
- return /*#__PURE__*/_jsx__default['default'](DSTooltip__default['default'], {
37
+ useFocusGroupItem__default["default"](ref);
38
+ return /*#__PURE__*/_jsx__default["default"](DSTooltip__default["default"], {
39
39
  isOpen: tooltipIsOpen,
40
40
  title: tooltipText,
41
41
  zIndex: 11,
42
- triggerComponent: /*#__PURE__*/_jsx__default['default'](Pill.Pill, {
42
+ triggerComponent: /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
43
43
  className: "overflow-pill",
44
44
  containerProps: containerProps,
45
45
  innerRef: ref,
@@ -20,7 +20,7 @@ const _excluded = ["containerProps", "label", "leftAddon", "rightAddon", "varian
20
20
 
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
22
 
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
24
  const pillBlockName = 'pill';
25
25
  const PillWrapper = dsClassnames.aggregatedClasses('div')(pillBlockName, null, ({
26
26
  size,
@@ -41,7 +41,7 @@ function Pill(_ref) {
41
41
  variant = 'value',
42
42
  size = 'm'
43
43
  } = _ref,
44
- otherProps = _objectWithoutProperties__default['default'](_ref, _excluded);
44
+ otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
45
45
 
46
46
  return /*#__PURE__*/jsxRuntime.jsxs(PillWrapper, _objectSpread(_objectSpread(_objectSpread({}, containerProps), {}, {
47
47
  classProps: {
@@ -49,7 +49,7 @@ function Pill(_ref) {
49
49
  size
50
50
  }
51
51
  }, otherProps), {}, {
52
- children: [leftAddon && /*#__PURE__*/_jsx__default['default'](PillAddon, {}, void 0, leftAddon), /*#__PURE__*/_jsx__default['default'](PillLabel, {}, void 0, label), rightAddon && /*#__PURE__*/_jsx__default['default'](PillAddon, {}, void 0, rightAddon)]
52
+ children: [leftAddon && /*#__PURE__*/_jsx__default["default"](PillAddon, {}, void 0, leftAddon), /*#__PURE__*/_jsx__default["default"](PillLabel, {}, void 0, label), rightAddon && /*#__PURE__*/_jsx__default["default"](PillAddon, {}, void 0, rightAddon)]
53
53
  }));
54
54
  }
55
55
 
@@ -77,4 +77,4 @@ DSPillWithSchema.propTypes = props;
77
77
 
78
78
  exports.DSPillWithSchema = DSPillWithSchema;
79
79
  exports.Pill = Pill;
80
- exports['default'] = Pill;
80
+ exports["default"] = Pill;
@@ -18,7 +18,7 @@ var FocusGroupProvider__default = /*#__PURE__*/_interopDefaultLegacy(FocusGroupP
18
18
 
19
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
20
20
 
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
22
22
  const pillGroupBlockName = 'pill-group';
23
23
  const Container = dsClassnames.aggregatedClasses('div')(pillGroupBlockName);
24
24
 
@@ -28,7 +28,7 @@ const PillGroup = ({
28
28
  onFocusPreviousGroup,
29
29
  onFocusGroupSet,
30
30
  children
31
- }) => /*#__PURE__*/_jsx__default['default'](FocusGroupProvider__default['default'], {
31
+ }) => /*#__PURE__*/_jsx__default["default"](FocusGroupProvider__default["default"], {
32
32
  keyBindings: {
33
33
  Tab: 'next'
34
34
  },
@@ -35,21 +35,21 @@ const ReadOnlyPill = ({
35
35
  };
36
36
 
37
37
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
38
- children: [/*#__PURE__*/_jsx__default['default'](Pill.Pill, {
38
+ children: [/*#__PURE__*/_jsx__default["default"](Pill.Pill, {
39
39
  "data-testid": "read-only-pill",
40
40
  className: "removable-pill",
41
41
  containerProps: containerProps,
42
42
  innerRef: ref,
43
43
  label: label,
44
44
  leftAddon: leftAddon,
45
- rightAddon: /*#__PURE__*/_jsx__default['default'](Popover__default['default'], {
45
+ rightAddon: /*#__PURE__*/_jsx__default["default"](Popover__default["default"], {
46
46
  isOpen: tooltipText && isTooltipOpen,
47
47
  content: tooltipText,
48
48
  placement: "top",
49
49
  showArrow: true,
50
50
  renderTrigger: ({
51
51
  ref
52
- }) => /*#__PURE__*/_jsx__default['default'](InfoCircleSmall__default['default'], {
52
+ }) => /*#__PURE__*/_jsx__default["default"](InfoCircleSmall__default["default"], {
53
53
  role: "button",
54
54
  "data-testid": "read-only-info-btn",
55
55
  className: "remove-pill-button",
@@ -61,7 +61,7 @@ const ReadOnlyPill = ({
61
61
  })
62
62
  }),
63
63
  tabIndex: -1
64
- }), /*#__PURE__*/_jsx__default['default'](DSModal__default['default'], {
64
+ }), /*#__PURE__*/_jsx__default["default"](DSModal__default["default"], {
65
65
  isOpen: isModalOpen,
66
66
  showClose: true,
67
67
  shouldCloseOnOverlayClick: true,
@@ -6,14 +6,14 @@ var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var React = require('react');
7
7
  var reactDesc = require('react-desc');
8
8
  var utils = require('@elliemae/ds-utilities/utils');
9
- var CloseXsmall = require('@elliemae/ds-icons/CloseXsmall');
9
+ var CloseIcon = require('@elliemae/ds-icons/CloseXsmall');
10
10
  var useFocusGroupItem = require('@elliemae/ds-shared/FocusGroup/useFocusGroupItem');
11
11
  var Pill = require('./Pill.js');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
15
15
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
16
- var CloseXsmall__default = /*#__PURE__*/_interopDefaultLegacy(CloseXsmall);
16
+ var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
17
17
  var useFocusGroupItem__default = /*#__PURE__*/_interopDefaultLegacy(useFocusGroupItem);
18
18
 
19
19
  function RemovablePill({
@@ -26,8 +26,8 @@ function RemovablePill({
26
26
  const ref = React.useRef(null);
27
27
  const {
28
28
  focusPrevious
29
- } = useFocusGroupItem__default['default'](ref);
30
- return /*#__PURE__*/_jsx__default['default'](Pill.Pill, {
29
+ } = useFocusGroupItem__default["default"](ref);
30
+ return /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
31
31
  className: "removable-pill",
32
32
  "data-testid": "removable-pill",
33
33
  containerProps: containerProps,
@@ -41,7 +41,7 @@ function RemovablePill({
41
41
  if (utils.isFunction(focusPrevious)) focusPrevious();
42
42
  }
43
43
  },
44
- rightAddon: /*#__PURE__*/_jsx__default['default'](CloseXsmall__default['default'], {
44
+ rightAddon: /*#__PURE__*/_jsx__default["default"](CloseIcon__default["default"], {
45
45
  role: "button",
46
46
  "data-testid": "remove-pill-button",
47
47
  className: "remove-pill-button",
package/cjs/index.js CHANGED
@@ -12,12 +12,13 @@ var ReadOnlyPill = require('./deprecated/ReadOnlyPill.js');
12
12
  var OverflowPill = require('./deprecated/OverflowPill.js');
13
13
  var Pill$1 = require('./components/Pill.js');
14
14
  var PillGroup$1 = require('./components/PillGroup.js');
15
+ var PillButton = require('./components/PillButton.js');
15
16
 
16
17
 
17
18
 
18
19
  exports.DSPillWithSchema = Pill.DSPillWithSchema;
19
20
  exports.Pill = Pill.Pill;
20
- exports.default = Pill.Pill;
21
+ exports["default"] = Pill.Pill;
21
22
  exports.Container = PillGroup.Container;
22
23
  exports.DSPillGroupWithSchema = PillGroup.DSPillGroupWithSchema;
23
24
  exports.PillGroup = PillGroup.PillGroup;
@@ -38,3 +39,5 @@ exports.DSPillV2WithSchema = Pill$1.DSPillV2WithSchema;
38
39
  exports.DSPillGroupV2 = PillGroup$1.DSPillGroupV2;
39
40
  exports.DSPillGroupV2Context = PillGroup$1.DSPillGroupV2Context;
40
41
  exports.DSPillGroupV2WithSchema = PillGroup$1.DSPillGroupV2WithSchema;
42
+ exports.DSPillButton = PillButton.DSPillButton;
43
+ exports.DSPillButtonWithSchema = PillButton.DSPillButtonWithSchema;
package/cjs/props.js CHANGED
@@ -10,11 +10,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var DSInput__default = /*#__PURE__*/_interopDefaultLegacy(DSInput);
11
11
 
12
12
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
13
- const pillTypes = reactDesc.PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable']);
13
+ const pillTypes = reactDesc.PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable', 'readonly']);
14
14
  const DSPillV2PropTypes = {
15
15
  label: reactDesc.PropTypes.string.description('Label to show in the pill').isRequired,
16
16
  type: pillTypes.description('The type of pill that you want to render').isRequired,
17
17
  innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Reference to the focuseable internal element of each pill (remove icons, inputs, dropdown, etc.)').defaultValue(() => null),
18
+ ariaLabel: reactDesc.PropTypes.string.description('Aria label for the pill. If not provided we will use the label').defaultValue(''),
19
+ tooltipValue: reactDesc.PropTypes.string.description('String to show as a tooltip in the value pill').defaultValue(''),
18
20
  iconLeft: reactDesc.PropTypes.node.description('A component to show int the left of a readonly pill').defaultValue(null),
19
21
  iconRight: reactDesc.PropTypes.node.description('A component to show in the right of a readonly pill').defaultValue(null),
20
22
  onRemove: reactDesc.PropTypes.func.description('Callback triggered when removing a pill with the close icon').defaultValue(() => null),
@@ -24,8 +26,14 @@ const DSPillV2PropTypes = {
24
26
  inputWidth: reactDesc.PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
25
27
  dropdownProps: reactDesc.PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({})
26
28
  };
29
+ const DSPillButtonPropTypes = {
30
+ type: reactDesc.PropTypes.oneOf(['only', 'left', 'right']).description('The position in which this button will be placed. Only used for css styling internally').defaultValue('right'),
31
+ width: reactDesc.PropTypes.string.description('Width of the button').defaultValue('100%'),
32
+ height: reactDesc.PropTypes.string.description('Height of the button').defaultValue('100%')
33
+ };
27
34
  const DSPillV2DefaultProps = {
28
35
  innerRef: () => null,
36
+ ariaLabel: '',
29
37
  tooltipValue: '',
30
38
  iconLeft: null,
31
39
  iconRight: null,
@@ -33,10 +41,17 @@ const DSPillV2DefaultProps = {
33
41
  inputPlaceholder: '',
34
42
  onInputChange: () => null,
35
43
  onInputClear: () => null,
36
- inputWidth: 150,
37
- inputRender: DSInput__default['default'],
44
+ inputWidth: 72,
45
+ inputRender: DSInput__default["default"],
38
46
  dropdownProps: {}
39
47
  };
48
+ const DSPillButtonDefaultProps = {
49
+ type: 'right',
50
+ width: '100%',
51
+ height: '100%'
52
+ };
40
53
 
54
+ exports.DSPillButtonDefaultProps = DSPillButtonDefaultProps;
55
+ exports.DSPillButtonPropTypes = DSPillButtonPropTypes;
41
56
  exports.DSPillV2DefaultProps = DSPillV2DefaultProps;
42
57
  exports.DSPillV2PropTypes = DSPillV2PropTypes;
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
2
  import 'react';
3
3
  import { describe } from 'react-desc';
4
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
4
5
  import { DSPillV2PropTypes, DSPillV2DefaultProps } from '../props.js';
5
6
  import { DropdownPill } from './types/DropdownPill.js';
6
7
  import { InputPill } from './types/InputPill.js';
@@ -23,9 +24,8 @@ const pillComponentGetter = {
23
24
  };
24
25
 
25
26
  const DSPillV2 = props => {
26
- // TODO -- investigate why showcase story doesn't work with useMemoMerge
27
- const propsWithDefaults = _objectSpread(_objectSpread({}, DSPillV2DefaultProps), props);
28
-
27
+ const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillV2DefaultProps);
28
+ useValidateTypescriptPropTypes(propsWithDefaults, DSPillV2WithSchema.toTypescript());
29
29
  const {
30
30
  type
31
31
  } = propsWithDefaults;
@@ -0,0 +1,41 @@
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
3
+ import 'react';
4
+ import { describe } from 'react-desc';
5
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
6
+ import { StyledPillButton } from './styled.js';
7
+ import { DSPillButtonPropTypes, DSPillButtonDefaultProps } from '../props.js';
8
+ import { jsx } from 'react/jsx-runtime';
9
+
10
+ const _excluded = ["type", "children"];
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
+ const typeToClassName = {
16
+ only: 'ds-pill-button-only',
17
+ left: 'ds-pill-button-left',
18
+ right: 'ds-pill-button-right'
19
+ };
20
+
21
+ const DSPillButton = props => {
22
+ const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillButtonDefaultProps);
23
+ useValidateTypescriptPropTypes(propsWithDefaults, DSPillButtonWithSchema.toTypescript());
24
+
25
+ const {
26
+ type,
27
+ children
28
+ } = propsWithDefaults,
29
+ rest = _objectWithoutProperties(propsWithDefaults, _excluded);
30
+
31
+ return /*#__PURE__*/jsx(StyledPillButton, _objectSpread(_objectSpread({}, rest), {}, {
32
+ buttonType: "raw",
33
+ className: `${typeToClassName[type]} ${rest.className}`,
34
+ children: children
35
+ }));
36
+ };
37
+
38
+ const DSPillButtonWithSchema = describe(DSPillButton).description('Pill button');
39
+ DSPillButtonWithSchema.propTypes = DSPillButtonPropTypes;
40
+
41
+ export { DSPillButton, DSPillButtonWithSchema };
@@ -1,2 +1,3 @@
1
1
  export { DSPillV2, DSPillV2WithSchema } from './Pill.js';
2
2
  export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema } from './PillGroup.js';
3
+ export { DSPillButton, DSPillButtonWithSchema } from './PillButton.js';