@helpwave/hightide 0.0.15 → 0.0.16
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/index.d.mts +86 -2
- package/dist/index.d.ts +86 -2
- package/dist/index.js +5714 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5541 -0
- package/dist/index.mjs.map +1 -1
- package/dist/util/news.d.mts +9 -9
- package/dist/util/news.d.ts +9 -9
- package/package.json +11 -7
- package/dist/components/Span.d.mts +0 -2
- package/dist/components/Span.d.ts +0 -2
- package/dist/components/Span.js +0 -2
- package/dist/components/Span.js.map +0 -1
- package/dist/components/Span.mjs +0 -1
- package/dist/components/Span.mjs.map +0 -1
- package/dist/components/examples/InputGroupExample.d.mts +0 -11
- package/dist/components/examples/InputGroupExample.d.ts +0 -11
- package/dist/components/examples/InputGroupExample.js +0 -466
- package/dist/components/examples/InputGroupExample.js.map +0 -1
- package/dist/components/examples/InputGroupExample.mjs +0 -436
- package/dist/components/examples/InputGroupExample.mjs.map +0 -1
- package/dist/components/examples/MultiSelectExample.d.mts +0 -14
- package/dist/components/examples/MultiSelectExample.d.ts +0 -14
- package/dist/components/examples/MultiSelectExample.js +0 -661
- package/dist/components/examples/MultiSelectExample.js.map +0 -1
- package/dist/components/examples/MultiSelectExample.mjs +0 -631
- package/dist/components/examples/MultiSelectExample.mjs.map +0 -1
- package/dist/components/examples/SearchableSelectExample.d.mts +0 -13
- package/dist/components/examples/SearchableSelectExample.d.ts +0 -13
- package/dist/components/examples/SearchableSelectExample.js +0 -365
- package/dist/components/examples/SearchableSelectExample.js.map +0 -1
- package/dist/components/examples/SearchableSelectExample.mjs +0 -335
- package/dist/components/examples/SearchableSelectExample.mjs.map +0 -1
- package/dist/components/examples/SelectExample.d.mts +0 -9
- package/dist/components/examples/SelectExample.d.ts +0 -9
- package/dist/components/examples/SelectExample.js +0 -180
- package/dist/components/examples/SelectExample.js.map +0 -1
- package/dist/components/examples/SelectExample.mjs +0 -145
- package/dist/components/examples/SelectExample.mjs.map +0 -1
- package/dist/components/examples/StackingModals.d.mts +0 -8
- package/dist/components/examples/StackingModals.d.ts +0 -8
- package/dist/components/examples/StackingModals.js +0 -498
- package/dist/components/examples/StackingModals.js.map +0 -1
- package/dist/components/examples/StackingModals.mjs +0 -463
- package/dist/components/examples/StackingModals.mjs.map +0 -1
- package/dist/components/examples/TableExample.d.mts +0 -13
- package/dist/components/examples/TableExample.d.ts +0 -13
- package/dist/components/examples/TableExample.js +0 -853
- package/dist/components/examples/TableExample.js.map +0 -1
- package/dist/components/examples/TableExample.mjs +0 -823
- package/dist/components/examples/TableExample.mjs.map +0 -1
- package/dist/components/examples/TextareaExample.d.mts +0 -12
- package/dist/components/examples/TextareaExample.d.ts +0 -12
- package/dist/components/examples/TextareaExample.js +0 -176
- package/dist/components/examples/TextareaExample.js.map +0 -1
- package/dist/components/examples/TextareaExample.mjs +0 -141
- package/dist/components/examples/TextareaExample.mjs.map +0 -1
- package/dist/components/examples/TileExample.d.mts +0 -14
- package/dist/components/examples/TileExample.d.ts +0 -14
- package/dist/components/examples/TileExample.js +0 -79
- package/dist/components/examples/TileExample.js.map +0 -1
- package/dist/components/examples/TileExample.mjs +0 -44
- package/dist/components/examples/TileExample.mjs.map +0 -1
- package/dist/components/examples/Title.d.mts +0 -2
- package/dist/components/examples/Title.d.ts +0 -2
- package/dist/components/examples/Title.js +0 -2
- package/dist/components/examples/Title.js.map +0 -1
- package/dist/components/examples/Title.mjs +0 -1
- package/dist/components/examples/Title.mjs.map +0 -1
- package/dist/components/examples/date/DateTimePickerExample.d.mts +0 -18
- package/dist/components/examples/date/DateTimePickerExample.d.ts +0 -18
- package/dist/components/examples/date/DateTimePickerExample.js +0 -879
- package/dist/components/examples/date/DateTimePickerExample.js.map +0 -1
- package/dist/components/examples/date/DateTimePickerExample.mjs +0 -844
- package/dist/components/examples/date/DateTimePickerExample.mjs.map +0 -1
- package/dist/components/examples/properties/CheckboxPropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/CheckboxPropertyExample.js +0 -349
- package/dist/components/examples/properties/CheckboxPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/CheckboxPropertyExample.mjs +0 -314
- package/dist/components/examples/properties/CheckboxPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/DatePropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/DatePropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/DatePropertyExample.js +0 -460
- package/dist/components/examples/properties/DatePropertyExample.js.map +0 -1
- package/dist/components/examples/properties/DatePropertyExample.mjs +0 -430
- package/dist/components/examples/properties/DatePropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.mts +0 -18
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +0 -18
- package/dist/components/examples/properties/MultiSelectPropertyExample.js +0 -848
- package/dist/components/examples/properties/MultiSelectPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/MultiSelectPropertyExample.mjs +0 -818
- package/dist/components/examples/properties/MultiSelectPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/NumberPropertyExample.d.mts +0 -14
- package/dist/components/examples/properties/NumberPropertyExample.d.ts +0 -14
- package/dist/components/examples/properties/NumberPropertyExample.js +0 -456
- package/dist/components/examples/properties/NumberPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/NumberPropertyExample.mjs +0 -426
- package/dist/components/examples/properties/NumberPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/SelectPropertyExample.d.mts +0 -17
- package/dist/components/examples/properties/SelectPropertyExample.d.ts +0 -17
- package/dist/components/examples/properties/SelectPropertyExample.js +0 -584
- package/dist/components/examples/properties/SelectPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/SelectPropertyExample.mjs +0 -554
- package/dist/components/examples/properties/SelectPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/TextPropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/TextPropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/TextPropertyExample.js +0 -405
- package/dist/components/examples/properties/TextPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/TextPropertyExample.mjs +0 -370
- package/dist/components/examples/properties/TextPropertyExample.mjs.map +0 -1
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
// src/components/examples/properties/TextPropertyExample.tsx
|
|
2
|
-
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
3
|
-
|
|
4
|
-
// src/components/properties/TextProperty.tsx
|
|
5
|
-
import { Text } from "lucide-react";
|
|
6
|
-
import clsx4 from "clsx";
|
|
7
|
-
|
|
8
|
-
// src/hooks/useLanguage.tsx
|
|
9
|
-
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
10
|
-
|
|
11
|
-
// src/hooks/useLocalStorage.tsx
|
|
12
|
-
import { useCallback, useEffect, useState } from "react";
|
|
13
|
-
|
|
14
|
-
// src/hooks/useLanguage.tsx
|
|
15
|
-
import { jsx } from "react/jsx-runtime";
|
|
16
|
-
var DEFAULT_LANGUAGE = "en";
|
|
17
|
-
var LanguageContext = createContext({ language: DEFAULT_LANGUAGE, setLanguage: (v) => v });
|
|
18
|
-
var useLanguage = () => useContext(LanguageContext);
|
|
19
|
-
|
|
20
|
-
// src/hooks/useTranslation.ts
|
|
21
|
-
var useTranslation = (defaults, translationOverwrite = {}) => {
|
|
22
|
-
const { language: languageProp, translation: overwrite } = translationOverwrite;
|
|
23
|
-
const { language: inferredLanguage } = useLanguage();
|
|
24
|
-
const usedLanguage = languageProp ?? inferredLanguage;
|
|
25
|
-
let defaultValues = defaults[usedLanguage];
|
|
26
|
-
if (overwrite && overwrite[usedLanguage]) {
|
|
27
|
-
defaultValues = { ...defaultValues, ...overwrite[usedLanguage] };
|
|
28
|
-
}
|
|
29
|
-
return defaultValues;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// src/components/user-input/Textarea.tsx
|
|
33
|
-
import { useState as useState4 } from "react";
|
|
34
|
-
import clsx from "clsx";
|
|
35
|
-
|
|
36
|
-
// src/hooks/useSaveDelay.ts
|
|
37
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
38
|
-
function useSaveDelay(setNotificationStatus, delay) {
|
|
39
|
-
const [updateTimer, setUpdateTimer] = useState3(void 0);
|
|
40
|
-
const [notificationTimer, setNotificationTimer] = useState3(void 0);
|
|
41
|
-
const restartTimer = (onSave) => {
|
|
42
|
-
clearTimeout(updateTimer);
|
|
43
|
-
setUpdateTimer(setTimeout(() => {
|
|
44
|
-
onSave();
|
|
45
|
-
setNotificationStatus(true);
|
|
46
|
-
clearTimeout(notificationTimer);
|
|
47
|
-
setNotificationTimer(setTimeout(() => {
|
|
48
|
-
setNotificationStatus(false);
|
|
49
|
-
clearTimeout(notificationTimer);
|
|
50
|
-
}, delay));
|
|
51
|
-
clearTimeout(updateTimer);
|
|
52
|
-
}, delay));
|
|
53
|
-
};
|
|
54
|
-
const clearUpdateTimer = (hasSaved = true) => {
|
|
55
|
-
clearTimeout(updateTimer);
|
|
56
|
-
if (hasSaved) {
|
|
57
|
-
setNotificationStatus(true);
|
|
58
|
-
clearTimeout(notificationTimer);
|
|
59
|
-
setNotificationTimer(setTimeout(() => {
|
|
60
|
-
setNotificationStatus(false);
|
|
61
|
-
clearTimeout(notificationTimer);
|
|
62
|
-
}, delay));
|
|
63
|
-
} else {
|
|
64
|
-
setNotificationStatus(false);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
useEffect3(() => {
|
|
68
|
-
return () => {
|
|
69
|
-
clearTimeout(updateTimer);
|
|
70
|
-
clearTimeout(notificationTimer);
|
|
71
|
-
};
|
|
72
|
-
}, []);
|
|
73
|
-
return { restartTimer, clearUpdateTimer };
|
|
74
|
-
}
|
|
75
|
-
var useSaveDelay_default = useSaveDelay;
|
|
76
|
-
|
|
77
|
-
// src/util/noop.ts
|
|
78
|
-
var noop = () => void 0;
|
|
79
|
-
|
|
80
|
-
// src/components/user-input/Label.tsx
|
|
81
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
82
|
-
var styleMapping = {
|
|
83
|
-
labelSmall: "textstyle-label-sm",
|
|
84
|
-
labelMedium: "textstyle-label-md",
|
|
85
|
-
labelBig: "textstyle-label-lg"
|
|
86
|
-
};
|
|
87
|
-
var Label = ({
|
|
88
|
-
children,
|
|
89
|
-
name,
|
|
90
|
-
labelType = "labelSmall",
|
|
91
|
-
...props
|
|
92
|
-
}) => {
|
|
93
|
-
return /* @__PURE__ */ jsx2("label", { ...props, children: children ? children : /* @__PURE__ */ jsx2("span", { className: styleMapping[labelType], children: name }) });
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/components/user-input/Textarea.tsx
|
|
97
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
98
|
-
var Textarea = ({
|
|
99
|
-
label,
|
|
100
|
-
headline,
|
|
101
|
-
id,
|
|
102
|
-
resizable = false,
|
|
103
|
-
onChange = noop,
|
|
104
|
-
disclaimer,
|
|
105
|
-
onBlur = noop,
|
|
106
|
-
onEditCompleted = noop,
|
|
107
|
-
defaultStyle = true,
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}) => {
|
|
111
|
-
const [hasFocus, setHasFocus] = useState4(false);
|
|
112
|
-
const { restartTimer, clearUpdateTimer } = useSaveDelay_default(() => void 0, 3e3);
|
|
113
|
-
const onEditCompletedWrapper = (text) => {
|
|
114
|
-
onEditCompleted(text);
|
|
115
|
-
clearUpdateTimer();
|
|
116
|
-
};
|
|
117
|
-
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
118
|
-
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx("mb-1", label.className), labelType: label.labelType ?? "labelSmall" }),
|
|
119
|
-
/* @__PURE__ */ jsxs("div", { className: `${clsx(" bg-surface text-on-surface focus-within:border-primary relative", { "shadow border-2 border-gray-300 hover:border-primary rounded-lg": defaultStyle })}`, children: [
|
|
120
|
-
headline && /* @__PURE__ */ jsx3("span", { className: "mx-3 mt-3 block text-gray-700 font-bold", children: headline }),
|
|
121
|
-
/* @__PURE__ */ jsx3(
|
|
122
|
-
"textarea",
|
|
123
|
-
{
|
|
124
|
-
id,
|
|
125
|
-
className: clsx("pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none", { "resize-none": !resizable, "h-32": defaultStyle, "mt-3": !headline }, className),
|
|
126
|
-
onChange: (event) => {
|
|
127
|
-
const value = event.target.value;
|
|
128
|
-
restartTimer(() => {
|
|
129
|
-
onEditCompletedWrapper(value);
|
|
130
|
-
});
|
|
131
|
-
onChange(value);
|
|
132
|
-
},
|
|
133
|
-
onFocus: () => {
|
|
134
|
-
setHasFocus(true);
|
|
135
|
-
},
|
|
136
|
-
onBlur: (event) => {
|
|
137
|
-
onBlur(event);
|
|
138
|
-
onEditCompletedWrapper(event.target.value);
|
|
139
|
-
setHasFocus(false);
|
|
140
|
-
},
|
|
141
|
-
...props
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
] }),
|
|
145
|
-
hasFocus && disclaimer && /* @__PURE__ */ jsx3("label", { className: "text-negative", children: disclaimer })
|
|
146
|
-
] });
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/components/properties/PropertyBase.tsx
|
|
150
|
-
import { AlertTriangle } from "lucide-react";
|
|
151
|
-
import clsx3 from "clsx";
|
|
152
|
-
|
|
153
|
-
// src/components/Button.tsx
|
|
154
|
-
import clsx2 from "clsx";
|
|
155
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
156
|
-
var ButtonSizePaddings = {
|
|
157
|
-
small: "btn-sm",
|
|
158
|
-
medium: "btn-md",
|
|
159
|
-
large: "btn-lg"
|
|
160
|
-
};
|
|
161
|
-
var TextButton = ({
|
|
162
|
-
children,
|
|
163
|
-
disabled = false,
|
|
164
|
-
color = "neutral",
|
|
165
|
-
size = "medium",
|
|
166
|
-
startIcon,
|
|
167
|
-
endIcon,
|
|
168
|
-
onClick,
|
|
169
|
-
className,
|
|
170
|
-
...restProps
|
|
171
|
-
}) => {
|
|
172
|
-
const colorClasses = {
|
|
173
|
-
negative: "bg-transparent text-button-text-negative-text",
|
|
174
|
-
neutral: "bg-transparent text-button-text-neutral-text"
|
|
175
|
-
}[color];
|
|
176
|
-
const iconColorClasses = {
|
|
177
|
-
negative: "text-button-text-negative-icon",
|
|
178
|
-
neutral: "text-button-text-neutral-icon"
|
|
179
|
-
}[color];
|
|
180
|
-
return /* @__PURE__ */ jsxs2(
|
|
181
|
-
"button",
|
|
182
|
-
{
|
|
183
|
-
onClick: disabled ? void 0 : onClick,
|
|
184
|
-
disabled: disabled || onClick === void 0,
|
|
185
|
-
className: clsx2(
|
|
186
|
-
className,
|
|
187
|
-
{
|
|
188
|
-
"text-disabled-text": disabled,
|
|
189
|
-
[clsx2(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
190
|
-
},
|
|
191
|
-
ButtonSizePaddings[size]
|
|
192
|
-
),
|
|
193
|
-
...restProps,
|
|
194
|
-
children: [
|
|
195
|
-
startIcon && /* @__PURE__ */ jsx4(
|
|
196
|
-
"span",
|
|
197
|
-
{
|
|
198
|
-
className: clsx2({
|
|
199
|
-
[iconColorClasses]: !disabled,
|
|
200
|
-
[`text-disabled-icon`]: disabled
|
|
201
|
-
}),
|
|
202
|
-
children: startIcon
|
|
203
|
-
}
|
|
204
|
-
),
|
|
205
|
-
children,
|
|
206
|
-
endIcon && /* @__PURE__ */ jsx4(
|
|
207
|
-
"span",
|
|
208
|
-
{
|
|
209
|
-
className: clsx2({
|
|
210
|
-
[iconColorClasses]: !disabled,
|
|
211
|
-
[`text-disabled-icon`]: disabled
|
|
212
|
-
}),
|
|
213
|
-
children: endIcon
|
|
214
|
-
}
|
|
215
|
-
)
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// src/components/properties/PropertyBase.tsx
|
|
222
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
223
|
-
var defaultPropertyBaseTranslation = {
|
|
224
|
-
en: {
|
|
225
|
-
remove: "Remove"
|
|
226
|
-
},
|
|
227
|
-
de: {
|
|
228
|
-
remove: "Entfernen"
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
var PropertyBase = ({
|
|
232
|
-
overwriteTranslation,
|
|
233
|
-
name,
|
|
234
|
-
input,
|
|
235
|
-
softRequired = false,
|
|
236
|
-
hasValue,
|
|
237
|
-
icon,
|
|
238
|
-
readOnly,
|
|
239
|
-
onRemove,
|
|
240
|
-
className = ""
|
|
241
|
-
}) => {
|
|
242
|
-
const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
|
|
243
|
-
const requiredAndNoValue = softRequired && !hasValue;
|
|
244
|
-
return /* @__PURE__ */ jsxs3("div", { className: clsx3("row gap-x-0 group", className), children: [
|
|
245
|
-
/* @__PURE__ */ jsxs3(
|
|
246
|
-
"div",
|
|
247
|
-
{
|
|
248
|
-
className: clsx3("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
|
|
249
|
-
"bg-gray-100 text-black group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
250
|
-
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
251
|
-
}, className),
|
|
252
|
-
children: [
|
|
253
|
-
icon,
|
|
254
|
-
name
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
/* @__PURE__ */ jsxs3(
|
|
259
|
-
"div",
|
|
260
|
-
{
|
|
261
|
-
className: clsx3("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
262
|
-
"bg-white group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
263
|
-
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
264
|
-
}, className),
|
|
265
|
-
children: [
|
|
266
|
-
input({ softRequired, hasValue }),
|
|
267
|
-
requiredAndNoValue && /* @__PURE__ */ jsx5("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx5(AlertTriangle, { size: 24 }) }),
|
|
268
|
-
onRemove && /* @__PURE__ */ jsx5(
|
|
269
|
-
TextButton,
|
|
270
|
-
{
|
|
271
|
-
onClick: onRemove,
|
|
272
|
-
color: "negative",
|
|
273
|
-
className: clsx3("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
274
|
-
disabled: !hasValue || readOnly,
|
|
275
|
-
children: translation.remove
|
|
276
|
-
}
|
|
277
|
-
)
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
)
|
|
281
|
-
] });
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// src/components/properties/TextProperty.tsx
|
|
285
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
286
|
-
var defaultTextPropertyTranslation = {
|
|
287
|
-
en: {
|
|
288
|
-
value: "Text"
|
|
289
|
-
},
|
|
290
|
-
de: {
|
|
291
|
-
value: "Text"
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
var TextProperty = ({
|
|
295
|
-
overwriteTranslation,
|
|
296
|
-
value,
|
|
297
|
-
readOnly,
|
|
298
|
-
onChange = noop,
|
|
299
|
-
onRemove = noop,
|
|
300
|
-
onEditComplete = noop,
|
|
301
|
-
...baseProps
|
|
302
|
-
}) => {
|
|
303
|
-
const translation = useTranslation(defaultTextPropertyTranslation, overwriteTranslation);
|
|
304
|
-
const hasValue = value !== void 0;
|
|
305
|
-
return /* @__PURE__ */ jsx6(
|
|
306
|
-
PropertyBase,
|
|
307
|
-
{
|
|
308
|
-
...baseProps,
|
|
309
|
-
onRemove,
|
|
310
|
-
hasValue,
|
|
311
|
-
icon: /* @__PURE__ */ jsx6(Text, { size: 16 }),
|
|
312
|
-
input: ({ softRequired }) => /* @__PURE__ */ jsx6(
|
|
313
|
-
"div",
|
|
314
|
-
{
|
|
315
|
-
className: clsx4("row grow pt-2 pb-1 px-4 cursor-pointer", { "text-warning": softRequired && !hasValue }),
|
|
316
|
-
children: /* @__PURE__ */ jsx6(
|
|
317
|
-
Textarea,
|
|
318
|
-
{
|
|
319
|
-
className: clsx4("!ring-0 !border-0 !outline-0 !p-0 !m-0 !shadow-none !rounded-none", { "bg-surface-warning placeholder-warning": softRequired && !hasValue }),
|
|
320
|
-
rows: 5,
|
|
321
|
-
defaultStyle: false,
|
|
322
|
-
value: value ?? "",
|
|
323
|
-
readOnly,
|
|
324
|
-
placeholder: `${translation.value}...`,
|
|
325
|
-
onChange: (value2) => {
|
|
326
|
-
if (!value2) {
|
|
327
|
-
onRemove();
|
|
328
|
-
} else {
|
|
329
|
-
onChange(value2);
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
onEditCompleted: (value2) => {
|
|
333
|
-
if (!value2) {
|
|
334
|
-
onRemove();
|
|
335
|
-
} else {
|
|
336
|
-
onEditComplete(value2);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
)
|
|
341
|
-
}
|
|
342
|
-
)
|
|
343
|
-
}
|
|
344
|
-
);
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// src/components/examples/properties/TextPropertyExample.tsx
|
|
348
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
349
|
-
var TextPropertyExample = ({
|
|
350
|
-
value,
|
|
351
|
-
...restProps
|
|
352
|
-
}) => {
|
|
353
|
-
const [usedValue, setUsedValue] = useState5(value);
|
|
354
|
-
useEffect4(() => {
|
|
355
|
-
setUsedValue(value);
|
|
356
|
-
}, [value]);
|
|
357
|
-
return /* @__PURE__ */ jsx7(
|
|
358
|
-
TextProperty,
|
|
359
|
-
{
|
|
360
|
-
...restProps,
|
|
361
|
-
onChange: setUsedValue,
|
|
362
|
-
onRemove: () => setUsedValue(void 0),
|
|
363
|
-
value: usedValue
|
|
364
|
-
}
|
|
365
|
-
);
|
|
366
|
-
};
|
|
367
|
-
export {
|
|
368
|
-
TextPropertyExample
|
|
369
|
-
};
|
|
370
|
-
//# sourceMappingURL=TextPropertyExample.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/examples/properties/TextPropertyExample.tsx","../../../../src/components/properties/TextProperty.tsx","../../../../src/hooks/useLanguage.tsx","../../../../src/hooks/useLocalStorage.tsx","../../../../src/hooks/useTranslation.ts","../../../../src/components/user-input/Textarea.tsx","../../../../src/hooks/useSaveDelay.ts","../../../../src/util/noop.ts","../../../../src/components/user-input/Label.tsx","../../../../src/components/properties/PropertyBase.tsx","../../../../src/components/Button.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { TextPropertyProps } from '../../properties/TextProperty'\nimport { TextProperty } from '../../properties/TextProperty'\n\nexport type TextPropertyExampleProps = Omit<TextPropertyProps, 'onChange' | 'onRemove'> & {\n readOnly: boolean,\n}\n\n/**\n * Example for using the TextProperty\n */\nexport const TextPropertyExample = ({\n value,\n ...restProps\n}: TextPropertyExampleProps) => {\n const [usedValue, setUsedValue] = useState<string | undefined>(value)\n\n useEffect(() => {\n setUsedValue(value)\n }, [value])\n\n return (\n <TextProperty\n {...restProps}\n onChange={setUsedValue}\n onRemove={() => setUsedValue(undefined)}\n value={usedValue}\n />\n )\n}\n","import { Text } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Languages } from '../../hooks/useLanguage'\nimport type { PropsForTranslation } from '../../hooks/useTranslation'\nimport { useTranslation } from '../../hooks/useTranslation'\nimport { Textarea } from '../user-input/Textarea'\nimport { noop } from '../../util/noop'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype TextPropertyTranslation = {\n value: string,\n}\n\nconst defaultTextPropertyTranslation: Record<Languages, TextPropertyTranslation> = {\n en: {\n value: 'Text'\n },\n de: {\n value: 'Text'\n }\n}\n\nexport type TextPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: string,\n onChange?: (value: string) => void,\n onEditComplete?: (value: string) => void,\n}\n\n/**\n * An Input for Text properties\n */\nexport const TextProperty = ({\n overwriteTranslation,\n value,\n readOnly,\n onChange = noop,\n onRemove = noop,\n onEditComplete = noop,\n ...baseProps\n}: PropsForTranslation<TextPropertyTranslation, TextPropertyProps>) => {\n const translation = useTranslation(defaultTextPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n {...baseProps}\n onRemove={onRemove}\n hasValue={hasValue}\n icon={<Text size={16} />}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow pt-2 pb-1 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Textarea\n className={clsx('!ring-0 !border-0 !outline-0 !p-0 !m-0 !shadow-none !rounded-none', { 'bg-surface-warning placeholder-warning': softRequired && !hasValue })}\n rows={5}\n defaultStyle={false}\n value={value ?? ''}\n readOnly={readOnly}\n placeholder={`${translation.value}...`}\n onChange={(value) => {\n if (!value) {\n onRemove()\n } else {\n onChange(value)\n }\n }}\n onEditCompleted={(value) => {\n if (!value) {\n onRemove()\n } else {\n onEditComplete(value)\n }\n }}\n />\n </div>\n )}\n />\n )\n}\n","import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'\nimport { createContext, useContext, useEffect, useState } from 'react'\nimport useLocalStorage from './useLocalStorage'\n\nexport const languages = ['en', 'de'] as const\nexport type Languages = typeof languages[number]\nexport const languagesLocalNames: Record<Languages, string> = {\n en: 'English',\n de: 'Deutsch',\n}\n\nexport const DEFAULT_LANGUAGE = 'en'\n\nexport type LanguageContextValue = {\n language: Languages,\n setLanguage: Dispatch<SetStateAction<Languages>>,\n}\n\nexport const LanguageContext = createContext<LanguageContextValue>({ language: DEFAULT_LANGUAGE, setLanguage: (v) => v })\n\nexport const useLanguage = () => useContext(LanguageContext)\n\nexport const useLocale = (overWriteLanguage?: Languages) => {\n const { language } = useLanguage()\n const mapping: Record<Languages, string> = {\n en: 'en-US',\n de: 'de-DE'\n }\n return mapping[overWriteLanguage ?? language]\n}\n\ntype ProvideLanguageProps = {\n initialLanguage?: Languages,\n}\n\nexport const ProvideLanguage = ({ initialLanguage, children }: PropsWithChildren<ProvideLanguageProps>) => {\n const [language, setLanguage] = useState<Languages>(initialLanguage ?? DEFAULT_LANGUAGE)\n const [storedLanguage, setStoredLanguage] = useLocalStorage<Languages>('language', initialLanguage ?? DEFAULT_LANGUAGE)\n\n useEffect(() => {\n if(language !== initialLanguage && initialLanguage){\n console.warn('LanguageProvider initial state changed: Prefer using useLanguages\\'s setLanguage instead')\n setLanguage(initialLanguage)\n }\n }, [initialLanguage]) // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n // TODO set locale of html tag here as well\n setStoredLanguage(language)\n }, [language, setStoredLanguage])\n\n useEffect(() => {\n if (storedLanguage !== null) {\n setLanguage(storedLanguage)\n return\n }\n\n const languagesToTestAgainst = Object.values(languages)\n\n const matchingBrowserLanguages = window.navigator.languages\n .map(language => languagesToTestAgainst.find((test) => language === test || language.split('-')[0] === test))\n .filter(entry => entry !== undefined)\n\n if (matchingBrowserLanguages.length === 0) return\n\n const firstMatch = matchingBrowserLanguages[0] as Languages\n setLanguage(firstMatch)\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <LanguageContext.Provider value={{\n language,\n setLanguage\n }}>\n {children}\n </LanguageContext.Provider>\n )\n}\n","import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nconst useLocalStorage = <T, >(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(value => {\n const newValue = value instanceof Function ? value(storedValue) : value\n const storageService = new LocalStorageService()\n storageService.set(key, value)\n\n setStoredValue(newValue)\n }, [storedValue, setStoredValue, key])\n\n useEffect(() => {\n setStoredValue(get())\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return [storedValue, setValue]\n}\n\nexport default useLocalStorage\n","import type { Languages } from './useLanguage'\nimport { useLanguage } from './useLanguage'\n\nexport type Translation<T> = Record<Languages, T>\n\ntype OverwriteTranslationType<Translation extends Record<string, unknown>> = {\n language?: Languages,\n translation?: Partial<Record<Languages, Partial<Translation>>>,\n}\n\n/**\n * Adds the `language` prop to the component props.\n *\n * @param Translation the type of the translation object\n *\n * @param Props the type of the component props, defaults to `Record<string, never>`,\n * if you don't expect any other props other than `language` and get an\n * error when using your component (because it uses `forwardRef` etc.)\n * you can try out `Record<string, unknown>`, this might resolve your\n * problem as `SomeType & never` is still `never` but `SomeType & unknown`\n * is `SomeType` which means that adding back props (like `ref` etc.)\n * works properly\n */\nexport type PropsForTranslation<\n Translation extends Record<string, unknown>,\n Props = Record<string, never>\n> = Props & {\n overwriteTranslation?: OverwriteTranslationType<Translation>,\n};\n\nexport const useTranslation = <Translation extends Record<string, unknown>>(\n defaults: Record<Languages, Translation>,\n translationOverwrite: OverwriteTranslationType<Translation> = {}\n) : Translation => {\n const { language: languageProp, translation: overwrite } = translationOverwrite\n const { language: inferredLanguage } = useLanguage()\n const usedLanguage = languageProp ?? inferredLanguage\n let defaultValues: Translation = defaults[usedLanguage]\n if (overwrite && overwrite[usedLanguage]) {\n defaultValues = { ...defaultValues, ...overwrite[usedLanguage] }\n }\n return defaultValues\n}\n","import type { TextareaHTMLAttributes } from 'react'\nimport { useState } from 'react'\nimport clsx from 'clsx'\nimport useSaveDelay from '../../hooks/useSaveDelay'\nimport { noop } from '../../util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type TextareaProps = {\n /** Outside the area */\n label?: Omit<LabelProps, 'id'>,\n /** Inside the area */\n headline?: string,\n id?: string,\n resizable?: boolean,\n onChange?: (text: string) => void,\n disclaimer?: string,\n onEditCompleted?: (text: string) => void,\n defaultStyle?: boolean,\n} & Omit<TextareaHTMLAttributes<Element>, 'id' | 'onChange'>\n\n/**\n * A Textarea component for inputting longer texts\n *\n * The State is managed by the parent\n */\nexport const Textarea = ({\n label,\n headline,\n id,\n resizable = false,\n onChange = noop,\n disclaimer,\n onBlur = noop,\n onEditCompleted = noop,\n defaultStyle = true,\n className,\n ...props\n}: TextareaProps) => {\n const [hasFocus, setHasFocus] = useState(false)\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n return (\n <div className=\"w-full\">\n {label && (<Label {...label} htmlFor={id} className={clsx('mb-1', label.className)} labelType={label.labelType ?? 'labelSmall'}/>)}\n <div className={`${clsx(' bg-surface text-on-surface focus-within:border-primary relative', { 'shadow border-2 border-gray-300 hover:border-primary rounded-lg': defaultStyle })}`}>\n {headline && (\n <span className=\"mx-3 mt-3 block text-gray-700 font-bold\">\n {headline}\n </span>\n )}\n <textarea\n id={id}\n className={clsx('pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none', { 'resize-none': !resizable, 'h-32': defaultStyle, 'mt-3': !headline }, className)}\n onChange={(event) => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChange(value)\n }}\n onFocus={() => {\n setHasFocus(true)\n }}\n onBlur={(event) => {\n onBlur(event)\n onEditCompletedWrapper(event.target.value)\n setHasFocus(false)\n }}\n {...props}\n >\n </textarea>\n </div>\n {(hasFocus && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n","import { useEffect, useState } from 'react'\n\nfunction useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}\n\nexport default useSaveDelay\n","export const noop = () => undefined\n","import type { LabelHTMLAttributes } from 'react'\n\nexport type LabelType = 'labelSmall' | 'labelMedium' | 'labelBig'\nconst styleMapping: Record<LabelType, string> = {\n labelSmall: 'textstyle-label-sm',\n labelMedium: 'textstyle-label-md',\n labelBig: 'textstyle-label-lg',\n}\n\n\nexport type LabelProps = {\n /** The text for the label */\n name?: string,\n /** The styling for the label */\n labelType?: LabelType,\n} & LabelHTMLAttributes<HTMLLabelElement>\n\n/**\n * A Label component\n */\nexport const Label = ({\n children,\n name,\n labelType = 'labelSmall',\n ...props\n}: LabelProps) => {\n return (\n <label {...props}>\n {children ? children : (<span className={styleMapping[labelType]}>{name}</span>)}\n </label>\n )\n}\n","import type { ReactNode } from 'react'\nimport { AlertTriangle } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Languages } from '../../hooks/useLanguage'\nimport { TextButton } from '../Button'\nimport type { PropsForTranslation } from '../../hooks/useTranslation'\nimport { useTranslation } from '../../hooks/useTranslation'\n\ntype PropertyBaseTranslation = {\n remove: string,\n}\n\nconst defaultPropertyBaseTranslation: Record<Languages, PropertyBaseTranslation> = {\n en: {\n remove: 'Remove'\n },\n de: {\n remove: 'Entfernen'\n }\n}\n\nexport type PropertyBaseProps = {\n name: string,\n input: (props: { softRequired: boolean, hasValue: boolean }) => ReactNode,\n onRemove?: () => void,\n hasValue: boolean,\n softRequired?: boolean,\n readOnly?: boolean,\n icon?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for showing a properties with uniform styling\n */\nexport const PropertyBase = ({\n overwriteTranslation,\n name,\n input,\n softRequired = false,\n hasValue,\n icon,\n readOnly,\n onRemove,\n className = '',\n}: PropsForTranslation<PropertyBaseTranslation, PropertyBaseProps>) => {\n const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation)\n const requiredAndNoValue = softRequired && !hasValue\n return (\n <div className={clsx('row gap-x-0 group', className)}>\n <div\n className={\n clsx('row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0', {\n 'bg-gray-100 text-black group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-warning text-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {icon}\n {name}\n </div>\n <div className={\n clsx('row grow justify-between items-center rounded-r-xl border-2 border-l-0', {\n 'bg-white group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {input({ softRequired, hasValue })}\n {requiredAndNoValue && (\n <div className=\"text-warning pr-4\"><AlertTriangle size={24}/></div>\n )}\n {onRemove && (\n <TextButton\n onClick={onRemove}\n color=\"negative\"\n className={clsx('pr-4 items-center', { '!text-transparent': !hasValue || readOnly })}\n disabled={!hasValue || readOnly}\n >\n {translation.remove}\n </TextButton>\n )}\n </div>\n </div>\n )\n}\n","import type { PropsWithChildren, ButtonHTMLAttributes, ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type SolidButtonColor = 'primary' | 'secondary' | 'tertiary' | 'positive' | 'warning'| 'negative'\nexport type OutlineButtonColor = 'primary'\nexport type TextButtonColor = 'negative' | 'neutral'\n\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nexport const ButtonSizePaddings: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n}\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: SolidButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-solid-primary-icon',\n secondary: 'text-button-solid-secondary-icon',\n tertiary: 'text-button-solid-tertiary-icon',\n positive: 'text-button-solid-positive-icon',\n warning: 'text-button-solid-warning-icon',\n negative: 'text-button-solid-negative-icon',\n }[color]\n\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n className,\n {\n 'text-disabled-text bg-disabled-background': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonSizePaddings[size]\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n className, {\n 'text-disabled-text border-disabled-outline)': disabled,\n [clsx(colorClasses, 'hover:brightness-80')]: !disabled,\n },\n ButtonSizePaddings[size]\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n disabled = false,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n negative: 'bg-transparent text-button-text-negative-text',\n neutral: 'bg-transparent text-button-text-neutral-text',\n }[color]\n\n const iconColorClasses = {\n negative: 'text-button-text-negative-icon',\n neutral: 'text-button-text-neutral-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n className, {\n 'text-disabled-text': disabled,\n [clsx(colorClasses, 'hover:bg-button-text-hover-background rounded-full')]: !disabled,\n },\n ButtonSizePaddings[size]\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n// TODO Icon button\n\nexport { SolidButton, OutlineButton, TextButton }\n"],"mappings":";AAAA,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;;;ACApC,SAAS,YAAY;AACrB,OAAOC,WAAU;;;ACAjB,SAAS,eAAe,YAAY,aAAAC,YAAW,YAAAC,iBAAgB;;;ACA/D,SAAS,aAAa,WAAW,gBAAgB;;;ADqE7C;AA3DG,IAAM,mBAAmB;AAOzB,IAAM,kBAAkB,cAAoC,EAAE,UAAU,kBAAkB,aAAa,CAAC,MAAM,EAAE,CAAC;AAEjH,IAAM,cAAc,MAAM,WAAW,eAAe;;;AEUpD,IAAM,iBAAiB,CAC5B,UACA,uBAA8D,CAAC,MAC9C;AACjB,QAAM,EAAE,UAAU,cAAc,aAAa,UAAU,IAAI;AAC3D,QAAM,EAAE,UAAU,iBAAiB,IAAI,YAAY;AACnD,QAAM,eAAe,gBAAgB;AACrC,MAAI,gBAA6B,SAAS,YAAY;AACtD,MAAI,aAAa,UAAU,YAAY,GAAG;AACxC,oBAAgB,EAAE,GAAG,eAAe,GAAG,UAAU,YAAY,EAAE;AAAA,EACjE;AACA,SAAO;AACT;;;ACzCA,SAAS,YAAAC,iBAAgB;AACzB,OAAO,UAAU;;;ACFjB,SAAS,aAAAC,YAA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,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA,GAAG;AACL,MAAgC;AAC9B,QAAM,CAAC,WAAW,YAAY,IAAIC,UAA6B,KAAK;AAEpE,EAAAC,WAAU,MAAM;AACd,iBAAa,KAAK;AAAA,EACpB,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,gBAAAF;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MACV,UAAU,MAAM,aAAa,MAAS;AAAA,MACtC,OAAO;AAAA;AAAA,EACT;AAEJ;","names":["useEffect","useState","clsx","useEffect","useState","useState","useEffect","useState","jsx","jsx","useState","clsx","clsx","jsx","jsxs","jsxs","clsx","jsx","jsx","jsxs","clsx","jsx","clsx","value","jsx","useState","useEffect"]}
|