@elliemae/ds-pills 2.3.0-alpha.8 → 2.3.0-next.2
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 +53 -0
- package/cjs/components/PillButton.js +56 -0
- package/cjs/components/PillGroup.js +64 -0
- package/cjs/components/index.js +17 -0
- package/cjs/components/styled.js +85 -0
- package/cjs/components/types/DropdownPill.js +86 -0
- package/cjs/components/types/InputPill.js +74 -0
- package/cjs/components/types/LabelPill.js +46 -0
- package/cjs/components/types/ReadOnlyPill.js +50 -0
- package/cjs/components/types/RemovablePill.js +72 -0
- package/cjs/components/types/ValuePill.js +54 -0
- package/cjs/components/types/index.js +19 -0
- package/cjs/deprecated/DropdownPill.js +113 -0
- package/cjs/deprecated/InputPill.js +84 -0
- package/cjs/deprecated/LabeledDropdownPills.js +106 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +134 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +153 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +162 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +20 -0
- package/cjs/deprecated/LabeledPills.js +62 -0
- package/cjs/deprecated/OverflowPill.js +73 -0
- package/cjs/deprecated/Pill.js +88 -0
- package/cjs/deprecated/PillGroup.js +72 -0
- package/cjs/deprecated/ReadOnlyPill.js +101 -0
- package/cjs/deprecated/RemovablePill.js +74 -0
- package/cjs/deprecated/index.js +33 -0
- package/cjs/index.d.js +2 -0
- package/cjs/index.js +43 -0
- package/cjs/props.js +69 -0
- package/cjs/utils.js +28 -0
- package/esm/components/Pill.js +44 -0
- package/esm/components/PillButton.js +46 -0
- package/esm/components/PillGroup.js +53 -0
- package/esm/components/index.js +3 -0
- package/esm/components/styled.js +67 -0
- package/esm/components/types/DropdownPill.js +76 -0
- package/esm/components/types/InputPill.js +65 -0
- package/esm/components/types/LabelPill.js +37 -0
- package/esm/components/types/ReadOnlyPill.js +41 -0
- package/esm/components/types/RemovablePill.js +63 -0
- package/esm/components/types/ValuePill.js +45 -0
- package/esm/components/types/index.js +6 -0
- package/esm/deprecated/DropdownPill.js +100 -0
- package/esm/deprecated/InputPill.js +74 -0
- package/esm/deprecated/LabeledDropdownPills.js +95 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +126 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +145 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +154 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +16 -0
- package/esm/deprecated/LabeledPills.js +53 -0
- package/esm/deprecated/OverflowPill.js +62 -0
- package/esm/deprecated/Pill.js +76 -0
- package/esm/deprecated/PillGroup.js +60 -0
- package/esm/deprecated/ReadOnlyPill.js +90 -0
- package/esm/deprecated/RemovablePill.js +64 -0
- package/esm/deprecated/index.js +8 -0
- package/esm/index.d.js +1 -0
- package/esm/index.js +11 -0
- package/esm/props.js +60 -0
- package/esm/utils.js +24 -0
- package/package.json +86 -88
- package/types/components/Pill.d.ts +5 -0
- package/types/components/PillButton.d.ts +5 -0
- package/types/components/PillGroup.d.ts +13 -0
- package/types/components/index.d.ts +3 -0
- package/types/components/styled.d.ts +24 -0
- package/types/components/types/DropdownPill.d.ts +3 -0
- package/types/components/types/InputPill.d.ts +3 -0
- package/types/components/types/LabelPill.d.ts +3 -0
- package/types/components/types/ReadOnlyPill.d.ts +3 -0
- package/types/components/types/RemovablePill.d.ts +3 -0
- package/types/components/types/ValuePill.d.ts +3 -0
- package/types/components/types/index.d.ts +6 -0
- package/types/deprecated/DropdownPill.d.ts +66 -0
- package/types/deprecated/InputPill.d.ts +10 -0
- package/types/deprecated/LabeledDropdownPills.d.ts +82 -0
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +15 -0
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +13 -0
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +28 -0
- package/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +1 -0
- package/types/deprecated/LabeledPills.d.ts +52 -0
- package/types/deprecated/OverflowPill.d.ts +33 -0
- package/types/deprecated/Pill.d.ts +59 -0
- package/types/deprecated/PillGroup.d.ts +50 -0
- package/types/deprecated/ReadOnlyPill.d.ts +56 -0
- package/types/deprecated/RemovablePill.d.ts +49 -0
- package/types/deprecated/index.d.ts +9 -0
- package/types/index.d.ts +3 -0
- package/types/props.d.ts +92 -0
- package/types/tests/DSPill.test.d.ts +1 -0
- package/types/tests/DSPillGroup.test.d.ts +1 -0
- package/types/tests/events/DSPill.events.keyboard.test.d.ts +1 -0
- package/types/tests/events/DSPill.events.test.d.ts +1 -0
- package/types/tests/events/DSPillGroup.events.keyboard.test.d.ts +1 -0
- package/types/tests/events/DSPillGroup.events.test.d.ts +1 -0
- package/types/utils.d.ts +4 -0
- package/dist/cjs/components/Pill.js +0 -60
- package/dist/cjs/components/Pill.js.map +0 -7
- package/dist/cjs/components/PillButton.js +0 -58
- package/dist/cjs/components/PillButton.js.map +0 -7
- package/dist/cjs/components/PillGroup.js +0 -72
- package/dist/cjs/components/PillGroup.js.map +0 -7
- package/dist/cjs/components/index.js +0 -30
- package/dist/cjs/components/index.js.map +0 -7
- package/dist/cjs/components/styled.js +0 -235
- package/dist/cjs/components/styled.js.map +0 -7
- package/dist/cjs/components/types/DropdownPill.js +0 -88
- package/dist/cjs/components/types/DropdownPill.js.map +0 -7
- package/dist/cjs/components/types/InputPill.js +0 -84
- package/dist/cjs/components/types/InputPill.js.map +0 -7
- package/dist/cjs/components/types/LabelPill.js +0 -52
- package/dist/cjs/components/types/LabelPill.js.map +0 -7
- package/dist/cjs/components/types/ReadOnlyPill.js +0 -55
- package/dist/cjs/components/types/ReadOnlyPill.js.map +0 -7
- package/dist/cjs/components/types/RemovablePill.js +0 -79
- package/dist/cjs/components/types/RemovablePill.js.map +0 -7
- package/dist/cjs/components/types/ValuePill.js +0 -59
- package/dist/cjs/components/types/ValuePill.js.map +0 -7
- package/dist/cjs/components/types/index.js +0 -33
- package/dist/cjs/components/types/index.js.map +0 -7
- package/dist/cjs/deprecated/DropdownPill.js +0 -92
- package/dist/cjs/deprecated/DropdownPill.js.map +0 -7
- package/dist/cjs/deprecated/InputPill.js +0 -82
- package/dist/cjs/deprecated/InputPill.js.map +0 -7
- package/dist/cjs/deprecated/LabeledDropdownPills.js +0 -102
- package/dist/cjs/deprecated/LabeledDropdownPills.js.map +0 -7
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -131
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +0 -7
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -145
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +0 -7
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -154
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +0 -7
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +0 -44
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +0 -7
- package/dist/cjs/deprecated/LabeledPills.js +0 -75
- package/dist/cjs/deprecated/LabeledPills.js.map +0 -7
- package/dist/cjs/deprecated/OverflowPill.js +0 -79
- package/dist/cjs/deprecated/OverflowPill.js.map +0 -7
- package/dist/cjs/deprecated/Pill.js +0 -73
- package/dist/cjs/deprecated/Pill.js.map +0 -7
- package/dist/cjs/deprecated/PillGroup.js +0 -72
- package/dist/cjs/deprecated/PillGroup.js.map +0 -7
- package/dist/cjs/deprecated/ReadOnlyPill.js +0 -100
- package/dist/cjs/deprecated/ReadOnlyPill.js.map +0 -7
- package/dist/cjs/deprecated/RemovablePill.js +0 -78
- package/dist/cjs/deprecated/RemovablePill.js.map +0 -7
- package/dist/cjs/deprecated/index.js +0 -43
- package/dist/cjs/deprecated/index.js.map +0 -7
- package/dist/cjs/index.d.js +0 -27
- package/dist/cjs/index.d.js.map +0 -7
- package/dist/cjs/index.js +0 -37
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/props.js +0 -95
- package/dist/cjs/props.js.map +0 -7
- package/dist/cjs/utils.js +0 -46
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/components/Pill.js +0 -31
- package/dist/esm/components/Pill.js.map +0 -7
- package/dist/esm/components/PillButton.js +0 -29
- package/dist/esm/components/PillButton.js.map +0 -7
- package/dist/esm/components/PillGroup.js +0 -43
- package/dist/esm/components/PillGroup.js.map +0 -7
- package/dist/esm/components/index.js +0 -5
- package/dist/esm/components/index.js.map +0 -7
- package/dist/esm/components/styled.js +0 -206
- package/dist/esm/components/styled.js.map +0 -7
- package/dist/esm/components/types/DropdownPill.js +0 -59
- package/dist/esm/components/types/DropdownPill.js.map +0 -7
- package/dist/esm/components/types/InputPill.js +0 -55
- package/dist/esm/components/types/InputPill.js.map +0 -7
- package/dist/esm/components/types/LabelPill.js +0 -23
- package/dist/esm/components/types/LabelPill.js.map +0 -7
- package/dist/esm/components/types/ReadOnlyPill.js +0 -26
- package/dist/esm/components/types/ReadOnlyPill.js.map +0 -7
- package/dist/esm/components/types/RemovablePill.js +0 -50
- package/dist/esm/components/types/RemovablePill.js.map +0 -7
- package/dist/esm/components/types/ValuePill.js +0 -30
- package/dist/esm/components/types/ValuePill.js.map +0 -7
- package/dist/esm/components/types/index.js +0 -8
- package/dist/esm/components/types/index.js.map +0 -7
- package/dist/esm/deprecated/DropdownPill.js +0 -63
- package/dist/esm/deprecated/DropdownPill.js.map +0 -7
- package/dist/esm/deprecated/InputPill.js +0 -53
- package/dist/esm/deprecated/InputPill.js.map +0 -7
- package/dist/esm/deprecated/LabeledDropdownPills.js +0 -73
- package/dist/esm/deprecated/LabeledDropdownPills.js.map +0 -7
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +0 -102
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +0 -7
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +0 -116
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +0 -7
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +0 -125
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +0 -7
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js +0 -15
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +0 -7
- package/dist/esm/deprecated/LabeledPills.js +0 -46
- package/dist/esm/deprecated/LabeledPills.js.map +0 -7
- package/dist/esm/deprecated/OverflowPill.js +0 -50
- package/dist/esm/deprecated/OverflowPill.js.map +0 -7
- package/dist/esm/deprecated/Pill.js +0 -44
- package/dist/esm/deprecated/Pill.js.map +0 -7
- package/dist/esm/deprecated/PillGroup.js +0 -43
- package/dist/esm/deprecated/PillGroup.js.map +0 -7
- package/dist/esm/deprecated/ReadOnlyPill.js +0 -71
- package/dist/esm/deprecated/ReadOnlyPill.js.map +0 -7
- package/dist/esm/deprecated/RemovablePill.js +0 -49
- package/dist/esm/deprecated/RemovablePill.js.map +0 -7
- package/dist/esm/deprecated/index.js +0 -14
- package/dist/esm/deprecated/index.js.map +0 -7
- package/dist/esm/index.d.js +0 -2
- package/dist/esm/index.d.js.map +0 -7
- package/dist/esm/index.js +0 -8
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/props.js +0 -66
- package/dist/esm/props.js.map +0 -7
- package/dist/esm/utils.js +0 -17
- package/dist/esm/utils.js.map +0 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Pill = require('./Pill.js');
|
|
6
|
+
var PillGroup = require('./PillGroup.js');
|
|
7
|
+
var LabeledDropdownPills = require('./LabeledDropdownPills.js');
|
|
8
|
+
var LabeledPills = require('./LabeledPills.js');
|
|
9
|
+
var DropdownPill = require('./DropdownPill.js');
|
|
10
|
+
var RemovablePill = require('./RemovablePill.js');
|
|
11
|
+
var ReadOnlyPill = require('./ReadOnlyPill.js');
|
|
12
|
+
var OverflowPill = require('./OverflowPill.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.DSPillWithSchema = Pill.DSPillWithSchema;
|
|
17
|
+
exports.Pill = Pill.Pill;
|
|
18
|
+
exports["default"] = Pill.Pill;
|
|
19
|
+
exports.Container = PillGroup.Container;
|
|
20
|
+
exports.DSPillGroupWithSchema = PillGroup.DSPillGroupWithSchema;
|
|
21
|
+
exports.PillGroup = PillGroup.PillGroup;
|
|
22
|
+
exports.DSLabeledDropdownPillsWithSchema = LabeledDropdownPills.DSLabeledDropdownPillsWithSchema;
|
|
23
|
+
exports.LabeledDropdownPills = LabeledDropdownPills.LabeledDropdownPills;
|
|
24
|
+
exports.DSLabeledPillsWithSchema = LabeledPills.DSLabeledPillsWithSchema;
|
|
25
|
+
exports.LabeledPills = LabeledPills.LabeledPills;
|
|
26
|
+
exports.DSDropdownPillWithSchema = DropdownPill.DSDropdownPillWithSchema;
|
|
27
|
+
exports.DropdownPill = DropdownPill.DropdownPill;
|
|
28
|
+
exports.DSRemovablePillWithSchema = RemovablePill.DSRemovablePillWithSchema;
|
|
29
|
+
exports.RemovablePill = RemovablePill.RemovablePill;
|
|
30
|
+
exports.DSReadOnlyPillWithSchema = ReadOnlyPill.DSReadOnlyPillWithSchema;
|
|
31
|
+
exports.ReadOnlyPill = ReadOnlyPill.ReadOnlyPill;
|
|
32
|
+
exports.DSOverflowPillWithSchema = OverflowPill.DSOverflowPillWithSchema;
|
|
33
|
+
exports.OverflowPill = OverflowPill.OverflowPill;
|
package/cjs/index.d.js
ADDED
package/cjs/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Pill = require('./deprecated/Pill.js');
|
|
6
|
+
var PillGroup = require('./deprecated/PillGroup.js');
|
|
7
|
+
var LabeledDropdownPills = require('./deprecated/LabeledDropdownPills.js');
|
|
8
|
+
var LabeledPills = require('./deprecated/LabeledPills.js');
|
|
9
|
+
var DropdownPill = require('./deprecated/DropdownPill.js');
|
|
10
|
+
var RemovablePill = require('./deprecated/RemovablePill.js');
|
|
11
|
+
var ReadOnlyPill = require('./deprecated/ReadOnlyPill.js');
|
|
12
|
+
var OverflowPill = require('./deprecated/OverflowPill.js');
|
|
13
|
+
var Pill$1 = require('./components/Pill.js');
|
|
14
|
+
var PillGroup$1 = require('./components/PillGroup.js');
|
|
15
|
+
var PillButton = require('./components/PillButton.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.DSPillWithSchema = Pill.DSPillWithSchema;
|
|
20
|
+
exports.Pill = Pill.Pill;
|
|
21
|
+
exports["default"] = Pill.Pill;
|
|
22
|
+
exports.Container = PillGroup.Container;
|
|
23
|
+
exports.DSPillGroupWithSchema = PillGroup.DSPillGroupWithSchema;
|
|
24
|
+
exports.PillGroup = PillGroup.PillGroup;
|
|
25
|
+
exports.DSLabeledDropdownPillsWithSchema = LabeledDropdownPills.DSLabeledDropdownPillsWithSchema;
|
|
26
|
+
exports.LabeledDropdownPills = LabeledDropdownPills.LabeledDropdownPills;
|
|
27
|
+
exports.DSLabeledPillsWithSchema = LabeledPills.DSLabeledPillsWithSchema;
|
|
28
|
+
exports.LabeledPills = LabeledPills.LabeledPills;
|
|
29
|
+
exports.DSDropdownPillWithSchema = DropdownPill.DSDropdownPillWithSchema;
|
|
30
|
+
exports.DropdownPill = DropdownPill.DropdownPill;
|
|
31
|
+
exports.DSRemovablePillWithSchema = RemovablePill.DSRemovablePillWithSchema;
|
|
32
|
+
exports.RemovablePill = RemovablePill.RemovablePill;
|
|
33
|
+
exports.DSReadOnlyPillWithSchema = ReadOnlyPill.DSReadOnlyPillWithSchema;
|
|
34
|
+
exports.ReadOnlyPill = ReadOnlyPill.ReadOnlyPill;
|
|
35
|
+
exports.DSOverflowPillWithSchema = OverflowPill.DSOverflowPillWithSchema;
|
|
36
|
+
exports.OverflowPill = OverflowPill.OverflowPill;
|
|
37
|
+
exports.DSPillV2 = Pill$1.DSPillV2;
|
|
38
|
+
exports.DSPillV2WithSchema = Pill$1.DSPillV2WithSchema;
|
|
39
|
+
exports.DSPillGroupV2 = PillGroup$1.DSPillGroupV2;
|
|
40
|
+
exports.DSPillGroupV2Context = PillGroup$1.DSPillGroupV2Context;
|
|
41
|
+
exports.DSPillGroupV2WithSchema = PillGroup$1.DSPillGroupV2WithSchema;
|
|
42
|
+
exports.DSPillButton = PillButton.DSPillButton;
|
|
43
|
+
exports.DSPillButtonWithSchema = PillButton.DSPillButtonWithSchema;
|
package/cjs/props.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactDesc = require('react-desc');
|
|
6
|
+
var dsForm = require('@elliemae/ds-form');
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
9
|
+
const pillTypes = reactDesc.PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable', 'readonly']);
|
|
10
|
+
const DSPillV2PropTypes = {
|
|
11
|
+
label: reactDesc.PropTypes.string.description('Label to show in the pill').isRequired,
|
|
12
|
+
type: pillTypes.description('The type of pill that you want to render').isRequired,
|
|
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'),
|
|
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),
|
|
17
|
+
tooltipValue: reactDesc.PropTypes.string.description('String to show as a tooltip in the value pill').defaultValue(''),
|
|
18
|
+
iconLeft: reactDesc.PropTypes.node.description('A component to show int the left of a readonly pill').defaultValue(null),
|
|
19
|
+
iconRight: reactDesc.PropTypes.node.description('A component to show in the right of a readonly pill').defaultValue(null),
|
|
20
|
+
onRemove: reactDesc.PropTypes.func.description('Callback triggered when removing a pill with the close icon').defaultValue(() => null),
|
|
21
|
+
inputPlaceholder: reactDesc.PropTypes.string.description('Placeholder for the input pill').defaultValue(''),
|
|
22
|
+
onInputChange: reactDesc.PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
23
|
+
onInputClear: reactDesc.PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
24
|
+
inputWidth: reactDesc.PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
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)
|
|
27
|
+
};
|
|
28
|
+
const DSPillButtonPropTypes = {
|
|
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'),
|
|
30
|
+
width: reactDesc.PropTypes.string.description('Width of the button').defaultValue('100%'),
|
|
31
|
+
height: reactDesc.PropTypes.string.description('Height of the button').defaultValue('100%')
|
|
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
|
+
};
|
|
37
|
+
const DSPillV2DefaultProps = {
|
|
38
|
+
innerRef: () => null,
|
|
39
|
+
ariaLabel: '',
|
|
40
|
+
size: 'm',
|
|
41
|
+
labelTruncated: true,
|
|
42
|
+
tooltipValue: '',
|
|
43
|
+
iconLeft: null,
|
|
44
|
+
iconRight: null,
|
|
45
|
+
onRemove: () => null,
|
|
46
|
+
inputPlaceholder: '',
|
|
47
|
+
onInputChange: () => null,
|
|
48
|
+
onInputClear: () => null,
|
|
49
|
+
inputWidth: 72,
|
|
50
|
+
inputRender: dsForm.DSInput,
|
|
51
|
+
dropdownProps: {},
|
|
52
|
+
onDropdownClick: () => null
|
|
53
|
+
};
|
|
54
|
+
const DSPillButtonDefaultProps = {
|
|
55
|
+
type: 'right',
|
|
56
|
+
width: '100%',
|
|
57
|
+
height: '100%'
|
|
58
|
+
};
|
|
59
|
+
const DSPillGroupDefaultProps = {
|
|
60
|
+
width: 'fit-content',
|
|
61
|
+
innerRef: () => null
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.DSPillButtonDefaultProps = DSPillButtonDefaultProps;
|
|
65
|
+
exports.DSPillButtonPropTypes = DSPillButtonPropTypes;
|
|
66
|
+
exports.DSPillGroupDefaultProps = DSPillGroupDefaultProps;
|
|
67
|
+
exports.DSPillGroupPropTypes = DSPillGroupPropTypes;
|
|
68
|
+
exports.DSPillV2DefaultProps = DSPillV2DefaultProps;
|
|
69
|
+
exports.DSPillV2PropTypes = DSPillV2PropTypes;
|
package/cjs/utils.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.setMultipleRefs = setMultipleRefs;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 'react';
|
|
8
|
+
import { describe } from 'react-desc';
|
|
9
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
10
|
+
import { DSPillV2PropTypes, DSPillV2DefaultProps } from '../props.js';
|
|
11
|
+
import { DropdownPill } from './types/DropdownPill.js';
|
|
12
|
+
import { InputPill } from './types/InputPill.js';
|
|
13
|
+
import { LabelPill } from './types/LabelPill.js';
|
|
14
|
+
import { ReadOnlyPill } from './types/ReadOnlyPill.js';
|
|
15
|
+
import { RemovablePill } from './types/RemovablePill.js';
|
|
16
|
+
import { ValuePill } from './types/ValuePill.js';
|
|
17
|
+
import { jsx } from 'react/jsx-runtime';
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
const pillComponentGetter = {
|
|
23
|
+
dropdown: DropdownPill,
|
|
24
|
+
input: InputPill,
|
|
25
|
+
label: LabelPill,
|
|
26
|
+
readonly: ReadOnlyPill,
|
|
27
|
+
removable: RemovablePill,
|
|
28
|
+
value: ValuePill
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const DSPillV2 = props => {
|
|
32
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillV2DefaultProps);
|
|
33
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillV2PropTypes);
|
|
34
|
+
const {
|
|
35
|
+
type
|
|
36
|
+
} = propsWithDefaults;
|
|
37
|
+
const PillComponent = pillComponentGetter[type];
|
|
38
|
+
return /*#__PURE__*/jsx(PillComponent, _objectSpread({}, propsWithDefaults));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const DSPillV2WithSchema = describe(DSPillV2).description('Pill');
|
|
42
|
+
DSPillV2WithSchema.propTypes = DSPillV2PropTypes;
|
|
43
|
+
|
|
44
|
+
export { DSPillV2, DSPillV2WithSchema };
|
|
@@ -0,0 +1,46 @@
|
|
|
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 };
|
|
@@ -0,0 +1,53 @@
|
|
|
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';
|
|
5
|
+
import React, { createContext, useMemo, useCallback } from 'react';
|
|
6
|
+
import { describe } from 'react-desc';
|
|
7
|
+
import { uid } from 'uid';
|
|
8
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
|
+
import { DSPillGroupPropTypes, DSPillGroupDefaultProps } from '../props.js';
|
|
10
|
+
import { StyledPillGroup } from './styled.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const DSPillGroupV2Context = /*#__PURE__*/createContext({
|
|
14
|
+
onKeyboardRemove: () => null
|
|
15
|
+
});
|
|
16
|
+
|
|
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;
|
|
26
|
+
const onKeyboardRemove = useCallback(pillUid => {
|
|
27
|
+
const elems = [...document.querySelectorAll("#".concat(pillGroupUid, " .ds-pill-focus-point"))];
|
|
28
|
+
const pillIndex = elems.findIndex(elem => elem.id === pillUid);
|
|
29
|
+
|
|
30
|
+
if (pillIndex > 0) {
|
|
31
|
+
elems[pillIndex - 1].focus();
|
|
32
|
+
} else if (pillIndex + 1 < elems.length) {
|
|
33
|
+
elems[pillIndex + 1].focus();
|
|
34
|
+
}
|
|
35
|
+
}, [pillGroupUid]);
|
|
36
|
+
return /*#__PURE__*/_jsx(DSPillGroupV2Context.Provider, {
|
|
37
|
+
value: {
|
|
38
|
+
onKeyboardRemove
|
|
39
|
+
}
|
|
40
|
+
}, void 0, /*#__PURE__*/jsx(StyledPillGroup, {
|
|
41
|
+
width: width,
|
|
42
|
+
id: pillGroupUid,
|
|
43
|
+
cols: React.Children.map(children, () => 'auto'),
|
|
44
|
+
gutter: "2px",
|
|
45
|
+
ref: innerRef,
|
|
46
|
+
children: children
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const DSPillGroupV2WithSchema = describe(DSPillGroupV2);
|
|
51
|
+
DSPillGroupV2WithSchema.propTypes = DSPillGroupPropTypes;
|
|
52
|
+
|
|
53
|
+
export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema };
|
|
@@ -0,0 +1,67 @@
|
|
|
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 };
|
|
@@ -0,0 +1,76 @@
|
|
|
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 };
|
|
@@ -0,0 +1,65 @@
|
|
|
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 };
|
|
@@ -0,0 +1,37 @@
|
|
|
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 };
|
|
@@ -0,0 +1,41 @@
|
|
|
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 };
|