@elliemae/ds-pills 2.3.1 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Pill.js +72 -0
- package/dist/cjs/components/Pill.js.map +7 -0
- package/dist/cjs/components/PillButton.js +86 -0
- package/dist/cjs/components/PillButton.js.map +7 -0
- package/dist/cjs/components/PillGroup.js +100 -0
- package/dist/cjs/components/PillGroup.js.map +7 -0
- package/dist/cjs/components/index.js +30 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/components/styled.js +235 -0
- package/dist/cjs/components/styled.js.map +7 -0
- package/dist/cjs/components/types/DropdownPill.js +105 -0
- package/dist/cjs/components/types/DropdownPill.js.map +7 -0
- package/dist/cjs/components/types/InputPill.js +84 -0
- package/dist/cjs/components/types/InputPill.js.map +7 -0
- package/dist/cjs/components/types/LabelPill.js +52 -0
- package/dist/cjs/components/types/LabelPill.js.map +7 -0
- package/dist/cjs/components/types/ReadOnlyPill.js +55 -0
- package/dist/cjs/components/types/ReadOnlyPill.js.map +7 -0
- package/dist/cjs/components/types/RemovablePill.js +90 -0
- package/dist/cjs/components/types/RemovablePill.js.map +7 -0
- package/dist/cjs/components/types/ValuePill.js +59 -0
- package/dist/cjs/components/types/ValuePill.js.map +7 -0
- package/dist/cjs/components/types/index.js +33 -0
- package/dist/cjs/components/types/index.js.map +7 -0
- package/dist/cjs/deprecated/DropdownPill.js +128 -0
- package/dist/cjs/deprecated/DropdownPill.js.map +7 -0
- package/dist/cjs/deprecated/InputPill.js +114 -0
- package/dist/cjs/deprecated/InputPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js +140 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +169 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +181 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +190 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +44 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/dist/cjs/deprecated/LabeledPills.js +75 -0
- package/dist/cjs/deprecated/LabeledPills.js.map +7 -0
- package/dist/cjs/deprecated/OverflowPill.js +79 -0
- package/dist/cjs/deprecated/OverflowPill.js.map +7 -0
- package/dist/cjs/deprecated/Pill.js +107 -0
- package/dist/cjs/deprecated/Pill.js.map +7 -0
- package/dist/cjs/deprecated/PillGroup.js +84 -0
- package/dist/cjs/deprecated/PillGroup.js.map +7 -0
- package/dist/cjs/deprecated/ReadOnlyPill.js +100 -0
- package/dist/cjs/deprecated/ReadOnlyPill.js.map +7 -0
- package/dist/cjs/deprecated/RemovablePill.js +78 -0
- package/dist/cjs/deprecated/RemovablePill.js.map +7 -0
- package/dist/cjs/deprecated/index.js +43 -0
- package/dist/cjs/deprecated/index.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/props.js +96 -0
- package/dist/cjs/props.js.map +7 -0
- package/dist/cjs/utils.js +46 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/components/Pill.js +45 -0
- package/dist/esm/components/Pill.js.map +7 -0
- package/dist/esm/components/PillButton.js +59 -0
- package/dist/esm/components/PillButton.js.map +7 -0
- package/dist/esm/components/PillGroup.js +78 -0
- package/dist/esm/components/PillGroup.js.map +7 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/styled.js +206 -0
- package/dist/esm/components/styled.js.map +7 -0
- package/dist/esm/components/types/DropdownPill.js +78 -0
- package/dist/esm/components/types/DropdownPill.js.map +7 -0
- package/dist/esm/components/types/InputPill.js +55 -0
- package/dist/esm/components/types/InputPill.js.map +7 -0
- package/dist/esm/components/types/LabelPill.js +23 -0
- package/dist/esm/components/types/LabelPill.js.map +7 -0
- package/dist/esm/components/types/ReadOnlyPill.js +26 -0
- package/dist/esm/components/types/ReadOnlyPill.js.map +7 -0
- package/dist/esm/components/types/RemovablePill.js +61 -0
- package/dist/esm/components/types/RemovablePill.js.map +7 -0
- package/dist/esm/components/types/ValuePill.js +30 -0
- package/dist/esm/components/types/ValuePill.js.map +7 -0
- package/dist/esm/components/types/index.js +8 -0
- package/dist/esm/components/types/index.js.map +7 -0
- package/dist/esm/deprecated/DropdownPill.js +101 -0
- package/dist/esm/deprecated/DropdownPill.js.map +7 -0
- package/dist/esm/deprecated/InputPill.js +87 -0
- package/dist/esm/deprecated/InputPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js +113 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +142 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +154 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +163 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js +15 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/dist/esm/deprecated/LabeledPills.js +46 -0
- package/dist/esm/deprecated/LabeledPills.js.map +7 -0
- package/dist/esm/deprecated/OverflowPill.js +50 -0
- package/dist/esm/deprecated/OverflowPill.js.map +7 -0
- package/dist/esm/deprecated/Pill.js +80 -0
- package/dist/esm/deprecated/Pill.js.map +7 -0
- package/dist/esm/deprecated/PillGroup.js +57 -0
- package/dist/esm/deprecated/PillGroup.js.map +7 -0
- package/dist/esm/deprecated/ReadOnlyPill.js +71 -0
- package/dist/esm/deprecated/ReadOnlyPill.js.map +7 -0
- package/dist/esm/deprecated/RemovablePill.js +49 -0
- package/dist/esm/deprecated/RemovablePill.js.map +7 -0
- package/dist/esm/deprecated/index.js +14 -0
- package/dist/esm/deprecated/index.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/props.js +67 -0
- package/dist/esm/props.js.map +7 -0
- package/dist/esm/utils.js +17 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +94 -85
- package/cjs/components/Pill.js +0 -53
- package/cjs/components/PillButton.js +0 -56
- package/cjs/components/PillGroup.js +0 -87
- package/cjs/components/index.js +0 -17
- package/cjs/components/styled.js +0 -85
- package/cjs/components/types/DropdownPill.js +0 -86
- package/cjs/components/types/InputPill.js +0 -74
- package/cjs/components/types/LabelPill.js +0 -46
- package/cjs/components/types/ReadOnlyPill.js +0 -50
- package/cjs/components/types/RemovablePill.js +0 -85
- package/cjs/components/types/ValuePill.js +0 -54
- package/cjs/components/types/index.js +0 -19
- package/cjs/deprecated/DropdownPill.js +0 -113
- package/cjs/deprecated/InputPill.js +0 -84
- package/cjs/deprecated/LabeledDropdownPills.js +0 -106
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -134
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -153
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -162
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +0 -20
- package/cjs/deprecated/LabeledPills.js +0 -62
- package/cjs/deprecated/OverflowPill.js +0 -73
- package/cjs/deprecated/Pill.js +0 -88
- package/cjs/deprecated/PillGroup.js +0 -72
- package/cjs/deprecated/ReadOnlyPill.js +0 -101
- package/cjs/deprecated/RemovablePill.js +0 -74
- package/cjs/deprecated/index.js +0 -33
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -43
- package/cjs/props.js +0 -70
- package/cjs/utils.js +0 -28
- package/esm/components/Pill.js +0 -44
- package/esm/components/PillButton.js +0 -46
- package/esm/components/PillGroup.js +0 -75
- package/esm/components/index.js +0 -3
- package/esm/components/styled.js +0 -67
- package/esm/components/types/DropdownPill.js +0 -76
- package/esm/components/types/InputPill.js +0 -65
- package/esm/components/types/LabelPill.js +0 -37
- package/esm/components/types/ReadOnlyPill.js +0 -41
- package/esm/components/types/RemovablePill.js +0 -76
- package/esm/components/types/ValuePill.js +0 -45
- package/esm/components/types/index.js +0 -6
- package/esm/deprecated/DropdownPill.js +0 -100
- package/esm/deprecated/InputPill.js +0 -74
- package/esm/deprecated/LabeledDropdownPills.js +0 -95
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -126
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -145
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -154
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +0 -16
- package/esm/deprecated/LabeledPills.js +0 -53
- package/esm/deprecated/OverflowPill.js +0 -62
- package/esm/deprecated/Pill.js +0 -76
- package/esm/deprecated/PillGroup.js +0 -60
- package/esm/deprecated/ReadOnlyPill.js +0 -90
- package/esm/deprecated/RemovablePill.js +0 -64
- package/esm/deprecated/index.js +0 -8
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -11
- package/esm/props.js +0 -61
- package/esm/utils.js +0 -24
- package/types/components/Pill.d.ts +0 -5
- package/types/components/PillButton.d.ts +0 -5
- package/types/components/PillGroup.d.ts +0 -9
- package/types/components/index.d.ts +0 -3
- package/types/components/styled.d.ts +0 -20
- package/types/components/types/DropdownPill.d.ts +0 -3
- package/types/components/types/InputPill.d.ts +0 -3
- package/types/components/types/LabelPill.d.ts +0 -3
- package/types/components/types/ReadOnlyPill.d.ts +0 -3
- package/types/components/types/RemovablePill.d.ts +0 -3
- package/types/components/types/ValuePill.d.ts +0 -3
- package/types/components/types/index.d.ts +0 -6
- package/types/deprecated/DropdownPill.d.ts +0 -66
- package/types/deprecated/InputPill.d.ts +0 -10
- package/types/deprecated/LabeledDropdownPills.d.ts +0 -82
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +0 -15
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +0 -13
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +0 -28
- package/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +0 -1
- package/types/deprecated/LabeledPills.d.ts +0 -52
- package/types/deprecated/OverflowPill.d.ts +0 -33
- package/types/deprecated/Pill.d.ts +0 -59
- package/types/deprecated/PillGroup.d.ts +0 -50
- package/types/deprecated/ReadOnlyPill.d.ts +0 -56
- package/types/deprecated/RemovablePill.d.ts +0 -49
- package/types/deprecated/index.d.ts +0 -9
- package/types/index.d.ts +0 -3
- package/types/props.d.ts +0 -93
- package/types/tests/DSPill.test.d.ts +0 -1
- package/types/tests/DSPillGroup.test.d.ts +0 -1
- package/types/tests/events/DSPill.events.keyboard.test.d.ts +0 -1
- package/types/tests/events/DSPill.events.test.d.ts +0 -1
- package/types/tests/events/DSPillGroup.events.keyboard.test.d.ts +0 -1
- package/types/tests/events/DSPillGroup.events.test.d.ts +0 -1
- package/types/utils.d.ts +0 -4
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
-
import 'react';
|
|
9
|
-
import { describe } from 'react-desc';
|
|
10
|
-
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
11
|
-
import { StyledPillButton } from './styled.js';
|
|
12
|
-
import { DSPillButtonPropTypes, DSPillButtonDefaultProps } from '../props.js';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
const _excluded = ["type", "children"];
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
const typeToClassName = {
|
|
21
|
-
only: 'ds-pill-button-only',
|
|
22
|
-
left: 'ds-pill-button-left',
|
|
23
|
-
right: 'ds-pill-button-right'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const DSPillButton = props => {
|
|
27
|
-
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillButtonDefaultProps);
|
|
28
|
-
useValidateTypescriptPropTypes(propsWithDefaults, DSPillButtonPropTypes);
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
type,
|
|
32
|
-
children
|
|
33
|
-
} = propsWithDefaults,
|
|
34
|
-
rest = _objectWithoutProperties(propsWithDefaults, _excluded);
|
|
35
|
-
|
|
36
|
-
return /*#__PURE__*/jsx(StyledPillButton, _objectSpread(_objectSpread({}, rest), {}, {
|
|
37
|
-
buttonType: "raw",
|
|
38
|
-
className: "".concat(typeToClassName[type], " ").concat(rest.className),
|
|
39
|
-
children: children
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const DSPillButtonWithSchema = describe(DSPillButton).description('Pill button');
|
|
44
|
-
DSPillButtonWithSchema.propTypes = DSPillButtonPropTypes;
|
|
45
|
-
|
|
46
|
-
export { DSPillButton, DSPillButtonWithSchema };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
11
|
-
import React, { createContext, useMemo, useCallback } from 'react';
|
|
12
|
-
import { uid } from 'uid';
|
|
13
|
-
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
|
|
14
|
-
import { DSPillGroupPropTypes, DSPillGroupDefaultProps } from '../props.js';
|
|
15
|
-
import { StyledPillGroup } from './styled.js';
|
|
16
|
-
import { jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
const DSPillGroupV2Context = /*#__PURE__*/createContext({
|
|
22
|
-
onKeyboardRemove: () => null,
|
|
23
|
-
onKeyboardNavigation: () => null
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const DSPillGroupV2 = props => {
|
|
27
|
-
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillGroupDefaultProps);
|
|
28
|
-
useValidateTypescriptPropTypes(propsWithDefaults, DSPillGroupPropTypes);
|
|
29
|
-
const globalAttrs = useGetGlobalAttributes(propsWithDefaults);
|
|
30
|
-
const pillGroupUid = useMemo(() => "ds-pill-group-".concat(uid()), []);
|
|
31
|
-
const {
|
|
32
|
-
children,
|
|
33
|
-
width,
|
|
34
|
-
innerRef
|
|
35
|
-
} = propsWithDefaults;
|
|
36
|
-
const onKeyboardRemove = useCallback(pillUid => {
|
|
37
|
-
const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
|
|
38
|
-
const pillIndex = elems.findIndex(elem => elem.id === pillUid);
|
|
39
|
-
|
|
40
|
-
if (pillIndex > 0) {
|
|
41
|
-
elems[pillIndex - 1].focus();
|
|
42
|
-
} else if (pillIndex + 1 < elems.length) {
|
|
43
|
-
elems[pillIndex + 1].focus();
|
|
44
|
-
}
|
|
45
|
-
}, [pillGroupUid]);
|
|
46
|
-
const onKeyboardNavigation = useCallback((pillUid, step, e) => {
|
|
47
|
-
const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
|
|
48
|
-
const pillIndex = elems.findIndex(elem => elem.id === pillUid);
|
|
49
|
-
|
|
50
|
-
if (pillIndex >= 0) {
|
|
51
|
-
if (elems[pillIndex + step]) {
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
elems[pillIndex + step].focus();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, [pillGroupUid]);
|
|
57
|
-
return /*#__PURE__*/_jsx(DSPillGroupV2Context.Provider, {
|
|
58
|
-
value: {
|
|
59
|
-
onKeyboardRemove,
|
|
60
|
-
onKeyboardNavigation
|
|
61
|
-
}
|
|
62
|
-
}, void 0, /*#__PURE__*/jsx(StyledPillGroup, _objectSpread(_objectSpread({}, globalAttrs), {}, {
|
|
63
|
-
width: width,
|
|
64
|
-
id: pillGroupUid,
|
|
65
|
-
cols: React.Children.map(children, () => 'auto'),
|
|
66
|
-
gutter: "2px",
|
|
67
|
-
ref: innerRef,
|
|
68
|
-
children: children
|
|
69
|
-
})));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const DSPillGroupV2WithSchema = describe(DSPillGroupV2);
|
|
73
|
-
DSPillGroupV2WithSchema.propTypes = DSPillGroupPropTypes;
|
|
74
|
-
|
|
75
|
-
export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema };
|
package/esm/components/index.js
DELETED
package/esm/components/styled.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { css } from '@elliemae/ds-system';
|
|
4
|
-
import Grid from '@elliemae/ds-grid';
|
|
5
|
-
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
6
|
-
|
|
7
|
-
var _templateObject, _templateObject2;
|
|
8
|
-
// Common CSS
|
|
9
|
-
// =============================================================================
|
|
10
|
-
|
|
11
|
-
const borderOutside = function (color) {
|
|
12
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
13
|
-
let zIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
14
|
-
let borderRadius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '12px';
|
|
15
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :after {\n content: ' ';\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n border: ", "px solid ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n pointer-events: none;\n z-index: ", ";\n }\n"])), size, color, borderRadius, borderRadius, borderRadius, borderRadius, zIndex);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const commonPillWrapperCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: ", ";\n\n position: relative;\n\n width: fit-content;\n\n background-color: ", ";\n\n outline: none;\n\n white-space: nowrap;\n\n padding: 0px 12px 0 12px;\n border-radius: 12px;\n\n font-size: 13px;\n line-height: 1;\n color: ", ";\n ", ";\n"])), props => (props === null || props === void 0 ? void 0 : props.size) === 'm' ? '24px' : '18px', props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => borderOutside(props.theme.colors.brand[300])); // =============================================================================
|
|
19
|
-
// Pills wrappers
|
|
20
|
-
// =============================================================================
|
|
21
|
-
|
|
22
|
-
const StyledLabelPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
23
|
-
componentId: "sc-j0tlch-0"
|
|
24
|
-
})(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIcon ? '0px !important' : '12px');
|
|
25
|
-
const StyledValuePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
26
|
-
componentId: "sc-j0tlch-1"
|
|
27
|
-
})(["", " font-weight:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.regular, props => props.hasIcon ? '0px !important' : '12px');
|
|
28
|
-
const StyledInputPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
29
|
-
componentId: "sc-j0tlch-2"
|
|
30
|
-
})(["", " background:", ";padding:0;", ":focus-within{", "}:active{", "}& .em-ds-input{outline:none !important;border:none !important;box-shadow:none !important;border-radius:0 !important;height:100%;background:transparent;width:", ";padding:0;margin:0 0 0 8px;}& .em-ds-input__tooltip-ref{height:100%;}"], commonPillWrapperCss, props => props.theme.colors.neutral['000'], _ref => {
|
|
31
|
-
let {
|
|
32
|
-
value,
|
|
33
|
-
theme
|
|
34
|
-
} = _ref;
|
|
35
|
-
return borderOutside(value === '' ? theme.colors.neutral[400] : theme.colors.brand[500]);
|
|
36
|
-
}, props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '', props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '', props => "".concat(props.inputWidth + (props.value === '' ? 24 : 0), "px"));
|
|
37
|
-
const StyledDropdownPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
38
|
-
componentId: "sc-j0tlch-3"
|
|
39
|
-
})(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.semibold);
|
|
40
|
-
const StyledReadonlyPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
41
|
-
componentId: "sc-j0tlch-4"
|
|
42
|
-
})(["", " font-weight:", ";padding-right:", ";padding-left:", ";"], commonPillWrapperCss, props => props.theme.fontWeights.semibold, props => props.hasIconRight ? '0 !important' : '12px', props => props.hasIconLeft ? '0 !important' : '12px');
|
|
43
|
-
const StyledRemovablePillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
44
|
-
componentId: "sc-j0tlch-5"
|
|
45
|
-
})(["", " font-weight:", ";padding:0 0 0 12px;"], commonPillWrapperCss, props => props.theme.fontWeights.regular); // =============================================================================
|
|
46
|
-
// Pill group
|
|
47
|
-
// =============================================================================
|
|
48
|
-
|
|
49
|
-
const StyledPillGroup = /*#__PURE__*/styled(Grid).withConfig({
|
|
50
|
-
componentId: "sc-j0tlch-6"
|
|
51
|
-
})(["width:", ";& .ds-pill-wrapper{&:not(:first-of-type){&,:after,:before,.ds-pill-tooltip-value:after{border-top-left-radius:0px;border-bottom-left-radius:0px;}}&:not(:last-of-type){&,:after,:before,.ds-pill-tooltip-value:after{border-top-right-radius:0px;border-bottom-right-radius:0px;}}}& .ds-pill-wrapper-label,& .ds-pill-wrapper-value,& .ds-pill-wrapper-readonly{&:not(:first-of-type){padding-left:8px;}&:not(:last-of-type){padding-right:8px;}}& .ds-pill-wrapper-removable:not(:first-of-type){padding-left:8px;}& .ds-pill-wrapper-dropdown:not(:first-of-type){padding-left:8px;}& .ds-pill-wrapper{:not(:first-of-type){.ds-pill-button-left{border-radius:0px;}.ds-pill-button-only{border-top-left-radius:0px;border-bottom-left-radius:0px;}}:not(:last-of-type){.ds-pill-button-right{border-radius:0px;}.ds-pill-button-only{border-top-right-radius:0px;border-bottom-right-radius:0px;}}}"], _ref2 => {
|
|
52
|
-
let {
|
|
53
|
-
width
|
|
54
|
-
} = _ref2;
|
|
55
|
-
return width;
|
|
56
|
-
}); // =============================================================================
|
|
57
|
-
// Extra stuff
|
|
58
|
-
// =============================================================================
|
|
59
|
-
|
|
60
|
-
const StyledSpanWithTooltip = /*#__PURE__*/styled.span.withConfig({
|
|
61
|
-
componentId: "sc-j0tlch-7"
|
|
62
|
-
})(["outline:none;:focus{", "}"], props => borderOutside(props.theme.colors.brand[700], 2, 3));
|
|
63
|
-
const StyledPillButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
64
|
-
componentId: "sc-j0tlch-8"
|
|
65
|
-
})(["display:grid;place-items:center;position:relative;padding:0;width:", ";height:", ";border-radius:12px;:focus{", "}cursor:pointer;"], props => props.width, props => props.height, props => borderOutside(props.theme.colors.brand[700], 2, 3, 'inherit'));
|
|
66
|
-
|
|
67
|
-
export { StyledDropdownPillWrapper, StyledInputPillWrapper, StyledLabelPillWrapper, StyledPillButton, StyledPillGroup, StyledReadonlyPillWrapper, StyledRemovablePillWrapper, StyledSpanWithTooltip, StyledValuePillWrapper };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
-
import React, { useRef, useMemo } from 'react';
|
|
9
|
-
import { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';
|
|
10
|
-
import { uid } from 'uid';
|
|
11
|
-
import { ChevronSmallDown } from '@elliemae/ds-icons';
|
|
12
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
13
|
-
import { StyledDropdownPillWrapper } from '../styled.js';
|
|
14
|
-
import { setMultipleRefs } from '../../utils.js';
|
|
15
|
-
import { DSPillButton } from '../PillButton.js';
|
|
16
|
-
import { jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
const DropdownPill = /*#__PURE__*/React.memo(_ref => {
|
|
22
|
-
let {
|
|
23
|
-
label,
|
|
24
|
-
size,
|
|
25
|
-
labelTruncated,
|
|
26
|
-
dropdownProps,
|
|
27
|
-
innerRef,
|
|
28
|
-
ariaLabel,
|
|
29
|
-
onDropdownClick
|
|
30
|
-
} = _ref;
|
|
31
|
-
const chevronRef = useRef(null);
|
|
32
|
-
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
33
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
34
|
-
let {
|
|
35
|
-
children
|
|
36
|
-
} = _ref2;
|
|
37
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
38
|
-
value: children
|
|
39
|
-
});
|
|
40
|
-
} : React.Fragment;
|
|
41
|
-
return /*#__PURE__*/_jsx(StyledDropdownPillWrapper, {
|
|
42
|
-
size: size,
|
|
43
|
-
id: pillUid,
|
|
44
|
-
className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
|
|
45
|
-
"data-testid": "ds-pill-wrapper",
|
|
46
|
-
cols: ['auto', '24px'],
|
|
47
|
-
gutter: "2px",
|
|
48
|
-
alignItems: "center",
|
|
49
|
-
justifyItems: "center"
|
|
50
|
-
}, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/jsx(DSDropdownMenuV2, _objectSpread(_objectSpread({
|
|
51
|
-
placementOrderPreference: ['bottom-start', 'bottom', 'bottom-end', 'right-end', 'top-start', 'top', 'top-end']
|
|
52
|
-
}, dropdownProps), {}, {
|
|
53
|
-
onClickOutside: e => {
|
|
54
|
-
if (e.code === 'Escape') chevronRef.current.focus();
|
|
55
|
-
if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);
|
|
56
|
-
},
|
|
57
|
-
wrapperStyles: {
|
|
58
|
-
w: '100%',
|
|
59
|
-
h: '100%'
|
|
60
|
-
},
|
|
61
|
-
children: /*#__PURE__*/_jsx(DSPillButton, {
|
|
62
|
-
className: "ds-pill-focus-point",
|
|
63
|
-
"data-testid": "ds-pill-dropdown-chevron",
|
|
64
|
-
innerRef: setMultipleRefs(chevronRef, innerRef),
|
|
65
|
-
"aria-label": ariaLabel || label,
|
|
66
|
-
type: "right",
|
|
67
|
-
onClick: onDropdownClick
|
|
68
|
-
}, void 0, /*#__PURE__*/_jsx(ChevronSmallDown, {
|
|
69
|
-
color: ['brand-primary', '800'],
|
|
70
|
-
width: 20,
|
|
71
|
-
height: 20
|
|
72
|
-
}))
|
|
73
|
-
})));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export { DropdownPill };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
-
import React, { useRef, useMemo, useCallback, useState } from 'react';
|
|
4
|
-
import { uid } from 'uid';
|
|
5
|
-
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
6
|
-
import { StyledInputPillWrapper } from '../styled.js';
|
|
7
|
-
import { setMultipleRefs } from '../../utils.js';
|
|
8
|
-
import { DSPillButton } from '../PillButton.js';
|
|
9
|
-
|
|
10
|
-
const InputPill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
-
let {
|
|
12
|
-
label,
|
|
13
|
-
size,
|
|
14
|
-
inputPlaceholder,
|
|
15
|
-
inputWidth,
|
|
16
|
-
inputRender,
|
|
17
|
-
onInputChange,
|
|
18
|
-
onInputClear,
|
|
19
|
-
innerRef
|
|
20
|
-
} = _ref;
|
|
21
|
-
const ref = useRef(null);
|
|
22
|
-
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
23
|
-
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
24
|
-
const onCloseIconClick = useCallback(e => {
|
|
25
|
-
if ([undefined, 'Enter', 'Space'].includes(e.code)) {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
onInputClear(e);
|
|
28
|
-
ref.current.focus();
|
|
29
|
-
}
|
|
30
|
-
}, [onInputClear]);
|
|
31
|
-
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
32
|
-
return /*#__PURE__*/_jsx(StyledInputPillWrapper, {
|
|
33
|
-
size: size,
|
|
34
|
-
className: "ds-pill-wrapper",
|
|
35
|
-
"data-testid": "ds-pill-wrapper",
|
|
36
|
-
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
37
|
-
inputWidth: inputWidth,
|
|
38
|
-
value: label,
|
|
39
|
-
inputHasFocus: inputHasFocus
|
|
40
|
-
}, void 0, /*#__PURE__*/_jsx(InputComponent, {
|
|
41
|
-
id: pillUid,
|
|
42
|
-
className: "ds-pill-focus-point",
|
|
43
|
-
"data-testid": "ds-pill-input",
|
|
44
|
-
innerRef: setMultipleRefs(ref, innerRef),
|
|
45
|
-
value: label,
|
|
46
|
-
onChange: onInputChange,
|
|
47
|
-
placeholder: inputPlaceholder,
|
|
48
|
-
onFocus: () => setInputHasFocus(true),
|
|
49
|
-
onBlur: () => setInputHasFocus(false),
|
|
50
|
-
disableTooltip: false
|
|
51
|
-
}), label !== '' && /*#__PURE__*/_jsx(DSPillButton, {
|
|
52
|
-
id: pillUid,
|
|
53
|
-
"data-testid": "ds-pill-clear-icon",
|
|
54
|
-
innerRef: innerRef,
|
|
55
|
-
onClick: onCloseIconClick,
|
|
56
|
-
onKeyDown: onCloseIconClick,
|
|
57
|
-
"aria-label": "Clear input",
|
|
58
|
-
type: "right"
|
|
59
|
-
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
60
|
-
size: "s",
|
|
61
|
-
color: ['brand-primary', '700']
|
|
62
|
-
})));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export { InputPill };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
7
|
-
import { StyledLabelPillWrapper } from '../styled.js';
|
|
8
|
-
|
|
9
|
-
const LabelPill = /*#__PURE__*/React.memo(_ref => {
|
|
10
|
-
let {
|
|
11
|
-
label,
|
|
12
|
-
size,
|
|
13
|
-
labelTruncated,
|
|
14
|
-
iconLeft,
|
|
15
|
-
ariaLabel
|
|
16
|
-
} = _ref;
|
|
17
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
18
|
-
let {
|
|
19
|
-
children
|
|
20
|
-
} = _ref2;
|
|
21
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
22
|
-
value: children
|
|
23
|
-
});
|
|
24
|
-
} : React.Fragment;
|
|
25
|
-
return /*#__PURE__*/_jsx(StyledLabelPillWrapper, {
|
|
26
|
-
size: size,
|
|
27
|
-
alignItems: "center",
|
|
28
|
-
className: "ds-pill-wrapper ds-pill-wrapper-label",
|
|
29
|
-
"data-testid": "ds-pill-wrapper",
|
|
30
|
-
"aria-label": ariaLabel || label,
|
|
31
|
-
cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
|
|
32
|
-
gutter: "xxxs",
|
|
33
|
-
hasIcon: iconLeft !== null
|
|
34
|
-
}, void 0, iconLeft, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export { LabelPill };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
7
|
-
import { StyledReadonlyPillWrapper } from '../styled.js';
|
|
8
|
-
|
|
9
|
-
const ReadOnlyPill = /*#__PURE__*/React.memo(_ref => {
|
|
10
|
-
let {
|
|
11
|
-
label,
|
|
12
|
-
size,
|
|
13
|
-
labelTruncated,
|
|
14
|
-
iconLeft,
|
|
15
|
-
iconRight,
|
|
16
|
-
ariaLabel
|
|
17
|
-
} = _ref;
|
|
18
|
-
const hasIconLeft = iconLeft !== null || iconRight !== null && label === '';
|
|
19
|
-
const hasIconRight = iconRight !== null || iconLeft !== null && label === '';
|
|
20
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
children
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
25
|
-
value: children
|
|
26
|
-
});
|
|
27
|
-
} : React.Fragment;
|
|
28
|
-
return /*#__PURE__*/_jsx(StyledReadonlyPillWrapper, {
|
|
29
|
-
size: size,
|
|
30
|
-
alignItems: "center",
|
|
31
|
-
className: "ds-pill-wrapper ds-pill-wrapper-readonly",
|
|
32
|
-
"data-testid": "ds-pill-wrapper",
|
|
33
|
-
"aria-label": ariaLabel || label,
|
|
34
|
-
cols: [iconLeft && 'min-content', label && 'auto', iconRight && 'min-content'].filter(notFalse => notFalse),
|
|
35
|
-
gutter: "xxxs",
|
|
36
|
-
hasIconRight: hasIconRight,
|
|
37
|
-
hasIconLeft: hasIconLeft
|
|
38
|
-
}, void 0, iconLeft, label ? /*#__PURE__*/_jsx(TextComponent, {}, void 0, label) : null, iconRight);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { ReadOnlyPill };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import React, { useContext, useMemo, useCallback } from 'react';
|
|
3
|
-
import { uid } from 'uid';
|
|
4
|
-
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
5
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
6
|
-
import { StyledRemovablePillWrapper } from '../styled.js';
|
|
7
|
-
import { DSPillGroupV2Context } from '../PillGroup.js';
|
|
8
|
-
import { DSPillButton } from '../PillButton.js';
|
|
9
|
-
|
|
10
|
-
const RemovablePill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
-
let {
|
|
12
|
-
label,
|
|
13
|
-
size,
|
|
14
|
-
labelTruncated,
|
|
15
|
-
onRemove,
|
|
16
|
-
innerRef,
|
|
17
|
-
ariaLabel,
|
|
18
|
-
tabIndex
|
|
19
|
-
} = _ref;
|
|
20
|
-
const {
|
|
21
|
-
onKeyboardRemove,
|
|
22
|
-
onKeyboardNavigation
|
|
23
|
-
} = useContext(DSPillGroupV2Context);
|
|
24
|
-
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
25
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
26
|
-
let {
|
|
27
|
-
children
|
|
28
|
-
} = _ref2;
|
|
29
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
30
|
-
value: children
|
|
31
|
-
});
|
|
32
|
-
} : React.Fragment;
|
|
33
|
-
const onKeyDown = useCallback(e => {
|
|
34
|
-
if (['Enter', 'Space'].includes(e.code)) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
if (onKeyboardRemove) onKeyboardRemove(pillUid);
|
|
37
|
-
onRemove(e);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (e.code === 'ArrowLeft') {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
if (onKeyboardNavigation) onKeyboardNavigation(pillUid, -1, e);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (e.code === 'ArrowRight') {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
if (onKeyboardNavigation) onKeyboardNavigation(pillUid, 1, e);
|
|
48
|
-
}
|
|
49
|
-
}, [onKeyboardRemove, onRemove, onKeyboardNavigation, pillUid]);
|
|
50
|
-
return /*#__PURE__*/_jsx(StyledRemovablePillWrapper, {
|
|
51
|
-
size: size,
|
|
52
|
-
cols: ['auto', '24px'],
|
|
53
|
-
gutter: "2px",
|
|
54
|
-
alignItems: "center",
|
|
55
|
-
justifyItems: "center",
|
|
56
|
-
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
57
|
-
"data-testid": "ds-pill-wrapper",
|
|
58
|
-
"aria-label": ariaLabel || label
|
|
59
|
-
}, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/_jsx(DSPillButton, {
|
|
60
|
-
className: "ds-pill-focus-point",
|
|
61
|
-
id: pillUid,
|
|
62
|
-
"data-testid": "ds-pill-close-icon",
|
|
63
|
-
innerRef: innerRef,
|
|
64
|
-
onClick: onRemove,
|
|
65
|
-
onKeyDown: onKeyDown,
|
|
66
|
-
"aria-label": "Remove ".concat(label),
|
|
67
|
-
type: "right",
|
|
68
|
-
tabIndex: tabIndex
|
|
69
|
-
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
70
|
-
width: size === 's' ? 18 : 22.65,
|
|
71
|
-
height: size === 's' ? 18 : 22.65,
|
|
72
|
-
color: ['brand-primary', '700']
|
|
73
|
-
})));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export { RemovablePill };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { DSTooltipV2 } from '@elliemae/ds-tooltip';
|
|
7
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
8
|
-
import { StyledValuePillWrapper, StyledSpanWithTooltip } from '../styled.js';
|
|
9
|
-
|
|
10
|
-
const ValuePill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
-
let {
|
|
12
|
-
label,
|
|
13
|
-
size,
|
|
14
|
-
labelTruncated,
|
|
15
|
-
tooltipValue,
|
|
16
|
-
iconLeft,
|
|
17
|
-
ariaLabel
|
|
18
|
-
} = _ref;
|
|
19
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
20
|
-
let {
|
|
21
|
-
children
|
|
22
|
-
} = _ref2;
|
|
23
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
24
|
-
value: children
|
|
25
|
-
});
|
|
26
|
-
} : React.Fragment;
|
|
27
|
-
return /*#__PURE__*/_jsx(StyledValuePillWrapper, {
|
|
28
|
-
size: size,
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
31
|
-
"data-testid": "ds-pill-wrapper",
|
|
32
|
-
"aria-label": ariaLabel || label,
|
|
33
|
-
cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
|
|
34
|
-
gutter: "xxxs",
|
|
35
|
-
hasIcon: iconLeft !== null
|
|
36
|
-
}, void 0, iconLeft, tooltipValue !== '' ? /*#__PURE__*/_jsx(DSTooltipV2, {
|
|
37
|
-
title: tooltipValue,
|
|
38
|
-
triggerComponent: /*#__PURE__*/_jsx(StyledSpanWithTooltip, {
|
|
39
|
-
className: "ds-pill-tooltip-value",
|
|
40
|
-
tabIndex: 0
|
|
41
|
-
}, void 0, label)
|
|
42
|
-
}) : /*#__PURE__*/_jsx(TextComponent, {}, void 0, label));
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export { ValuePill };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { DropdownPill } from './DropdownPill.js';
|
|
2
|
-
export { InputPill } from './InputPill.js';
|
|
3
|
-
export { LabelPill } from './LabelPill.js';
|
|
4
|
-
export { ReadOnlyPill } from './ReadOnlyPill.js';
|
|
5
|
-
export { RemovablePill } from './RemovablePill.js';
|
|
6
|
-
export { ValuePill } from './ValuePill.js';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
-
import { useRef, useState } from 'react';
|
|
11
|
-
import { PropTypes, describe } from 'react-desc';
|
|
12
|
-
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
13
|
-
import { ChevronDown } from '@elliemae/ds-icons';
|
|
14
|
-
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
15
|
-
import { Pill } from './Pill.js';
|
|
16
|
-
import { jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
var _ChevronDown;
|
|
19
|
-
|
|
20
|
-
const _excluded = ["containerProps", "label", "variant", "tabIndex", "closeMenuOnItemSelection", "maxWidth", "minWidth"];
|
|
21
|
-
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
26
|
-
function DropdownPill(_ref) {
|
|
27
|
-
let {
|
|
28
|
-
containerProps = {},
|
|
29
|
-
label = '',
|
|
30
|
-
variant,
|
|
31
|
-
tabIndex = -1,
|
|
32
|
-
closeMenuOnItemSelection = false,
|
|
33
|
-
maxWidth,
|
|
34
|
-
minWidth
|
|
35
|
-
} = _ref,
|
|
36
|
-
dropdownProps = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
|
|
38
|
-
const ref = useRef(null);
|
|
39
|
-
const [chevronEl, chevronRef] = useState();
|
|
40
|
-
const {
|
|
41
|
-
focusFirst
|
|
42
|
-
} = useFocusGroupItem(ref);
|
|
43
|
-
return /*#__PURE__*/jsx(DSDropdownMenu, _objectSpread(_objectSpread({}, dropdownProps), {}, {
|
|
44
|
-
closeMenuOnItemSelection: closeMenuOnItemSelection,
|
|
45
|
-
maxWidth: maxWidth,
|
|
46
|
-
hideIfNotVisible: true,
|
|
47
|
-
menuProps: {
|
|
48
|
-
className: 'dropdown-pill-menu',
|
|
49
|
-
zIndex: 100
|
|
50
|
-
},
|
|
51
|
-
minWidth: minWidth,
|
|
52
|
-
onClose: focusFirst,
|
|
53
|
-
referenceNode: chevronEl,
|
|
54
|
-
triggerComponent: /*#__PURE__*/_jsx(Pill, {
|
|
55
|
-
"data-testid": "dropdown-pill",
|
|
56
|
-
className: "dropdown-pill",
|
|
57
|
-
containerProps: _objectSpread({
|
|
58
|
-
role: 'listbox'
|
|
59
|
-
}, containerProps),
|
|
60
|
-
innerRef: ref,
|
|
61
|
-
label: label,
|
|
62
|
-
rightAddon: /*#__PURE__*/jsx("div", {
|
|
63
|
-
ref: chevronRef,
|
|
64
|
-
children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx(ChevronDown, {
|
|
65
|
-
className: "dropdown-pill-chevron-down",
|
|
66
|
-
"data-testid": "dropdown-pill-button"
|
|
67
|
-
}))
|
|
68
|
-
}),
|
|
69
|
-
tabIndex: tabIndex,
|
|
70
|
-
variant: variant
|
|
71
|
-
})
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const props = {
|
|
76
|
-
/** props injected to component wrapper */
|
|
77
|
-
containerProps: PropTypes.object.description('props injected to component wrapper'),
|
|
78
|
-
|
|
79
|
-
/** labeled pill text label */
|
|
80
|
-
label: PropTypes.string.isRequired.description('pill text label'),
|
|
81
|
-
|
|
82
|
-
/** pill variant */
|
|
83
|
-
variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),
|
|
84
|
-
|
|
85
|
-
/** html focus border */
|
|
86
|
-
tabIndex: PropTypes.number.description('html focus order'),
|
|
87
|
-
|
|
88
|
-
/** close menu on item selection */
|
|
89
|
-
closeMenuOnItemSelection: PropTypes.bool.description('close menu on item selection'),
|
|
90
|
-
|
|
91
|
-
/** pill max width */
|
|
92
|
-
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),
|
|
93
|
-
|
|
94
|
-
/** pill min width */
|
|
95
|
-
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width')
|
|
96
|
-
};
|
|
97
|
-
const DSDropdownPillWithSchema = describe(DropdownPill);
|
|
98
|
-
DSDropdownPillWithSchema.propTypes = props;
|
|
99
|
-
|
|
100
|
-
export { DSDropdownPillWithSchema, DropdownPill };
|