@elliemae/ds-pills 2.0.0-alpha.11 → 2.0.0-alpha.12
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 +6 -1
- package/cjs/components/PillButton.js +6 -1
- package/cjs/components/PillGroup.js +20 -7
- package/cjs/components/styled.js +24 -8
- package/cjs/components/types/DropdownPill.js +42 -22
- package/cjs/components/types/InputPill.js +14 -12
- package/cjs/components/types/LabelPill.js +30 -15
- package/cjs/components/types/ReadOnlyPill.js +22 -9
- package/cjs/components/types/RemovablePill.js +23 -13
- package/cjs/components/types/ValuePill.js +37 -22
- package/cjs/deprecated/DropdownPill.js +7 -3
- package/cjs/deprecated/InputPill.js +22 -18
- package/cjs/deprecated/LabeledDropdownPills.js +5 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +17 -8
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +11 -4
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +18 -14
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +4 -2
- package/cjs/deprecated/LabeledPills.js +9 -8
- package/cjs/deprecated/OverflowPill.js +9 -5
- package/cjs/deprecated/Pill.js +18 -10
- package/cjs/deprecated/PillGroup.js +25 -17
- package/cjs/deprecated/ReadOnlyPill.js +25 -22
- package/cjs/deprecated/RemovablePill.js +13 -13
- package/cjs/deprecated/index.js +1 -0
- package/cjs/props.js +20 -8
- package/cjs/utils.js +19 -9
- package/esm/components/Pill.js +6 -1
- package/esm/components/PillButton.js +6 -1
- package/esm/components/PillGroup.js +20 -7
- package/esm/components/styled.js +24 -9
- package/esm/components/types/DropdownPill.js +43 -21
- package/esm/components/types/InputPill.js +14 -11
- package/esm/components/types/LabelPill.js +30 -15
- package/esm/components/types/ReadOnlyPill.js +22 -9
- package/esm/components/types/RemovablePill.js +23 -12
- package/esm/components/types/ValuePill.js +38 -23
- package/esm/deprecated/DropdownPill.js +6 -1
- package/esm/deprecated/InputPill.js +19 -12
- package/esm/deprecated/LabeledDropdownPills.js +5 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +14 -5
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +8 -1
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +14 -8
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +3 -1
- package/esm/deprecated/LabeledPills.js +9 -8
- package/esm/deprecated/OverflowPill.js +9 -5
- package/esm/deprecated/Pill.js +18 -10
- package/esm/deprecated/PillGroup.js +25 -17
- package/esm/deprecated/ReadOnlyPill.js +25 -21
- package/esm/deprecated/RemovablePill.js +11 -10
- package/esm/deprecated/index.js +1 -1
- package/esm/props.js +18 -4
- package/esm/utils.js +19 -9
- package/package.json +21 -12
- package/types/components/PillGroup.d.ts +8 -2
- package/types/components/styled.d.ts +17 -33
- package/types/deprecated/DropdownPill.d.ts +51 -7
- package/types/deprecated/LabeledDropdownPills.d.ts +65 -9
- package/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +1 -1
- package/types/deprecated/LabeledPills.d.ts +37 -5
- package/types/deprecated/OverflowPill.d.ts +22 -3
- package/types/deprecated/Pill.d.ts +44 -6
- package/types/deprecated/PillGroup.d.ts +36 -5
- package/types/deprecated/ReadOnlyPill.d.ts +43 -6
- package/types/deprecated/RemovablePill.d.ts +37 -6
- package/types/deprecated/index.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/props.d.ts +69 -16
package/cjs/utils.js
CHANGED
|
@@ -2,17 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const setMultipleRefs = function () {
|
|
10
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
refs[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
return _ref => {
|
|
15
|
+
refs.forEach(ref => {
|
|
16
|
+
if (!ref || !_ref) return;
|
|
17
|
+
|
|
18
|
+
if (typeof ref === 'function') {
|
|
19
|
+
ref(_ref);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (ref) ref.current = _ref;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
16
26
|
};
|
|
17
27
|
|
|
18
28
|
exports.setMultipleRefs = setMultipleRefs;
|
package/esm/components/Pill.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'react';
|
|
3
8
|
import { describe } from 'react-desc';
|
|
@@ -25,7 +30,7 @@ const pillComponentGetter = {
|
|
|
25
30
|
|
|
26
31
|
const DSPillV2 = props => {
|
|
27
32
|
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillV2DefaultProps);
|
|
28
|
-
useValidateTypescriptPropTypes(propsWithDefaults,
|
|
33
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillV2PropTypes);
|
|
29
34
|
const {
|
|
30
35
|
type
|
|
31
36
|
} = propsWithDefaults;
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import 'react';
|
|
@@ -20,7 +25,7 @@ const typeToClassName = {
|
|
|
20
25
|
|
|
21
26
|
const DSPillButton = props => {
|
|
22
27
|
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillButtonDefaultProps);
|
|
23
|
-
useValidateTypescriptPropTypes(propsWithDefaults,
|
|
28
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillButtonPropTypes);
|
|
24
29
|
|
|
25
30
|
const {
|
|
26
31
|
type,
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
5
|
import React, { createContext, useMemo, useCallback } from 'react';
|
|
4
6
|
import { describe } from 'react-desc';
|
|
5
7
|
import { uid } from 'uid';
|
|
8
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
|
+
import { DSPillGroupPropTypes, DSPillGroupDefaultProps } from '../props.js';
|
|
6
10
|
import { StyledPillGroup } from './styled.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
12
|
|
|
8
13
|
const DSPillGroupV2Context = /*#__PURE__*/createContext({
|
|
9
14
|
onKeyboardRemove: () => null
|
|
10
15
|
});
|
|
11
16
|
|
|
12
|
-
const DSPillGroupV2 =
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
const DSPillGroupV2 = props => {
|
|
18
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillGroupDefaultProps);
|
|
19
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillGroupPropTypes);
|
|
15
20
|
const pillGroupUid = useMemo(() => "ds-pill-group-".concat(uid()), []);
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
width,
|
|
24
|
+
innerRef
|
|
25
|
+
} = propsWithDefaults;
|
|
16
26
|
const onKeyboardRemove = useCallback(pillUid => {
|
|
17
27
|
const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
|
|
18
28
|
const pillIndex = elems.findIndex(elem => elem.id === pillUid);
|
|
@@ -27,14 +37,17 @@ const DSPillGroupV2 = ({
|
|
|
27
37
|
value: {
|
|
28
38
|
onKeyboardRemove
|
|
29
39
|
}
|
|
30
|
-
}, void 0, /*#__PURE__*/
|
|
40
|
+
}, void 0, /*#__PURE__*/jsx(StyledPillGroup, {
|
|
41
|
+
width: width,
|
|
31
42
|
id: pillGroupUid,
|
|
32
43
|
cols: React.Children.map(children, () => 'auto'),
|
|
33
|
-
gutter: "2px"
|
|
34
|
-
|
|
44
|
+
gutter: "2px",
|
|
45
|
+
ref: innerRef,
|
|
46
|
+
children: children
|
|
47
|
+
}));
|
|
35
48
|
};
|
|
36
49
|
|
|
37
50
|
const DSPillGroupV2WithSchema = describe(DSPillGroupV2);
|
|
38
|
-
DSPillGroupV2WithSchema.propTypes =
|
|
51
|
+
DSPillGroupV2WithSchema.propTypes = DSPillGroupPropTypes;
|
|
39
52
|
|
|
40
53
|
export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema };
|
package/esm/components/styled.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { css } from '@elliemae/ds-system';
|
|
2
4
|
import Grid from '@elliemae/ds-grid';
|
|
3
5
|
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
var _templateObject, _templateObject2;
|
|
6
8
|
// Common CSS
|
|
7
9
|
// =============================================================================
|
|
8
10
|
|
|
9
|
-
const borderOutside = (color
|
|
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
|
+
};
|
|
10
17
|
|
|
11
|
-
const commonPillWrapperCss =
|
|
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])); // =============================================================================
|
|
12
19
|
// Pills wrappers
|
|
13
20
|
// =============================================================================
|
|
14
21
|
|
|
@@ -20,10 +27,13 @@ const StyledValuePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
20
27
|
})(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.regular, props => props.hasIcon ? '0px !important' : '12px');
|
|
21
28
|
const StyledInputPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
22
29
|
componentId: "sc-j0tlch-2"
|
|
23
|
-
})(["", " 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'],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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"));
|
|
27
37
|
const StyledDropdownPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
28
38
|
componentId: "sc-j0tlch-3"
|
|
29
39
|
})(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.semibold);
|
|
@@ -38,7 +48,12 @@ const StyledRemovablePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
38
48
|
|
|
39
49
|
const StyledPillGroup = /*#__PURE__*/styled(Grid).withConfig({
|
|
40
50
|
componentId: "sc-j0tlch-6"
|
|
41
|
-
})(["width:
|
|
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
|
+
}); // =============================================================================
|
|
42
57
|
// Extra stuff
|
|
43
58
|
// =============================================================================
|
|
44
59
|
|
|
@@ -1,9 +1,14 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import React, { useRef, useMemo } from 'react';
|
|
4
|
-
import
|
|
9
|
+
import { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';
|
|
5
10
|
import { uid } from 'uid';
|
|
6
|
-
import
|
|
11
|
+
import { ChevronSmallDown } from '@elliemae/ds-icons';
|
|
7
12
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
8
13
|
import { StyledDropdownPillWrapper } from '../styled.js';
|
|
9
14
|
import { setMultipleRefs } from '../../utils.js';
|
|
@@ -13,15 +18,28 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
13
18
|
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; }
|
|
14
19
|
|
|
15
20
|
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; }
|
|
16
|
-
const DropdownPill = /*#__PURE__*/React.memo(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
22
31
|
const chevronRef = useRef(null);
|
|
23
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;
|
|
24
41
|
return /*#__PURE__*/_jsx(StyledDropdownPillWrapper, {
|
|
42
|
+
size: size,
|
|
25
43
|
id: pillUid,
|
|
26
44
|
className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
|
|
27
45
|
"data-testid": "ds-pill-wrapper",
|
|
@@ -29,24 +47,28 @@ const DropdownPill = /*#__PURE__*/React.memo(({
|
|
|
29
47
|
gutter: "2px",
|
|
30
48
|
alignItems: "center",
|
|
31
49
|
justifyItems: "center"
|
|
32
|
-
}, void 0, /*#__PURE__*/_jsx(
|
|
33
|
-
|
|
34
|
-
}), /*#__PURE__*/jsx(DSDropdownMenu, _objectSpread(_objectSpread({
|
|
35
|
-
hideIfNotVisible: true,
|
|
36
|
-
onClose: () => chevronRef.current.focus(),
|
|
37
|
-
menuProps: {
|
|
38
|
-
zIndex: 100
|
|
39
|
-
}
|
|
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']
|
|
40
52
|
}, dropdownProps), {}, {
|
|
41
|
-
|
|
53
|
+
onClickOutside: e => {
|
|
54
|
+
if (e.code === 'Escape') chevronRef.current.focus();
|
|
55
|
+
if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);
|
|
56
|
+
},
|
|
57
|
+
wrapperStyles: {
|
|
58
|
+
width: '100%',
|
|
59
|
+
height: '100%'
|
|
60
|
+
},
|
|
61
|
+
children: /*#__PURE__*/_jsx(DSPillButton, {
|
|
42
62
|
className: "ds-pill-focus-point",
|
|
43
63
|
"data-testid": "ds-pill-dropdown-chevron",
|
|
44
64
|
innerRef: setMultipleRefs(chevronRef, innerRef),
|
|
45
65
|
"aria-label": ariaLabel || label,
|
|
46
|
-
type: "right"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
type: "right",
|
|
67
|
+
onClick: onDropdownClick
|
|
68
|
+
}, void 0, /*#__PURE__*/_jsx(ChevronSmallDown, {
|
|
69
|
+
color: ['brand-primary', '800'],
|
|
70
|
+
width: 20,
|
|
71
|
+
height: 20
|
|
50
72
|
}))
|
|
51
73
|
})));
|
|
52
74
|
});
|
|
@@ -2,20 +2,22 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
3
|
import React, { useRef, useMemo, useCallback, useState } from 'react';
|
|
4
4
|
import { uid } from 'uid';
|
|
5
|
-
import
|
|
5
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
6
6
|
import { StyledInputPillWrapper } from '../styled.js';
|
|
7
7
|
import { setMultipleRefs } from '../../utils.js';
|
|
8
8
|
import { DSPillButton } from '../PillButton.js';
|
|
9
9
|
|
|
10
|
-
const InputPill = /*#__PURE__*/React.memo(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
19
21
|
const ref = useRef(null);
|
|
20
22
|
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
21
23
|
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
@@ -28,6 +30,7 @@ const InputPill = /*#__PURE__*/React.memo(({
|
|
|
28
30
|
}, [onInputClear]);
|
|
29
31
|
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
30
32
|
return /*#__PURE__*/_jsx(StyledInputPillWrapper, {
|
|
33
|
+
size: size,
|
|
31
34
|
className: "ds-pill-wrapper",
|
|
32
35
|
"data-testid": "ds-pill-wrapper",
|
|
33
36
|
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
@@ -53,7 +56,7 @@ const InputPill = /*#__PURE__*/React.memo(({
|
|
|
53
56
|
onKeyDown: onCloseIconClick,
|
|
54
57
|
"aria-label": "Clear input",
|
|
55
58
|
type: "right"
|
|
56
|
-
}, void 0, /*#__PURE__*/_jsx(
|
|
59
|
+
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
57
60
|
size: "s",
|
|
58
61
|
color: ['brand-primary', '700']
|
|
59
62
|
})));
|
|
@@ -1,22 +1,37 @@
|
|
|
1
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';
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
4
7
|
import { StyledLabelPillWrapper } from '../styled.js';
|
|
5
8
|
|
|
6
|
-
const LabelPill = /*#__PURE__*/React.memo(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
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
|
+
});
|
|
21
36
|
|
|
22
37
|
export { LabelPill };
|
|
@@ -1,17 +1,32 @@
|
|
|
1
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';
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
4
7
|
import { StyledReadonlyPillWrapper } from '../styled.js';
|
|
5
8
|
|
|
6
|
-
const ReadOnlyPill = /*#__PURE__*/React.memo(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const ReadOnlyPill = /*#__PURE__*/React.memo(_ref => {
|
|
10
|
+
let {
|
|
11
|
+
label,
|
|
12
|
+
size,
|
|
13
|
+
labelTruncated,
|
|
14
|
+
iconLeft,
|
|
15
|
+
iconRight,
|
|
16
|
+
ariaLabel
|
|
17
|
+
} = _ref;
|
|
12
18
|
const hasIconLeft = iconLeft !== null || iconRight !== null && label === '';
|
|
13
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;
|
|
14
28
|
return /*#__PURE__*/_jsx(StyledReadonlyPillWrapper, {
|
|
29
|
+
size: size,
|
|
15
30
|
alignItems: "center",
|
|
16
31
|
className: "ds-pill-wrapper ds-pill-wrapper-readonly",
|
|
17
32
|
"data-testid": "ds-pill-wrapper",
|
|
@@ -20,9 +35,7 @@ const ReadOnlyPill = /*#__PURE__*/React.memo(({
|
|
|
20
35
|
gutter: "xxxs",
|
|
21
36
|
hasIconRight: hasIconRight,
|
|
22
37
|
hasIconLeft: hasIconLeft
|
|
23
|
-
}, void 0, iconLeft, label ? /*#__PURE__*/_jsx(
|
|
24
|
-
value: label
|
|
25
|
-
}) : null, iconRight);
|
|
38
|
+
}, void 0, iconLeft, label ? /*#__PURE__*/_jsx(TextComponent, {}, void 0, label) : null, iconRight);
|
|
26
39
|
});
|
|
27
40
|
|
|
28
41
|
export { ReadOnlyPill };
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import React, { useContext, useMemo, useCallback } from 'react';
|
|
3
3
|
import { uid } from 'uid';
|
|
4
|
-
import
|
|
4
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
5
5
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
6
6
|
import { StyledRemovablePillWrapper } from '../styled.js';
|
|
7
7
|
import { DSPillGroupV2Context } from '../PillGroup.js';
|
|
8
8
|
import { DSPillButton } from '../PillButton.js';
|
|
9
9
|
|
|
10
|
-
const RemovablePill = /*#__PURE__*/React.memo(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const RemovablePill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
label,
|
|
13
|
+
size,
|
|
14
|
+
labelTruncated,
|
|
15
|
+
onRemove,
|
|
16
|
+
innerRef,
|
|
17
|
+
ariaLabel
|
|
18
|
+
} = _ref;
|
|
16
19
|
const {
|
|
17
20
|
onKeyboardRemove
|
|
18
21
|
} = useContext(DSPillGroupV2Context);
|
|
19
22
|
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
23
|
+
const TextComponent = labelTruncated ? _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
children
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
28
|
+
value: children
|
|
29
|
+
});
|
|
30
|
+
} : React.Fragment;
|
|
20
31
|
const onKeyDown = useCallback(e => {
|
|
21
32
|
if (['Enter', 'Space'].includes(e.code)) {
|
|
22
33
|
e.preventDefault();
|
|
@@ -25,6 +36,7 @@ const RemovablePill = /*#__PURE__*/React.memo(({
|
|
|
25
36
|
}
|
|
26
37
|
}, [onKeyboardRemove, onRemove, pillUid]);
|
|
27
38
|
return /*#__PURE__*/_jsx(StyledRemovablePillWrapper, {
|
|
39
|
+
size: size,
|
|
28
40
|
cols: ['auto', '24px'],
|
|
29
41
|
gutter: "2px",
|
|
30
42
|
alignItems: "center",
|
|
@@ -32,9 +44,7 @@ const RemovablePill = /*#__PURE__*/React.memo(({
|
|
|
32
44
|
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
33
45
|
"data-testid": "ds-pill-wrapper",
|
|
34
46
|
"aria-label": ariaLabel || label
|
|
35
|
-
}, void 0, /*#__PURE__*/_jsx(
|
|
36
|
-
value: label
|
|
37
|
-
}), /*#__PURE__*/_jsx(DSPillButton, {
|
|
47
|
+
}, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/_jsx(DSPillButton, {
|
|
38
48
|
className: "ds-pill-focus-point",
|
|
39
49
|
id: pillUid,
|
|
40
50
|
"data-testid": "ds-pill-close-icon",
|
|
@@ -43,8 +53,9 @@ const RemovablePill = /*#__PURE__*/React.memo(({
|
|
|
43
53
|
onKeyDown: onKeyDown,
|
|
44
54
|
"aria-label": "Remove ".concat(label),
|
|
45
55
|
type: "right"
|
|
46
|
-
}, void 0, /*#__PURE__*/_jsx(
|
|
47
|
-
|
|
56
|
+
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
57
|
+
width: 22.65,
|
|
58
|
+
height: 22.65,
|
|
48
59
|
color: ['brand-primary', '700']
|
|
49
60
|
})));
|
|
50
61
|
});
|
|
@@ -1,30 +1,45 @@
|
|
|
1
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';
|
|
2
5
|
import React from 'react';
|
|
3
|
-
import {
|
|
6
|
+
import { DSTooltipV2 } from '@elliemae/ds-tooltip';
|
|
4
7
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
5
8
|
import { StyledValuePillWrapper, StyledSpanWithTooltip } from '../styled.js';
|
|
6
9
|
|
|
7
|
-
const ValuePill = /*#__PURE__*/React.memo(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
});
|
|
29
44
|
|
|
30
45
|
export { ValuePill };
|
|
@@ -2,10 +2,15 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
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';
|
|
5
10
|
import { useRef, useState } from 'react';
|
|
6
11
|
import { PropTypes, describe } from 'react-desc';
|
|
7
12
|
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
8
|
-
import ChevronDown from '@elliemae/ds-icons
|
|
13
|
+
import { ChevronDown } from '@elliemae/ds-icons';
|
|
9
14
|
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
10
15
|
import { Pill } from './Pill.js';
|
|
11
16
|
import { jsx } from 'react/jsx-runtime';
|