@elliemae/ds-pills 2.3.0-next.3 → 3.0.0-alpha.0
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 +60 -0
- package/dist/cjs/components/Pill.js.map +7 -0
- package/dist/cjs/components/PillButton.js +58 -0
- package/dist/cjs/components/PillButton.js.map +7 -0
- package/dist/cjs/components/PillGroup.js +72 -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 +88 -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 +79 -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 +92 -0
- package/dist/cjs/deprecated/DropdownPill.js.map +7 -0
- package/dist/cjs/deprecated/InputPill.js +82 -0
- package/dist/cjs/deprecated/InputPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js +102 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +131 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +145 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +154 -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 +73 -0
- package/dist/cjs/deprecated/Pill.js.map +7 -0
- package/dist/cjs/deprecated/PillGroup.js +72 -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 +95 -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 +31 -0
- package/dist/esm/components/Pill.js.map +7 -0
- package/dist/esm/components/PillButton.js +29 -0
- package/dist/esm/components/PillButton.js.map +7 -0
- package/dist/esm/components/PillGroup.js +43 -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 +59 -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 +50 -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 +63 -0
- package/dist/esm/deprecated/DropdownPill.js.map +7 -0
- package/dist/esm/deprecated/InputPill.js +53 -0
- package/dist/esm/deprecated/InputPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js +73 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +102 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +116 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +125 -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 +44 -0
- package/dist/esm/deprecated/Pill.js.map +7 -0
- package/dist/esm/deprecated/PillGroup.js +43 -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 +66 -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/{types → dist/types}/components/Pill.d.ts +0 -0
- package/{types → dist/types}/components/PillButton.d.ts +0 -0
- package/{types → dist/types}/components/PillGroup.d.ts +0 -0
- package/{types → dist/types}/components/index.d.ts +0 -0
- package/{types → dist/types}/components/styled.d.ts +8 -8
- package/{types → dist/types}/components/types/DropdownPill.d.ts +0 -0
- package/{types → dist/types}/components/types/InputPill.d.ts +0 -0
- package/{types → dist/types}/components/types/LabelPill.d.ts +0 -0
- package/{types → dist/types}/components/types/ReadOnlyPill.d.ts +0 -0
- package/{types → dist/types}/components/types/RemovablePill.d.ts +0 -0
- package/{types → dist/types}/components/types/ValuePill.d.ts +0 -0
- package/{types → dist/types}/components/types/index.d.ts +0 -0
- package/{types → dist/types}/deprecated/DropdownPill.d.ts +0 -0
- package/{types → dist/types}/deprecated/InputPill.d.ts +0 -0
- package/{types → dist/types}/deprecated/LabeledDropdownPills.d.ts +1 -1
- package/{types → dist/types}/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +3 -1
- package/{types → dist/types}/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +3 -1
- package/{types → dist/types}/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +1 -0
- package/{types → dist/types}/deprecated/LabeledDropdownPillsTypes/utils.d.ts +0 -0
- package/{types → dist/types}/deprecated/LabeledPills.d.ts +0 -0
- package/{types → dist/types}/deprecated/OverflowPill.d.ts +0 -0
- package/{types → dist/types}/deprecated/Pill.d.ts +0 -0
- package/{types → dist/types}/deprecated/PillGroup.d.ts +0 -0
- package/{types → dist/types}/deprecated/ReadOnlyPill.d.ts +0 -0
- package/{types → dist/types}/deprecated/RemovablePill.d.ts +0 -0
- package/{types → dist/types}/deprecated/index.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/props.d.ts +0 -0
- package/{types → dist/types}/tests/DSPill.test.d.ts +0 -0
- package/{types → dist/types}/tests/DSPillGroup.test.d.ts +0 -0
- package/{types → dist/types}/tests/events/DSPill.events.keyboard.test.d.ts +0 -0
- package/{types → dist/types}/tests/events/DSPill.events.test.d.ts +0 -0
- package/{types → dist/types}/tests/events/DSPillGroup.events.keyboard.test.d.ts +0 -0
- package/{types → dist/types}/tests/events/DSPillGroup.events.test.d.ts +0 -0
- package/{types → dist/types}/utils.d.ts +0 -0
- package/package.json +93 -85
- package/cjs/components/Pill.js +0 -53
- package/cjs/components/PillButton.js +0 -56
- package/cjs/components/PillGroup.js +0 -64
- 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 -72
- 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 -69
- 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 -53
- 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 -63
- 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 -60
- package/esm/utils.js +0 -24
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import * as React from "react";
|
|
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
|
+
const borderOutside = (color, size = 1, zIndex = 2, borderRadius = "12px") => css`
|
|
7
|
+
:after {
|
|
8
|
+
content: ' ';
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0px;
|
|
11
|
+
left: 0px;
|
|
12
|
+
right: 0px;
|
|
13
|
+
bottom: 0px;
|
|
14
|
+
border: ${size}px solid ${color};
|
|
15
|
+
border-top-left-radius: ${borderRadius};
|
|
16
|
+
border-top-right-radius: ${borderRadius};
|
|
17
|
+
border-bottom-left-radius: ${borderRadius};
|
|
18
|
+
border-bottom-right-radius: ${borderRadius};
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
z-index: ${zIndex};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const commonPillWrapperCss = css`
|
|
24
|
+
height: ${(props) => props?.size === "m" ? "24px" : "18px"};
|
|
25
|
+
|
|
26
|
+
position: relative;
|
|
27
|
+
|
|
28
|
+
width: fit-content;
|
|
29
|
+
|
|
30
|
+
background-color: ${(props) => props.theme.colors.brand[200]};
|
|
31
|
+
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
|
|
36
|
+
padding: 0px 12px 0 12px;
|
|
37
|
+
border-radius: 12px;
|
|
38
|
+
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
line-height: 1;
|
|
41
|
+
color: ${(props) => props.theme.colors.brand[800]};
|
|
42
|
+
${(props) => borderOutside(props.theme.colors.brand[300])};
|
|
43
|
+
`;
|
|
44
|
+
const StyledLabelPillWrapper = styled(Grid)`
|
|
45
|
+
${commonPillWrapperCss}
|
|
46
|
+
|
|
47
|
+
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
48
|
+
padding-left: ${(props) => props.hasIcon ? "0px !important" : "12px"};
|
|
49
|
+
`;
|
|
50
|
+
const StyledValuePillWrapper = styled(Grid)`
|
|
51
|
+
${commonPillWrapperCss}
|
|
52
|
+
|
|
53
|
+
font-weight: ${(props) => props.theme.fontWeights.regular};
|
|
54
|
+
padding-left: ${(props) => props.hasIcon ? "0px !important" : "12px"};
|
|
55
|
+
`;
|
|
56
|
+
const StyledInputPillWrapper = styled(Grid)`
|
|
57
|
+
${commonPillWrapperCss}
|
|
58
|
+
|
|
59
|
+
background: ${(props) => props.theme.colors.neutral["000"]};
|
|
60
|
+
padding: 0;
|
|
61
|
+
|
|
62
|
+
${({ value, theme }) => borderOutside(value === "" ? theme.colors.neutral[400] : theme.colors.brand[500])}
|
|
63
|
+
|
|
64
|
+
:focus-within {
|
|
65
|
+
${(props) => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : ""}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:active {
|
|
69
|
+
${(props) => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : ""}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
& .em-ds-input {
|
|
73
|
+
outline: none !important;
|
|
74
|
+
border: none !important;
|
|
75
|
+
box-shadow: none !important;
|
|
76
|
+
border-radius: 0 !important;
|
|
77
|
+
height: 100%;
|
|
78
|
+
background: transparent;
|
|
79
|
+
width: ${(props) => `${props.inputWidth + (props.value === "" ? 24 : 0)}px`};
|
|
80
|
+
padding: 0;
|
|
81
|
+
margin: 0 0 0 8px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
& .em-ds-input__tooltip-ref {
|
|
85
|
+
height: 100%;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
const StyledDropdownPillWrapper = styled(Grid)`
|
|
89
|
+
${commonPillWrapperCss}
|
|
90
|
+
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
91
|
+
|
|
92
|
+
padding: 0 0 0 12px;
|
|
93
|
+
`;
|
|
94
|
+
const StyledReadonlyPillWrapper = styled(Grid)`
|
|
95
|
+
${commonPillWrapperCss}
|
|
96
|
+
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
97
|
+
padding-right: ${(props) => props.hasIconRight ? "0 !important" : "12px"};
|
|
98
|
+
padding-left: ${(props) => props.hasIconLeft ? "0 !important" : "12px"};
|
|
99
|
+
`;
|
|
100
|
+
const StyledRemovablePillWrapper = styled(Grid)`
|
|
101
|
+
${commonPillWrapperCss}
|
|
102
|
+
font-weight: ${(props) => props.theme.fontWeights.regular};
|
|
103
|
+
padding: 0 0 0 12px;
|
|
104
|
+
`;
|
|
105
|
+
const StyledPillGroup = styled(Grid)`
|
|
106
|
+
width: ${({ width }) => width};
|
|
107
|
+
|
|
108
|
+
// Pill edges
|
|
109
|
+
& .ds-pill-wrapper {
|
|
110
|
+
&:not(:first-of-type) {
|
|
111
|
+
&,
|
|
112
|
+
:after,
|
|
113
|
+
:before,
|
|
114
|
+
.ds-pill-tooltip-value:after {
|
|
115
|
+
border-top-left-radius: 0px;
|
|
116
|
+
border-bottom-left-radius: 0px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
&:not(:last-of-type) {
|
|
120
|
+
&,
|
|
121
|
+
:after,
|
|
122
|
+
:before,
|
|
123
|
+
.ds-pill-tooltip-value:after {
|
|
124
|
+
border-top-right-radius: 0px;
|
|
125
|
+
border-bottom-right-radius: 0px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Pill paddings to the left / right
|
|
131
|
+
& .ds-pill-wrapper-label,
|
|
132
|
+
& .ds-pill-wrapper-value,
|
|
133
|
+
& .ds-pill-wrapper-readonly {
|
|
134
|
+
&:not(:first-of-type) {
|
|
135
|
+
padding-left: 8px;
|
|
136
|
+
}
|
|
137
|
+
&:not(:last-of-type) {
|
|
138
|
+
padding-right: 8px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
& .ds-pill-wrapper-removable:not(:first-of-type) {
|
|
143
|
+
padding-left: 8px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
& .ds-pill-wrapper-dropdown:not(:first-of-type) {
|
|
147
|
+
padding-left: 8px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
& .ds-pill-wrapper {
|
|
151
|
+
:not(:first-of-type) {
|
|
152
|
+
.ds-pill-button-left {
|
|
153
|
+
border-radius: 0px;
|
|
154
|
+
}
|
|
155
|
+
.ds-pill-button-only {
|
|
156
|
+
border-top-left-radius: 0px;
|
|
157
|
+
border-bottom-left-radius: 0px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
:not(:last-of-type) {
|
|
161
|
+
.ds-pill-button-right {
|
|
162
|
+
border-radius: 0px;
|
|
163
|
+
}
|
|
164
|
+
.ds-pill-button-only {
|
|
165
|
+
border-top-right-radius: 0px;
|
|
166
|
+
border-bottom-right-radius: 0px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
const StyledSpanWithTooltip = styled.span`
|
|
172
|
+
outline: none;
|
|
173
|
+
:focus {
|
|
174
|
+
${(props) => borderOutside(props.theme.colors.brand[700], 2, 3)}
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
const StyledPillButton = styled(DSButtonV2)`
|
|
178
|
+
display: grid;
|
|
179
|
+
place-items: center;
|
|
180
|
+
|
|
181
|
+
position: relative;
|
|
182
|
+
|
|
183
|
+
padding: 0;
|
|
184
|
+
width: ${(props) => props.width};
|
|
185
|
+
height: ${(props) => props.height};
|
|
186
|
+
|
|
187
|
+
border-radius: 12px;
|
|
188
|
+
|
|
189
|
+
:focus {
|
|
190
|
+
${(props) => borderOutside(props.theme.colors.brand[700], 2, 3, "inherit")}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
`;
|
|
195
|
+
export {
|
|
196
|
+
StyledDropdownPillWrapper,
|
|
197
|
+
StyledInputPillWrapper,
|
|
198
|
+
StyledLabelPillWrapper,
|
|
199
|
+
StyledPillButton,
|
|
200
|
+
StyledPillGroup,
|
|
201
|
+
StyledReadonlyPillWrapper,
|
|
202
|
+
StyledRemovablePillWrapper,
|
|
203
|
+
StyledSpanWithTooltip,
|
|
204
|
+
StyledValuePillWrapper
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport styled from 'styled-components';\nimport { css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button';\n\n// =============================================================================\n// Common CSS\n// =============================================================================\n\nconst borderOutside = (color: string, size = 1, zIndex = 2, borderRadius = '12px') => css`\n :after {\n content: ' ';\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n border: ${size}px solid ${color};\n border-top-left-radius: ${borderRadius};\n border-top-right-radius: ${borderRadius};\n border-bottom-left-radius: ${borderRadius};\n border-bottom-right-radius: ${borderRadius};\n pointer-events: none;\n z-index: ${zIndex};\n }\n`;\n\nconst commonPillWrapperCss = css<{ size: 'm' | 's' }>`\n height: ${(props) => (props?.size === 'm' ? '24px' : '18px')};\n\n position: relative;\n\n width: fit-content;\n\n background-color: ${(props) => props.theme.colors.brand[200]};\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: ${(props) => props.theme.colors.brand[800]};\n ${(props) => borderOutside(props.theme.colors.brand[300])};\n`;\n\n// =============================================================================\n// Pills wrappers\n// =============================================================================\n\nexport const StyledLabelPillWrapper = styled(Grid)`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\nexport const StyledValuePillWrapper = styled(Grid)`\n ${commonPillWrapperCss}\n\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding-left: ${(props) => (props.hasIcon ? '0px !important' : '12px')};\n`;\n\nexport const StyledInputPillWrapper = styled(Grid)<{ value: string; inputWidth: number; inputHasFocus: boolean }>`\n ${commonPillWrapperCss}\n\n background: ${(props) => props.theme.colors.neutral['000']};\n padding: 0;\n\n ${({ value, theme }) => borderOutside(value === '' ? theme.colors.neutral[400] : theme.colors.brand[500])}\n\n :focus-within {\n ${(props) => (props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '')}\n }\n\n :active {\n ${(props) => (props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '')}\n }\n\n & .em-ds-input {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n border-radius: 0 !important;\n height: 100%;\n background: transparent;\n width: ${(props) => `${props.inputWidth + (props.value === '' ? 24 : 0)}px`};\n padding: 0;\n margin: 0 0 0 8px;\n }\n\n & .em-ds-input__tooltip-ref {\n height: 100%;\n }\n`;\n\nexport const StyledDropdownPillWrapper = styled(Grid)`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n\n padding: 0 0 0 12px;\n`;\n\nexport const StyledReadonlyPillWrapper = styled(Grid)<{ hasIconRight: boolean; hasIconLeft: boolean }>`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n padding-right: ${(props) => (props.hasIconRight ? '0 !important' : '12px')};\n padding-left: ${(props) => (props.hasIconLeft ? '0 !important' : '12px')};\n`;\n\nexport const StyledRemovablePillWrapper = styled(Grid)`\n ${commonPillWrapperCss}\n font-weight: ${(props) => props.theme.fontWeights.regular};\n padding: 0 0 0 12px;\n`;\n\n// =============================================================================\n// Pill group\n// =============================================================================\n\nexport const StyledPillGroup = styled(Grid)`\n width: ${({ width }) => width};\n\n // Pill edges\n & .ds-pill-wrapper {\n &:not(:first-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n &:not(:last-of-type) {\n &,\n :after,\n :before,\n .ds-pill-tooltip-value:after {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n\n // Pill paddings to the left / right\n & .ds-pill-wrapper-label,\n & .ds-pill-wrapper-value,\n & .ds-pill-wrapper-readonly {\n &:not(:first-of-type) {\n padding-left: 8px;\n }\n &:not(:last-of-type) {\n padding-right: 8px;\n }\n }\n\n & .ds-pill-wrapper-removable:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper-dropdown:not(:first-of-type) {\n padding-left: 8px;\n }\n\n & .ds-pill-wrapper {\n :not(:first-of-type) {\n .ds-pill-button-left {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n }\n }\n :not(:last-of-type) {\n .ds-pill-button-right {\n border-radius: 0px;\n }\n .ds-pill-button-only {\n border-top-right-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n }\n }\n`;\n\n// =============================================================================\n// Extra stuff\n// =============================================================================\n\nexport const StyledSpanWithTooltip = styled.span`\n outline: none;\n :focus {\n ${(props) => borderOutside(props.theme.colors.brand[700], 2, 3)}\n }\n`;\n\nexport const StyledPillButton = styled(DSButtonV2)<{ width: string; height: string }>`\n display: grid;\n place-items: center;\n\n position: relative;\n\n padding: 0;\n width: ${(props) => props.width};\n height: ${(props) => props.height};\n\n border-radius: 12px;\n\n :focus {\n ${(props) => borderOutside(props.theme.colors.brand[700], 2, 3, 'inherit')}\n }\n\n cursor: pointer;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AAMA,MAAM,gBAAgB,CAAC,OAAe,OAAO,GAAG,SAAS,GAAG,eAAe,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAQxE,gBAAgB;AAAA,8BACA;AAAA,+BACC;AAAA,iCACE;AAAA,kCACC;AAAA;AAAA,eAEnB;AAAA;AAAA;AAIf,MAAM,uBAAuB;AAAA,YACjB,CAAC,UAAW,OAAO,SAAS,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMjC,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAW/C,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA,IAC3C,CAAC,UAAU,cAAc,MAAM,MAAM,OAAO,MAAM;AAAA;AAO/C,MAAM,yBAAyB,OAAO;AAAA,IACzC;AAAA;AAAA,iBAEa,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA,kBAClC,CAAC,UAAW,MAAM,UAAU,mBAAmB;AAAA;AAG1D,MAAM,yBAAyB,OAAO;AAAA,IACzC;AAAA;AAAA,iBAEa,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA,kBAClC,CAAC,UAAW,MAAM,UAAU,mBAAmB;AAAA;AAG1D,MAAM,yBAAyB,OAAO;AAAA,IACzC;AAAA;AAAA,gBAEY,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,IAGlD,CAAC,EAAE,OAAO,YAAY,cAAc,UAAU,KAAK,MAAM,OAAO,QAAQ,OAAO,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,MAGhG,CAAC,UAAW,MAAM,gBAAgB,cAAc,MAAM,MAAM,OAAO,MAAM,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA,MAIpF,CAAC,UAAW,MAAM,gBAAgB,cAAc,MAAM,MAAM,OAAO,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAU1E,CAAC,UAAU,GAAG,MAAM,aAAc,OAAM,UAAU,KAAK,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUlE,MAAM,4BAA4B,OAAO;AAAA,IAC5C;AAAA,iBACa,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA;AAAA;AAAA;AAK7C,MAAM,4BAA4B,OAAO;AAAA,IAC5C;AAAA,iBACa,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA,mBACjC,CAAC,UAAW,MAAM,eAAe,iBAAiB;AAAA,kBACnD,CAAC,UAAW,MAAM,cAAc,iBAAiB;AAAA;AAG5D,MAAM,6BAA6B,OAAO;AAAA,IAC7C;AAAA,iBACa,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA;AAAA;AAQ7C,MAAM,kBAAkB,OAAO;AAAA,WAC3B,CAAC,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsEnB,MAAM,wBAAwB,OAAO;AAAA;AAAA;AAAA,MAGtC,CAAC,UAAU,cAAc,MAAM,MAAM,OAAO,MAAM,MAAM,GAAG;AAAA;AAAA;AAI1D,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAO5B,CAAC,UAAU,MAAM;AAAA,YAChB,CAAC,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,MAKvB,CAAC,UAAU,cAAc,MAAM,MAAM,OAAO,MAAM,MAAM,GAAG,GAAG;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useMemo, useRef } from "react";
|
|
3
|
+
import { DSDropdownMenuV2 } from "@elliemae/ds-dropdownmenu";
|
|
4
|
+
import { uid } from "uid";
|
|
5
|
+
import { ChevronSmallDown } from "@elliemae/ds-icons";
|
|
6
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
7
|
+
import { StyledDropdownPillWrapper } from "../styled";
|
|
8
|
+
import { setMultipleRefs } from "../../utils";
|
|
9
|
+
import { DSPillButton } from "../PillButton";
|
|
10
|
+
const DropdownPill = React2.memo(({ label, size, labelTruncated, dropdownProps, innerRef, ariaLabel, onDropdownClick }) => {
|
|
11
|
+
const chevronRef = useRef(null);
|
|
12
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
13
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
14
|
+
value: children
|
|
15
|
+
}) : React2.Fragment;
|
|
16
|
+
return /* @__PURE__ */ React2.createElement(StyledDropdownPillWrapper, {
|
|
17
|
+
size,
|
|
18
|
+
id: pillUid,
|
|
19
|
+
className: "ds-pill-wrapper ds-pill-wrapper-dropdown",
|
|
20
|
+
"data-testid": "ds-pill-wrapper",
|
|
21
|
+
cols: ["auto", "24px"],
|
|
22
|
+
gutter: "2px",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyItems: "center"
|
|
25
|
+
}, /* @__PURE__ */ React2.createElement(TextComponent, null, label), /* @__PURE__ */ React2.createElement(DSDropdownMenuV2, {
|
|
26
|
+
placementOrderPreference: [
|
|
27
|
+
"bottom-start",
|
|
28
|
+
"bottom",
|
|
29
|
+
"bottom-end",
|
|
30
|
+
"right-end",
|
|
31
|
+
"top-start",
|
|
32
|
+
"top",
|
|
33
|
+
"top-end"
|
|
34
|
+
],
|
|
35
|
+
...dropdownProps,
|
|
36
|
+
onClickOutside: (e) => {
|
|
37
|
+
if (e.code === "Escape")
|
|
38
|
+
chevronRef.current.focus();
|
|
39
|
+
if (dropdownProps.onClickOutside)
|
|
40
|
+
dropdownProps.onClickOutside(e);
|
|
41
|
+
},
|
|
42
|
+
wrapperStyles: { w: "100%", h: "100%" }
|
|
43
|
+
}, /* @__PURE__ */ React2.createElement(DSPillButton, {
|
|
44
|
+
className: "ds-pill-focus-point",
|
|
45
|
+
"data-testid": "ds-pill-dropdown-chevron",
|
|
46
|
+
innerRef: setMultipleRefs(chevronRef, innerRef),
|
|
47
|
+
"aria-label": ariaLabel || label,
|
|
48
|
+
type: "right",
|
|
49
|
+
onClick: onDropdownClick
|
|
50
|
+
}, /* @__PURE__ */ React2.createElement(ChevronSmallDown, {
|
|
51
|
+
color: ["brand-primary", "800"],
|
|
52
|
+
width: 20,
|
|
53
|
+
height: 20
|
|
54
|
+
}))));
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
DropdownPill
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=DropdownPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/DropdownPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useMemo, useRef } from 'react';\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';\nimport { uid } from 'uid';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { StyledDropdownPillWrapper } from '../styled';\nimport type { DSPillProps } from '../../index.d';\nimport { setMultipleRefs } from '../../utils';\nimport { DSPillButton } from '../PillButton';\n\nexport const DropdownPill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, dropdownProps, innerRef, ariaLabel, onDropdownClick }) => {\n const chevronRef = useRef(null);\n\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n return (\n <StyledDropdownPillWrapper\n size={size}\n id={pillUid}\n className=\"ds-pill-wrapper ds-pill-wrapper-dropdown\"\n data-testid=\"ds-pill-wrapper\"\n cols={['auto', '24px']}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n >\n <TextComponent>{label}</TextComponent>\n <DSDropdownMenuV2\n placementOrderPreference={[\n 'bottom-start',\n 'bottom',\n 'bottom-end',\n 'right-end',\n 'top-start',\n 'top',\n 'top-end',\n ]}\n {...dropdownProps}\n onClickOutside={(e) => {\n if (e.code === 'Escape') chevronRef.current.focus();\n if (dropdownProps.onClickOutside) dropdownProps.onClickOutside(e);\n }}\n wrapperStyles={{ w: '100%', h: '100%' }}\n >\n <DSPillButton\n className=\"ds-pill-focus-point\"\n data-testid=\"ds-pill-dropdown-chevron\"\n innerRef={setMultipleRefs(chevronRef, innerRef)}\n aria-label={ariaLabel || label}\n type=\"right\"\n onClick={onDropdownClick}\n >\n <ChevronSmallDown color={['brand-primary', '800']} width={20} height={20} />\n </DSPillButton>\n </DSDropdownMenuV2>\n </StyledDropdownPillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEO,MAAM,eAAe,OAAM,KAChC,CAAC,EAAE,OAAO,MAAM,gBAAgB,eAAe,UAAU,WAAW,sBAAsB;AACxF,QAAM,aAAa,OAAO;AAE1B,QAAM,UAAU,QAAQ,MAAM,WAAW,SAAS;AAElD,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,SACE,qCAAC,2BAAD;AAAA,IACE;AAAA,IACA,IAAI;AAAA,IACJ,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,MAAM,CAAC,QAAQ;AAAA,IACf,QAAO;AAAA,IACP,YAAW;AAAA,IACX,cAAa;AAAA,KAEb,qCAAC,eAAD,MAAgB,QAChB,qCAAC,kBAAD;AAAA,IACE,0BAA0B;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,OAEE;AAAA,IACJ,gBAAgB,CAAC,MAAM;AACrB,UAAI,EAAE,SAAS;AAAU,mBAAW,QAAQ;AAC5C,UAAI,cAAc;AAAgB,sBAAc,eAAe;AAAA;AAAA,IAEjE,eAAe,EAAE,GAAG,QAAQ,GAAG;AAAA,KAE/B,qCAAC,cAAD;AAAA,IACE,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,UAAU,gBAAgB,YAAY;AAAA,IACtC,cAAY,aAAa;AAAA,IACzB,MAAK;AAAA,IACL,SAAS;AAAA,KAET,qCAAC,kBAAD;AAAA,IAAkB,OAAO,CAAC,iBAAiB;AAAA,IAAQ,OAAO;AAAA,IAAI,QAAQ;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { uid } from "uid";
|
|
4
|
+
import { CloseXsmall } from "@elliemae/ds-icons";
|
|
5
|
+
import { StyledInputPillWrapper } from "../styled";
|
|
6
|
+
import { setMultipleRefs } from "../../utils";
|
|
7
|
+
import { DSPillButton } from "../PillButton";
|
|
8
|
+
const InputPill = React2.memo(({ label, size, inputPlaceholder, inputWidth, inputRender, onInputChange, onInputClear, innerRef }) => {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
11
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
12
|
+
const onCloseIconClick = useCallback((e) => {
|
|
13
|
+
if ([void 0, "Enter", "Space"].includes(e.code)) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
onInputClear(e);
|
|
16
|
+
ref.current.focus();
|
|
17
|
+
}
|
|
18
|
+
}, [onInputClear]);
|
|
19
|
+
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
20
|
+
return /* @__PURE__ */ React2.createElement(StyledInputPillWrapper, {
|
|
21
|
+
size,
|
|
22
|
+
className: "ds-pill-wrapper",
|
|
23
|
+
"data-testid": "ds-pill-wrapper",
|
|
24
|
+
cols: label === "" ? ["auto"] : ["auto", "24px"],
|
|
25
|
+
inputWidth,
|
|
26
|
+
value: label,
|
|
27
|
+
inputHasFocus
|
|
28
|
+
}, /* @__PURE__ */ React2.createElement(InputComponent, {
|
|
29
|
+
id: pillUid,
|
|
30
|
+
className: "ds-pill-focus-point",
|
|
31
|
+
"data-testid": "ds-pill-input",
|
|
32
|
+
innerRef: setMultipleRefs(ref, innerRef),
|
|
33
|
+
value: label,
|
|
34
|
+
onChange: onInputChange,
|
|
35
|
+
placeholder: inputPlaceholder,
|
|
36
|
+
onFocus: () => setInputHasFocus(true),
|
|
37
|
+
onBlur: () => setInputHasFocus(false),
|
|
38
|
+
disableTooltip: false
|
|
39
|
+
}), label !== "" && /* @__PURE__ */ React2.createElement(DSPillButton, {
|
|
40
|
+
id: pillUid,
|
|
41
|
+
"data-testid": "ds-pill-clear-icon",
|
|
42
|
+
innerRef,
|
|
43
|
+
onClick: onCloseIconClick,
|
|
44
|
+
onKeyDown: onCloseIconClick,
|
|
45
|
+
"aria-label": "Clear input",
|
|
46
|
+
type: "right"
|
|
47
|
+
}, /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
48
|
+
size: "s",
|
|
49
|
+
color: ["brand-primary", "700"]
|
|
50
|
+
})));
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
InputPill
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=InputPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/InputPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledInputPillWrapper } from '../styled';\nimport { setMultipleRefs } from '../../utils';\nimport { DSPillButton } from '../PillButton';\n\nexport const InputPill = React.memo<DSPillProps>(\n ({ label, size, inputPlaceholder, inputWidth, inputRender, onInputChange, onInputClear, innerRef }) => {\n const ref = useRef<HTMLElement>(null);\n\n const InputComponent = useMemo(() => inputRender, [inputRender]);\n\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const onCloseIconClick: React.MouseEventHandler & React.KeyboardEventHandler = useCallback(\n (e) => {\n if ([undefined, 'Enter', 'Space'].includes(e.code)) {\n e.preventDefault();\n onInputClear(e);\n ref.current.focus();\n }\n },\n [onInputClear],\n );\n\n const [inputHasFocus, setInputHasFocus] = useState(false);\n\n return (\n <StyledInputPillWrapper\n size={size}\n className=\"ds-pill-wrapper\"\n data-testid=\"ds-pill-wrapper\"\n cols={label === '' ? ['auto'] : ['auto', '24px']}\n inputWidth={inputWidth}\n value={label}\n inputHasFocus={inputHasFocus}\n >\n <InputComponent\n id={pillUid}\n className=\"ds-pill-focus-point\"\n data-testid=\"ds-pill-input\"\n innerRef={setMultipleRefs(ref, innerRef)}\n value={label}\n onChange={onInputChange}\n placeholder={inputPlaceholder}\n onFocus={() => setInputHasFocus(true)}\n onBlur={() => setInputHasFocus(false)}\n disableTooltip={false}\n />\n {label !== '' && (\n <DSPillButton\n id={pillUid}\n data-testid=\"ds-pill-clear-icon\"\n innerRef={innerRef}\n onClick={onCloseIconClick}\n onKeyDown={onCloseIconClick}\n aria-label=\"Clear input\"\n type=\"right\"\n >\n <CloseXsmall size=\"s\" color={['brand-primary', '700']} />\n </DSPillButton>\n )}\n </StyledInputPillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEA;AACA;AACA;AAEO,MAAM,YAAY,OAAM,KAC7B,CAAC,EAAE,OAAO,MAAM,kBAAkB,YAAY,aAAa,eAAe,cAAc,eAAe;AACrG,QAAM,MAAM,OAAoB;AAEhC,QAAM,iBAAiB,QAAQ,MAAM,aAAa,CAAC;AAEnD,QAAM,UAAU,QAAQ,MAAM,WAAW,SAAS;AAElD,QAAM,mBAAyE,YAC7E,CAAC,MAAM;AACL,QAAI,CAAC,QAAW,SAAS,SAAS,SAAS,EAAE,OAAO;AAClD,QAAE;AACF,mBAAa;AACb,UAAI,QAAQ;AAAA;AAAA,KAGhB,CAAC;AAGH,QAAM,CAAC,eAAe,oBAAoB,SAAS;AAEnD,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,MAAM,UAAU,KAAK,CAAC,UAAU,CAAC,QAAQ;AAAA,IACzC;AAAA,IACA,OAAO;AAAA,IACP;AAAA,KAEA,qCAAC,gBAAD;AAAA,IACE,IAAI;AAAA,IACJ,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,UAAU,gBAAgB,KAAK;AAAA,IAC/B,OAAO;AAAA,IACP,UAAU;AAAA,IACV,aAAa;AAAA,IACb,SAAS,MAAM,iBAAiB;AAAA,IAChC,QAAQ,MAAM,iBAAiB;AAAA,IAC/B,gBAAgB;AAAA,MAEjB,UAAU,MACT,qCAAC,cAAD;AAAA,IACE,IAAI;AAAA,IACJ,eAAY;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,cAAW;AAAA,IACX,MAAK;AAAA,KAEL,qCAAC,aAAD;AAAA,IAAa,MAAK;AAAA,IAAI,OAAO,CAAC,iBAAiB;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
4
|
+
import { StyledLabelPillWrapper } from "../styled";
|
|
5
|
+
const LabelPill = React2.memo(({ label, size, labelTruncated, iconLeft, ariaLabel }) => {
|
|
6
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
7
|
+
value: children
|
|
8
|
+
}) : React2.Fragment;
|
|
9
|
+
return /* @__PURE__ */ React2.createElement(StyledLabelPillWrapper, {
|
|
10
|
+
size,
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
className: "ds-pill-wrapper ds-pill-wrapper-label",
|
|
13
|
+
"data-testid": "ds-pill-wrapper",
|
|
14
|
+
"aria-label": ariaLabel || label,
|
|
15
|
+
cols: [iconLeft && "min-content", "auto"].filter((notFalse) => notFalse),
|
|
16
|
+
gutter: "xxxs",
|
|
17
|
+
hasIcon: iconLeft !== null
|
|
18
|
+
}, iconLeft, /* @__PURE__ */ React2.createElement(TextComponent, null, label));
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
LabelPill
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=LabelPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/LabelPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledLabelPillWrapper } from '../styled';\n\nexport const LabelPill = React.memo<DSPillProps>(({ label, size, labelTruncated, iconLeft, ariaLabel }) => {\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n return (\n <StyledLabelPillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', 'auto'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIcon={iconLeft !== null}\n >\n {iconLeft}\n <TextComponent>{label}</TextComponent>\n </StyledLabelPillWrapper>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AAEA;AAEO,MAAM,YAAY,OAAM,KAAkB,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,gBAAgB;AACzG,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AACV,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,QAAQ,OAAO,CAAC,aAAa;AAAA,IAC/D,QAAO;AAAA,IACP,SAAS,aAAa;AAAA,KAErB,UACD,qCAAC,eAAD,MAAgB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
4
|
+
import { StyledReadonlyPillWrapper } from "../styled";
|
|
5
|
+
const ReadOnlyPill = React2.memo(({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel }) => {
|
|
6
|
+
const hasIconLeft = iconLeft !== null || iconRight !== null && label === "";
|
|
7
|
+
const hasIconRight = iconRight !== null || iconLeft !== null && label === "";
|
|
8
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
9
|
+
value: children
|
|
10
|
+
}) : React2.Fragment;
|
|
11
|
+
return /* @__PURE__ */ React2.createElement(StyledReadonlyPillWrapper, {
|
|
12
|
+
size,
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
className: "ds-pill-wrapper ds-pill-wrapper-readonly",
|
|
15
|
+
"data-testid": "ds-pill-wrapper",
|
|
16
|
+
"aria-label": ariaLabel || label,
|
|
17
|
+
cols: [iconLeft && "min-content", label && "auto", iconRight && "min-content"].filter((notFalse) => notFalse),
|
|
18
|
+
gutter: "xxxs",
|
|
19
|
+
hasIconRight,
|
|
20
|
+
hasIconLeft
|
|
21
|
+
}, iconLeft, label ? /* @__PURE__ */ React2.createElement(TextComponent, null, label) : null, iconRight);
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
ReadOnlyPill
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=ReadOnlyPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/ReadOnlyPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledReadonlyPillWrapper } from '../styled';\n\nexport const ReadOnlyPill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel }) => {\n const hasIconLeft = iconLeft !== null || (iconRight !== null && label === '');\n const hasIconRight = iconRight !== null || (iconLeft !== null && label === '');\n\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n return (\n <StyledReadonlyPillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-readonly\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', label && 'auto', iconRight && 'min-content'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIconRight={hasIconRight}\n hasIconLeft={hasIconLeft}\n >\n {iconLeft}\n {label ? <TextComponent>{label}</TextComponent> : null}\n {iconRight}\n </StyledReadonlyPillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AAEA;AAEO,MAAM,eAAe,OAAM,KAChC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,gBAAgB;AACnE,QAAM,cAAc,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC1E,QAAM,eAAe,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE3E,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,SACE,qCAAC,2BAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,SAAS,QAAQ,aAAa,eAAe,OAAO,CAAC,aAAa;AAAA,IACpG,QAAO;AAAA,IACP;AAAA,IACA;AAAA,KAEC,UACA,QAAQ,qCAAC,eAAD,MAAgB,SAAyB,MACjD;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useCallback, useContext, useMemo } 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";
|
|
7
|
+
import { DSPillGroupV2Context } from "../PillGroup";
|
|
8
|
+
import { DSPillButton } from "../PillButton";
|
|
9
|
+
const RemovablePill = React2.memo(({ label, size, labelTruncated, onRemove, innerRef, ariaLabel }) => {
|
|
10
|
+
const { onKeyboardRemove } = useContext(DSPillGroupV2Context);
|
|
11
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
12
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
13
|
+
value: children
|
|
14
|
+
}) : React2.Fragment;
|
|
15
|
+
const onKeyDown = useCallback((e) => {
|
|
16
|
+
if (["Enter", "Space"].includes(e.code)) {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
if (onKeyboardRemove)
|
|
19
|
+
onKeyboardRemove(pillUid);
|
|
20
|
+
onRemove(e);
|
|
21
|
+
}
|
|
22
|
+
}, [onKeyboardRemove, onRemove, pillUid]);
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(StyledRemovablePillWrapper, {
|
|
24
|
+
size,
|
|
25
|
+
cols: ["auto", "24px"],
|
|
26
|
+
gutter: "2px",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyItems: "center",
|
|
29
|
+
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
30
|
+
"data-testid": "ds-pill-wrapper",
|
|
31
|
+
"aria-label": ariaLabel || label
|
|
32
|
+
}, /* @__PURE__ */ React2.createElement(TextComponent, null, label), /* @__PURE__ */ React2.createElement(DSPillButton, {
|
|
33
|
+
className: "ds-pill-focus-point",
|
|
34
|
+
id: pillUid,
|
|
35
|
+
"data-testid": "ds-pill-close-icon",
|
|
36
|
+
innerRef,
|
|
37
|
+
onClick: onRemove,
|
|
38
|
+
onKeyDown,
|
|
39
|
+
"aria-label": `Remove ${label}`,
|
|
40
|
+
type: "right"
|
|
41
|
+
}, /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
42
|
+
width: 22.65,
|
|
43
|
+
height: 22.65,
|
|
44
|
+
color: ["brand-primary", "700"]
|
|
45
|
+
})));
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
RemovablePill
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=RemovablePill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/RemovablePill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledRemovablePillWrapper } from '../styled';\nimport { DSPillGroupV2Context } from '../PillGroup';\nimport { DSPillButton } from '../PillButton';\n\nexport const RemovablePill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, onRemove, innerRef, ariaLabel }) => {\n const { onKeyboardRemove } = useContext(DSPillGroupV2Context);\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n const onKeyDown: React.MouseEventHandler & React.KeyboardEventHandler = useCallback(\n (e) => {\n if (['Enter', 'Space'].includes(e.code)) {\n e.preventDefault();\n if (onKeyboardRemove) onKeyboardRemove(pillUid);\n onRemove(e);\n }\n },\n [onKeyboardRemove, onRemove, pillUid],\n );\n\n return (\n <StyledRemovablePillWrapper\n size={size}\n cols={['auto', '24px']}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-removable\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n >\n <TextComponent>{label}</TextComponent>\n <DSPillButton\n className=\"ds-pill-focus-point\"\n id={pillUid}\n data-testid=\"ds-pill-close-icon\"\n innerRef={innerRef}\n onClick={onRemove}\n onKeyDown={onKeyDown}\n aria-label={`Remove ${label}`}\n type=\"right\"\n >\n <CloseXsmall width={22.65} height={22.65} color={['brand-primary', '700']} />\n </DSPillButton>\n </StyledRemovablePillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEO,MAAM,gBAAgB,OAAM,KACjC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,gBAAgB;AAClE,QAAM,EAAE,qBAAqB,WAAW;AACxC,QAAM,UAAU,QAAQ,MAAM,WAAW,SAAS;AAElD,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,QAAM,YAAkE,YACtE,CAAC,MAAM;AACL,QAAI,CAAC,SAAS,SAAS,SAAS,EAAE,OAAO;AACvC,QAAE;AACF,UAAI;AAAkB,yBAAiB;AACvC,eAAS;AAAA;AAAA,KAGb,CAAC,kBAAkB,UAAU;AAG/B,SACE,qCAAC,4BAAD;AAAA,IACE;AAAA,IACA,MAAM,CAAC,QAAQ;AAAA,IACf,QAAO;AAAA,IACP,YAAW;AAAA,IACX,cAAa;AAAA,IACb,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,KAEzB,qCAAC,eAAD,MAAgB,QAChB,qCAAC,cAAD;AAAA,IACE,WAAU;AAAA,IACV,IAAI;AAAA,IACJ,eAAY;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,cAAY,UAAU;AAAA,IACtB,MAAK;AAAA,KAEL,qCAAC,aAAD;AAAA,IAAa,OAAO;AAAA,IAAO,QAAQ;AAAA,IAAO,OAAO,CAAC,iBAAiB;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { DSTooltipV2 } from "@elliemae/ds-tooltip";
|
|
4
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
5
|
+
import { StyledSpanWithTooltip, StyledValuePillWrapper } from "../styled";
|
|
6
|
+
const ValuePill = React2.memo(({ label, size, labelTruncated, tooltipValue, iconLeft, ariaLabel }) => {
|
|
7
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
8
|
+
value: children
|
|
9
|
+
}) : React2.Fragment;
|
|
10
|
+
return /* @__PURE__ */ React2.createElement(StyledValuePillWrapper, {
|
|
11
|
+
size,
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
14
|
+
"data-testid": "ds-pill-wrapper",
|
|
15
|
+
"aria-label": ariaLabel || label,
|
|
16
|
+
cols: [iconLeft && "min-content", "auto"].filter((notFalse) => notFalse),
|
|
17
|
+
gutter: "xxxs",
|
|
18
|
+
hasIcon: iconLeft !== null
|
|
19
|
+
}, iconLeft, tooltipValue !== "" ? /* @__PURE__ */ React2.createElement(DSTooltipV2, {
|
|
20
|
+
title: tooltipValue,
|
|
21
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(StyledSpanWithTooltip, {
|
|
22
|
+
className: "ds-pill-tooltip-value",
|
|
23
|
+
tabIndex: 0
|
|
24
|
+
}, label)
|
|
25
|
+
}) : /* @__PURE__ */ React2.createElement(TextComponent, null, label));
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
ValuePill
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=ValuePill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/ValuePill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { DSTooltipV2 } from '@elliemae/ds-tooltip';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledSpanWithTooltip, StyledValuePillWrapper } from '../styled';\n\nexport const ValuePill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, tooltipValue, iconLeft, ariaLabel }) => {\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n return (\n <StyledValuePillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-value\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', 'auto'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIcon={iconLeft !== null}\n >\n {iconLeft}\n {tooltipValue !== '' ? (\n <DSTooltipV2\n title={tooltipValue}\n triggerComponent={\n <StyledSpanWithTooltip className=\"ds-pill-tooltip-value\" tabIndex={0}>\n {label}\n </StyledSpanWithTooltip>\n }\n />\n ) : (\n <TextComponent>{label}</TextComponent>\n )}\n </StyledValuePillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEA;AAEO,MAAM,YAAY,OAAM,KAC7B,CAAC,EAAE,OAAO,MAAM,gBAAgB,cAAc,UAAU,gBAAgB;AACtE,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,QAAQ,OAAO,CAAC,aAAa;AAAA,IAC/D,QAAO;AAAA,IACP,SAAS,aAAa;AAAA,KAErB,UACA,iBAAiB,KAChB,qCAAC,aAAD;AAAA,IACE,OAAO;AAAA,IACP,kBACE,qCAAC,uBAAD;AAAA,MAAuB,WAAU;AAAA,MAAwB,UAAU;AAAA,OAChE;AAAA,OAKP,qCAAC,eAAD,MAAgB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DropdownPill';\nexport * from './InputPill';\nexport * from './LabelPill';\nexport * from './ReadOnlyPill';\nexport * from './RemovablePill';\nexport * from './ValuePill';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useRef, useState } from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { DSDropdownMenu } from "@elliemae/ds-dropdownmenu";
|
|
5
|
+
import { ChevronDown } from "@elliemae/ds-icons";
|
|
6
|
+
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup/useFocusGroupItem";
|
|
7
|
+
import { Pill } from "./Pill";
|
|
8
|
+
function DropdownPill({
|
|
9
|
+
containerProps = {},
|
|
10
|
+
label = "",
|
|
11
|
+
variant,
|
|
12
|
+
tabIndex = -1,
|
|
13
|
+
closeMenuOnItemSelection = false,
|
|
14
|
+
maxWidth,
|
|
15
|
+
minWidth,
|
|
16
|
+
...dropdownProps
|
|
17
|
+
}) {
|
|
18
|
+
const ref = useRef(null);
|
|
19
|
+
const [chevronEl, chevronRef] = useState();
|
|
20
|
+
const { focusFirst } = useFocusGroupItem(ref);
|
|
21
|
+
return /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
|
|
22
|
+
...dropdownProps,
|
|
23
|
+
closeMenuOnItemSelection,
|
|
24
|
+
maxWidth,
|
|
25
|
+
hideIfNotVisible: true,
|
|
26
|
+
menuProps: { className: "dropdown-pill-menu", zIndex: 100 },
|
|
27
|
+
minWidth,
|
|
28
|
+
onClose: focusFirst,
|
|
29
|
+
referenceNode: chevronEl,
|
|
30
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(Pill, {
|
|
31
|
+
"data-testid": "dropdown-pill",
|
|
32
|
+
className: "dropdown-pill",
|
|
33
|
+
containerProps: { role: "listbox", ...containerProps },
|
|
34
|
+
innerRef: ref,
|
|
35
|
+
label,
|
|
36
|
+
rightAddon: /* @__PURE__ */ React2.createElement("div", {
|
|
37
|
+
ref: chevronRef
|
|
38
|
+
}, /* @__PURE__ */ React2.createElement(ChevronDown, {
|
|
39
|
+
className: "dropdown-pill-chevron-down",
|
|
40
|
+
"data-testid": "dropdown-pill-button"
|
|
41
|
+
})),
|
|
42
|
+
tabIndex,
|
|
43
|
+
variant
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const props = {
|
|
48
|
+
containerProps: PropTypes.object.description("props injected to component wrapper"),
|
|
49
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
50
|
+
variant: PropTypes.oneOf(["value", "title"]).description("pill variant"),
|
|
51
|
+
tabIndex: PropTypes.number.description("html focus order"),
|
|
52
|
+
closeMenuOnItemSelection: PropTypes.bool.description("close menu on item selection"),
|
|
53
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("pill max width"),
|
|
54
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("pill min width")
|
|
55
|
+
};
|
|
56
|
+
DropdownPill.propTypes = props;
|
|
57
|
+
const DSDropdownPillWithSchema = describe(DropdownPill);
|
|
58
|
+
DSDropdownPillWithSchema.propTypes = props;
|
|
59
|
+
export {
|
|
60
|
+
DSDropdownPillWithSchema,
|
|
61
|
+
DropdownPill
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=DropdownPill.js.map
|