@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.
- package/cjs/components/Pill.js +4 -4
- package/cjs/components/PillButton.js +51 -0
- package/cjs/components/PillGroup.js +3 -3
- package/cjs/components/index.js +3 -0
- package/cjs/components/styled.js +33 -52
- package/cjs/components/types/DropdownPill.js +34 -32
- package/cjs/components/types/InputPill.js +32 -25
- package/cjs/components/types/LabelPill.js +14 -6
- package/cjs/components/types/ReadOnlyPill.js +20 -10
- package/cjs/components/types/RemovablePill.js +30 -19
- package/cjs/components/types/ValuePill.js +20 -9
- package/cjs/deprecated/DropdownPill.js +6 -6
- package/cjs/deprecated/InputPill.js +9 -9
- package/cjs/deprecated/LabeledDropdownPills.js +3 -3
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +4 -4
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +4 -4
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +6 -6
- package/cjs/deprecated/LabeledPills.js +2 -2
- package/cjs/deprecated/OverflowPill.js +3 -3
- package/cjs/deprecated/Pill.js +4 -4
- package/cjs/deprecated/PillGroup.js +2 -2
- package/cjs/deprecated/ReadOnlyPill.js +4 -4
- package/cjs/deprecated/RemovablePill.js +5 -5
- package/cjs/index.js +4 -1
- package/cjs/props.js +18 -3
- package/esm/components/Pill.js +3 -3
- package/esm/components/PillButton.js +41 -0
- package/esm/components/index.js +1 -0
- package/esm/components/styled.js +28 -44
- package/esm/components/types/DropdownPill.js +34 -33
- package/esm/components/types/InputPill.js +30 -24
- package/esm/components/types/LabelPill.js +12 -4
- package/esm/components/types/ReadOnlyPill.js +20 -10
- package/esm/components/types/RemovablePill.js +29 -19
- package/esm/components/types/ValuePill.js +20 -9
- package/esm/deprecated/InputPill.js +2 -2
- package/esm/deprecated/RemovablePill.js +2 -2
- package/esm/index.js +1 -0
- package/esm/props.js +16 -3
- package/package.json +13 -9
- package/types/components/PillButton.d.ts +5 -0
- package/types/components/index.d.ts +1 -0
- package/types/components/styled.d.ts +30 -7
- package/types/props.d.ts +13 -0
package/cjs/components/Pill.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
require('react');
|
|
7
7
|
var reactDesc = require('react-desc');
|
|
8
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
8
9
|
var props = require('../props.js');
|
|
9
10
|
var DropdownPill = require('./types/DropdownPill.js');
|
|
10
11
|
var InputPill = require('./types/InputPill.js');
|
|
@@ -20,7 +21,7 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
20
21
|
|
|
21
22
|
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
23
|
|
|
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[
|
|
24
|
+
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
25
|
const pillComponentGetter = {
|
|
25
26
|
dropdown: DropdownPill.DropdownPill,
|
|
26
27
|
input: InputPill.InputPill,
|
|
@@ -31,9 +32,8 @@ const pillComponentGetter = {
|
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const DSPillV2 = props$1 => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const propsWithDefaults = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.DSPillV2DefaultProps);
|
|
36
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefaults, DSPillV2WithSchema.toTypescript());
|
|
37
37
|
const {
|
|
38
38
|
type
|
|
39
39
|
} = propsWithDefaults;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
require('react');
|
|
8
|
+
var reactDesc = require('react-desc');
|
|
9
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
10
|
+
var styled = require('./styled.js');
|
|
11
|
+
var props = require('../props.js');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
18
|
+
|
|
19
|
+
const _excluded = ["type", "children"];
|
|
20
|
+
|
|
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
|
+
|
|
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
|
+
const typeToClassName = {
|
|
25
|
+
only: 'ds-pill-button-only',
|
|
26
|
+
left: 'ds-pill-button-left',
|
|
27
|
+
right: 'ds-pill-button-right'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const DSPillButton = props$1 => {
|
|
31
|
+
const propsWithDefaults = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.DSPillButtonDefaultProps);
|
|
32
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefaults, DSPillButtonWithSchema.toTypescript());
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
type,
|
|
36
|
+
children
|
|
37
|
+
} = propsWithDefaults,
|
|
38
|
+
rest = _objectWithoutProperties__default["default"](propsWithDefaults, _excluded);
|
|
39
|
+
|
|
40
|
+
return /*#__PURE__*/jsxRuntime.jsx(styled.StyledPillButton, _objectSpread(_objectSpread({}, rest), {}, {
|
|
41
|
+
buttonType: "raw",
|
|
42
|
+
className: `${typeToClassName[type]} ${rest.className}`,
|
|
43
|
+
children: children
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const DSPillButtonWithSchema = reactDesc.describe(DSPillButton).description('Pill button');
|
|
48
|
+
DSPillButtonWithSchema.propTypes = props.DSPillButtonPropTypes;
|
|
49
|
+
|
|
50
|
+
exports.DSPillButton = DSPillButton;
|
|
51
|
+
exports.DSPillButtonWithSchema = DSPillButtonWithSchema;
|
|
@@ -31,13 +31,13 @@ const DSPillGroupV2 = ({
|
|
|
31
31
|
elems[pillIndex + 1].focus();
|
|
32
32
|
}
|
|
33
33
|
}, [pillGroupUid]);
|
|
34
|
-
return /*#__PURE__*/_jsx__default[
|
|
34
|
+
return /*#__PURE__*/_jsx__default["default"](DSPillGroupV2Context.Provider, {
|
|
35
35
|
value: {
|
|
36
36
|
onKeyboardRemove
|
|
37
37
|
}
|
|
38
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
38
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledPillGroup, {
|
|
39
39
|
id: pillGroupUid,
|
|
40
|
-
cols: React__default[
|
|
40
|
+
cols: React__default["default"].Children.map(children, () => 'auto'),
|
|
41
41
|
gutter: "2px"
|
|
42
42
|
}, void 0, children));
|
|
43
43
|
};
|
package/cjs/components/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Pill = require('./Pill.js');
|
|
6
6
|
var PillGroup = require('./PillGroup.js');
|
|
7
|
+
var PillButton = require('./PillButton.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
@@ -12,3 +13,5 @@ exports.DSPillV2WithSchema = Pill.DSPillV2WithSchema;
|
|
|
12
13
|
exports.DSPillGroupV2 = PillGroup.DSPillGroupV2;
|
|
13
14
|
exports.DSPillGroupV2Context = PillGroup.DSPillGroupV2Context;
|
|
14
15
|
exports.DSPillGroupV2WithSchema = PillGroup.DSPillGroupV2WithSchema;
|
|
16
|
+
exports.DSPillButton = PillButton.DSPillButton;
|
|
17
|
+
exports.DSPillButtonWithSchema = PillButton.DSPillButtonWithSchema;
|
package/cjs/components/styled.js
CHANGED
|
@@ -4,85 +4,66 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var styled = require('styled-components');
|
|
6
6
|
var Grid = require('@elliemae/ds-grid');
|
|
7
|
-
var
|
|
8
|
-
var ChevronDown = require('@elliemae/ds-icons/ChevronSmallDown');
|
|
7
|
+
var dsButton = require('@elliemae/ds-button');
|
|
9
8
|
|
|
10
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
10
|
|
|
12
11
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
12
|
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
14
|
-
var CloseXsmall__default = /*#__PURE__*/_interopDefaultLegacy(CloseXsmall);
|
|
15
|
-
var ChevronDown__default = /*#__PURE__*/_interopDefaultLegacy(ChevronDown);
|
|
16
13
|
|
|
17
14
|
/* eslint-disable max-lines */
|
|
18
15
|
// Common CSS
|
|
19
16
|
// =============================================================================
|
|
20
17
|
|
|
21
|
-
const borderOutside = color => styled.css([":after{content:' ';position:absolute;top:0px;left:0px;right:0px;bottom:0px;border:
|
|
18
|
+
const borderOutside = (color, size = 1, zIndex = 2, borderRadius = '12px') => styled.css([":after{content:' ';position:absolute;top:0px;left:0px;right:0px;bottom:0px;border:", "px solid ", ";border-top-left-radius:", ";border-top-right-radius:", ";border-bottom-left-radius:", ";border-bottom-right-radius:", ";pointer-events:none;z-index:", ";}"], size, color, borderRadius, borderRadius, borderRadius, borderRadius, zIndex);
|
|
22
19
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const commonPillWrapperCss = /*#__PURE__*/styled.css(["height:24px;position:relative;width:fit-content;background-color:", ";outline:none;padding:0px 12px 0 12px;border-radius:12px;font-size:", ";color:", ";"], props => props.theme.colors.brand[200], props => props.theme.fontSizes.value[400], props => props.theme.colors.neutral[800]);
|
|
26
|
-
const commonFocuseablePillWrapperCss = /*#__PURE__*/styled.css([":focus,:hover,:active{color:", ";", " ", "}"], props => props.theme.colors.brand[800], props => borderOutside(props.theme.colors.brand[600]), props => borderInside(props.theme.colors.brand[300])); // =============================================================================
|
|
27
|
-
// Pill content
|
|
20
|
+
const commonPillWrapperCss = /*#__PURE__*/styled.css(["height:24px;position:relative;width:fit-content;background-color:", ";outline:none;padding:0px 12px 0 12px;border-radius:12px;font-size:13px;line-height:1;color:", ";", ";"], props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => borderOutside(props.theme.colors.brand[300])); // =============================================================================
|
|
21
|
+
// Pills wrappers
|
|
28
22
|
// =============================================================================
|
|
29
23
|
|
|
30
|
-
const
|
|
24
|
+
const StyledLabelPillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
31
25
|
componentId: "sc-j0tlch-0"
|
|
32
|
-
})(["
|
|
33
|
-
|
|
34
|
-
theme
|
|
35
|
-
}) => value === '' ? theme.colors.neutral[500] : theme.colors.brand[800], props => props.inputWidth, props => props.theme.colors.brand[800]); // =============================================================================
|
|
36
|
-
// Icons
|
|
37
|
-
// =============================================================================
|
|
38
|
-
|
|
39
|
-
const StyledCloseIcon = /*#__PURE__*/styled__default['default'](CloseXsmall__default['default']).withConfig({
|
|
26
|
+
})(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIcon ? '0px !important' : '12px');
|
|
27
|
+
const StyledValuePillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
40
28
|
componentId: "sc-j0tlch-1"
|
|
41
|
-
})(["
|
|
42
|
-
const
|
|
29
|
+
})(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.regular, props => props.hasIcon ? '0px !important' : '12px');
|
|
30
|
+
const StyledInputPillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
43
31
|
componentId: "sc-j0tlch-2"
|
|
44
|
-
})(["
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
32
|
+
})(["", " 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'], ({
|
|
33
|
+
value,
|
|
34
|
+
theme
|
|
35
|
+
}) => borderOutside(value === '' ? theme.colors.neutral[400] : theme.colors.brand[500]), props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '', props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '', props => `${props.inputWidth + (props.value === '' ? 24 : 0)}px`);
|
|
36
|
+
const StyledDropdownPillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
49
37
|
componentId: "sc-j0tlch-3"
|
|
50
|
-
})(["", "
|
|
51
|
-
const
|
|
38
|
+
})(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.semibold);
|
|
39
|
+
const StyledReadonlyPillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
52
40
|
componentId: "sc-j0tlch-4"
|
|
53
|
-
})(["", " ", "
|
|
54
|
-
const
|
|
41
|
+
})(["", " font-weight:", ";padding-right:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIconRight ? '0 !important' : '12px', props => props.hasIconLeft ? '0 !important' : '12px');
|
|
42
|
+
const StyledRemovablePillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
55
43
|
componentId: "sc-j0tlch-5"
|
|
56
|
-
})(["", "
|
|
57
|
-
value,
|
|
58
|
-
theme
|
|
59
|
-
}) => value === '' ? theme.colors.neutral['000'] : theme.colors.brand[200], ({
|
|
60
|
-
value,
|
|
61
|
-
theme
|
|
62
|
-
}) => value === '' ? `1px solid ${theme.colors.neutral[300]}` : '1px solid transparent', props => props.theme.colors.brand[600], props => props.theme.colors.brand[300], props => props.theme.colors.brand[200], props => props.theme.colors.brand[700], props => `${props.inputWidth}px`);
|
|
63
|
-
const StyledDropdownPillWrapper = /*#__PURE__*/styled__default['default'](Grid__default['default']).withConfig({
|
|
64
|
-
componentId: "sc-j0tlch-6"
|
|
65
|
-
})(["", " ", " font-weight:", ";cursor:pointer;padding:1px 3px 0 12px;:focus,:hover,:active{& ", "{fill:", ";}}"], commonPillWrapperCss, commonFocuseablePillWrapperCss, props => props.theme.fontWeights.semibold, StyledChevronDown, props => props.theme.colors.brand[800]);
|
|
66
|
-
const StyledReadonlyPillWrapper = /*#__PURE__*/styled__default['default'](Grid__default['default']).withConfig({
|
|
67
|
-
componentId: "sc-j0tlch-7"
|
|
68
|
-
})(["", " font-weight:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold);
|
|
69
|
-
const StyledRemovablePillWrapper = /*#__PURE__*/styled__default['default'](Grid__default['default']).withConfig({
|
|
70
|
-
componentId: "sc-j0tlch-8"
|
|
71
|
-
})(["", " ", " font-weight:", ";padding:1px 3px 0 12px;"], commonPillWrapperCss, commonFocuseablePillWrapperCss, props => props.theme.fontWeights.regular); // =============================================================================
|
|
44
|
+
})(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.regular); // =============================================================================
|
|
72
45
|
// Pill group
|
|
73
46
|
// =============================================================================
|
|
74
47
|
|
|
75
|
-
const StyledPillGroup = /*#__PURE__*/styled__default[
|
|
76
|
-
componentId: "sc-j0tlch-
|
|
77
|
-
})(["width:fit-content;& .ds-pill-wrapper{&:not(:first-of-type){&,:after,:before
|
|
48
|
+
const StyledPillGroup = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
49
|
+
componentId: "sc-j0tlch-6"
|
|
50
|
+
})(["width:fit-content;& .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;}}}"]); // =============================================================================
|
|
51
|
+
// Extra stuff
|
|
52
|
+
// =============================================================================
|
|
53
|
+
|
|
54
|
+
const StyledSpanWithTooltip = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
55
|
+
componentId: "sc-j0tlch-7"
|
|
56
|
+
})(["outline:none;:focus{", "}"], props => borderOutside(props.theme.colors.brand[700], 2, 3));
|
|
57
|
+
const StyledPillButton = /*#__PURE__*/styled__default["default"](dsButton.DSButtonV2).withConfig({
|
|
58
|
+
componentId: "sc-j0tlch-8"
|
|
59
|
+
})(["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'));
|
|
78
60
|
|
|
79
|
-
exports.StyledChevronDown = StyledChevronDown;
|
|
80
|
-
exports.StyledCloseIcon = StyledCloseIcon;
|
|
81
61
|
exports.StyledDropdownPillWrapper = StyledDropdownPillWrapper;
|
|
82
|
-
exports.StyledInput = StyledInput;
|
|
83
62
|
exports.StyledInputPillWrapper = StyledInputPillWrapper;
|
|
84
63
|
exports.StyledLabelPillWrapper = StyledLabelPillWrapper;
|
|
64
|
+
exports.StyledPillButton = StyledPillButton;
|
|
85
65
|
exports.StyledPillGroup = StyledPillGroup;
|
|
86
66
|
exports.StyledReadonlyPillWrapper = StyledReadonlyPillWrapper;
|
|
87
67
|
exports.StyledRemovablePillWrapper = StyledRemovablePillWrapper;
|
|
68
|
+
exports.StyledSpanWithTooltip = StyledSpanWithTooltip;
|
|
88
69
|
exports.StyledValuePillWrapper = StyledValuePillWrapper;
|
|
@@ -7,8 +7,11 @@ var _jsx = require('@babel/runtime/helpers/jsx');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
9
9
|
var uid = require('uid');
|
|
10
|
+
var ChevronDown = require('@elliemae/ds-icons/ChevronSmallDown');
|
|
11
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
10
12
|
var styled = require('../styled.js');
|
|
11
13
|
var utils = require('../../utils.js');
|
|
14
|
+
var PillButton = require('../PillButton.js');
|
|
12
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
16
|
|
|
14
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -17,48 +20,47 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
17
20
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
22
|
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
20
|
-
|
|
21
|
-
var _StyledChevronDown;
|
|
23
|
+
var ChevronDown__default = /*#__PURE__*/_interopDefaultLegacy(ChevronDown);
|
|
22
24
|
|
|
23
25
|
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
26
|
|
|
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[
|
|
26
|
-
const DropdownPill = /*#__PURE__*/React__default[
|
|
27
|
+
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; }
|
|
28
|
+
const DropdownPill = /*#__PURE__*/React__default["default"].memo(({
|
|
27
29
|
label,
|
|
28
30
|
dropdownProps,
|
|
29
|
-
innerRef
|
|
31
|
+
innerRef,
|
|
32
|
+
ariaLabel
|
|
30
33
|
}) => {
|
|
31
|
-
const
|
|
32
|
-
const pillRef = React.useRef(null);
|
|
34
|
+
const chevronRef = React.useRef(null);
|
|
33
35
|
const pillUid = React.useMemo(() => `ds-pill-${uid.uid()}`, []);
|
|
34
|
-
return /*#__PURE__*/
|
|
36
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledDropdownPillWrapper, {
|
|
37
|
+
id: pillUid,
|
|
38
|
+
className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
|
|
39
|
+
"data-testid": "ds-pill-wrapper",
|
|
40
|
+
cols: ['auto', '24px'],
|
|
41
|
+
gutter: "2px",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyItems: "center"
|
|
44
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
45
|
+
value: label
|
|
46
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default["default"], _objectSpread(_objectSpread({
|
|
35
47
|
hideIfNotVisible: true,
|
|
36
|
-
|
|
37
|
-
onClose: () => pillRef.current.focus(),
|
|
48
|
+
onClose: () => chevronRef.current.focus(),
|
|
38
49
|
menuProps: {
|
|
39
50
|
zIndex: 100
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className: "ds-pill-
|
|
44
|
-
"data-testid": "ds-pill-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children: [label, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
54
|
-
ref: chevronRef,
|
|
55
|
-
children: _StyledChevronDown || (_StyledChevronDown = /*#__PURE__*/_jsx__default['default'](styled.StyledChevronDown, {
|
|
56
|
-
size: "s",
|
|
57
|
-
"data-testid": "ds-pill-dropdown-chevron"
|
|
58
|
-
}))
|
|
59
|
-
})]
|
|
60
|
-
})
|
|
61
|
-
}));
|
|
51
|
+
}
|
|
52
|
+
}, dropdownProps), {}, {
|
|
53
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](PillButton.DSPillButton, {
|
|
54
|
+
className: "ds-pill-focus-point",
|
|
55
|
+
"data-testid": "ds-pill-dropdown-chevron",
|
|
56
|
+
innerRef: utils.setMultipleRefs(chevronRef, innerRef),
|
|
57
|
+
"aria-label": ariaLabel || label,
|
|
58
|
+
type: "right"
|
|
59
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](ChevronDown__default["default"], {
|
|
60
|
+
color: ['brand-primary', '700'],
|
|
61
|
+
size: "s"
|
|
62
|
+
}))
|
|
63
|
+
})));
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
exports.DropdownPill = DropdownPill;
|
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var uid = require('uid');
|
|
8
|
+
var CloseIcon = require('@elliemae/ds-icons/CloseXsmall');
|
|
8
9
|
var styled = require('../styled.js');
|
|
9
10
|
var utils = require('../../utils.js');
|
|
11
|
+
var PillButton = require('../PillButton.js');
|
|
10
12
|
|
|
11
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
14
|
|
|
13
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
+
var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
|
|
15
18
|
|
|
16
|
-
const InputPill = /*#__PURE__*/React__default[
|
|
19
|
+
const InputPill = /*#__PURE__*/React__default["default"].memo(({
|
|
17
20
|
label,
|
|
18
21
|
inputPlaceholder,
|
|
19
22
|
inputWidth,
|
|
@@ -25,40 +28,44 @@ const InputPill = /*#__PURE__*/React__default['default'].memo(({
|
|
|
25
28
|
const ref = React.useRef(null);
|
|
26
29
|
const InputComponent = React.useMemo(() => inputRender, [inputRender]);
|
|
27
30
|
const pillUid = React.useMemo(() => `ds-pill-${uid.uid()}`, []);
|
|
28
|
-
|
|
31
|
+
const onCloseIconClick = React.useCallback(e => {
|
|
32
|
+
if ([undefined, 'Enter', 'Space'].includes(e.code)) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
onInputClear(e);
|
|
35
|
+
ref.current.focus();
|
|
36
|
+
}
|
|
37
|
+
}, [onInputClear]);
|
|
38
|
+
const [inputHasFocus, setInputHasFocus] = React.useState(false);
|
|
39
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledInputPillWrapper, {
|
|
29
40
|
className: "ds-pill-wrapper",
|
|
30
41
|
"data-testid": "ds-pill-wrapper",
|
|
31
|
-
cols: ['auto', '24px'],
|
|
32
|
-
inputWidth: inputWidth
|
|
33
|
-
|
|
42
|
+
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
43
|
+
inputWidth: inputWidth,
|
|
44
|
+
value: label,
|
|
45
|
+
inputHasFocus: inputHasFocus
|
|
46
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](InputComponent, {
|
|
34
47
|
id: pillUid,
|
|
35
48
|
className: "ds-pill-focus-point",
|
|
36
49
|
"data-testid": "ds-pill-input",
|
|
37
50
|
innerRef: utils.setMultipleRefs(ref, innerRef),
|
|
38
51
|
value: label,
|
|
39
52
|
onChange: onInputChange,
|
|
40
|
-
placeholder: inputPlaceholder
|
|
41
|
-
|
|
53
|
+
placeholder: inputPlaceholder,
|
|
54
|
+
onFocus: () => setInputHasFocus(true),
|
|
55
|
+
onBlur: () => setInputHasFocus(false),
|
|
56
|
+
disableTooltip: false
|
|
57
|
+
}), label !== '' && /*#__PURE__*/_jsx__default["default"](PillButton.DSPillButton, {
|
|
58
|
+
id: pillUid,
|
|
42
59
|
"data-testid": "ds-pill-clear-icon",
|
|
43
|
-
|
|
60
|
+
innerRef: innerRef,
|
|
61
|
+
onClick: onCloseIconClick,
|
|
62
|
+
onKeyDown: onCloseIconClick,
|
|
63
|
+
"aria-label": "Clear input",
|
|
64
|
+
type: "right"
|
|
65
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](CloseIcon__default["default"], {
|
|
44
66
|
size: "s",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
ref.current.focus();
|
|
48
|
-
},
|
|
49
|
-
onKeyDown: e => {
|
|
50
|
-
if (['Enter', 'Space'].includes(e.code)) {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
onInputClear(e);
|
|
53
|
-
ref.current.focus();
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
style: {
|
|
57
|
-
position: 'absolute',
|
|
58
|
-
right: 6,
|
|
59
|
-
top: 4
|
|
60
|
-
}
|
|
61
|
-
}));
|
|
67
|
+
color: ['brand-primary', '700']
|
|
68
|
+
})));
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
exports.InputPill = InputPill;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
7
8
|
var styled = require('../styled.js');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -11,13 +12,20 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
12
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
14
|
|
|
14
|
-
const LabelPill = /*#__PURE__*/React__default[
|
|
15
|
-
label
|
|
16
|
-
|
|
15
|
+
const LabelPill = /*#__PURE__*/React__default["default"].memo(({
|
|
16
|
+
label,
|
|
17
|
+
iconLeft,
|
|
18
|
+
ariaLabel
|
|
19
|
+
}) => /*#__PURE__*/_jsx__default["default"](styled.StyledLabelPillWrapper, {
|
|
17
20
|
alignItems: "center",
|
|
18
|
-
className: "ds-pill-wrapper",
|
|
21
|
+
className: "ds-pill-wrapper ds-pill-wrapper-label",
|
|
19
22
|
"data-testid": "ds-pill-wrapper",
|
|
20
|
-
"aria-label": label
|
|
21
|
-
|
|
23
|
+
"aria-label": ariaLabel || label,
|
|
24
|
+
cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
|
|
25
|
+
gutter: "xxxs",
|
|
26
|
+
hasIcon: iconLeft !== null
|
|
27
|
+
}, void 0, iconLeft, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
28
|
+
value: label
|
|
29
|
+
})));
|
|
22
30
|
|
|
23
31
|
exports.LabelPill = LabelPill;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
7
8
|
var styled = require('../styled.js');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -11,17 +12,26 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
12
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
14
|
|
|
14
|
-
const ReadOnlyPill = /*#__PURE__*/React__default[
|
|
15
|
+
const ReadOnlyPill = /*#__PURE__*/React__default["default"].memo(({
|
|
15
16
|
label,
|
|
16
17
|
iconLeft,
|
|
17
|
-
iconRight
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
iconRight,
|
|
19
|
+
ariaLabel
|
|
20
|
+
}) => {
|
|
21
|
+
const hasIconLeft = iconLeft !== null || iconRight !== null && label === '';
|
|
22
|
+
const hasIconRight = iconRight !== null || iconLeft !== null && label === '';
|
|
23
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledReadonlyPillWrapper, {
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
className: "ds-pill-wrapper ds-pill-wrapper-readonly",
|
|
26
|
+
"data-testid": "ds-pill-wrapper",
|
|
27
|
+
"aria-label": ariaLabel || label,
|
|
28
|
+
cols: [iconLeft && 'min-content', label && 'auto', iconRight && 'min-content'].filter(notFalse => notFalse),
|
|
29
|
+
gutter: "xxxs",
|
|
30
|
+
hasIconRight: hasIconRight,
|
|
31
|
+
hasIconLeft: hasIconLeft
|
|
32
|
+
}, void 0, iconLeft, label ? /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
33
|
+
value: label
|
|
34
|
+
}) : null, iconRight);
|
|
35
|
+
});
|
|
26
36
|
|
|
27
37
|
exports.ReadOnlyPill = ReadOnlyPill;
|
|
@@ -5,47 +5,58 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var uid = require('uid');
|
|
8
|
+
var CloseIcon = require('@elliemae/ds-icons/CloseXsmall');
|
|
9
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
8
10
|
var styled = require('../styled.js');
|
|
9
|
-
var utils = require('../../utils.js');
|
|
10
11
|
var PillGroup = require('../PillGroup.js');
|
|
12
|
+
var PillButton = require('../PillButton.js');
|
|
11
13
|
|
|
12
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
15
|
|
|
14
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
17
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
|
|
16
19
|
|
|
17
|
-
const RemovablePill = /*#__PURE__*/React__default[
|
|
20
|
+
const RemovablePill = /*#__PURE__*/React__default["default"].memo(({
|
|
18
21
|
label,
|
|
19
22
|
onRemove,
|
|
20
|
-
innerRef
|
|
23
|
+
innerRef,
|
|
24
|
+
ariaLabel
|
|
21
25
|
}) => {
|
|
22
26
|
const {
|
|
23
27
|
onKeyboardRemove
|
|
24
28
|
} = React.useContext(PillGroup.DSPillGroupV2Context);
|
|
25
29
|
const pillUid = React.useMemo(() => `ds-pill-${uid.uid()}`, []);
|
|
26
|
-
|
|
30
|
+
const onKeyDown = React.useCallback(e => {
|
|
31
|
+
if (['Enter', 'Space'].includes(e.code)) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
if (onKeyboardRemove) onKeyboardRemove(pillUid);
|
|
34
|
+
onRemove(e);
|
|
35
|
+
}
|
|
36
|
+
}, [onKeyboardRemove, onRemove, pillUid]);
|
|
37
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledRemovablePillWrapper, {
|
|
27
38
|
cols: ['auto', '24px'],
|
|
39
|
+
gutter: "2px",
|
|
28
40
|
alignItems: "center",
|
|
29
41
|
justifyItems: "center",
|
|
30
|
-
className: "ds-pill-wrapper",
|
|
42
|
+
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
31
43
|
"data-testid": "ds-pill-wrapper",
|
|
32
|
-
"aria-label": label
|
|
33
|
-
}, void 0,
|
|
34
|
-
|
|
44
|
+
"aria-label": ariaLabel || label
|
|
45
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
46
|
+
value: label
|
|
47
|
+
}), /*#__PURE__*/_jsx__default["default"](PillButton.DSPillButton, {
|
|
35
48
|
className: "ds-pill-focus-point",
|
|
49
|
+
id: pillUid,
|
|
36
50
|
"data-testid": "ds-pill-close-icon",
|
|
37
|
-
|
|
38
|
-
size: "s",
|
|
39
|
-
innerRef: utils.setMultipleRefs(innerRef),
|
|
51
|
+
innerRef: innerRef,
|
|
40
52
|
onClick: onRemove,
|
|
41
|
-
onKeyDown:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}));
|
|
53
|
+
onKeyDown: onKeyDown,
|
|
54
|
+
"aria-label": `Remove ${label}`,
|
|
55
|
+
type: "right"
|
|
56
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](CloseIcon__default["default"], {
|
|
57
|
+
size: "s",
|
|
58
|
+
color: ['brand-primary', '700']
|
|
59
|
+
})));
|
|
49
60
|
});
|
|
50
61
|
|
|
51
62
|
exports.RemovablePill = RemovablePill;
|