@safestrong/ppa-component-library 1.9.2 → 1.9.4
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/package.json +1 -1
- package/dist/index.d.mts +0 -167
- package/dist/index.d.ts +0 -167
- package/dist/index.js +0 -791
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -747
- package/dist/index.mjs.map +0 -1
- package/dist/styles.css +0 -1688
package/dist/index.mjs
DELETED
|
@@ -1,747 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/components/Button.tsx
|
|
34
|
-
import React from "react";
|
|
35
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
36
|
-
import { faCircleNotch } from "@fortawesome/free-solid-svg-icons";
|
|
37
|
-
function Button(_a) {
|
|
38
|
-
var _b = _a, {
|
|
39
|
-
label,
|
|
40
|
-
icon,
|
|
41
|
-
isLoading,
|
|
42
|
-
btnType,
|
|
43
|
-
className
|
|
44
|
-
} = _b, rest = __objRest(_b, [
|
|
45
|
-
"label",
|
|
46
|
-
"icon",
|
|
47
|
-
"isLoading",
|
|
48
|
-
"btnType",
|
|
49
|
-
"className"
|
|
50
|
-
]);
|
|
51
|
-
const buttonIcon = isLoading ? faCircleNotch : icon;
|
|
52
|
-
const loadingLabel = label && isLoading ? "Memproses ..." : "";
|
|
53
|
-
return /* @__PURE__ */ React.createElement(
|
|
54
|
-
"button",
|
|
55
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
56
|
-
disabled: rest.disabled || isLoading,
|
|
57
|
-
className: `${!icon && "py-[0.84rem]"} ${className} ${btnType == "secondary" && "btn__secondary"} btn__primary ${label ? "" : "!p-[0.87rem]"}`
|
|
58
|
-
}),
|
|
59
|
-
buttonIcon && icon && /* @__PURE__ */ React.createElement(
|
|
60
|
-
FontAwesomeIcon,
|
|
61
|
-
{
|
|
62
|
-
icon: buttonIcon,
|
|
63
|
-
className: `text-[1.2rem] ${label && "mr-[0.3rem]"} ${isLoading && "animate-spin"}`
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
isLoading ? loadingLabel : label
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
var IconButton = (props) => {
|
|
70
|
-
return /* @__PURE__ */ React.createElement(
|
|
71
|
-
"button",
|
|
72
|
-
__spreadProps(__spreadValues({}, props), {
|
|
73
|
-
className: `${props.className} ${props.label ? "max-w-[content] px-[0.8rem]" : ""} icon__button`
|
|
74
|
-
}),
|
|
75
|
-
props.icon && /* @__PURE__ */ React.createElement(FontAwesomeIcon, { icon: props.icon }),
|
|
76
|
-
props.label && /* @__PURE__ */ React.createElement("span", { className: "inline-block ml-[0.8rem] text-[1rem]" }, props.label)
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
var IconButtonGroup = ({ list: list2 }) => {
|
|
80
|
-
return /* @__PURE__ */ React.createElement("div", { className: "icon__button_group" }, list2.map((props, idx) => /* @__PURE__ */ React.createElement("button", __spreadValues({ key: idx + 1, className: getBtnClass(idx) }, props), props.icon && /* @__PURE__ */ React.createElement(FontAwesomeIcon, { icon: props.icon }), props.isNotif && /* @__PURE__ */ React.createElement("span", { className: "btn__notif_badge" }))));
|
|
81
|
-
};
|
|
82
|
-
var SSOButton = ({ href, btnclass }) => {
|
|
83
|
-
return /* @__PURE__ */ React.createElement("a", { href, className: `sso-button ${btnclass}` }, /* @__PURE__ */ React.createElement(
|
|
84
|
-
"img",
|
|
85
|
-
{
|
|
86
|
-
alt: "logo",
|
|
87
|
-
className: "sso-icon",
|
|
88
|
-
src: "https://storage.ppa-ho.net/public/ppa-component-library/lock.png"
|
|
89
|
-
}
|
|
90
|
-
), " ", "Login dengan SSO");
|
|
91
|
-
};
|
|
92
|
-
Button.IconButton = IconButton;
|
|
93
|
-
Button.IconButtonGroup = IconButtonGroup;
|
|
94
|
-
Button.SSOButton = SSOButton;
|
|
95
|
-
function getBtnClass(idx) {
|
|
96
|
-
return `icon__button !h-[2.95rem] !rounded-[0] border-[0] relative ${idx == 0 ? "" : "border-l border-l-[var(--color-border)]"}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/components/TextInput.tsx
|
|
100
|
-
import React2 from "react";
|
|
101
|
-
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
102
|
-
var input__icon = "w-[2rem] p-[0.9rem] px-[0.7rem] text-[1.2rem] bg-[var(--color-background-icon)] text-[var(--color-icon-input)] mr-2 group-focus-within:text-[var(--color-primary)] ";
|
|
103
|
-
function TextInput(_a) {
|
|
104
|
-
var _b = _a, {
|
|
105
|
-
label,
|
|
106
|
-
labelFor,
|
|
107
|
-
icon,
|
|
108
|
-
outerclass,
|
|
109
|
-
isdarkmode,
|
|
110
|
-
inputclass
|
|
111
|
-
} = _b, attr = __objRest(_b, [
|
|
112
|
-
"label",
|
|
113
|
-
"labelFor",
|
|
114
|
-
"icon",
|
|
115
|
-
"outerclass",
|
|
116
|
-
"isdarkmode",
|
|
117
|
-
"inputclass"
|
|
118
|
-
]);
|
|
119
|
-
function getThemedClass(prefix) {
|
|
120
|
-
return `var(--color${isdarkmode ? "-dark" : ""}${prefix})`;
|
|
121
|
-
}
|
|
122
|
-
return /* @__PURE__ */ React2.createElement("div", { className: `group ${outerclass} w-full` }, label && /* @__PURE__ */ React2.createElement(
|
|
123
|
-
"label",
|
|
124
|
-
{
|
|
125
|
-
htmlFor: labelFor,
|
|
126
|
-
className: "text-input__label",
|
|
127
|
-
style: {
|
|
128
|
-
color: getThemedClass("-text-secondary")
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
label
|
|
132
|
-
), /* @__PURE__ */ React2.createElement(
|
|
133
|
-
"div",
|
|
134
|
-
{
|
|
135
|
-
className: `text-input__wrapper overflow-hidden ${attr.className}`,
|
|
136
|
-
style: {
|
|
137
|
-
borderColor: getThemedClass("-border"),
|
|
138
|
-
background: getThemedClass("-bg-surface")
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
icon && /* @__PURE__ */ React2.createElement(FontAwesomeIcon2, { icon, className: input__icon }),
|
|
142
|
-
/* @__PURE__ */ React2.createElement(
|
|
143
|
-
"input",
|
|
144
|
-
__spreadProps(__spreadValues({}, attr), {
|
|
145
|
-
className: `text-input w-full ${icon && "!pl-[0.3rem]"} ${inputclass}`,
|
|
146
|
-
style: {
|
|
147
|
-
color: getThemedClass("-text-primary")
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
)
|
|
151
|
-
));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/components/Slider.tsx
|
|
155
|
-
import React3 from "react";
|
|
156
|
-
import { faCheck } from "@fortawesome/free-solid-svg-icons";
|
|
157
|
-
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
158
|
-
function Slider(attr) {
|
|
159
|
-
return /* @__PURE__ */ React3.createElement("div", { className: "flex items-center h-[3rem]" }, /* @__PURE__ */ React3.createElement("div", { className: "slider__wrapper group relative" }, /* @__PURE__ */ React3.createElement("input", __spreadValues({ id: "slider", type: "checkbox", className: input }, attr)), /* @__PURE__ */ React3.createElement("label", { htmlFor: attr.id || "slider", className: "slider" }, /* @__PURE__ */ React3.createElement(
|
|
160
|
-
FontAwesomeIcon3,
|
|
161
|
-
{
|
|
162
|
-
icon: faCheck,
|
|
163
|
-
className: "text-[0.7rem] translate-x-[0.2px]"
|
|
164
|
-
}
|
|
165
|
-
))));
|
|
166
|
-
}
|
|
167
|
-
var input = "peer ... w-[38px] h-[20px] opacity-[0] cursor-pointer absolute";
|
|
168
|
-
|
|
169
|
-
// src/components/SingleSelect.tsx
|
|
170
|
-
import React4, { useEffect, useMemo, useState } from "react";
|
|
171
|
-
import { FontAwesomeIcon as FontAwesomeIcon4 } from "@fortawesome/react-fontawesome";
|
|
172
|
-
import { faCheck as faCheck2, faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
|
173
|
-
function SingleSelect(attr) {
|
|
174
|
-
var _b;
|
|
175
|
-
const _a = attr, { options = [], stringOptions = [], isdarkmode } = _a, attrInput = __objRest(_a, ["options", "stringOptions", "isdarkmode"]);
|
|
176
|
-
const inputValue = attrInput.value;
|
|
177
|
-
const [keyword, setKeyword] = useState("");
|
|
178
|
-
const [selected, setSelected] = useState({
|
|
179
|
-
label: "",
|
|
180
|
-
value: ""
|
|
181
|
-
});
|
|
182
|
-
function selectItem({ label, value }, e) {
|
|
183
|
-
const triggerManual = attrInput.onChange;
|
|
184
|
-
if (triggerManual) {
|
|
185
|
-
triggerManual == null ? void 0 : triggerManual({
|
|
186
|
-
target: { value, name: attrInput.name }
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
setSelected({ label, value });
|
|
190
|
-
if (attr.stateaction) {
|
|
191
|
-
if ((options == null ? void 0 : options.length) > 0) attr.stateaction({ label, value });
|
|
192
|
-
if ((stringOptions == null ? void 0 : stringOptions.length) > 0) attr.stateaction(value);
|
|
193
|
-
}
|
|
194
|
-
setKeyword("");
|
|
195
|
-
e.currentTarget.blur();
|
|
196
|
-
}
|
|
197
|
-
function autoUpdateValue(updatedValue) {
|
|
198
|
-
if (updatedValue) {
|
|
199
|
-
const filtered = availableOptions.find(
|
|
200
|
-
({ value }) => value == updatedValue
|
|
201
|
-
);
|
|
202
|
-
if (filtered) setSelected(filtered);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const availableOptions = useMemo(() => {
|
|
206
|
-
let defaultOptions = options && options.length > 0;
|
|
207
|
-
if (!defaultOptions)
|
|
208
|
-
return stringOptions.map((opt) => ({ label: opt, value: opt }));
|
|
209
|
-
return options;
|
|
210
|
-
}, [options, stringOptions]);
|
|
211
|
-
const filteredOptions = useMemo(() => {
|
|
212
|
-
return availableOptions.filter(
|
|
213
|
-
({ label, value }) => (label + "").toLowerCase().includes(keyword.toLowerCase()) || (value + "").toLowerCase().includes(keyword.toLowerCase())
|
|
214
|
-
);
|
|
215
|
-
}, [keyword, availableOptions]);
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
inputValue && autoUpdateValue(inputValue);
|
|
218
|
-
}, [inputValue]);
|
|
219
|
-
function getThemedClass(prefix) {
|
|
220
|
-
return `var(--color${isdarkmode ? "-dark" : ""}${prefix})`;
|
|
221
|
-
}
|
|
222
|
-
const placeholderClass = `${input2} select-item-placeholder-${isdarkmode ? "dark" : ""}`;
|
|
223
|
-
const optionHoverClass = `select-item-hover${isdarkmode ? "-dark" : ""}`;
|
|
224
|
-
return /* @__PURE__ */ React4.createElement("div", { className: `w-full group ${attr.outerclass}` }, attrInput.label && /* @__PURE__ */ React4.createElement(
|
|
225
|
-
"label",
|
|
226
|
-
{
|
|
227
|
-
className: "text-input__label",
|
|
228
|
-
htmlFor: attrInput.labelHtml,
|
|
229
|
-
style: { color: getThemedClass("-text-secondary") }
|
|
230
|
-
},
|
|
231
|
-
attrInput.label
|
|
232
|
-
), /* @__PURE__ */ React4.createElement(
|
|
233
|
-
"div",
|
|
234
|
-
{
|
|
235
|
-
className: `${attrInput.className} text-input__wrapper relative`,
|
|
236
|
-
style: {
|
|
237
|
-
borderColor: getThemedClass("-border"),
|
|
238
|
-
background: getThemedClass("-bg-surface")
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
/* @__PURE__ */ React4.createElement(
|
|
242
|
-
"input",
|
|
243
|
-
__spreadProps(__spreadValues(__spreadValues({
|
|
244
|
-
type: "hidden"
|
|
245
|
-
}, attrInput), attrInput.onChange ? { onChange: attrInput.onChange } : {}), {
|
|
246
|
-
value: (_b = attrInput.value) != null ? _b : selected.value
|
|
247
|
-
})
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ React4.createElement(
|
|
250
|
-
"input",
|
|
251
|
-
{
|
|
252
|
-
type: "search",
|
|
253
|
-
value: keyword,
|
|
254
|
-
autoComplete: "off",
|
|
255
|
-
onChange: (e) => setKeyword(e.target.value),
|
|
256
|
-
className: `${attrInput.name}-keyword ${placeholderClass}`,
|
|
257
|
-
placeholder: selected.value ? selected.label : attrInput.placeholder,
|
|
258
|
-
style: {
|
|
259
|
-
color: selected.value ? getThemedClass("-text-primary") : void 0
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
),
|
|
263
|
-
/* @__PURE__ */ React4.createElement(
|
|
264
|
-
"div",
|
|
265
|
-
{
|
|
266
|
-
className: "select-item__wrapper",
|
|
267
|
-
style: {
|
|
268
|
-
borderColor: getThemedClass("-border"),
|
|
269
|
-
background: getThemedClass("-bg-surface")
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
filteredOptions.length == 0 && keyword != "" && /* @__PURE__ */ React4.createElement(
|
|
273
|
-
"button",
|
|
274
|
-
{
|
|
275
|
-
disabled: true,
|
|
276
|
-
className: "select-item",
|
|
277
|
-
style: { color: "var(--color-danger)" }
|
|
278
|
-
},
|
|
279
|
-
"Tidak ada Item"
|
|
280
|
-
),
|
|
281
|
-
filteredOptions.map(({ label, value }) => /* @__PURE__ */ React4.createElement(
|
|
282
|
-
"button",
|
|
283
|
-
{
|
|
284
|
-
key: value,
|
|
285
|
-
type: "button",
|
|
286
|
-
className: `select-item ${optionHoverClass}`,
|
|
287
|
-
onClick: (e) => selectItem({ label, value }, e),
|
|
288
|
-
style: { color: getThemedClass("-text-secondary") }
|
|
289
|
-
},
|
|
290
|
-
label,
|
|
291
|
-
selected.value == value && /* @__PURE__ */ React4.createElement(
|
|
292
|
-
FontAwesomeIcon4,
|
|
293
|
-
{
|
|
294
|
-
icon: faCheck2,
|
|
295
|
-
style: { color: "var(--color-info)" }
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
))
|
|
299
|
-
),
|
|
300
|
-
/* @__PURE__ */ React4.createElement(FontAwesomeIcon4, { icon: faChevronDown, style: { color: getThemedClass("-icon-input"), paddingRight: "0.7rem" } })
|
|
301
|
-
));
|
|
302
|
-
}
|
|
303
|
-
SingleSelect.autoFill = autoFillInput;
|
|
304
|
-
function autoFillInput(value, elName, list2) {
|
|
305
|
-
const inp = document.querySelector(`[name="${elName}"]`);
|
|
306
|
-
inp.value = `${value}`;
|
|
307
|
-
const filtered = list2.find((item) => item.value == value);
|
|
308
|
-
const el = document.querySelector(`.${elName}-keyword`);
|
|
309
|
-
el == null ? void 0 : el.setAttribute("placeholder", `${filtered == null ? void 0 : filtered.label}`);
|
|
310
|
-
}
|
|
311
|
-
var input2 = "text-input peer ... w-full";
|
|
312
|
-
|
|
313
|
-
// src/components/Tooltip.tsx
|
|
314
|
-
import React5 from "react";
|
|
315
|
-
function Tooltip({
|
|
316
|
-
children,
|
|
317
|
-
text,
|
|
318
|
-
position = "top"
|
|
319
|
-
}) {
|
|
320
|
-
function getAccent() {
|
|
321
|
-
const mapping = {
|
|
322
|
-
top,
|
|
323
|
-
bottom,
|
|
324
|
-
left,
|
|
325
|
-
right
|
|
326
|
-
};
|
|
327
|
-
return mapping[position];
|
|
328
|
-
}
|
|
329
|
-
return /* @__PURE__ */ React5.createElement("div", { className: "relative" }, /* @__PURE__ */ React5.createElement("div", { className: "peer" }, children), /* @__PURE__ */ React5.createElement("span", { className: `tooltip-text ${getAccent()}` }, text));
|
|
330
|
-
}
|
|
331
|
-
var top = "bottom-full translate-y-[-0.3rem] right-0 after:bottom-0 after:translate-y-[0.25rem] ";
|
|
332
|
-
var bottom = "right-0 top-full translate-y-[0.3rem] after:top-[-0.4rem] after:translate-y-[0.2rem] ";
|
|
333
|
-
var right = "left-full w-[max-content] translate-x-[0.6rem] after:left-[-0.2rem] top-[-0.2rem] after:top-[0.6rem]";
|
|
334
|
-
var left = "right-full w-[max-content] translate-x-[-0.6rem] top-[-0.2rem] after:right-[-0.2rem] after:top-[0.6rem]";
|
|
335
|
-
|
|
336
|
-
// src/components/NavTabClient.tsx
|
|
337
|
-
import React6 from "react";
|
|
338
|
-
function NavTabClient({
|
|
339
|
-
items,
|
|
340
|
-
state
|
|
341
|
-
}) {
|
|
342
|
-
return /* @__PURE__ */ React6.createElement("nav", { className: "navtab__wrapper" }, items.map(({ label, value }) => /* @__PURE__ */ React6.createElement(
|
|
343
|
-
"button",
|
|
344
|
-
{
|
|
345
|
-
key: value,
|
|
346
|
-
className: `navtab__item ${state.active == value ? "navtab__item__active" : "hover:bg-[var(--color-border)]/50"}`,
|
|
347
|
-
onClick: () => state.setActive(value)
|
|
348
|
-
},
|
|
349
|
-
label
|
|
350
|
-
)));
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// src/components/Card.tsx
|
|
354
|
-
import React7 from "react";
|
|
355
|
-
function Card({ children, className }) {
|
|
356
|
-
return /* @__PURE__ */ React7.createElement("div", { className: `card ${className}` }, children);
|
|
357
|
-
}
|
|
358
|
-
var Footer = ({
|
|
359
|
-
className,
|
|
360
|
-
children
|
|
361
|
-
}) => {
|
|
362
|
-
return /* @__PURE__ */ React7.createElement("div", { className: `${className} border-t border-t-[var(--color-border)]` }, children);
|
|
363
|
-
};
|
|
364
|
-
Card.Footer = Footer;
|
|
365
|
-
|
|
366
|
-
// src/components/Toast.tsx
|
|
367
|
-
import React8 from "react";
|
|
368
|
-
import { FontAwesomeIcon as FontAwesomeIcon5 } from "@fortawesome/react-fontawesome";
|
|
369
|
-
import {
|
|
370
|
-
faCheckCircle,
|
|
371
|
-
faInfoCircle,
|
|
372
|
-
faQuestionCircle,
|
|
373
|
-
faXmarkCircle
|
|
374
|
-
} from "@fortawesome/free-solid-svg-icons";
|
|
375
|
-
function Toast({
|
|
376
|
-
title,
|
|
377
|
-
description,
|
|
378
|
-
type = "info",
|
|
379
|
-
className
|
|
380
|
-
}) {
|
|
381
|
-
return /* @__PURE__ */ React8.createElement("div", { className: `toast__wrapper group ${className}` }, /* @__PURE__ */ React8.createElement("div", { className: "toast__body" }, /* @__PURE__ */ React8.createElement("div", { style: { background: getColor(type) }, className: bullet }), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("p", { className: "toast__title" }, title), /* @__PURE__ */ React8.createElement("p", { className: "toast__description" }, description)), /* @__PURE__ */ React8.createElement("div", { className: `toast__icon toast__icon__${type}` })), /* @__PURE__ */ React8.createElement(
|
|
382
|
-
"p",
|
|
383
|
-
{
|
|
384
|
-
className: "toast__bar toast-bar-animate",
|
|
385
|
-
style: { background: getColor(type) }
|
|
386
|
-
}
|
|
387
|
-
));
|
|
388
|
-
}
|
|
389
|
-
var Inline = ({
|
|
390
|
-
className,
|
|
391
|
-
text,
|
|
392
|
-
type
|
|
393
|
-
}) => {
|
|
394
|
-
return /* @__PURE__ */ React8.createElement(
|
|
395
|
-
"div",
|
|
396
|
-
{
|
|
397
|
-
className: `toast__inline ${className}`,
|
|
398
|
-
style: { background: `var(--color-${type}-soft)`, opacity: 0.9 }
|
|
399
|
-
},
|
|
400
|
-
/* @__PURE__ */ React8.createElement(
|
|
401
|
-
FontAwesomeIcon5,
|
|
402
|
-
{
|
|
403
|
-
icon: getIcon(type),
|
|
404
|
-
className: "text-[1.3rem]",
|
|
405
|
-
style: { color: getColor(type) }
|
|
406
|
-
}
|
|
407
|
-
),
|
|
408
|
-
/* @__PURE__ */ React8.createElement("p", null, text)
|
|
409
|
-
);
|
|
410
|
-
};
|
|
411
|
-
Toast.Inline = Inline;
|
|
412
|
-
function getColor(type) {
|
|
413
|
-
return `var(--color-${type})`;
|
|
414
|
-
}
|
|
415
|
-
function getIcon(type) {
|
|
416
|
-
const mapping = {
|
|
417
|
-
warning: faQuestionCircle,
|
|
418
|
-
info: faInfoCircle,
|
|
419
|
-
danger: faXmarkCircle,
|
|
420
|
-
success: faCheckCircle
|
|
421
|
-
};
|
|
422
|
-
return mapping[type];
|
|
423
|
-
}
|
|
424
|
-
var bullet = "w-[2rem] h-[2rem] absolute top-[-0.7rem] left-[-0.7rem] rounded-[50%]";
|
|
425
|
-
|
|
426
|
-
// src/components/Expandable.tsx
|
|
427
|
-
import React9 from "react";
|
|
428
|
-
import { faCaretRight } from "@fortawesome/free-solid-svg-icons";
|
|
429
|
-
import { FontAwesomeIcon as FontAwesomeIcon6 } from "@fortawesome/react-fontawesome";
|
|
430
|
-
function Expandable({
|
|
431
|
-
children,
|
|
432
|
-
title,
|
|
433
|
-
className,
|
|
434
|
-
isOpen
|
|
435
|
-
}) {
|
|
436
|
-
const name = title.replace(" ", "");
|
|
437
|
-
return /* @__PURE__ */ React9.createElement("div", { className: `expandable ${className}` }, /* @__PURE__ */ React9.createElement(
|
|
438
|
-
"input",
|
|
439
|
-
{
|
|
440
|
-
id: name,
|
|
441
|
-
type: "checkbox",
|
|
442
|
-
defaultChecked: isOpen,
|
|
443
|
-
className: "opacity-[0] peer absolute top-0 ex-title"
|
|
444
|
-
}
|
|
445
|
-
), /* @__PURE__ */ React9.createElement(FontAwesomeIcon6, { icon: faCaretRight, className: "expandable__icon" }), /* @__PURE__ */ React9.createElement("label", { htmlFor: name, className: "expandable__title" }, title), /* @__PURE__ */ React9.createElement("div", { className: "expandable__body" }, /* @__PURE__ */ React9.createElement("div", { className: "p-[0.75rem] px-[1rem]" }, children)));
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
// src/components/MultiSelect.tsx
|
|
449
|
-
import React10, { useCallback, useMemo as useMemo2, useState as useState2 } from "react";
|
|
450
|
-
import { FontAwesomeIcon as FontAwesomeIcon7 } from "@fortawesome/react-fontawesome";
|
|
451
|
-
import { faCheck as faCheck3, faListCheck } from "@fortawesome/free-solid-svg-icons";
|
|
452
|
-
function MultiSelect(_a) {
|
|
453
|
-
var _b = _a, {
|
|
454
|
-
state,
|
|
455
|
-
label,
|
|
456
|
-
labelHtml
|
|
457
|
-
} = _b, attr = __objRest(_b, [
|
|
458
|
-
"state",
|
|
459
|
-
"label",
|
|
460
|
-
"labelHtml"
|
|
461
|
-
]);
|
|
462
|
-
const { options = [], stringOptions = [], isdarkmode } = attr;
|
|
463
|
-
const [keyword, setKeyword] = useState2("");
|
|
464
|
-
const optionHoverClass = `select-item-hover${isdarkmode ? "-dark" : ""}`;
|
|
465
|
-
const placeholderClass = `${input3} select-item-placeholder-${isdarkmode ? "dark" : ""}`;
|
|
466
|
-
const availableOptions = useMemo2(() => {
|
|
467
|
-
const isDefaultOption = options && options.length > 0;
|
|
468
|
-
if (!isDefaultOption)
|
|
469
|
-
return stringOptions.map((opt) => ({ label: opt, value: opt }));
|
|
470
|
-
return options;
|
|
471
|
-
}, [options, stringOptions]);
|
|
472
|
-
function getFiltered() {
|
|
473
|
-
return availableOptions.filter(
|
|
474
|
-
({ label: label2, value }) => (label2 + "").toLowerCase().includes(keyword.toLowerCase()) || (value + "").toLowerCase().includes(keyword.toLowerCase())
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
function selectItem({ label: label2, value }) {
|
|
478
|
-
state.select((prev) => {
|
|
479
|
-
const isItemExist2 = prev.find((item) => item.value == value);
|
|
480
|
-
if (isItemExist2) {
|
|
481
|
-
return prev.filter((item) => item.value != value);
|
|
482
|
-
}
|
|
483
|
-
return [...prev, { label: label2, value }];
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
function isItemExist(value) {
|
|
487
|
-
return state.value.find((item) => item.value == value);
|
|
488
|
-
}
|
|
489
|
-
const selectUnSelectAll = useCallback(() => {
|
|
490
|
-
const isAllSelected = state.value.length == availableOptions.length;
|
|
491
|
-
state.select(isAllSelected ? [] : availableOptions);
|
|
492
|
-
}, [state.value]);
|
|
493
|
-
function getThemedClass(prefix) {
|
|
494
|
-
return `var(--color${isdarkmode ? "-dark" : ""}${prefix})`;
|
|
495
|
-
}
|
|
496
|
-
return /* @__PURE__ */ React10.createElement("div", { className: `group w-full ${attr.outerclass}` }, label && /* @__PURE__ */ React10.createElement(
|
|
497
|
-
"label",
|
|
498
|
-
{
|
|
499
|
-
htmlFor: labelHtml,
|
|
500
|
-
className: "text-input__label",
|
|
501
|
-
style: { color: getThemedClass("-text-secondary") }
|
|
502
|
-
},
|
|
503
|
-
label
|
|
504
|
-
), /* @__PURE__ */ React10.createElement(
|
|
505
|
-
"div",
|
|
506
|
-
{
|
|
507
|
-
className: "text-input__wrapper relative",
|
|
508
|
-
style: {
|
|
509
|
-
borderColor: getThemedClass("-border"),
|
|
510
|
-
background: getThemedClass("-bg-surface")
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
/* @__PURE__ */ React10.createElement(
|
|
514
|
-
"input",
|
|
515
|
-
{
|
|
516
|
-
type: "search",
|
|
517
|
-
value: keyword,
|
|
518
|
-
autoComplete: "off",
|
|
519
|
-
className: `${input3} ${placeholderClass}`,
|
|
520
|
-
onChange: (e) => setKeyword(e.target.value),
|
|
521
|
-
placeholder: `${state.value.length} Dipilih`,
|
|
522
|
-
style: {
|
|
523
|
-
color: state.value.length > 0 ? getThemedClass("-text-primary") : void 0
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
),
|
|
527
|
-
/* @__PURE__ */ React10.createElement(
|
|
528
|
-
"div",
|
|
529
|
-
{
|
|
530
|
-
className: "select-item__wrapper select-multiple__wrapper",
|
|
531
|
-
style: {
|
|
532
|
-
borderColor: getThemedClass("-border"),
|
|
533
|
-
background: getThemedClass("-bg-surface")
|
|
534
|
-
}
|
|
535
|
-
},
|
|
536
|
-
getFiltered().length == 0 && keyword != "" && /* @__PURE__ */ React10.createElement(
|
|
537
|
-
"button",
|
|
538
|
-
{
|
|
539
|
-
disabled: true,
|
|
540
|
-
className: "select-item",
|
|
541
|
-
style: { color: "var(--color-danger)" }
|
|
542
|
-
},
|
|
543
|
-
"Tidak ada Item"
|
|
544
|
-
),
|
|
545
|
-
getFiltered().map(({ label: label2, value }) => /* @__PURE__ */ React10.createElement(
|
|
546
|
-
"button",
|
|
547
|
-
{
|
|
548
|
-
key: value,
|
|
549
|
-
type: "button",
|
|
550
|
-
onClick: () => selectItem({ label: label2, value }),
|
|
551
|
-
className: `select-item ${optionHoverClass}`,
|
|
552
|
-
style: { color: getThemedClass("-text-secondary") }
|
|
553
|
-
},
|
|
554
|
-
label2,
|
|
555
|
-
isItemExist(value) && /* @__PURE__ */ React10.createElement(
|
|
556
|
-
FontAwesomeIcon7,
|
|
557
|
-
{
|
|
558
|
-
icon: faCheck3,
|
|
559
|
-
style: { color: "var(--color-info)" }
|
|
560
|
-
}
|
|
561
|
-
)
|
|
562
|
-
))
|
|
563
|
-
),
|
|
564
|
-
/* @__PURE__ */ React10.createElement(
|
|
565
|
-
"button",
|
|
566
|
-
{
|
|
567
|
-
type: "button",
|
|
568
|
-
className: "cursor-pointer",
|
|
569
|
-
onClick: selectUnSelectAll
|
|
570
|
-
},
|
|
571
|
-
/* @__PURE__ */ React10.createElement(
|
|
572
|
-
FontAwesomeIcon7,
|
|
573
|
-
{
|
|
574
|
-
icon: faListCheck,
|
|
575
|
-
style: {
|
|
576
|
-
color: getThemedClass("-icon-input"),
|
|
577
|
-
paddingRight: "0.7rem",
|
|
578
|
-
fontSize: "1.2rem"
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
)
|
|
583
|
-
));
|
|
584
|
-
}
|
|
585
|
-
var input3 = "text-input peer ... w-full";
|
|
586
|
-
|
|
587
|
-
// src/components/ThemeToggle.tsx
|
|
588
|
-
import React11 from "react";
|
|
589
|
-
function ThemeToggle(attr) {
|
|
590
|
-
return /* @__PURE__ */ React11.createElement("div", { className: "flex items-center h-[3rem]" }, /* @__PURE__ */ React11.createElement(
|
|
591
|
-
"label",
|
|
592
|
-
{
|
|
593
|
-
htmlFor: `${attr.id || "theme-toggle"}`,
|
|
594
|
-
className: "slider__wrapper slider-theme slider-theme-light relative"
|
|
595
|
-
},
|
|
596
|
-
/* @__PURE__ */ React11.createElement(
|
|
597
|
-
"input",
|
|
598
|
-
__spreadProps(__spreadValues({
|
|
599
|
-
id: "theme-toggle"
|
|
600
|
-
}, attr), {
|
|
601
|
-
type: "checkbox",
|
|
602
|
-
className: "peer ... w-[38px] h-[20px] opacity-[0] cursor-pointer absolute"
|
|
603
|
-
})
|
|
604
|
-
),
|
|
605
|
-
/* @__PURE__ */ React11.createElement("span", { className: "slider-theme__bullet" })
|
|
606
|
-
));
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// src/components/Dashboard.tsx
|
|
610
|
-
import React12, { useState as useState3 } from "react";
|
|
611
|
-
var list = [
|
|
612
|
-
{ label: "Option 1", value: "option1" },
|
|
613
|
-
{ label: "Option 2", value: "option2" },
|
|
614
|
-
{ label: "Option 3", value: "option3" }
|
|
615
|
-
];
|
|
616
|
-
var stringList = ["option1", "option2", "option3"];
|
|
617
|
-
function Dashboard() {
|
|
618
|
-
const [selectedItem, setSelectedItem] = useState3([]);
|
|
619
|
-
const [sel, setSel] = useState3({ label: "", value: "" });
|
|
620
|
-
function updateState(item) {
|
|
621
|
-
const filtered = list.find(({ value }) => value == item);
|
|
622
|
-
filtered && setSel(filtered);
|
|
623
|
-
}
|
|
624
|
-
return /* @__PURE__ */ React12.createElement("div", { className: "flex items-center gap-[1rem]" }, /* @__PURE__ */ React12.createElement(
|
|
625
|
-
MultiSelect,
|
|
626
|
-
{
|
|
627
|
-
isdarkmode: true,
|
|
628
|
-
label: "Multi Select",
|
|
629
|
-
stringOptions: stringList,
|
|
630
|
-
state: { value: selectedItem, select: setSelectedItem }
|
|
631
|
-
}
|
|
632
|
-
), /* @__PURE__ */ React12.createElement(
|
|
633
|
-
SingleSelect,
|
|
634
|
-
{
|
|
635
|
-
label: "Single Select",
|
|
636
|
-
name: "newinput",
|
|
637
|
-
stringOptions: stringList,
|
|
638
|
-
placeholder: "-- Pilih Status --",
|
|
639
|
-
value: sel.value
|
|
640
|
-
}
|
|
641
|
-
));
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// src/components/Badge.tsx
|
|
645
|
-
import React13 from "react";
|
|
646
|
-
function Badge({
|
|
647
|
-
text,
|
|
648
|
-
type,
|
|
649
|
-
className
|
|
650
|
-
}) {
|
|
651
|
-
return /* @__PURE__ */ React13.createElement("div", { className: "badge__wrapper" }, /* @__PURE__ */ React13.createElement(
|
|
652
|
-
"span",
|
|
653
|
-
{
|
|
654
|
-
style: {
|
|
655
|
-
background: `var(--color-${type})`
|
|
656
|
-
},
|
|
657
|
-
className: `badge ${className}`
|
|
658
|
-
},
|
|
659
|
-
text
|
|
660
|
-
));
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
// src/components/Skeleton.tsx
|
|
664
|
-
import React14 from "react";
|
|
665
|
-
function Skeleton({ className }) {
|
|
666
|
-
return /* @__PURE__ */ React14.createElement("div", { className: `${className} skeleton` }, /* @__PURE__ */ React14.createElement("span", { className: "skeleton__item skeleton-slide" }));
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
// src/components/Navigation.tsx
|
|
670
|
-
import React15 from "react";
|
|
671
|
-
function Navigation() {
|
|
672
|
-
return /* @__PURE__ */ React15.createElement("nav", null);
|
|
673
|
-
}
|
|
674
|
-
var URLNavigation = (props) => {
|
|
675
|
-
const Component = props.CustomComponent || "a";
|
|
676
|
-
function getAnchorClass(href) {
|
|
677
|
-
return href === props.activeUrl ? "bg-[var(--color-primary-soft)] text-[var(--color-primary)]" : "text-[var(--color-text-secondary)]/70 hover:bg-[var(--color-border)]/40";
|
|
678
|
-
}
|
|
679
|
-
return /* @__PURE__ */ React15.createElement("nav", { className: `nav__wrapper ${props.outerclass}` }, props.list.map((prop) => /* @__PURE__ */ React15.createElement(
|
|
680
|
-
Component,
|
|
681
|
-
__spreadValues({
|
|
682
|
-
key: prop.href,
|
|
683
|
-
className: `${base__anchor} ${getAnchorClass(prop.href)}`
|
|
684
|
-
}, prop),
|
|
685
|
-
prop.label
|
|
686
|
-
)));
|
|
687
|
-
};
|
|
688
|
-
Navigation.URL = URLNavigation;
|
|
689
|
-
var base__anchor = "p-[0.8rem] h-full grid items-center transition-all leading-[1] px-[1.2rem] rounded-[0.4rem]";
|
|
690
|
-
|
|
691
|
-
// src/components/Confirmation.tsx
|
|
692
|
-
import React16 from "react";
|
|
693
|
-
function Confirmation({
|
|
694
|
-
type = "warning",
|
|
695
|
-
text,
|
|
696
|
-
title,
|
|
697
|
-
secondaryAction,
|
|
698
|
-
secondaryLabel = "Tidak",
|
|
699
|
-
mainAction,
|
|
700
|
-
mainLabel = "Ya"
|
|
701
|
-
}) {
|
|
702
|
-
return /* @__PURE__ */ React16.createElement("div", { className: "confirmation__outer" }, /* @__PURE__ */ React16.createElement("div", { className: "confirmation__card" }, /* @__PURE__ */ React16.createElement("div", { className: wrapper }, /* @__PURE__ */ React16.createElement("div", { className: `baloon__${type} baloon` }), /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement("h3", { className: "font-semibold" }, title), /* @__PURE__ */ React16.createElement("p", { className: confirmation__text }, text))), /* @__PURE__ */ React16.createElement("div", { className: "confirmation__footer" }, secondaryAction && /* @__PURE__ */ React16.createElement(
|
|
703
|
-
"button",
|
|
704
|
-
{
|
|
705
|
-
onClick: secondaryAction,
|
|
706
|
-
type: "button",
|
|
707
|
-
className: "cursor-pointer",
|
|
708
|
-
style: { color: `var(--color-${type})` }
|
|
709
|
-
},
|
|
710
|
-
secondaryLabel
|
|
711
|
-
), /* @__PURE__ */ React16.createElement(
|
|
712
|
-
"button",
|
|
713
|
-
{
|
|
714
|
-
onClick: () => {
|
|
715
|
-
mainAction();
|
|
716
|
-
secondaryAction && secondaryAction();
|
|
717
|
-
},
|
|
718
|
-
className: "cursor-pointer btn__primary min-w-[8rem]",
|
|
719
|
-
style: {
|
|
720
|
-
background: `var(--color-${type})`,
|
|
721
|
-
border: `1px solid var(--color-${type})`
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
mainLabel
|
|
725
|
-
))));
|
|
726
|
-
}
|
|
727
|
-
var wrapper = "pt-[0.5rem] pb-[1rem] px-[1.8rem] grid items-center gap-[1.5rem]";
|
|
728
|
-
var confirmation__text = "mt-[0.7rem] w-[90%] text-[var(--color-text-secondary)]";
|
|
729
|
-
export {
|
|
730
|
-
Badge,
|
|
731
|
-
Button,
|
|
732
|
-
Card,
|
|
733
|
-
Confirmation,
|
|
734
|
-
Dashboard,
|
|
735
|
-
Expandable,
|
|
736
|
-
MultiSelect,
|
|
737
|
-
NavTabClient,
|
|
738
|
-
Navigation,
|
|
739
|
-
SingleSelect,
|
|
740
|
-
Skeleton,
|
|
741
|
-
Slider,
|
|
742
|
-
TextInput,
|
|
743
|
-
ThemeToggle,
|
|
744
|
-
Toast,
|
|
745
|
-
Tooltip
|
|
746
|
-
};
|
|
747
|
-
//# sourceMappingURL=index.mjs.map
|