@elliemae/ds-pills 2.0.0-alpha.10 → 2.0.0-alpha.14
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 +7 -2
- package/cjs/components/PillGroup.js +23 -9
- package/cjs/components/styled.js +24 -8
- package/cjs/components/types/DropdownPill.js +43 -23
- package/cjs/components/types/InputPill.js +16 -13
- package/cjs/components/types/LabelPill.js +30 -15
- package/cjs/components/types/ReadOnlyPill.js +22 -9
- package/cjs/components/types/RemovablePill.js +25 -15
- package/cjs/components/types/ValuePill.js +37 -22
- package/cjs/deprecated/DropdownPill.js +8 -3
- package/cjs/deprecated/InputPill.js +22 -18
- package/cjs/deprecated/LabeledDropdownPills.js +5 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +18 -8
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +13 -5
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +19 -14
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +4 -2
- package/cjs/deprecated/LabeledPills.js +9 -8
- package/cjs/deprecated/OverflowPill.js +12 -7
- package/cjs/deprecated/Pill.js +18 -10
- package/cjs/deprecated/PillGroup.js +25 -17
- package/cjs/deprecated/ReadOnlyPill.js +26 -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 +7 -2
- package/esm/components/PillGroup.js +23 -9
- package/esm/components/styled.js +24 -9
- package/esm/components/types/DropdownPill.js +44 -22
- package/esm/components/types/InputPill.js +16 -12
- package/esm/components/types/LabelPill.js +30 -15
- package/esm/components/types/ReadOnlyPill.js +22 -9
- package/esm/components/types/RemovablePill.js +25 -14
- package/esm/components/types/ValuePill.js +38 -23
- package/esm/deprecated/DropdownPill.js +7 -1
- package/esm/deprecated/InputPill.js +19 -12
- package/esm/deprecated/LabeledDropdownPills.js +5 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +15 -5
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +10 -2
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +15 -8
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +3 -1
- package/esm/deprecated/LabeledPills.js +9 -8
- package/esm/deprecated/OverflowPill.js +12 -7
- package/esm/deprecated/Pill.js +18 -10
- package/esm/deprecated/PillGroup.js +25 -17
- package/esm/deprecated/ReadOnlyPill.js +26 -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/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/props.js
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var DSInput__default = /*#__PURE__*/_interopDefaultLegacy(DSInput);
|
|
6
|
+
var dsForm = require('@elliemae/ds-form');
|
|
11
7
|
|
|
12
8
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
13
9
|
const pillTypes = reactDesc.PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable', 'readonly']);
|
|
@@ -15,7 +11,9 @@ const DSPillV2PropTypes = {
|
|
|
15
11
|
label: reactDesc.PropTypes.string.description('Label to show in the pill').isRequired,
|
|
16
12
|
type: pillTypes.description('The type of pill that you want to render').isRequired,
|
|
17
13
|
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),
|
|
14
|
+
size: reactDesc.PropTypes.oneOf(['s', 'm']).description('Vertical pill size').defaultValue('m'),
|
|
18
15
|
ariaLabel: reactDesc.PropTypes.string.description('Aria label for the pill. If not provided we will use the label').defaultValue(''),
|
|
16
|
+
labelTruncated: reactDesc.PropTypes.bool.description('Whether to truncate the pills label').defaultValue(true),
|
|
19
17
|
tooltipValue: reactDesc.PropTypes.string.description('String to show as a tooltip in the value pill').defaultValue(''),
|
|
20
18
|
iconLeft: reactDesc.PropTypes.node.description('A component to show int the left of a readonly pill').defaultValue(null),
|
|
21
19
|
iconRight: reactDesc.PropTypes.node.description('A component to show in the right of a readonly pill').defaultValue(null),
|
|
@@ -24,16 +22,23 @@ const DSPillV2PropTypes = {
|
|
|
24
22
|
onInputChange: reactDesc.PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
25
23
|
onInputClear: reactDesc.PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
26
24
|
inputWidth: reactDesc.PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
27
|
-
dropdownProps: reactDesc.PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({})
|
|
25
|
+
dropdownProps: reactDesc.PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({}),
|
|
26
|
+
onDropdownClick: reactDesc.PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null)
|
|
28
27
|
};
|
|
29
28
|
const DSPillButtonPropTypes = {
|
|
30
29
|
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
30
|
width: reactDesc.PropTypes.string.description('Width of the button').defaultValue('100%'),
|
|
32
31
|
height: reactDesc.PropTypes.string.description('Height of the button').defaultValue('100%')
|
|
33
32
|
};
|
|
33
|
+
const DSPillGroupPropTypes = {
|
|
34
|
+
width: reactDesc.PropTypes.string.description('Width of the group').defaultValue('fit-content'),
|
|
35
|
+
innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Reference to the pill group wrapper').defaultValue(() => null)
|
|
36
|
+
};
|
|
34
37
|
const DSPillV2DefaultProps = {
|
|
35
38
|
innerRef: () => null,
|
|
36
39
|
ariaLabel: '',
|
|
40
|
+
size: 'm',
|
|
41
|
+
labelTruncated: true,
|
|
37
42
|
tooltipValue: '',
|
|
38
43
|
iconLeft: null,
|
|
39
44
|
iconRight: null,
|
|
@@ -42,16 +47,23 @@ const DSPillV2DefaultProps = {
|
|
|
42
47
|
onInputChange: () => null,
|
|
43
48
|
onInputClear: () => null,
|
|
44
49
|
inputWidth: 72,
|
|
45
|
-
inputRender:
|
|
46
|
-
dropdownProps: {}
|
|
50
|
+
inputRender: dsForm.DSInput,
|
|
51
|
+
dropdownProps: {},
|
|
52
|
+
onDropdownClick: () => null
|
|
47
53
|
};
|
|
48
54
|
const DSPillButtonDefaultProps = {
|
|
49
55
|
type: 'right',
|
|
50
56
|
width: '100%',
|
|
51
57
|
height: '100%'
|
|
52
58
|
};
|
|
59
|
+
const DSPillGroupDefaultProps = {
|
|
60
|
+
width: 'fit-content',
|
|
61
|
+
innerRef: () => null
|
|
62
|
+
};
|
|
53
63
|
|
|
54
64
|
exports.DSPillButtonDefaultProps = DSPillButtonDefaultProps;
|
|
55
65
|
exports.DSPillButtonPropTypes = DSPillButtonPropTypes;
|
|
66
|
+
exports.DSPillGroupDefaultProps = DSPillGroupDefaultProps;
|
|
67
|
+
exports.DSPillGroupPropTypes = DSPillGroupPropTypes;
|
|
56
68
|
exports.DSPillV2DefaultProps = DSPillV2DefaultProps;
|
|
57
69
|
exports.DSPillV2PropTypes = DSPillV2PropTypes;
|
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,
|
|
@@ -30,7 +35,7 @@ const DSPillButton = props => {
|
|
|
30
35
|
|
|
31
36
|
return /*#__PURE__*/jsx(StyledPillButton, _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
37
|
buttonType: "raw",
|
|
33
|
-
className:
|
|
38
|
+
className: "".concat(typeToClassName[type], " ").concat(rest.className),
|
|
34
39
|
children: children
|
|
35
40
|
}));
|
|
36
41
|
};
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
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';
|
|
2
5
|
import React, { createContext, useMemo, useCallback } from 'react';
|
|
3
6
|
import { describe } from 'react-desc';
|
|
4
7
|
import { uid } from 'uid';
|
|
8
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
|
+
import { DSPillGroupPropTypes, DSPillGroupDefaultProps } from '../props.js';
|
|
5
10
|
import { StyledPillGroup } from './styled.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
12
|
|
|
7
13
|
const DSPillGroupV2Context = /*#__PURE__*/createContext({
|
|
8
14
|
onKeyboardRemove: () => null
|
|
9
15
|
});
|
|
10
16
|
|
|
11
|
-
const DSPillGroupV2 =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const pillGroupUid = useMemo(() =>
|
|
17
|
+
const DSPillGroupV2 = props => {
|
|
18
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillGroupDefaultProps);
|
|
19
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillGroupPropTypes);
|
|
20
|
+
const pillGroupUid = useMemo(() => "ds-pill-group-".concat(uid()), []);
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
width,
|
|
24
|
+
innerRef
|
|
25
|
+
} = propsWithDefaults;
|
|
15
26
|
const onKeyboardRemove = useCallback(pillUid => {
|
|
16
|
-
const elems = [...document.querySelectorAll(
|
|
27
|
+
const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
|
|
17
28
|
const pillIndex = elems.findIndex(elem => elem.id === pillUid);
|
|
18
29
|
|
|
19
30
|
if (pillIndex > 0) {
|
|
@@ -26,14 +37,17 @@ const DSPillGroupV2 = ({
|
|
|
26
37
|
value: {
|
|
27
38
|
onKeyboardRemove
|
|
28
39
|
}
|
|
29
|
-
}, void 0, /*#__PURE__*/
|
|
40
|
+
}, void 0, /*#__PURE__*/jsx(StyledPillGroup, {
|
|
41
|
+
width: width,
|
|
30
42
|
id: pillGroupUid,
|
|
31
43
|
cols: React.Children.map(children, () => 'auto'),
|
|
32
|
-
gutter: "2px"
|
|
33
|
-
|
|
44
|
+
gutter: "2px",
|
|
45
|
+
ref: innerRef,
|
|
46
|
+
children: children
|
|
47
|
+
}));
|
|
34
48
|
};
|
|
35
49
|
|
|
36
50
|
const DSPillGroupV2WithSchema = describe(DSPillGroupV2);
|
|
37
|
-
DSPillGroupV2WithSchema.propTypes =
|
|
51
|
+
DSPillGroupV2WithSchema.propTypes = DSPillGroupPropTypes;
|
|
38
52
|
|
|
39
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
|
-
const pillUid = useMemo(() =>
|
|
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
|
});
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import React, { useRef, useMemo, useCallback, useState } from 'react';
|
|
3
4
|
import { uid } from 'uid';
|
|
4
|
-
import
|
|
5
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
5
6
|
import { StyledInputPillWrapper } from '../styled.js';
|
|
6
7
|
import { setMultipleRefs } from '../../utils.js';
|
|
7
8
|
import { DSPillButton } from '../PillButton.js';
|
|
8
9
|
|
|
9
|
-
const InputPill = /*#__PURE__*/React.memo(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
18
21
|
const ref = useRef(null);
|
|
19
22
|
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
20
|
-
const pillUid = useMemo(() =>
|
|
23
|
+
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
21
24
|
const onCloseIconClick = useCallback(e => {
|
|
22
25
|
if ([undefined, 'Enter', 'Space'].includes(e.code)) {
|
|
23
26
|
e.preventDefault();
|
|
@@ -27,6 +30,7 @@ const InputPill = /*#__PURE__*/React.memo(({
|
|
|
27
30
|
}, [onInputClear]);
|
|
28
31
|
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
29
32
|
return /*#__PURE__*/_jsx(StyledInputPillWrapper, {
|
|
33
|
+
size: size,
|
|
30
34
|
className: "ds-pill-wrapper",
|
|
31
35
|
"data-testid": "ds-pill-wrapper",
|
|
32
36
|
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
@@ -52,7 +56,7 @@ const InputPill = /*#__PURE__*/React.memo(({
|
|
|
52
56
|
onKeyDown: onCloseIconClick,
|
|
53
57
|
"aria-label": "Clear input",
|
|
54
58
|
type: "right"
|
|
55
|
-
}, void 0, /*#__PURE__*/_jsx(
|
|
59
|
+
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
56
60
|
size: "s",
|
|
57
61
|
color: ['brand-primary', '700']
|
|
58
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
|
-
const pillUid = useMemo(() =>
|
|
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,19 +44,18 @@ 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",
|
|
41
51
|
innerRef: innerRef,
|
|
42
52
|
onClick: onRemove,
|
|
43
53
|
onKeyDown: onKeyDown,
|
|
44
|
-
"aria-label":
|
|
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
|
});
|