@lightsparkdev/ui 0.0.7 → 0.0.8
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/CHANGELOG.md +11 -0
- package/dist/{chunk-JYWYEOM6.js → chunk-2JM7UTAZ.js} +18 -5
- package/dist/{chunk-UO6U7AYM.js → chunk-2YB7653N.js} +1 -1
- package/dist/{chunk-RTUZVKPK.js → chunk-36C653MV.js} +1 -1
- package/dist/{chunk-IQFU7CM5.js → chunk-4KWTXZRY.js} +1 -1
- package/dist/{chunk-CLU2FRJZ.js → chunk-55OQPFLF.js} +1 -1
- package/dist/{chunk-3CZOYF3X.js → chunk-6FHLZM6N.js} +2 -2
- package/dist/{chunk-K7D7A34K.js → chunk-744FBGRP.js} +1 -1
- package/dist/{chunk-FKETYVPP.js → chunk-76Q4BK35.js} +87 -43
- package/dist/{chunk-NGS4OSWT.js → chunk-BAO4T4G5.js} +1 -1
- package/dist/{chunk-NH25O7PC.js → chunk-CW3W2VTZ.js} +1 -1
- package/dist/{chunk-G2PZZFJL.js → chunk-DAVVD7YE.js} +10 -10
- package/dist/{chunk-VBWTKANQ.js → chunk-FN5PM3HQ.js} +6 -6
- package/dist/{chunk-RFGKH3R6.js → chunk-HNVQIY5U.js} +0 -8
- package/dist/{chunk-I74XQIVV.js → chunk-MAMSU2XB.js} +3 -3
- package/dist/chunk-NRXJA2PM.js +67 -0
- package/dist/{chunk-M56R3RJ7.js → chunk-OGSDZTHM.js} +7 -3
- package/dist/chunk-SZVMKB4E.js +222 -0
- package/dist/chunk-U6XT5JKC.js +25 -0
- package/dist/{chunk-WWFDI534.js → chunk-UWN53KLJ.js} +13 -6
- package/dist/{chunk-TAI352I3.js → chunk-VE7J2N47.js} +1 -1
- package/dist/{chunk-NZJCJJH5.js → chunk-VHW2KROZ.js} +1 -1
- package/dist/{chunk-N2RDQJQ5.js → chunk-WTO7C7WA.js} +1 -1
- package/dist/{chunk-23SR7TFO.js → chunk-XAZ6NZ6I.js} +1 -1
- package/dist/chunk-YPB5SA65.js +163 -0
- package/dist/{chunk-SVQELXFK.js → chunk-Z5TPS2BO.js} +1 -1
- package/dist/{chunk-T33SBHYI.js → chunk-ZSUX6RLD.js} +3 -1
- package/dist/{chunk-2WYVO6B2.js → chunk-ZYHA6MJC.js} +1 -1
- package/dist/components/Badge.cjs +1332 -0
- package/dist/components/Badge.d.cts +10 -0
- package/dist/components/Badge.d.ts +10 -0
- package/dist/components/Badge.js +13 -0
- package/dist/components/Button.cjs +197 -83
- package/dist/components/Button.d.cts +3 -1
- package/dist/components/Button.d.ts +3 -1
- package/dist/components/Button.js +8 -7
- package/dist/components/ButtonRow.cjs +212 -82
- package/dist/components/ButtonRow.d.cts +6 -2
- package/dist/components/ButtonRow.d.ts +6 -2
- package/dist/components/ButtonRow.js +14 -11
- package/dist/components/Collapsible.cjs +0 -30
- package/dist/components/Collapsible.js +4 -5
- package/dist/components/ContentTable.cjs +0 -30
- package/dist/components/ContentTable.js +3 -4
- package/dist/components/CopyToClipboardButton.cjs +123 -41
- package/dist/components/CopyToClipboardButton.js +6 -5
- package/dist/components/CurrencyAmount.cjs +0 -30
- package/dist/components/CurrencyAmount.js +3 -4
- package/dist/components/FileInput.cjs +1945 -0
- package/dist/components/FileInput.d.cts +21 -0
- package/dist/components/FileInput.d.ts +21 -0
- package/dist/components/FileInput.js +113 -0
- package/dist/components/Icon.cjs +0 -30
- package/dist/components/Icon.js +2 -3
- package/dist/components/LightTooltip.cjs +1414 -0
- package/dist/components/LightTooltip.d.cts +9 -0
- package/dist/components/LightTooltip.d.ts +9 -0
- package/dist/components/LightTooltip.js +12 -0
- package/dist/components/LightboxImage.cjs +1 -1
- package/dist/components/LightboxImage.js +2 -2
- package/dist/components/LightsparkProvider.cjs +3 -33
- package/dist/components/LightsparkProvider.js +3 -4
- package/dist/components/Loading.cjs +0 -30
- package/dist/components/Loading.js +3 -4
- package/dist/components/Modal.cjs +208 -114
- package/dist/components/Modal.js +12 -11
- package/dist/components/Pill.cjs +1703 -0
- package/dist/components/Pill.d.cts +19 -0
- package/dist/components/Pill.d.ts +19 -0
- package/dist/components/Pill.js +16 -0
- package/dist/components/ProgressBar.cjs +0 -32
- package/dist/components/ProgressBar.js +2 -3
- package/dist/components/SecretContainer.cjs +124 -42
- package/dist/components/SecretContainer.js +7 -6
- package/dist/components/TextIconAligner.cjs +0 -30
- package/dist/components/TextIconAligner.js +3 -4
- package/dist/components/UnstyledButton.cjs +0 -30
- package/dist/components/UnstyledButton.js +2 -3
- package/dist/components/documentation/AnchorLinkHeader.cjs +0 -32
- package/dist/components/documentation/AnchorLinkHeader.js +3 -4
- package/dist/components/documentation/index.cjs +0 -32
- package/dist/components/documentation/index.js +3 -4
- package/dist/components/index.cjs +608 -327
- package/dist/components/index.d.cts +5 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +37 -25
- package/dist/icons/Copy.cjs +4 -3
- package/dist/icons/Copy.js +4 -3
- package/dist/icons/Download.cjs +22 -11
- package/dist/icons/Download.js +23 -12
- package/dist/icons/Upload.cjs +22 -11
- package/dist/icons/Upload.js +23 -12
- package/dist/icons/index.cjs +0 -30
- package/dist/icons/index.js +2 -3
- package/dist/router.cjs +7 -3
- package/dist/router.js +1 -1
- package/dist/styles/common.cjs +0 -32
- package/dist/styles/common.d.cts +1 -5
- package/dist/styles/common.d.ts +1 -5
- package/dist/styles/common.js +1 -4
- package/dist/styles/fields.cjs +65 -34
- package/dist/styles/fields.d.cts +8 -2
- package/dist/styles/fields.d.ts +8 -2
- package/dist/styles/fields.js +28 -164
- package/dist/styles/fonts/typography/Article.cjs +0 -30
- package/dist/styles/fonts/typography/Article.js +6 -7
- package/dist/styles/fonts/typography/index.cjs +0 -30
- package/dist/styles/fonts/typography/index.js +11 -12
- package/dist/styles/global.cjs +3 -33
- package/dist/styles/global.js +2 -3
- package/dist/styles/type.cjs +0 -30
- package/dist/styles/type.js +2 -3
- package/dist/styles/utils.cjs +0 -30
- package/dist/styles/utils.js +2 -3
- package/dist/styles/z-index.cjs +1 -1
- package/dist/styles/z-index.d.cts +1 -1
- package/dist/styles/z-index.d.ts +1 -1
- package/dist/styles/z-index.js +1 -1
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/toReactNodes.cjs +7 -3
- package/dist/utils/toReactNodes.js +2 -2
- package/package.json +5 -4
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
z
|
|
3
|
+
} from "./chunk-55OQPFLF.js";
|
|
4
|
+
import {
|
|
5
|
+
standardBorderRadius,
|
|
6
|
+
subtext
|
|
7
|
+
} from "./chunk-HNVQIY5U.js";
|
|
8
|
+
import {
|
|
9
|
+
colors,
|
|
10
|
+
themeOr
|
|
11
|
+
} from "./chunk-2VBDEO6M.js";
|
|
12
|
+
|
|
13
|
+
// src/styles/fields.tsx
|
|
14
|
+
import { css } from "@emotion/react";
|
|
15
|
+
import styled from "@emotion/styled";
|
|
16
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
17
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
18
|
+
var maxFieldWidth = "100%";
|
|
19
|
+
var fieldWidth = "100%";
|
|
20
|
+
var inputSpacingPx = 24;
|
|
21
|
+
var formButtonTopMargin = "32px";
|
|
22
|
+
var formButtonTopMarginStyle = css`
|
|
23
|
+
margin-top: ${formButtonTopMargin};
|
|
24
|
+
`;
|
|
25
|
+
var standardBorderColor = ({ theme }) => css`
|
|
26
|
+
border-color: ${themeOr(theme.c1Neutral, theme.mcNeutral)({ theme })};
|
|
27
|
+
`;
|
|
28
|
+
var inputBlockStyle = ({
|
|
29
|
+
theme,
|
|
30
|
+
hasValue,
|
|
31
|
+
hasError
|
|
32
|
+
}) => css`
|
|
33
|
+
${subtext({ theme })}
|
|
34
|
+
${standardBorderColor({ theme })}
|
|
35
|
+
${standardBorderRadius(8)}
|
|
36
|
+
background-color: ${theme.bg};
|
|
37
|
+
border-width: 2px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
position: relative;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
padding: 52.5px;
|
|
45
|
+
${hasError ? `border-style: solid; border-color: ${colors.danger}; border-width: 2px;` : hasValue ? `border-style: solid; border-color: ${theme.info};` : `border-style: dashed;`}
|
|
46
|
+
`;
|
|
47
|
+
var textInputPlaceholderColor = ({ theme }) => theme.c4Neutral;
|
|
48
|
+
var textInputColor = ({ theme }) => theme.text;
|
|
49
|
+
var textInputFontWeight = 600;
|
|
50
|
+
var textInputBorderRadiusPx = 8;
|
|
51
|
+
var textInputPaddingPx = 12;
|
|
52
|
+
var textInputPadding = `${textInputPaddingPx}px`;
|
|
53
|
+
var textInputBorderColor = ({ theme }) => themeOr(theme.c1Neutral, theme.c3Neutral)({ theme });
|
|
54
|
+
var textInputBorderColorFocused = ({ theme }) => themeOr(theme.hcNeutral, theme.hcNeutral)({ theme });
|
|
55
|
+
var textInputStyle = ({
|
|
56
|
+
theme,
|
|
57
|
+
disabled,
|
|
58
|
+
hasError,
|
|
59
|
+
paddingLeftPx,
|
|
60
|
+
paddingRightPx
|
|
61
|
+
}) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return css`
|
|
64
|
+
border-radius: ${textInputBorderRadiusPx}px;
|
|
65
|
+
background-color: ${disabled ? theme.vlcNeutral : theme.bg};
|
|
66
|
+
cursor: ${disabled ? "not-allowed" : "auto"};
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
font-weight: ${textInputFontWeight};
|
|
69
|
+
|
|
70
|
+
position: relative;
|
|
71
|
+
z-index: ${z.textInput};
|
|
72
|
+
font-family: ${(_a = theme.typography) == null ? void 0 : _a.fontFamilies.main};
|
|
73
|
+
padding: ${textInputPaddingPx - (hasError ? 1 : 0)}px;
|
|
74
|
+
${paddingLeftPx ? `padding-left: ${paddingLeftPx - (hasError ? 1 : 0)}px;` : ""}
|
|
75
|
+
${paddingRightPx ? `padding-right: ${paddingRightPx - (hasError ? 1 : 0)}px;` : ""}
|
|
76
|
+
border-style: solid;
|
|
77
|
+
border-width: ${hasError ? "2" : "1"}px;
|
|
78
|
+
border-color: ${hasError ? theme.danger : textInputBorderColor({ theme })};
|
|
79
|
+
line-height: 22px;
|
|
80
|
+
outline: none;
|
|
81
|
+
/* Use low contrast by default. Some fields, eg login, need high contrast simply
|
|
82
|
+
because of quirks with default autofill styles. Clicking in to an autofilled value
|
|
83
|
+
does not change the color of the text, it just uses the default field color */
|
|
84
|
+
color: ${textInputColor({ theme })};
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
width: ${fieldWidth};
|
|
87
|
+
max-width: ${maxFieldWidth};
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
&:focus,
|
|
90
|
+
&:active {
|
|
91
|
+
border-color: ${textInputBorderColorFocused({ theme })};
|
|
92
|
+
border-width: 2px;
|
|
93
|
+
color: ${textInputColor({ theme })};
|
|
94
|
+
padding: ${textInputPaddingPx - 1}px;
|
|
95
|
+
${paddingLeftPx ? `padding-left: ${paddingLeftPx - 1}px;` : ""}
|
|
96
|
+
${paddingRightPx ? `padding-right: ${paddingRightPx - 1}px;` : ""}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&::placeholder {
|
|
100
|
+
color: ${textInputPlaceholderColor({ theme })};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus::placeholder {
|
|
104
|
+
color: ${textInputPlaceholderColor({ theme })};
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
};
|
|
108
|
+
var FieldError = styled.div`
|
|
109
|
+
background-color: rgba(242, 239, 255, 1);
|
|
110
|
+
padding: 16px 16px 8px;
|
|
111
|
+
margin-top: -8px;
|
|
112
|
+
border-radius: 0 0 8px 8px;
|
|
113
|
+
position: relative;
|
|
114
|
+
z-index: ${z.fieldError};
|
|
115
|
+
`;
|
|
116
|
+
var aboveFieldError = ({
|
|
117
|
+
theme,
|
|
118
|
+
hasError
|
|
119
|
+
}) => css`
|
|
120
|
+
${hasError ? "border: none !important" : ""};
|
|
121
|
+
background-color: ${theme.bg};
|
|
122
|
+
position: relative;
|
|
123
|
+
z-index: ${z.fieldError + 1};
|
|
124
|
+
${hasError && "box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.08), 0px 1px 4px rgba(0, 0, 0, 0.1);"}
|
|
125
|
+
`;
|
|
126
|
+
var inputSubtextSeconds = 0.25;
|
|
127
|
+
function InputSubtext({
|
|
128
|
+
text,
|
|
129
|
+
hasError = false,
|
|
130
|
+
tooltipId
|
|
131
|
+
}) {
|
|
132
|
+
const timeoutRef = useRef(null);
|
|
133
|
+
const [subtext2, setSubtext] = useState(text);
|
|
134
|
+
const [visible, setVisible] = useState(Boolean(text));
|
|
135
|
+
useLayoutEffect(() => {
|
|
136
|
+
if (text) {
|
|
137
|
+
setSubtext(text);
|
|
138
|
+
setVisible(true);
|
|
139
|
+
if (timeoutRef.current) {
|
|
140
|
+
clearTimeout(timeoutRef.current);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
setVisible(false);
|
|
144
|
+
timeoutRef.current = setTimeout(() => {
|
|
145
|
+
setSubtext(void 0);
|
|
146
|
+
}, inputSubtextSeconds * 1e3);
|
|
147
|
+
}
|
|
148
|
+
}, [text]);
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
|
+
StyledInputSubtext,
|
|
151
|
+
{
|
|
152
|
+
visible,
|
|
153
|
+
hasError,
|
|
154
|
+
cursorPointer: Boolean(tooltipId),
|
|
155
|
+
children: tooltipId ? /* @__PURE__ */ jsx("span", { "data-tooltip-id": tooltipId, children: subtext2 }) : subtext2
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
var StyledInputSubtext = styled.div`
|
|
160
|
+
margin-top: ${({ visible }) => visible ? "8px" : "0px"};
|
|
161
|
+
margin-left: ${({ visible }) => visible ? "8px" : "0px"};
|
|
162
|
+
font-size: 12px;
|
|
163
|
+
font-size: ${({ visible }) => visible ? "12px" : "0px"};
|
|
164
|
+
opacity: ${({ visible }) => visible ? "1" : "0"};
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
transition:
|
|
167
|
+
font-size ${inputSubtextSeconds}s cubic-bezier(0.25, 0.87, 0.56, 1.23),
|
|
168
|
+
opacity ${inputSubtextSeconds * 0.8}s cubic-bezier(0.25, 0.87, 0.56, 1.23),
|
|
169
|
+
margin ${inputSubtextSeconds}s cubic-bezier(0.25, 0.87, 0.56, 1.23);
|
|
170
|
+
color: ${({ hasError, theme }) => hasError ? theme.danger : theme.text};
|
|
171
|
+
cursor: ${({ cursorPointer }) => cursorPointer ? "pointer" : "auto"};
|
|
172
|
+
`;
|
|
173
|
+
var labelStyle = ({
|
|
174
|
+
theme,
|
|
175
|
+
hasError
|
|
176
|
+
}) => css`
|
|
177
|
+
color: ${hasError ? theme.danger : theme.text};
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: space-between;
|
|
181
|
+
align-items: center;
|
|
182
|
+
& + * {
|
|
183
|
+
margin-top: 12px;
|
|
184
|
+
}
|
|
185
|
+
* ~ & {
|
|
186
|
+
margin-top: 40px;
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
var Label = styled.label`
|
|
190
|
+
${subtext}
|
|
191
|
+
${labelStyle}
|
|
192
|
+
`;
|
|
193
|
+
var LabelDiv = styled.div`
|
|
194
|
+
${subtext}
|
|
195
|
+
${labelStyle}
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
maxFieldWidth,
|
|
200
|
+
fieldWidth,
|
|
201
|
+
inputSpacingPx,
|
|
202
|
+
formButtonTopMargin,
|
|
203
|
+
formButtonTopMarginStyle,
|
|
204
|
+
standardBorderColor,
|
|
205
|
+
inputBlockStyle,
|
|
206
|
+
textInputPlaceholderColor,
|
|
207
|
+
textInputColor,
|
|
208
|
+
textInputFontWeight,
|
|
209
|
+
textInputBorderRadiusPx,
|
|
210
|
+
textInputPaddingPx,
|
|
211
|
+
textInputPadding,
|
|
212
|
+
textInputBorderColor,
|
|
213
|
+
textInputBorderColorFocused,
|
|
214
|
+
textInputStyle,
|
|
215
|
+
FieldError,
|
|
216
|
+
aboveFieldError,
|
|
217
|
+
InputSubtext,
|
|
218
|
+
StyledInputSubtext,
|
|
219
|
+
labelStyle,
|
|
220
|
+
Label,
|
|
221
|
+
LabelDiv
|
|
222
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
standardBorderRadius
|
|
3
|
+
} from "./chunk-HNVQIY5U.js";
|
|
4
|
+
import {
|
|
5
|
+
isLight
|
|
6
|
+
} from "./chunk-2VBDEO6M.js";
|
|
7
|
+
|
|
8
|
+
// src/components/Badge.tsx
|
|
9
|
+
import styled from "@emotion/styled";
|
|
10
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
11
|
+
function Badge({ text, ml = 0 }) {
|
|
12
|
+
return text ? /* @__PURE__ */ jsx(StyledBadge, { ml, children: text }) : null;
|
|
13
|
+
}
|
|
14
|
+
var badgeVPadding = 2;
|
|
15
|
+
var StyledBadge = styled.span`
|
|
16
|
+
${standardBorderRadius(4)}
|
|
17
|
+
${({ ml }) => ml === 0 ? "" : `margin-left: ${ml}px;`}
|
|
18
|
+
padding: ${badgeVPadding}px 6px;
|
|
19
|
+
background-color: ${({ theme }) => isLight(theme) ? theme.c05Neutral : theme.c15Neutral};
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
Badge,
|
|
24
|
+
badgeVPadding
|
|
25
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnstyledButton
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4KWTXZRY.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
LightTooltip
|
|
6
|
+
} from "./chunk-NRXJA2PM.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
Icon
|
|
9
|
+
} from "./chunk-VHW2KROZ.js";
|
|
10
10
|
import {
|
|
11
11
|
__async
|
|
12
12
|
} from "./chunk-CIGAQ47A.js";
|
|
@@ -49,7 +49,14 @@ var CopyToClipboardButton = (props) => {
|
|
|
49
49
|
]
|
|
50
50
|
}
|
|
51
51
|
),
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
LightTooltip,
|
|
54
|
+
{
|
|
55
|
+
id,
|
|
56
|
+
place: props.place || "right",
|
|
57
|
+
content: tooltipContent
|
|
58
|
+
}
|
|
59
|
+
)
|
|
53
60
|
] });
|
|
54
61
|
};
|
|
55
62
|
var Children = styled.span`
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Loading
|
|
3
|
+
} from "./chunk-BAO4T4G5.js";
|
|
4
|
+
import {
|
|
5
|
+
flexCenter
|
|
6
|
+
} from "./chunk-2YB7653N.js";
|
|
7
|
+
import {
|
|
8
|
+
UnstyledButton
|
|
9
|
+
} from "./chunk-4KWTXZRY.js";
|
|
10
|
+
import {
|
|
11
|
+
Icon
|
|
12
|
+
} from "./chunk-VHW2KROZ.js";
|
|
13
|
+
import {
|
|
14
|
+
colors
|
|
15
|
+
} from "./chunk-2VBDEO6M.js";
|
|
16
|
+
|
|
17
|
+
// src/components/Pill.tsx
|
|
18
|
+
import styled from "@emotion/styled";
|
|
19
|
+
import { useEffect, useRef } from "react";
|
|
20
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
21
|
+
function Pill({
|
|
22
|
+
text,
|
|
23
|
+
onDeleteMouseDown,
|
|
24
|
+
onDeleteMouseUp,
|
|
25
|
+
onDeleteFromKeyboard,
|
|
26
|
+
icon,
|
|
27
|
+
loading = false,
|
|
28
|
+
cursor = "text",
|
|
29
|
+
isEditing = false,
|
|
30
|
+
onChangeTextInput = () => {
|
|
31
|
+
},
|
|
32
|
+
onFocusTextInput = () => {
|
|
33
|
+
},
|
|
34
|
+
onClickPillBody = () => {
|
|
35
|
+
},
|
|
36
|
+
onBlurTextInput = () => {
|
|
37
|
+
}
|
|
38
|
+
}) {
|
|
39
|
+
const textInputRef = useRef(null);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (isEditing && textInputRef.current) {
|
|
42
|
+
textInputRef.current.focus();
|
|
43
|
+
}
|
|
44
|
+
}, [isEditing]);
|
|
45
|
+
function handleOnDeleteMouseDown(event) {
|
|
46
|
+
if (onDeleteMouseDown) {
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
onDeleteMouseDown(event);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function handleOnDeleteKeyDown(event) {
|
|
52
|
+
if (onDeleteFromKeyboard) {
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
if (event.key === "Enter") {
|
|
55
|
+
onDeleteFromKeyboard();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsxs(
|
|
60
|
+
StyledPill,
|
|
61
|
+
{
|
|
62
|
+
hasIcon: Boolean(icon || loading || onDeleteMouseDown),
|
|
63
|
+
cursor,
|
|
64
|
+
onClick: (event) => {
|
|
65
|
+
if (onClickPillBody) {
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
onClickPillBody();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
isEditing ? /* @__PURE__ */ jsx(
|
|
72
|
+
PillInput,
|
|
73
|
+
{
|
|
74
|
+
value: text,
|
|
75
|
+
onChange: (event) => onChangeTextInput(event.target.value),
|
|
76
|
+
onFocus: onFocusTextInput,
|
|
77
|
+
onBlur: onBlurTextInput,
|
|
78
|
+
ref: textInputRef
|
|
79
|
+
}
|
|
80
|
+
) : /* @__PURE__ */ jsx(PillText, { children: text }),
|
|
81
|
+
(icon || loading || onDeleteMouseDown) && /* @__PURE__ */ jsxs(
|
|
82
|
+
PillIconContainer,
|
|
83
|
+
{
|
|
84
|
+
hasIconInset: Boolean(icon && !loading && !onDeleteMouseDown),
|
|
85
|
+
children: [
|
|
86
|
+
loading && /* @__PURE__ */ jsx(Loading, { size: 16.1, center: false, ml: 5 }),
|
|
87
|
+
!loading && onDeleteMouseDown && /* @__PURE__ */ jsx(
|
|
88
|
+
UnstyledButton,
|
|
89
|
+
{
|
|
90
|
+
onMouseDown: handleOnDeleteMouseDown,
|
|
91
|
+
onKeyDown: handleOnDeleteKeyDown,
|
|
92
|
+
type: "button",
|
|
93
|
+
css: {
|
|
94
|
+
display: "flex",
|
|
95
|
+
padding: "10px",
|
|
96
|
+
marginRight: "-10px"
|
|
97
|
+
},
|
|
98
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "DeleteIcon", width: 16.1 })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
!loading && icon && !onDeleteMouseDown && /* @__PURE__ */ jsx(Icon, { name: icon, width: 16.1, color: colors.white })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
var PillText = styled.div`
|
|
110
|
+
/* For mobile ensure empty values don't prevent div from having height: */
|
|
111
|
+
height: 1.2rem;
|
|
112
|
+
min-width: 100px;
|
|
113
|
+
max-width: 210px;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
text-overflow: ellipsis;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
`;
|
|
119
|
+
var StyledPill = styled.div`
|
|
120
|
+
* + & {
|
|
121
|
+
margin-top: 16px;
|
|
122
|
+
}
|
|
123
|
+
background-color: ${({ theme }) => theme.c05Neutral};
|
|
124
|
+
color: ${({ theme }) => theme.text};
|
|
125
|
+
padding: 12px 18px;
|
|
126
|
+
${({ hasIcon }) => hasIcon && `padding-right: 48px;`}
|
|
127
|
+
border-radius: 2em;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
cursor: ${({ cursor }) => cursor};
|
|
131
|
+
position: relative;
|
|
132
|
+
`;
|
|
133
|
+
var PillIconContainer = styled.div`
|
|
134
|
+
${flexCenter}
|
|
135
|
+
${({ hasIconInset }) => hasIconInset ? `
|
|
136
|
+
background-color: ${colors.blue43};
|
|
137
|
+
padding: 8px;
|
|
138
|
+
right: 4px;
|
|
139
|
+
top: 3.5px;` : `right: 18px;`}
|
|
140
|
+
border-radius: 50%;
|
|
141
|
+
margin-left: 12px;
|
|
142
|
+
position: absolute;
|
|
143
|
+
`;
|
|
144
|
+
var PillInput = styled.input`
|
|
145
|
+
background-color: transparent;
|
|
146
|
+
border: none;
|
|
147
|
+
outline: none;
|
|
148
|
+
color: ${({ theme }) => theme.text};
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
font-size: 1rem;
|
|
151
|
+
padding: 0;
|
|
152
|
+
margin: 0;
|
|
153
|
+
width: 100%;
|
|
154
|
+
max-width: 210px;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
text-overflow: ellipsis;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
font-family: ${({ theme }) => theme.typography.fontFamilies.main};
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
export {
|
|
162
|
+
Pill
|
|
163
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
rootFontSizeRems,
|
|
6
6
|
standardLineHeightEms
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HNVQIY5U.js";
|
|
8
8
|
import {
|
|
9
9
|
useThemeBg
|
|
10
10
|
} from "./chunk-2VBDEO6M.js";
|
|
@@ -110,6 +110,8 @@ function GlobalStyles() {
|
|
|
110
110
|
:root {
|
|
111
111
|
${cssVars.docHeight}: 100vh;
|
|
112
112
|
--rt-opacity: 1 !important;
|
|
113
|
+
--rt-transition-show-delay: 0.15s !important;
|
|
114
|
+
--rt-transition-closing-delay: 0.2s !important;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
html {
|