@helpwave/hightide 0.1.27 → 0.1.28
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/coloring/index.d.mts +2 -0
- package/dist/coloring/index.d.ts +2 -0
- package/dist/coloring/index.js +85 -0
- package/dist/coloring/index.js.map +1 -0
- package/dist/coloring/index.mjs +48 -0
- package/dist/coloring/index.mjs.map +1 -0
- package/dist/components/branding/index.d.mts +3 -0
- package/dist/components/branding/index.d.ts +3 -0
- package/dist/components/branding/index.js +140 -0
- package/dist/components/branding/index.js.map +1 -0
- package/dist/components/branding/index.mjs +104 -0
- package/dist/components/branding/index.mjs.map +1 -0
- package/dist/components/date/index.d.mts +10 -0
- package/dist/components/date/index.d.ts +10 -0
- package/dist/components/date/index.js +1168 -0
- package/dist/components/date/index.js.map +1 -0
- package/dist/components/date/index.mjs +1124 -0
- package/dist/components/date/index.mjs.map +1 -0
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/form/index.d.mts +5 -0
- package/dist/components/form/index.d.ts +5 -0
- package/dist/components/form/index.js +100 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/index.mjs +64 -0
- package/dist/components/form/index.mjs.map +1 -0
- package/dist/components/icons-and-geometry/index.d.mts +7 -0
- package/dist/components/icons-and-geometry/index.d.ts +7 -0
- package/dist/components/icons-and-geometry/index.js +3955 -0
- package/dist/components/icons-and-geometry/index.js.map +1 -0
- package/dist/components/icons-and-geometry/index.mjs +3939 -0
- package/dist/components/icons-and-geometry/index.mjs.map +1 -0
- package/dist/components/index.d.mts +83 -0
- package/dist/components/index.d.ts +83 -0
- package/dist/components/index.js +15471 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +15377 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/layout/index.d.mts +18 -0
- package/dist/components/layout/index.d.ts +18 -0
- package/dist/components/layout/index.js +3111 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/index.mjs +3064 -0
- package/dist/components/layout/index.mjs.map +1 -0
- package/dist/components/loading-states/index.d.mts +12 -0
- package/dist/components/loading-states/index.d.ts +12 -0
- package/dist/components/loading-states/index.js +614 -0
- package/dist/components/loading-states/index.js.map +1 -0
- package/dist/components/loading-states/index.mjs +573 -0
- package/dist/components/loading-states/index.mjs.map +1 -0
- package/dist/components/navigation/index.d.mts +9 -0
- package/dist/components/navigation/index.d.ts +9 -0
- package/dist/components/navigation/index.js +4660 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/index.mjs +4648 -0
- package/dist/components/navigation/index.mjs.map +1 -0
- package/dist/components/properties/index.d.mts +12 -0
- package/dist/components/properties/index.d.ts +12 -0
- package/dist/components/properties/index.js +2983 -0
- package/dist/components/properties/index.js.map +1 -0
- package/dist/components/properties/index.mjs +2951 -0
- package/dist/components/properties/index.mjs.map +1 -0
- package/dist/components/table/index.d.mts +10 -0
- package/dist/components/table/index.d.ts +10 -0
- package/dist/components/table/index.js +2329 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/index.mjs +2293 -0
- package/dist/components/table/index.mjs.map +1 -0
- package/dist/components/user-action/index.d.mts +30 -0
- package/dist/components/user-action/index.d.ts +30 -0
- package/dist/components/user-action/index.js +4257 -0
- package/dist/components/user-action/index.js.map +1 -0
- package/dist/components/user-action/index.mjs +4195 -0
- package/dist/components/user-action/index.mjs.map +1 -0
- package/dist/components/user-action/input/index.d.mts +6 -0
- package/dist/components/user-action/input/index.d.ts +6 -0
- package/dist/components/user-action/input/index.js +398 -0
- package/dist/components/user-action/input/index.js.map +1 -0
- package/dist/components/user-action/input/index.mjs +357 -0
- package/dist/components/user-action/input/index.mjs.map +1 -0
- package/dist/components/user-action/select/index.d.mts +4 -0
- package/dist/components/user-action/select/index.d.ts +4 -0
- package/dist/components/user-action/select/index.js +1369 -0
- package/dist/components/user-action/select/index.js.map +1 -0
- package/dist/components/user-action/select/index.mjs +1333 -0
- package/dist/components/user-action/select/index.mjs.map +1 -0
- package/dist/components/utils/index.d.mts +4 -0
- package/dist/components/utils/index.d.ts +4 -0
- package/dist/components/utils/index.js +302 -0
- package/dist/components/utils/index.js.map +1 -0
- package/dist/components/utils/index.mjs +275 -0
- package/dist/components/utils/index.mjs.map +1 -0
- package/dist/hooks/focus/index.d.mts +6 -0
- package/dist/hooks/focus/index.d.ts +6 -0
- package/dist/hooks/focus/index.js +379 -0
- package/dist/hooks/focus/index.js.map +1 -0
- package/dist/hooks/focus/index.mjs +339 -0
- package/dist/hooks/focus/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +16 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.js +844 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +794 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +16101 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +15941 -0
- package/dist/index.mjs.map +1 -0
- package/dist/localization/defaults/index.d.mts +4 -0
- package/dist/localization/defaults/index.d.ts +4 -0
- package/dist/localization/defaults/index.js +223 -0
- package/dist/localization/defaults/index.js.map +1 -0
- package/dist/localization/defaults/index.mjs +195 -0
- package/dist/localization/defaults/index.mjs.map +1 -0
- package/dist/localization/index.d.mts +7 -0
- package/dist/localization/index.d.ts +7 -0
- package/dist/localization/index.js +415 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/localization/index.mjs +380 -0
- package/dist/localization/index.mjs.map +1 -0
- package/dist/theming/index.d.mts +5 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +174 -0
- package/dist/theming/index.js.map +1 -0
- package/dist/theming/index.mjs +145 -0
- package/dist/theming/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +15 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +553 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +493 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +25 -24
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ErrorComponent, ErrorComponentProps } from './ErrorComponent.js';
|
|
2
|
+
export { LoadingAndErrorComponent, LoadingAndErrorComponentProps } from './LoadingAndErrorComponent.js';
|
|
3
|
+
export { LoadingAnimation, LoadingAnimationProps } from './LoadingAnimation.js';
|
|
4
|
+
export { LoadingButton } from './LoadingButton.js';
|
|
5
|
+
export { LoadingComponentProps, LoadingContainer } from './LoadingContainer.js';
|
|
6
|
+
export { ProgressIndicator, ProgressIndicatorProps } from './ProgressIndicator.js';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import '../../localization/useTranslation.js';
|
|
9
|
+
import '../../localization/util.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '../../localization/defaults/form.js';
|
|
12
|
+
import '../user-action/Button.js';
|
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/loading-states/index.ts
|
|
30
|
+
var loading_states_exports = {};
|
|
31
|
+
__export(loading_states_exports, {
|
|
32
|
+
ErrorComponent: () => ErrorComponent,
|
|
33
|
+
LoadingAndErrorComponent: () => LoadingAndErrorComponent,
|
|
34
|
+
LoadingAnimation: () => LoadingAnimation,
|
|
35
|
+
LoadingButton: () => LoadingButton,
|
|
36
|
+
LoadingContainer: () => LoadingContainer,
|
|
37
|
+
ProgressIndicator: () => ProgressIndicator
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(loading_states_exports);
|
|
40
|
+
|
|
41
|
+
// src/components/loading-states/ErrorComponent.tsx
|
|
42
|
+
var import_lucide_react = require("lucide-react");
|
|
43
|
+
|
|
44
|
+
// src/localization/LanguageProvider.tsx
|
|
45
|
+
var import_react2 = require("react");
|
|
46
|
+
|
|
47
|
+
// src/hooks/useLocalStorage.ts
|
|
48
|
+
var import_react = require("react");
|
|
49
|
+
|
|
50
|
+
// src/localization/util.ts
|
|
51
|
+
var languages = ["en", "de"];
|
|
52
|
+
var languagesLocalNames = {
|
|
53
|
+
en: "English",
|
|
54
|
+
de: "Deutsch"
|
|
55
|
+
};
|
|
56
|
+
var DEFAULT_LANGUAGE = "en";
|
|
57
|
+
var LanguageUtil = {
|
|
58
|
+
languages,
|
|
59
|
+
DEFAULT_LANGUAGE,
|
|
60
|
+
languagesLocalNames
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/localization/LanguageProvider.tsx
|
|
64
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
65
|
+
var LanguageContext = (0, import_react2.createContext)({
|
|
66
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
67
|
+
setLanguage: (v) => v
|
|
68
|
+
});
|
|
69
|
+
var useLanguage = () => (0, import_react2.useContext)(LanguageContext);
|
|
70
|
+
|
|
71
|
+
// src/localization/useTranslation.ts
|
|
72
|
+
var TranslationPluralCount = {
|
|
73
|
+
zero: 0,
|
|
74
|
+
one: 1,
|
|
75
|
+
two: 2,
|
|
76
|
+
few: 3,
|
|
77
|
+
many: 11,
|
|
78
|
+
other: -1
|
|
79
|
+
};
|
|
80
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
81
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
82
|
+
const { language: inferredLanguage } = useLanguage();
|
|
83
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
84
|
+
const usedTranslations = [...translations];
|
|
85
|
+
if (overwrite) {
|
|
86
|
+
usedTranslations.push(overwrite);
|
|
87
|
+
}
|
|
88
|
+
return (key, options) => {
|
|
89
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
90
|
+
try {
|
|
91
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
92
|
+
const translation = translations[i];
|
|
93
|
+
const localizedTranslation = translation[usedLanguage];
|
|
94
|
+
if (!localizedTranslation) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const value = localizedTranslation[key];
|
|
98
|
+
if (!value) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
let forProcessing;
|
|
102
|
+
if (typeof value !== "string") {
|
|
103
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
104
|
+
forProcessing = value.zero;
|
|
105
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
106
|
+
forProcessing = value.one;
|
|
107
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
108
|
+
forProcessing = value.two;
|
|
109
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
110
|
+
forProcessing = value.few;
|
|
111
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
112
|
+
forProcessing = value.many;
|
|
113
|
+
} else {
|
|
114
|
+
forProcessing = value.other;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
forProcessing = value;
|
|
118
|
+
}
|
|
119
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
120
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
121
|
+
});
|
|
122
|
+
return forProcessing;
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {
|
|
125
|
+
console.error(e);
|
|
126
|
+
}
|
|
127
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// src/components/loading-states/ErrorComponent.tsx
|
|
132
|
+
var import_clsx = __toESM(require("clsx"));
|
|
133
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
134
|
+
var defaultErrorComponentTranslation = {
|
|
135
|
+
en: {
|
|
136
|
+
errorOccurred: "An error occurred"
|
|
137
|
+
},
|
|
138
|
+
de: {
|
|
139
|
+
errorOccurred: "Ein Fehler ist aufgetreten"
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var ErrorComponent = ({
|
|
143
|
+
overwriteTranslation,
|
|
144
|
+
errorText,
|
|
145
|
+
classname
|
|
146
|
+
}) => {
|
|
147
|
+
const translation = useTranslation([defaultErrorComponentTranslation], overwriteTranslation);
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: (0, import_clsx.default)("flex-col-4 items-center justify-center w-full h-24", classname), children: [
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.AlertOctagon, { size: 64, className: "text-warning" }),
|
|
150
|
+
errorText ?? `${translation("errorOccurred")} :(`
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/components/loading-states/LoadingAndErrorComponent.tsx
|
|
155
|
+
var import_react3 = require("react");
|
|
156
|
+
|
|
157
|
+
// src/components/loading-states/LoadingContainer.tsx
|
|
158
|
+
var import_clsx2 = require("clsx");
|
|
159
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
160
|
+
var LoadingContainer = ({ className }) => {
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_clsx2.clsx)("relative overflow-hidden shimmer bg-disabled-background rounded-md", className) });
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// src/components/loading-states/LoadingAndErrorComponent.tsx
|
|
165
|
+
var import_clsx3 = require("clsx");
|
|
166
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
167
|
+
var LoadingAndErrorComponent = ({
|
|
168
|
+
children,
|
|
169
|
+
isLoading = false,
|
|
170
|
+
hasError = false,
|
|
171
|
+
loadingComponent,
|
|
172
|
+
errorComponent,
|
|
173
|
+
minimumLoadingDuration = 200,
|
|
174
|
+
className
|
|
175
|
+
}) => {
|
|
176
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = (0, import_react3.useState)(false);
|
|
177
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = (0, import_react3.useState)(false);
|
|
178
|
+
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
179
|
+
setIsInMinimumLoading(true);
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
setIsInMinimumLoading(false);
|
|
182
|
+
setHasUsedMinimumLoading(true);
|
|
183
|
+
}, minimumLoadingDuration);
|
|
184
|
+
}
|
|
185
|
+
if (isLoading || minimumLoadingDuration && isInMinimumLoading) {
|
|
186
|
+
return loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoadingContainer, { className: (0, import_clsx3.clsx)(className) });
|
|
187
|
+
}
|
|
188
|
+
if (hasError) {
|
|
189
|
+
return errorComponent ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoadingContainer, { className: (0, import_clsx3.clsx)("bg-negative", className) });
|
|
190
|
+
}
|
|
191
|
+
return children;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// src/components/loading-states/LoadingAnimation.tsx
|
|
195
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
196
|
+
|
|
197
|
+
// src/components/icons-and-geometry/HelpwaveLogo.tsx
|
|
198
|
+
var import_clsx4 = require("clsx");
|
|
199
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
200
|
+
var HelpwaveLogo = ({
|
|
201
|
+
color = "currentColor",
|
|
202
|
+
size,
|
|
203
|
+
animate = "none",
|
|
204
|
+
...props
|
|
205
|
+
}) => {
|
|
206
|
+
const isLoadingAnimation = animate === "loading";
|
|
207
|
+
let svgAnimationKey = "";
|
|
208
|
+
if (animate === "pulse") {
|
|
209
|
+
svgAnimationKey = "animate-pulse";
|
|
210
|
+
} else if (animate === "bounce") {
|
|
211
|
+
svgAnimationKey = "animate-bounce";
|
|
212
|
+
}
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
214
|
+
"svg",
|
|
215
|
+
{
|
|
216
|
+
...props,
|
|
217
|
+
viewBox: "0 0 1024 1024",
|
|
218
|
+
fill: "none",
|
|
219
|
+
strokeLinecap: "round",
|
|
220
|
+
strokeWidth: 65,
|
|
221
|
+
className: (0, import_clsx4.clsx)({
|
|
222
|
+
"max-w-16 max-h-16": size === "lg",
|
|
223
|
+
"max-w-12 max-h-12": size === "md",
|
|
224
|
+
"max-w-8 max-h-8": size === "sm"
|
|
225
|
+
}, props.className),
|
|
226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { className: (0, import_clsx4.clsx)(svgAnimationKey), children: [
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
228
|
+
"path",
|
|
229
|
+
{
|
|
230
|
+
className: (0, import_clsx4.clsx)({ "animate-wave-big-left-up": isLoadingAnimation }),
|
|
231
|
+
d: "M146 644.214C146 498.088 253.381 379.629 385.843 379.629",
|
|
232
|
+
stroke: color,
|
|
233
|
+
strokeDasharray: "1000"
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
237
|
+
"path",
|
|
238
|
+
{
|
|
239
|
+
className: (0, import_clsx4.clsx)({ "animate-wave-big-right-down": isLoadingAnimation }),
|
|
240
|
+
d: "M625.686 645.272C493.224 645.272 385.843 526.813 385.843 380.687",
|
|
241
|
+
stroke: color,
|
|
242
|
+
strokeDasharray: "1000"
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
246
|
+
"path",
|
|
247
|
+
{
|
|
248
|
+
className: (0, import_clsx4.clsx)({ "animate-wave-small-left-up": isLoadingAnimation }),
|
|
249
|
+
d: "M533.585 613.522C533.585 508.895 610.47 424.079 705.312 424.079",
|
|
250
|
+
stroke: color,
|
|
251
|
+
strokeDasharray: "1000"
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
255
|
+
"path",
|
|
256
|
+
{
|
|
257
|
+
className: (0, import_clsx4.clsx)({ "animate-wave-small-right-down": isLoadingAnimation }),
|
|
258
|
+
d: "M878 615.639C782.628 615.639 705.313 530.822 705.313 426.196",
|
|
259
|
+
stroke: color,
|
|
260
|
+
strokeDasharray: "1000"
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
] })
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/localization/defaults/form.ts
|
|
269
|
+
var formTranslation = {
|
|
270
|
+
en: {
|
|
271
|
+
add: "Add",
|
|
272
|
+
all: "All",
|
|
273
|
+
apply: "Apply",
|
|
274
|
+
back: "Back",
|
|
275
|
+
cancel: "Cancel",
|
|
276
|
+
change: "Change",
|
|
277
|
+
clear: "Clear",
|
|
278
|
+
click: "Click",
|
|
279
|
+
clickToCopy: "Click to Copy",
|
|
280
|
+
close: "Close",
|
|
281
|
+
confirm: "Confirm",
|
|
282
|
+
copy: "Copy",
|
|
283
|
+
copied: "Copied",
|
|
284
|
+
create: "Create",
|
|
285
|
+
decline: "Decline",
|
|
286
|
+
delete: "Delete",
|
|
287
|
+
discard: "Discard",
|
|
288
|
+
discardChanges: "Discard Changes",
|
|
289
|
+
done: "Done",
|
|
290
|
+
edit: "Edit",
|
|
291
|
+
enterText: "Enter text here",
|
|
292
|
+
error: "Error",
|
|
293
|
+
exit: "Exit",
|
|
294
|
+
fieldRequiredError: "This field is required.",
|
|
295
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
296
|
+
less: "Less",
|
|
297
|
+
loading: "Loading",
|
|
298
|
+
maxLengthError: "Maximum length exceeded.",
|
|
299
|
+
minLengthError: "Minimum length not met.",
|
|
300
|
+
more: "More",
|
|
301
|
+
next: "Next",
|
|
302
|
+
no: "No",
|
|
303
|
+
none: "None",
|
|
304
|
+
nothingFound: "Nothing found",
|
|
305
|
+
of: "of",
|
|
306
|
+
optional: "Optional",
|
|
307
|
+
pleaseWait: "Please wait...",
|
|
308
|
+
previous: "Previous",
|
|
309
|
+
remove: "Remove",
|
|
310
|
+
required: "Required",
|
|
311
|
+
reset: "Reset",
|
|
312
|
+
save: "Save",
|
|
313
|
+
saved: "Saved",
|
|
314
|
+
search: "Search",
|
|
315
|
+
select: "Select",
|
|
316
|
+
selectOption: "Select an option",
|
|
317
|
+
show: "Show",
|
|
318
|
+
showMore: "Show more",
|
|
319
|
+
showLess: "Show less",
|
|
320
|
+
submit: "Submit",
|
|
321
|
+
success: "Success",
|
|
322
|
+
update: "Update",
|
|
323
|
+
unsavedChanges: "Unsaved Changes",
|
|
324
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
325
|
+
yes: "Yes"
|
|
326
|
+
},
|
|
327
|
+
de: {
|
|
328
|
+
add: "Hinzuf\xFCgen",
|
|
329
|
+
all: "Alle",
|
|
330
|
+
apply: "Anwenden",
|
|
331
|
+
back: "Zur\xFCck",
|
|
332
|
+
cancel: "Abbrechen",
|
|
333
|
+
change: "\xC4ndern",
|
|
334
|
+
clear: "L\xF6schen",
|
|
335
|
+
click: "Klicken",
|
|
336
|
+
clickToCopy: "Zum kopieren klicken",
|
|
337
|
+
close: "Schlie\xDFen",
|
|
338
|
+
confirm: "Best\xE4tigen",
|
|
339
|
+
copy: "Kopieren",
|
|
340
|
+
copied: "Kopiert",
|
|
341
|
+
create: "Erstellen",
|
|
342
|
+
decline: "Ablehnen",
|
|
343
|
+
delete: "L\xF6schen",
|
|
344
|
+
discard: "Verwerfen",
|
|
345
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
346
|
+
done: "Fertig",
|
|
347
|
+
edit: "Bearbeiten",
|
|
348
|
+
enterText: "Text hier eingeben",
|
|
349
|
+
error: "Fehler",
|
|
350
|
+
exit: "Beenden",
|
|
351
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
352
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
353
|
+
less: "Weniger",
|
|
354
|
+
loading: "L\xE4dt",
|
|
355
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
356
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
357
|
+
more: "Mehr",
|
|
358
|
+
next: "Weiter",
|
|
359
|
+
no: "Nein",
|
|
360
|
+
none: "Nichts",
|
|
361
|
+
nothingFound: "Nichts gefunden",
|
|
362
|
+
of: "von",
|
|
363
|
+
optional: "Optional",
|
|
364
|
+
pleaseWait: "Bitte warten...",
|
|
365
|
+
previous: "Vorherige",
|
|
366
|
+
remove: "Entfernen",
|
|
367
|
+
required: "Erforderlich",
|
|
368
|
+
reset: "Zur\xFCcksetzen",
|
|
369
|
+
save: "Speichern",
|
|
370
|
+
saved: "Gespeichert",
|
|
371
|
+
search: "Suche",
|
|
372
|
+
select: "Select",
|
|
373
|
+
selectOption: "Option ausw\xE4hlen",
|
|
374
|
+
show: "Anzeigen",
|
|
375
|
+
showMore: "Mehr anzeigen",
|
|
376
|
+
showLess: "Weniger anzeigen",
|
|
377
|
+
submit: "Abschicken",
|
|
378
|
+
success: "Erfolg",
|
|
379
|
+
update: "Update",
|
|
380
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
381
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
382
|
+
yes: "Ja"
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// src/components/loading-states/LoadingAnimation.tsx
|
|
387
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
388
|
+
var LoadingAnimation = ({
|
|
389
|
+
overwriteTranslation,
|
|
390
|
+
loadingText,
|
|
391
|
+
classname
|
|
392
|
+
}) => {
|
|
393
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("flex-col-2 items-center justify-center w-full h-24", classname), children: [
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HelpwaveLogo, { animate: "loading" }),
|
|
396
|
+
loadingText ?? `${translation("loading")}...`
|
|
397
|
+
] });
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// src/components/loading-states/LoadingButton.tsx
|
|
401
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
402
|
+
|
|
403
|
+
// src/components/user-action/Button.tsx
|
|
404
|
+
var import_react4 = require("react");
|
|
405
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
406
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
407
|
+
var ButtonColorUtil = {
|
|
408
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
409
|
+
text: ["primary", "negative", "neutral"],
|
|
410
|
+
outline: ["primary"]
|
|
411
|
+
};
|
|
412
|
+
var IconButtonUtil = {
|
|
413
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
414
|
+
};
|
|
415
|
+
var paddingMapping = {
|
|
416
|
+
small: "btn-sm",
|
|
417
|
+
medium: "btn-md",
|
|
418
|
+
large: "btn-lg"
|
|
419
|
+
};
|
|
420
|
+
var iconPaddingMapping = {
|
|
421
|
+
tiny: "icon-btn-xs",
|
|
422
|
+
small: "icon-btn-sm",
|
|
423
|
+
medium: "icon-btn-md",
|
|
424
|
+
large: "icon-btn-lg"
|
|
425
|
+
};
|
|
426
|
+
var ButtonUtil = {
|
|
427
|
+
paddingMapping,
|
|
428
|
+
iconPaddingMapping
|
|
429
|
+
};
|
|
430
|
+
var SolidButton = (0, import_react4.forwardRef)(function SolidButton2({
|
|
431
|
+
children,
|
|
432
|
+
color = "primary",
|
|
433
|
+
size = "medium",
|
|
434
|
+
startIcon,
|
|
435
|
+
endIcon,
|
|
436
|
+
onClick,
|
|
437
|
+
className,
|
|
438
|
+
...restProps
|
|
439
|
+
}, ref) {
|
|
440
|
+
const colorClasses = {
|
|
441
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
442
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
443
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
444
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
445
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
446
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
447
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
448
|
+
}[color];
|
|
449
|
+
const iconColorClasses = {
|
|
450
|
+
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
451
|
+
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
452
|
+
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
453
|
+
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
454
|
+
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
455
|
+
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
456
|
+
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
457
|
+
}[color];
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
459
|
+
"button",
|
|
460
|
+
{
|
|
461
|
+
ref,
|
|
462
|
+
onClick,
|
|
463
|
+
className: (0, import_clsx6.default)(
|
|
464
|
+
"group font-semibold",
|
|
465
|
+
colorClasses,
|
|
466
|
+
"not-disabled:hover:brightness-90",
|
|
467
|
+
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
468
|
+
ButtonUtil.paddingMapping[size],
|
|
469
|
+
className
|
|
470
|
+
),
|
|
471
|
+
...restProps,
|
|
472
|
+
children: [
|
|
473
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
474
|
+
"span",
|
|
475
|
+
{
|
|
476
|
+
className: (0, import_clsx6.default)(
|
|
477
|
+
iconColorClasses,
|
|
478
|
+
"group-disabled:text-disabled-icon"
|
|
479
|
+
),
|
|
480
|
+
children: startIcon
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
children,
|
|
484
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
485
|
+
"span",
|
|
486
|
+
{
|
|
487
|
+
className: (0, import_clsx6.default)(
|
|
488
|
+
iconColorClasses,
|
|
489
|
+
"group-disabled:text-disabled-icon"
|
|
490
|
+
),
|
|
491
|
+
children: endIcon
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
});
|
|
498
|
+
var IconButton = (0, import_react4.forwardRef)(function IconButton2({
|
|
499
|
+
children,
|
|
500
|
+
color = "primary",
|
|
501
|
+
size = "medium",
|
|
502
|
+
className,
|
|
503
|
+
...restProps
|
|
504
|
+
}, ref) {
|
|
505
|
+
const colorClasses = {
|
|
506
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
507
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
508
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
509
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
510
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
511
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
512
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
513
|
+
transparent: "not-disabled:bg-transparent"
|
|
514
|
+
}[color];
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
516
|
+
"button",
|
|
517
|
+
{
|
|
518
|
+
ref,
|
|
519
|
+
className: (0, import_clsx6.default)(
|
|
520
|
+
colorClasses,
|
|
521
|
+
"not-disabled:hover:brightness-90",
|
|
522
|
+
"disabled:text-disabled-text",
|
|
523
|
+
{
|
|
524
|
+
"disabled:bg-disabled-background": color !== "transparent",
|
|
525
|
+
"disabled:opacity-70": color === "transparent",
|
|
526
|
+
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
527
|
+
},
|
|
528
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
529
|
+
className
|
|
530
|
+
),
|
|
531
|
+
...restProps,
|
|
532
|
+
children
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// src/utils/noop.ts
|
|
538
|
+
var noop = () => void 0;
|
|
539
|
+
|
|
540
|
+
// src/components/loading-states/LoadingButton.tsx
|
|
541
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
542
|
+
var LoadingButton = ({ isLoading = false, size = "medium", onClick, ...rest }) => {
|
|
543
|
+
const paddingClass = ButtonUtil.paddingMapping[size];
|
|
544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "inline-block relative", children: [
|
|
545
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_clsx7.default)("flex-row-2 absolute inset-0 items-center justify-center bg-white/40", paddingClass), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HelpwaveLogo, { animate: "loading", className: "text-white" }) }),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SolidButton, { ...rest, disabled: rest.disabled, onClick: isLoading ? noop : onClick })
|
|
547
|
+
] });
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// src/components/loading-states/ProgressIndicator.tsx
|
|
551
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
552
|
+
var sizeMapping = { small: 16, medium: 24, big: 48 };
|
|
553
|
+
var ProgressIndicator = ({
|
|
554
|
+
progress,
|
|
555
|
+
strokeWidth = 5,
|
|
556
|
+
size = "medium",
|
|
557
|
+
direction = "counterclockwise",
|
|
558
|
+
rotation = 0
|
|
559
|
+
}) => {
|
|
560
|
+
const currentSize = sizeMapping[size];
|
|
561
|
+
const center = currentSize / 2;
|
|
562
|
+
const radius = center - strokeWidth / 2;
|
|
563
|
+
const arcLength = 2 * Math.PI * radius;
|
|
564
|
+
const arcOffset = arcLength * progress;
|
|
565
|
+
if (direction === "clockwise") {
|
|
566
|
+
rotation += 360 * progress;
|
|
567
|
+
}
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
569
|
+
"svg",
|
|
570
|
+
{
|
|
571
|
+
style: {
|
|
572
|
+
height: `${currentSize}px`,
|
|
573
|
+
width: `${currentSize}px`,
|
|
574
|
+
transform: `rotate(${rotation}deg)`
|
|
575
|
+
},
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
578
|
+
"circle",
|
|
579
|
+
{
|
|
580
|
+
cx: center,
|
|
581
|
+
cy: center,
|
|
582
|
+
r: radius,
|
|
583
|
+
fill: "transparent",
|
|
584
|
+
strokeWidth,
|
|
585
|
+
className: "stroke-progress-indicator-fill"
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
589
|
+
"circle",
|
|
590
|
+
{
|
|
591
|
+
cx: center,
|
|
592
|
+
cy: center,
|
|
593
|
+
r: radius,
|
|
594
|
+
fill: "transparent",
|
|
595
|
+
strokeWidth,
|
|
596
|
+
strokeDasharray: arcLength,
|
|
597
|
+
strokeDashoffset: arcOffset,
|
|
598
|
+
className: "stroke-progress-indicator-background"
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
]
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
};
|
|
605
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
606
|
+
0 && (module.exports = {
|
|
607
|
+
ErrorComponent,
|
|
608
|
+
LoadingAndErrorComponent,
|
|
609
|
+
LoadingAnimation,
|
|
610
|
+
LoadingButton,
|
|
611
|
+
LoadingContainer,
|
|
612
|
+
ProgressIndicator
|
|
613
|
+
});
|
|
614
|
+
//# sourceMappingURL=index.js.map
|