@houssemdi2000/design-system 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.d.ts +16 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +6 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +18 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +9 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +6 -0
- package/dist/components/Button/Button.stories.d.ts +1 -0
- package/dist/components/Carousel/SmartCarousel.d.ts +17 -0
- package/dist/components/Carousel/SmartCarousel.stories.d.ts +6 -0
- package/dist/components/Carousel/index.d.ts +1 -0
- package/dist/components/Colors/Colors.d.ts +182 -0
- package/dist/components/Colors/index.d.ts +1 -0
- package/dist/components/DragDrop/DragDrop.d.ts +16 -0
- package/dist/components/DragDrop/DragDrop.stories.d.ts +7 -0
- package/dist/components/DragDrop/index.d.ts +1 -0
- package/dist/components/Footer/Footer.d.ts +21 -0
- package/dist/components/Footer/Footer.stories.d.ts +6 -0
- package/dist/components/Footer/index.d.ts +1 -0
- package/dist/components/Form/Form.d.ts +35 -0
- package/dist/components/Form/Form.stories.d.ts +6 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +18 -0
- package/dist/components/Input/Input.stories.d.ts +9 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Layout/Layout.d.ts +14 -0
- package/dist/components/Layout/Layout.stories.d.ts +7 -0
- package/dist/components/Layout/index.d.ts +1 -0
- package/dist/components/Loading/Loading.d.ts +14 -0
- package/dist/components/Loading/Loading.stories.d.ts +10 -0
- package/dist/components/Loading/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +12 -0
- package/dist/components/Modal/Modal.stories.d.ts +7 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Navbar/Navbar.d.ts +25 -0
- package/dist/components/Navbar/Navbar.stories.d.ts +6 -0
- package/dist/components/Navbar/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +12 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +8 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/ProfileMenu/ProfileMenu.d.ts +20 -0
- package/dist/components/ProfileMenu/ProfileMenu.stories.d.ts +6 -0
- package/dist/components/ProfileMenu/index.d.ts +1 -0
- package/dist/components/QuicklyLogin/QuicklyLogin.d.ts +17 -0
- package/dist/components/QuicklyLogin/QuicklyLogin.stories.d.ts +6 -0
- package/dist/components/SecureText/SecureText.d.ts +14 -0
- package/dist/components/SecureText/SecureText.stories.d.ts +8 -0
- package/dist/components/SecureText/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.d.ts +22 -0
- package/dist/components/Sidebar/Sidebar.stories.d.ts +6 -0
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/Slider/SmartSlider.d.ts +17 -0
- package/dist/components/Slider/SmartSlider.stories.d.ts +7 -0
- package/dist/components/Table/SmartTable.d.ts +23 -0
- package/dist/components/Table/SmartTable.stories.d.ts +10 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/TableFilterBar/TableFilterBar.d.ts +42 -0
- package/dist/components/TableFilterBar/TableFilterBar.stories.d.ts +7 -0
- package/dist/components/TableFilterBar/index.d.ts +1 -0
- package/dist/components/Tag/Tag.d.ts +13 -0
- package/dist/components/Tag/Tag.stories.d.ts +7 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Text/Text.d.ts +18 -0
- package/dist/components/Text/Text.stories.d.ts +8 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/Theme/ThemeContext.d.ts +12 -0
- package/dist/components/Theme/index.d.ts +2 -0
- package/dist/components/Theme/types.d.ts +7 -0
- package/dist/components/TimeLine/SmartTimeLine.d.ts +22 -0
- package/dist/components/TimeLine/SmartTimeLine.stories.d.ts +6 -0
- package/dist/components/TimeLine/index.d.ts +1 -0
- package/dist/components/Toast/ToastContext.d.ts +2 -1
- package/dist/components/index.d.ts +18 -0
- package/dist/index.esm.js +513 -43
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +534 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var
|
|
4
|
+
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function styleInject(css, ref) {
|
|
7
7
|
if ( ref === void 0 ) ref = {};
|
|
@@ -30,29 +30,29 @@ function styleInject(css, ref) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var css_248z$
|
|
34
|
-
styleInject(css_248z$
|
|
33
|
+
var css_248z$s = ".btn{align-items:center;border:none;border-radius:4px;cursor:pointer;display:inline-flex;font-size:16px;font-weight:500;justify-content:center;padding:10px 20px;transition:all .3s ease}.btn-primary{background-color:#007bff;color:#fff}.btn-primary:hover{background-color:#0056b3}.btn-secondary{background-color:#6c757d;color:#fff}.btn-danger{background-color:#dc3545;color:#fff}.btn-dark{background-color:#141617;color:#fff}.btn-light{background-color:#f8f9fa;color:#000}.btn-small{font-size:14px;padding:5px 10px}.btn-medium{font-size:16px;padding:10px 20px}.btn-large{font-size:18px;padding:15px 30px}.btn:disabled{cursor:not-allowed;opacity:.5}.btn-left-icon{margin-right:8px}.btn-left-icon,.btn-right-icon{align-items:center;display:inline-flex}.btn-right-icon{margin-left:8px}.btn-spinner{animation:spin .7s linear infinite;border:3px solid hsla(0,0%,100%,.4);border-radius:50%;border-top-color:#fff;display:inline-block;height:12px;margin-left:5px;width:12px}@keyframes spin{to{transform:rotate(1turn)}}.btn-loading{cursor:not-allowed;position:relative}.btn-loading span,.btn-loading svg{opacity:0}.btn-loading>:not(.btn-spinner){visibility:hidden}";
|
|
34
|
+
styleInject(css_248z$s);
|
|
35
35
|
|
|
36
|
-
const Button = ({ label, onClick, variant = "primary", size = "medium", disabled = false, icon, iconPosition = "left", backgroundColor, color, isLoading = false, }) => {
|
|
37
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("button", { className: `btn btn-${variant} btn-${size}`, onClick: onClick, disabled: disabled || isLoading, style: { backgroundColor, color }, children: [icon && iconPosition === "left" && jsxRuntime.jsx("span", { className: "btn-left-icon", children: icon }), label, icon && iconPosition === "right" && jsxRuntime.jsx("span", { className: "btn-right-icon", children: icon }), isLoading && jsxRuntime.jsx("span", { className: "btn-spinner" })] }) }));
|
|
36
|
+
const Button = ({ label, onClick, type = "button", variant = "primary", size = "medium", disabled = false, icon, iconPosition = "left", backgroundColor, color, isLoading = false, mt, mb, mr, ml, style = {} }) => {
|
|
37
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("button", { className: `btn btn-${variant} btn-${size}`, onClick: onClick, type: type, disabled: disabled || isLoading, style: Object.assign(Object.assign({}, style), { backgroundColor, color, marginTop: mt, marginBottom: mb, marginRight: mr, marginLeft: ml }), children: [icon && iconPosition === "left" && jsxRuntime.jsx("span", { className: "btn-left-icon", children: icon }), label, icon && iconPosition === "right" && jsxRuntime.jsx("span", { className: "btn-right-icon", children: icon }), isLoading && jsxRuntime.jsx("span", { className: "btn-spinner" })] }) }));
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var css_248z$
|
|
41
|
-
styleInject(css_248z$
|
|
40
|
+
var css_248z$r = ".center{align-items:center;display:flex;justify-content:center}";
|
|
41
|
+
styleInject(css_248z$r);
|
|
42
42
|
|
|
43
43
|
const Center = ({ children, backgroundColor = 'white', color = 'black' }) => {
|
|
44
44
|
return jsxRuntime.jsx("div", { className: "center", style: { backgroundColor, color }, children: children });
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
var css_248z$
|
|
48
|
-
styleInject(css_248z$
|
|
47
|
+
var css_248z$q = ".card{background:#fff;border-radius:12px;display:flex;flex-direction:column;gap:12px;transition:box-shadow .2s ease,transform .2s ease}.card-elevated{box-shadow:0 2px 4px rgba(0,0,0,.08),0 8px 16px rgba(0,0,0,.06)}.card-elevated:hover{box-shadow:0 4px 8px rgba(0,0,0,.1),0 12px 24px rgba(0,0,0,.08);transform:translateY(-2px)}.card-outlined{border:1px solid #e5e7eb}.card-flat{background:transparent;border:none}.card-padding-sm{padding:8px}.card-padding-md{padding:16px}.card-padding-lg{padding:24px}.card-header{font-size:1.25rem;font-weight:600;margin-bottom:4px}.card-body{font-size:.95rem;line-height:1.5}.card-footer{border-top:1px solid #ececec;color:#555;font-size:.9rem;margin-top:8px;padding-top:8px}";
|
|
48
|
+
styleInject(css_248z$q);
|
|
49
49
|
|
|
50
50
|
const Card = ({ title, children, footer, backgroundColor, color, variant = "elevated", padding = "md", }) => {
|
|
51
51
|
return (jsxRuntime.jsxs("div", { className: `card card-${variant} card-padding-${padding}`, style: { backgroundColor, color }, children: [title && jsxRuntime.jsx("div", { className: "card-header", children: title }), jsxRuntime.jsx("div", { className: "card-body", children: children }), footer && jsxRuntime.jsx("div", { className: "card-footer", children: footer })] }));
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
var css_248z$
|
|
55
|
-
styleInject(css_248z$
|
|
54
|
+
var css_248z$p = ".bloc{box-sizing:border-box;max-width:100%;padding:16px;width:100%}@media (max-width:600px){.bloc{border-radius:6px;padding:12px}}@media (max-width:900px){.bloc{padding:14px}}";
|
|
55
|
+
styleInject(css_248z$p);
|
|
56
56
|
|
|
57
57
|
const Bloc = ({ children, className = "", style = {}, layout = "default", }) => {
|
|
58
58
|
const layoutStyles = (() => {
|
|
@@ -76,22 +76,22 @@ const Bloc = ({ children, className = "", style = {}, layout = "default", }) =>
|
|
|
76
76
|
return (jsxRuntime.jsx("div", { className: `bloc ${className}`, style: Object.assign(Object.assign({}, layoutStyles), style), children: children }));
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
var css_248z$
|
|
80
|
-
styleInject(css_248z$
|
|
79
|
+
var css_248z$o = ".container{margin:0 auto;padding:0 16px;width:100%}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1200px}}.container-fluid{max-width:100%}";
|
|
80
|
+
styleInject(css_248z$o);
|
|
81
81
|
|
|
82
82
|
const Container = ({ children, className = "", style = {}, fluid = false }) => {
|
|
83
83
|
return (jsxRuntime.jsx("div", { className: `container ${fluid ? "container-fluid" : ""} ${className}`, style: style, children: children }));
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
var css_248z$
|
|
87
|
-
styleInject(css_248z$
|
|
86
|
+
var css_248z$n = ".row{align-items:stretch;box-sizing:border-box;display:flex;flex-direction:row;gap:16px}@media (max-width:768px){.row{flex-direction:column}}";
|
|
87
|
+
styleInject(css_248z$n);
|
|
88
88
|
|
|
89
89
|
const Row = ({ children, className = "", style = {} }) => {
|
|
90
90
|
return jsxRuntime.jsx("div", { className: `row ${className}`, style: Object.assign({}, style), children: children });
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
var css_248z$
|
|
94
|
-
styleInject(css_248z$
|
|
93
|
+
var css_248z$m = ".col,.column{box-sizing:border-box;flex:1 1 0;min-width:0;padding:8px}.col.small{max-width:20%}.col.medium{max-width:50%}.col.large{max-width:100%}.col>*,.column>*{box-sizing:border-box;max-width:100%;overflow-wrap:anywhere;word-break:break-word}.col img,.column img{display:block;height:auto;max-width:100%}@media (max-width:768px){.col,.col.large,.col.medium,.col.small,.column{flex:none;max-width:100%;width:100%}}";
|
|
94
|
+
styleInject(css_248z$m);
|
|
95
95
|
|
|
96
96
|
const Column = ({ children, className = "", style = {} }) => {
|
|
97
97
|
return (jsxRuntime.jsx("div", { className: `col ${className}`, style: Object.assign({}, style), children: children }));
|
|
@@ -125,8 +125,8 @@ const Divider = ({ color = "#e0e0e0", thickness = 1, orientation = "horizontal",
|
|
|
125
125
|
return jsxRuntime.jsx("div", { style: styles });
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
var css_248z$
|
|
129
|
-
styleInject(css_248z$
|
|
128
|
+
var css_248z$l = ".checkbox-container{align-items:center;cursor:pointer;display:flex;font-family:sans-serif;gap:8px;user-select:none}.checkbox-container.disabled{cursor:not-allowed;opacity:.5}.checkbox-container input{appearance:none;-webkit-appearance:none;height:0;position:absolute;width:0}.checkbox-box{border:2px solid var(--cb-box-color,#777);border-radius:4px;display:inline-block;height:18px;position:relative;transition:.2s ease;width:18px}.checkbox-container input:checked+.checkbox-box{background-color:var(--cb-checked-bg,#007bff);border-color:var(--cb-checked-bg,#007bff)}.checkbox-container input:checked+.checkbox-box:after{border-width:medium;border-bottom:2px solid var(--cb-check-color,#fff);border-left:0 solid var(--cb-check-color,#fff);border-right:2px solid var(--cb-check-color,#fff);border-top:0 solid var(--cb-check-color,#fff);content:\"\";height:10px;left:5px;position:absolute;top:1px;transform:rotate(45deg);width:5px}.checkbox-container input:focus+.checkbox-box{box-shadow:0 0 4px var(--cb-focus-shadow,rgba(0,123,255,.4))}.checkbox-box.error{border-color:#d93025!important}.checkbox-label{font-size:14px}";
|
|
129
|
+
styleInject(css_248z$l);
|
|
130
130
|
|
|
131
131
|
const Checkbox = ({ label, checked, onChange, disabled = false, error = false, boxColor = "#777", checkColor = "#fff", checkedBackground = "#007bff", focusShadow = "rgba(0, 123, 255, 0.4)", style, }) => {
|
|
132
132
|
return (jsxRuntime.jsxs("label", { className: `checkbox-container ${disabled ? "disabled" : ""}`, style: {
|
|
@@ -137,64 +137,535 @@ const Checkbox = ({ label, checked, onChange, disabled = false, error = false, b
|
|
|
137
137
|
}, children: [jsxRuntime.jsx("input", { type: "checkbox", checked: checked, disabled: disabled, onChange: (e) => onChange(e.target.checked) }), jsxRuntime.jsx("span", { className: `checkbox-box ${error ? "error" : ""}` }), label && jsxRuntime.jsx("span", { className: "checkbox-label", children: label })] }));
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
var css_248z$
|
|
141
|
-
styleInject(css_248z$
|
|
140
|
+
var css_248z$k = ".textfield{display:flex;flex-direction:column;font-family:sans-serif;gap:6px}.fullWidth{width:100%}.textfield-label{color:#333;font-size:14px;font-weight:600}.textfield-input{border:1px solid #ccc;border-radius:6px;font-size:14px;padding:10px 12px;transition:.2s ease}.textfield-input:focus{border-color:#4c00ff;box-shadow:0 0 2px #007bff;outline:none}.textfield-input.error{background-color:#fff5f5;border-color:#d93025}.textfield-error{background-color:#f44343;color:#ece6e6;font-size:12px;padding:8px}.textfield-icon{position:absolute;right:45px;top:45px;width:2px}";
|
|
141
|
+
styleInject(css_248z$k);
|
|
142
142
|
|
|
143
143
|
const TextField = ({ label, value = "", placeholder, onChange, error, disabled = false, type = "text", fullWidth = true, icon, }) => {
|
|
144
144
|
return (jsxRuntime.jsxs("div", { className: `textfield ${fullWidth ? "fullWidth" : ""}`, children: [label && jsxRuntime.jsx("label", { className: "textfield-label", children: label }), jsxRuntime.jsx("input", { type: type, className: `textfield-input ${error ? "error" : ""}`, value: value, placeholder: placeholder, disabled: disabled, onChange: (e) => onChange && onChange(e.target.value) }), icon && jsxRuntime.jsx("div", { className: "textfield-icon", children: icon }), error && jsxRuntime.jsx("p", { className: "textfield-error", children: error })] }));
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
var css_248z$
|
|
148
|
-
styleInject(css_248z$
|
|
147
|
+
var css_248z$j = ".radio-container{align-items:center;cursor:pointer;display:flex;font-family:sans-serif;gap:8px}.radio-container input{display:none}.radio-circle{align-items:center;border:2px solid var(--rd-border-color,#777);border-radius:50%;display:flex;height:18px;justify-content:center;position:relative;transition:.2s ease;width:18px}.radio-circle:after{background-color:var(--rd-dot-color,#fff);border-radius:50%;content:\"\";height:10px;opacity:0;transform:scale(.4);transition:.2s ease;width:10px}.radio-container input:checked+.radio-circle{background-color:var(--rd-checked-bg,#007bff);border-color:var(--rd-checked-border,#007bff)}.radio-container input:checked+.radio-circle:after{opacity:1;transform:scale(1)}.radio-circle.error{border-color:#d93025!important}.radio-label{font-size:14px}.disabled{cursor:not-allowed;opacity:.6}";
|
|
148
|
+
styleInject(css_248z$j);
|
|
149
149
|
|
|
150
150
|
const Radio = ({ label, name, value, selectedValue, onChange, disabled = false, error = false, borderColor = "#777", dotColor = "#fff", checkedBorderColor = "#007bff", checkedBackground = error ? "#d93025" : "#007bff", focusShadow = "rgba(0, 123, 255, 0.4)", style, }) => {
|
|
151
151
|
const checked = selectedValue === value;
|
|
152
152
|
return (jsxRuntime.jsxs("label", { className: `radio-container ${disabled ? "disabled" : ""}`, style: Object.assign(Object.assign({}, style), { ["--rd-border-color"]: borderColor, ["--rd-dot-color"]: dotColor, ["--rd-checked-border"]: checkedBorderColor, ["--rd-checked-bg"]: checkedBackground, ["--rd-focus-shadow"]: focusShadow }), children: [jsxRuntime.jsx("input", { type: "radio", name: name, value: value, disabled: disabled, checked: checked, onChange: () => onChange(value) }), jsxRuntime.jsx("span", { className: `radio-circle ${error ? "error" : ""}` }), label && jsxRuntime.jsx("span", { className: "radio-label", children: label })] }));
|
|
153
153
|
};
|
|
154
154
|
|
|
155
|
-
var css_248z$
|
|
156
|
-
styleInject(css_248z$
|
|
157
|
-
|
|
158
|
-
const Select = ({ label, value, onChange, options, disabled = false, error = false, borderColor = "#ccc", focusBorder = "#007bff", focusShadow = "rgba(0, 123, 255, 0.4)", errorColor = "#e63946", style, }) => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
155
|
+
var css_248z$i = ".select-wrapper{display:flex;flex-direction:column;font-family:sans-serif;gap:4px}.select-wrapper.dark-mode{background:#333;color:#fff}.select-label{font-size:14px;font-weight:500}.custom-select{align-items:center;border-radius:6px;cursor:pointer;display:flex;justify-content:space-between;padding:10px 12px;position:relative;transition:all .2s ease}.custom-select.default{background:#fff;border:1px solid var(--sel-border,#ccc)}.custom-select.dark-mode{background:#333;border:1px solid var(--sel-border,#000);color:#fff}.custom-select:focus-within,.custom-select:hover{border-color:var(--sel-focus-border,#007bff);box-shadow:0 0 0 2px var(--sel-focus-shadow,rgba(0,123,255,.4))}.custom-select.disabled{background:#f2f2f2;cursor:not-allowed;opacity:.6}.custom-select.error{border-color:var(--sel-error,red)}.custom-select.error:hover{box-shadow:0 0 0 2px rgba(230,57,70,.35)}.selected-value{font-size:15px}.options-list{animation:fadeIn .12s ease-out;border-radius:6px;left:0;max-height:260px;overflow-y:auto;position:absolute;right:0;top:calc(100% + 4px);z-index:20}.options-list.dark-mode{background:#333;border-color:var(--sel-border,#555)}.options-list.default{background:#fff;border:1px solid var(--sel-border,#ccc)}.option-item{cursor:pointer;padding:10px;transition:background .15s ease,color .15s ease}.option-item:hover{background:#b2a3a3!important}.option-item.active{background:var(--sel-item-active,#007bff)!important;color:#fff!important}.arrow{font-size:12px;opacity:.6}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}";
|
|
156
|
+
styleInject(css_248z$i);
|
|
157
|
+
|
|
158
|
+
const Select = ({ label, goal = "SELECT ...", value, onChange, options, disabled = false, error = false, borderColor = "#ccc", focusBorder = "#007bff", focusShadow = "rgba(0, 123, 255, 0.4)", errorColor = "#e63946", isDarkMode = false, style, }) => {
|
|
159
|
+
const [open, setOpen] = React.useState(false);
|
|
160
|
+
const wrapperRef = React.useRef(null);
|
|
161
|
+
const selected = options.find((o) => o.value === value);
|
|
162
|
+
/** Close dropdown when clicking outside */
|
|
163
|
+
React.useEffect(() => {
|
|
164
|
+
const handleClick = (e) => {
|
|
165
|
+
if (wrapperRef.current &&
|
|
166
|
+
!wrapperRef.current.contains(e.target)) {
|
|
167
|
+
setOpen(false);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
document.addEventListener("mousedown", handleClick);
|
|
171
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
172
|
+
}, []);
|
|
173
|
+
return (jsxRuntime.jsxs("div", { className: `select-wrapper ${isDarkMode ? "dark-mode" : ""}`, style: style, ref: wrapperRef, children: [label && jsxRuntime.jsx("label", { className: "select-label", children: label }), jsxRuntime.jsxs("div", { className: `custom-select ${disabled ? "disabled" : ""} ${error ? "error" : ""} ${isDarkMode ? "dark-mode" : "default"}`, style: {
|
|
174
|
+
["--sel-border"]: isDarkMode ? "black" : borderColor,
|
|
175
|
+
["--sel-focus-border"]: focusBorder,
|
|
176
|
+
["--sel-focus-shadow"]: focusShadow,
|
|
177
|
+
["--sel-error"]: errorColor,
|
|
178
|
+
}, onClick: () => !disabled && setOpen((o) => !o), children: [jsxRuntime.jsx("div", { className: "selected-value", children: selected ? selected.label : goal }), jsxRuntime.jsx("div", { className: "arrow", children: open ? "▲" : "▼" }), open && (jsxRuntime.jsx("div", { className: `options-list ${isDarkMode ? "dark-mode" : "default"}`, children: options.map((opt) => (jsxRuntime.jsx("div", { className: `option-item ${opt.value === value ? "active" : ""}`, style: {
|
|
179
|
+
background: opt.bgColor,
|
|
180
|
+
color: opt.textColor,
|
|
181
|
+
["--sel-item-active"]: focusBorder,
|
|
182
|
+
}, onClick: () => {
|
|
183
|
+
onChange(opt.value);
|
|
184
|
+
setOpen(false);
|
|
185
|
+
}, children: opt.label }, opt.value))) }))] })] }));
|
|
168
186
|
};
|
|
169
187
|
|
|
170
|
-
var css_248z = ".toast-container{display:flex;flex-direction:column;gap:10px;position:fixed;right:20px;top:20px;
|
|
171
|
-
styleInject(css_248z);
|
|
188
|
+
var css_248z$h = ".toast-container{display:flex;flex-direction:column;gap:10px;position:fixed;z-index:9999}.top-right{right:20px;top:20px}.top-left{left:20px;top:20px}.bottom-right{bottom:20px;right:20px}.bottom-left{bottom:20px;left:20px}.toast-icon{font-size:18px}.toast{align-items:center;animation:toast-slide .3s ease,toast-fadeout .3s ease forwards;animation-delay:0s,2.8s;border-radius:8px;box-shadow:0 4px 8px rgba(0,0,0,.2);color:#fff;display:flex;font-size:14px;justify-content:space-between;max-width:320px;min-width:260px;padding:12px 16px;position:relative}.toast-success{background-color:#2ecc71}.toast-error{background-color:#e74c3c}.toast-warning{background-color:#f1c40f;color:#333}.toast-info{background-color:#3498db}.toast-close{background:none;border:none;color:inherit;cursor:pointer;font-size:16px}@keyframes toast-slide{0%{opacity:0;transform:translateX(40px)}to{opacity:1;transform:translateX(0)}}@keyframes toast-fadeout{0%{opacity:1}to{opacity:0}}";
|
|
189
|
+
styleInject(css_248z$h);
|
|
172
190
|
|
|
173
|
-
const ToastContext =
|
|
191
|
+
const ToastContext = React.createContext(undefined);
|
|
174
192
|
const useToast = () => {
|
|
175
|
-
const ctx =
|
|
193
|
+
const ctx = React.useContext(ToastContext);
|
|
176
194
|
if (!ctx)
|
|
177
195
|
throw new Error("useToast must be used inside <ToastProvider>");
|
|
178
196
|
return ctx;
|
|
179
197
|
};
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
198
|
+
// ✔ Icônes par défaut selon le variant
|
|
199
|
+
const TOAST_ICONS = {
|
|
200
|
+
success: "✔️",
|
|
201
|
+
error: "❌",
|
|
202
|
+
warning: "⚠️",
|
|
203
|
+
info: "ℹ️",
|
|
204
|
+
};
|
|
205
|
+
const ToastProvider = ({ children, }) => {
|
|
206
|
+
const [toasts, setToasts] = React.useState([]);
|
|
207
|
+
function addToast(message, variant = "info", duration = 3000, position = "top-right") {
|
|
183
208
|
const toast = {
|
|
184
209
|
id: Date.now().toString(),
|
|
185
210
|
message,
|
|
186
211
|
variant,
|
|
187
212
|
duration,
|
|
213
|
+
position,
|
|
188
214
|
};
|
|
189
215
|
setToasts((prev) => [...prev, toast]);
|
|
190
|
-
// auto-remove
|
|
191
216
|
setTimeout(() => {
|
|
192
217
|
setToasts((prev) => prev.filter((t) => t.id !== toast.id));
|
|
193
218
|
}, duration);
|
|
194
219
|
}
|
|
195
|
-
return (jsxRuntime.jsxs(ToastContext.Provider, { value: { addToast }, children: [children, jsxRuntime.jsx("div", { className: "toast-
|
|
220
|
+
return (jsxRuntime.jsxs(ToastContext.Provider, { value: { addToast }, children: [children, jsxRuntime.jsx("div", { className: "toast-root", children: toasts.map((t) => {
|
|
221
|
+
var _a;
|
|
222
|
+
return (jsxRuntime.jsxs("div", { className: `toast toast-${t.variant} ${t.position}`, children: [jsxRuntime.jsx("span", { className: "toast-icon", children: TOAST_ICONS[(_a = t.variant) !== null && _a !== void 0 ? _a : "info"] }), jsxRuntime.jsx("span", { className: "toast-message", children: t.message }), jsxRuntime.jsx("button", { className: "toast-close", onClick: () => setToasts((prev) => prev.filter((x) => x.id !== t.id)), children: "\u2715" })] }, t.id));
|
|
223
|
+
}) })] }));
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
var css_248z$g = ".modal-overlay{align-items:center;animation:fadeIn .25s ease forwards;backdrop-filter:blur(3px);background:rgba(0,0,0,.45);display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:9999}.modal-container{animation:scaleIn .25s ease forwards;background:#fff;border-radius:10px;box-shadow:0 10px 25px rgba(0,0,0,.2);font-family:sans-serif;max-width:90%;padding:20px}.modal-container.light-mode{background:#fdfdfd}.modal-container.dark-mode{background:#121212;color:#fff}.modal-header{align-items:center;display:flex;justify-content:space-between}.modal-title{font-size:16px;font-weight:600;margin:0 0 10px}.modal-body{margin-bottom:15px}.modal-footer{display:flex;justify-content:flex-end}.modal-close-btn{border:none;border-radius:100%;cursor:pointer;margin-bottom:5px;padding:7px 13px;transition:.2s}.modal-close-btn.dark-mode,.modal-close-btn.light-mode{background:#fdfdfd}.modal-close-btn.dark-mode:hover{background:#444}.modal-close-btn.light-mode:hover{background:#f6f3f3}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes scaleIn{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}";
|
|
227
|
+
styleInject(css_248z$g);
|
|
228
|
+
|
|
229
|
+
const Modal = ({ open, onClose, title, children, width = "400px", footer, isDarkMode = false, }) => {
|
|
230
|
+
// Close with ESC key
|
|
231
|
+
React.useEffect(() => {
|
|
232
|
+
if (!open)
|
|
233
|
+
return;
|
|
234
|
+
const handleKey = (e) => {
|
|
235
|
+
if (e.key === "Escape")
|
|
236
|
+
onClose();
|
|
237
|
+
};
|
|
238
|
+
window.addEventListener("keydown", handleKey);
|
|
239
|
+
return () => window.removeEventListener("keydown", handleKey);
|
|
240
|
+
}, [open]);
|
|
241
|
+
if (!open)
|
|
242
|
+
return null;
|
|
243
|
+
const stopPropagation = (e) => e.stopPropagation();
|
|
244
|
+
return (jsxRuntime.jsx("div", { className: "modal-overlay", onClick: onClose, children: jsxRuntime.jsxs("div", { className: `modal-container ${isDarkMode ? "dark-mode" : "light-mode"}`, style: { width }, onClick: stopPropagation, children: [jsxRuntime.jsxs("div", { className: "modal-header", children: [title && jsxRuntime.jsx("h2", { className: "modal-title", children: title }), jsxRuntime.jsx("button", { className: `modal-close-btn ${isDarkMode ? "dark-mode" : "light-mode"}`, onClick: onClose, children: "\u2716\uFE0F" })] }), jsxRuntime.jsx(Divider, { margin: 2 }), jsxRuntime.jsx("div", { className: "modal-body", children: children }), jsxRuntime.jsx("div", { className: "modal-footer", children: footer })] }) }));
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
var css_248z$f = ".tag{align-items:center;border:1px solid transparent;border-radius:6px;cursor:default;display:inline-flex;font-family:sans-serif;font-size:.85rem;gap:6px;padding:4px 10px;transition:.2s ease-in-out;user-select:none}.tag.none{display:none}.tag-filled{background:var(--tag-bg);border-color:var(--tag-bg);color:var(--tag-color)}.tag-outline{background:transparent;border-color:var(--tag-border)}.tag-outline,.tag-soft{color:var(--tag-border)}.tag-soft{background:rgba(0,0,0,.05);border-color:transparent}.tag-close{background:transparent;border:none;color:inherit;cursor:pointer;font-size:14px;line-height:1;padding:0}.tag-close:hover{opacity:.7}.tag.disabled{cursor:not-allowed;opacity:.5}.tag.disabled .tag-close{pointer-events:none}";
|
|
248
|
+
styleInject(css_248z$f);
|
|
249
|
+
|
|
250
|
+
const Tag = ({ label, variant = "filled", color = "#fff", background = "#007bff", borderColor = "#007bff", closable = false, disabled = false, style, }) => {
|
|
251
|
+
const [isClosed, setIsClosed] = React.useState(false);
|
|
252
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isClosed && (jsxRuntime.jsxs("div", { className: `tag tag-${variant} ${disabled ? "disabled" : ""} ${isClosed ? "none" : ""}`, style: Object.assign({ ["--tag-color"]: color, ["--tag-bg"]: background, ["--tag-border"]: borderColor }, style), children: [jsxRuntime.jsx("span", { children: label }), closable && (jsxRuntime.jsx("button", { className: "tag-close", disabled: disabled, onClick: (e) => {
|
|
253
|
+
e.stopPropagation();
|
|
254
|
+
setIsClosed(true);
|
|
255
|
+
}, children: "\u00D7" }))] })) }));
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const tco = {
|
|
259
|
+
primary: "#007bff",
|
|
260
|
+
text: "#222",
|
|
261
|
+
textDark: "#fff",
|
|
262
|
+
borderDark: "#ddd",
|
|
263
|
+
background: "#ffffff",
|
|
264
|
+
backgroundDark: "#333",
|
|
265
|
+
backgroundDark2: "#222",
|
|
266
|
+
backgroundDark3: "#111",
|
|
267
|
+
border: "#ccc",
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const ThemeContext = React.createContext(undefined);
|
|
271
|
+
const useTheme = () => {
|
|
272
|
+
const ctx = React.useContext(ThemeContext);
|
|
273
|
+
if (!ctx)
|
|
274
|
+
throw new Error("useTheme must be used within ThemeProvider");
|
|
275
|
+
return ctx;
|
|
276
|
+
};
|
|
277
|
+
const ThemeProvider = ({ children, }) => {
|
|
278
|
+
const [theme, setTheme] = React.useState({
|
|
279
|
+
primary: tco.primary,
|
|
280
|
+
background: tco.background,
|
|
281
|
+
text: tco.text,
|
|
282
|
+
border: tco.border,
|
|
283
|
+
mode: "light",
|
|
284
|
+
});
|
|
285
|
+
const toggleDarkMode = () => {
|
|
286
|
+
setTheme((prev) => (Object.assign(Object.assign({}, prev), { mode: prev.mode === "light" ? "dark" : "light", background: prev.mode === "light" ? tco.backgroundDark : tco.background, text: prev.mode === "light" ? tco.textDark : tco.text })));
|
|
287
|
+
};
|
|
288
|
+
const setCustomTheme = (t) => {
|
|
289
|
+
setTheme((prev) => (Object.assign(Object.assign({}, prev), t)));
|
|
290
|
+
};
|
|
291
|
+
return (jsxRuntime.jsx(ThemeContext.Provider, { value: { theme, toggleDarkMode, setCustomTheme }, children: jsxRuntime.jsx("div", { style: {
|
|
292
|
+
backgroundColor: theme.background,
|
|
293
|
+
color: theme.text,
|
|
294
|
+
minHeight: "100vh",
|
|
295
|
+
transition: "all 0.25s ease",
|
|
296
|
+
}, children: children }) }));
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
var css_248z$e = ".st-wrapper{font-family:sans-serif;margin-top:8px;overflow-x:auto;width:100%}.st-wrapper.bordered{border:1px solid var(--color-border,#ddd);border-radius:6px}.st-table{border-collapse:collapse;font-size:14px;width:100%}.st-table th{background:var(--color-table-header,#f4f4f4);border-bottom:2px solid var(--color-border,#ddd);color:var(--color-table-header-text,#333);font-weight:600;padding:10px 8px;text-align:left}.st-sortable{cursor:pointer;user-select:none}.st-th-content{align-items:center;display:flex;gap:6px}.st-sort-icons{display:flex;flex-direction:column;font-size:10px;line-height:10px;opacity:.4}.st-sort-icons span.active{font-weight:700;opacity:1}.st-table td{border-bottom:1px solid var(--color-border,#eee);padding:10px 8px}.st-table tr.even{background:var(--color-row-even,#fff);color:var(--color-row-even-text,#333)}.st-table tr.odd{background:var(--color-row-odd,#f9f9f9);color:var(--color-row-odd-text,#333)}.st-table tr.clickable{cursor:pointer;transition:background .2s ease}.st-table tr.clickable:hover{background:var(--color-row-hover,#eaf3ff)}.st-empty,.st-loading{color:var(--color-text-light,#777);font-style:italic;padding:20px;text-align:center!important}@media (max-width:600px){.st-table td,.st-table th{padding:8px 6px}}";
|
|
300
|
+
styleInject(css_248z$e);
|
|
301
|
+
|
|
302
|
+
function SmartTable({ data, columns, loading = false, clickable = false, onRowClick, striped = true, bordered = false, emptyText = "No data available", isDarkMode = false, enableSorting = false, }) {
|
|
303
|
+
const [sortKey, setSortKey] = React.useState(null);
|
|
304
|
+
const [sortDirection, setSortDirection] = React.useState(null);
|
|
305
|
+
const handleSort = (key) => {
|
|
306
|
+
if (sortKey !== key) {
|
|
307
|
+
setSortKey(key);
|
|
308
|
+
setSortDirection("asc");
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (sortDirection === "asc") {
|
|
312
|
+
setSortDirection("desc");
|
|
313
|
+
}
|
|
314
|
+
else if (sortDirection === "desc") {
|
|
315
|
+
setSortKey(null);
|
|
316
|
+
setSortDirection(null);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
setSortDirection("asc");
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const sortedData = React.useMemo(() => {
|
|
323
|
+
if (!enableSorting || !sortKey || !sortDirection)
|
|
324
|
+
return data;
|
|
325
|
+
return [...data].sort((a, b) => {
|
|
326
|
+
const aVal = a[sortKey];
|
|
327
|
+
const bVal = b[sortKey];
|
|
328
|
+
if (aVal == null)
|
|
329
|
+
return 1;
|
|
330
|
+
if (bVal == null)
|
|
331
|
+
return -1;
|
|
332
|
+
if (typeof aVal === "number" && typeof bVal === "number") {
|
|
333
|
+
return sortDirection === "asc" ? aVal - bVal : bVal - aVal;
|
|
334
|
+
}
|
|
335
|
+
return sortDirection === "asc"
|
|
336
|
+
? String(aVal).localeCompare(String(bVal))
|
|
337
|
+
: String(bVal).localeCompare(String(aVal));
|
|
338
|
+
});
|
|
339
|
+
}, [data, enableSorting, sortKey, sortDirection]);
|
|
340
|
+
return (jsxRuntime.jsx("div", { className: `st-wrapper ${bordered ? "bordered" : ""}`, children: jsxRuntime.jsxs("table", { className: "st-table", children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsx("tr", { children: columns.map((col) => {
|
|
341
|
+
var _a;
|
|
342
|
+
return (jsxRuntime.jsx("th", { className: enableSorting && col.sortable ? "st-sortable" : "", onClick: () => enableSorting && col.sortable && handleSort(col.key), style: {
|
|
343
|
+
width: col.width,
|
|
344
|
+
textAlign: (_a = col.align) !== null && _a !== void 0 ? _a : "left",
|
|
345
|
+
["--color-table-header"]: isDarkMode
|
|
346
|
+
? tco.backgroundDark3
|
|
347
|
+
: "",
|
|
348
|
+
["--color-table-header-text"]: isDarkMode
|
|
349
|
+
? tco.textDark
|
|
350
|
+
: "",
|
|
351
|
+
}, children: jsxRuntime.jsxs("div", { className: "st-th-content", children: [jsxRuntime.jsx("span", { children: col.label }), (enableSorting && col.sortable && col.sortable === true) ? (jsxRuntime.jsxs("span", { className: "st-sort-icons", children: [jsxRuntime.jsx("span", { className: sortKey === col.key && sortDirection === "asc"
|
|
352
|
+
? "active"
|
|
353
|
+
: "", children: "\u25B2" }), jsxRuntime.jsx("span", { className: sortKey === col.key && sortDirection === "desc"
|
|
354
|
+
? "active"
|
|
355
|
+
: "", children: "\u25BC" })] })) : null] }) }, String(col.key)));
|
|
356
|
+
}) }) }), jsxRuntime.jsx("tbody", { children: loading ? (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: columns.length, className: "st-loading", children: "Loading..." }) })) : sortedData.length === 0 ? (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: columns.length, className: "st-empty", children: emptyText }) })) : (sortedData.map((row, index) => (jsxRuntime.jsx("tr", { style: {
|
|
357
|
+
["--color-row-even"]: isDarkMode
|
|
358
|
+
? tco.backgroundDark
|
|
359
|
+
: "",
|
|
360
|
+
["--color-row-odd"]: isDarkMode
|
|
361
|
+
? tco.backgroundDark2
|
|
362
|
+
: "",
|
|
363
|
+
["--color-row-even-text"]: isDarkMode
|
|
364
|
+
? tco.textDark
|
|
365
|
+
: "",
|
|
366
|
+
["--color-row-odd-text"]: isDarkMode
|
|
367
|
+
? tco.textDark
|
|
368
|
+
: "",
|
|
369
|
+
}, className: `${striped ? (index % 2 === 0 ? "even" : "odd") : ""} ${clickable ? "clickable" : ""}`, onClick: () => clickable && (onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row)), children: columns.map((col) => {
|
|
370
|
+
var _a;
|
|
371
|
+
const value = row[col.key];
|
|
372
|
+
const renderValue = col.render
|
|
373
|
+
? col.render(value, row)
|
|
374
|
+
: value;
|
|
375
|
+
return (jsxRuntime.jsx("td", { style: { textAlign: (_a = col.align) !== null && _a !== void 0 ? _a : "left" }, children: renderValue }, String(col.key)));
|
|
376
|
+
}) }, index)))) })] }) }));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
var css_248z$d = ".pagination{align-items:center;display:flex;gap:6px;margin-top:16px}.pagination button{background:var(--pg-bg);border:1px solid var(--pg-border);border-radius:6px;color:var(--pg-text);cursor:pointer;font-size:14px;height:32px;min-width:32px;transition:all .2s ease}.pagination button:hover:not(:disabled){background:rgba(0,123,255,.1)}.pagination button.active{background:var(--pg-active);border-color:var(--pg-active);color:#fff}.pagination button:disabled{cursor:not-allowed;opacity:.5}";
|
|
380
|
+
styleInject(css_248z$d);
|
|
381
|
+
|
|
382
|
+
const Pagination = ({ page, pageSize, total, onPageChange, isDarkMode = false, color = tco.primary, position = "center" }) => {
|
|
383
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
384
|
+
if (totalPages <= 1)
|
|
385
|
+
return null;
|
|
386
|
+
const goToPage = (p) => {
|
|
387
|
+
if (p < 1 || p > totalPages)
|
|
388
|
+
return;
|
|
389
|
+
onPageChange(p);
|
|
390
|
+
};
|
|
391
|
+
return (jsxRuntime.jsxs("div", { className: "pagination", style: {
|
|
392
|
+
["--pg-bg"]: isDarkMode ? tco.backgroundDark2 : "#fff",
|
|
393
|
+
["--pg-text"]: isDarkMode ? tco.textDark : "#333",
|
|
394
|
+
["--pg-border"]: isDarkMode ? tco.borderDark : "#ddd",
|
|
395
|
+
["--pg-active"]: color,
|
|
396
|
+
justifyContent: position === "left" ? "flex-start" : position === "center" ? "center" : "flex-end"
|
|
397
|
+
}, children: [jsxRuntime.jsx("button", { disabled: page === 1, onClick: () => goToPage(page - 1), children: "\u2039" }), Array.from({ length: totalPages }).map((_, i) => {
|
|
398
|
+
const p = i + 1;
|
|
399
|
+
return (jsxRuntime.jsx("button", { className: p === page ? "active" : "", onClick: () => goToPage(p), children: p }, p));
|
|
400
|
+
}), jsxRuntime.jsx("button", { disabled: page === totalPages, onClick: () => goToPage(page + 1), children: "\u203A" })] }));
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
var css_248z$c = ".tfb-container{align-items:\"flex-start\";background:var(--tf-bg);border:1px solid var(--tf-border);border-radius:8px;display:flex;font-family:sans-serif;justify-content:space-between;margin-bottom:12px;padding:12px}.tfb-wrapper{display:flex;flex-wrap:wrap;width:70%}.tfb-item{color:var(--tf-text);display:flex;flex-direction:column;font-size:13px;gap:4px}.tfb-item input,.tfb-item select{border:1px solid var(--tf-border);border-radius:6px;font-size:13px;padding:6px 8px}.tfb-radio-group{display:flex;gap:8px}.tfb-reset{align-self:flex-end;background:#e63946;border:none;border-radius:6px;color:#fff;cursor:pointer;padding:6px 12px}.tfp-wrapper-toggle{align-items:flex-end;display:flex;justify-content:flex-end;width:30%}.tfp-wrapper-toggle button{background:transparent;border:1px solid var(--tf-border);border-radius:6px;cursor:pointer;font-size:14px;padding:4px 8px}.tfp-wrapper-toggle button:hover{opacity:.8}.tfp-wrapper-toggle-open{display:flex;justify-content:flex-end;margin-bottom:10;width:100%}.tfp-wrapper-toggle-open button{background:transparent;border:1px solid var(--tf-border);border-radius:6px;cursor:pointer;font-size:14px;padding:4px 8px}";
|
|
404
|
+
styleInject(css_248z$c);
|
|
405
|
+
|
|
406
|
+
const TableFilterBar = ({ filters, values, onChange, onReset, resetButton, isDarkMode = false, position = "left", gap = 16, collapsible = true, }) => {
|
|
407
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
408
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && (jsxRuntime.jsxs("div", { className: "tfb-container", style: {
|
|
409
|
+
["--tf-bg"]: isDarkMode ? tco.backgroundDark2 : "#fff",
|
|
410
|
+
["--tf-border"]: isDarkMode ? tco.borderDark : "#ddd",
|
|
411
|
+
["--tf-text"]: isDarkMode ? tco.textDark : "#333",
|
|
412
|
+
justifyContent: position === "left"
|
|
413
|
+
? "flex-start"
|
|
414
|
+
: position === "center"
|
|
415
|
+
? "center"
|
|
416
|
+
: "flex-end",
|
|
417
|
+
gap: gap,
|
|
418
|
+
}, children: [jsxRuntime.jsxs("div", { className: "tfb-wrapper", style: {
|
|
419
|
+
justifyContent: position === "left"
|
|
420
|
+
? "flex-start"
|
|
421
|
+
: position === "center"
|
|
422
|
+
? "center"
|
|
423
|
+
: "flex-end",
|
|
424
|
+
gap: gap,
|
|
425
|
+
}, children: [filters.map((filter) => {
|
|
426
|
+
var _a, _b;
|
|
427
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
428
|
+
width: filter.width === "large"
|
|
429
|
+
? "50%"
|
|
430
|
+
: filter.width === "medium"
|
|
431
|
+
? "30%"
|
|
432
|
+
: "",
|
|
433
|
+
}, className: "tfb-item", children: [jsxRuntime.jsx("label", { children: filter.label }), filter.type === "text" && (jsxRuntime.jsx("input", { type: "text", placeholder: filter.placeholder, value: (_a = values[filter.key]) !== null && _a !== void 0 ? _a : "", onChange: (e) => onChange(filter.key, e.target.value) })), filter.type === "select" && (jsxRuntime.jsxs("select", { value: (_b = values[filter.key]) !== null && _b !== void 0 ? _b : "", onChange: (e) => onChange(filter.key, e.target.value), children: [jsxRuntime.jsx("option", { value: "", children: "All" }), filter.options.map((opt) => (jsxRuntime.jsx("option", { value: opt.value, children: opt.label }, opt.value)))] })), filter.type === "checkbox" && (jsxRuntime.jsx("input", { type: "checkbox", checked: !!values[filter.key], onChange: (e) => onChange(filter.key, e.target.checked) })), filter.type === "radio" && (jsxRuntime.jsx("div", { className: "tfb-radio-group", children: filter.options.map((opt) => (jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx("input", { type: "radio", name: filter.key, value: opt.value, checked: values[filter.key] === opt.value, onChange: () => onChange(filter.key, opt.value) }), opt.label] }, opt.value))) }))] }, filter.key));
|
|
434
|
+
}), resetButton ? resetButton : (jsxRuntime.jsx("button", { className: "tfb-reset", onClick: onReset, children: "Reset" }))] }), jsxRuntime.jsx("div", { className: "tfp-wrapper-toggle", children: collapsible && (jsxRuntime.jsx("button", { onClick: () => setIsOpen(false), title: "Hide filters", children: "✕" })) })] })), collapsible && !isOpen && (jsxRuntime.jsx("div", { className: "tfp-wrapper-toggle-open", children: jsxRuntime.jsx("button", { onClick: () => setIsOpen(true), title: "Show filters", children: "🔍" }) }))] }));
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
var css_248z$b = ".txt{font-family:system-ui,-apple-system,sans-serif;margin:0}.txt-title{font-size:28px;line-height:1.2}.txt-subtitle{font-size:20px;opacity:.9}.txt-body{font-size:14px}.txt-caption{font-size:12px;opacity:.7}.txt-overline{font-size:11px;letter-spacing:.08em;text-transform:uppercase}.txt-muted{opacity:.6}.txt-error{color:#e53935}.txt-success{color:#2e7d32}.txt-regular{font-weight:400}.txt-medium{font-weight:500}.txt-bold{font-weight:700}.txt-left{text-align:left}.txt-center{text-align:center}.txt-right{text-align:right}";
|
|
438
|
+
styleInject(css_248z$b);
|
|
439
|
+
|
|
440
|
+
const Text = ({ as = "span", variant = "body", weight = "regular", align = "left", color, isDarkMode = false, className = "", children, }) => {
|
|
441
|
+
const Component = as;
|
|
442
|
+
return (jsxRuntime.jsx(Component, { className: `txt txt-${variant} txt-${weight} txt-${align} ${className}`, style: {
|
|
443
|
+
color: color !== null && color !== void 0 ? color : (isDarkMode
|
|
444
|
+
? tco.textDark
|
|
445
|
+
: undefined),
|
|
446
|
+
}, children: children }));
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
var css_248z$a = ".stl-wrapper{background:var(--tl-bg);color:var(--tl-text);display:flex;flex-direction:column;font-family:sans-serif;gap:20px}.stl-wrapper.horizontal{flex-direction:row}.stl-item{display:flex;gap:12px}.stl-item.clickable{cursor:pointer}.stl-item.clickable:hover{opacity:.85}.stl-indicator{flex-direction:column}.stl-dot,.stl-indicator{align-items:center;display:flex}.stl-dot{background:#ccc;border-radius:50%;height:14px;justify-content:center;width:14px}.stl-line.vertical{background:var(--tl-line);flex:1;margin-top:4px;width:2px}.stl-line.horizontal{background:var(--tl-line);height:2px;margin-left:4px;width:40px}.stl-content{padding-bottom:16px}.stl-date{font-size:12px;opacity:.6}.stl-title{font-size:15px;margin:4px 0}.stl-desc{font-size:13px;opacity:.85}.status-default{background:#9e9e9e}.status-success{background:#4caf50}.status-warning{background:#ff9800}.status-error{background:#f44336}.status-info{background:#2196f3}";
|
|
450
|
+
styleInject(css_248z$a);
|
|
451
|
+
|
|
452
|
+
const SmartTimeline = ({ items, orientation = "vertical", showLine = true, clickable = false, isDarkMode = false, onItemClick, }) => {
|
|
453
|
+
return (jsxRuntime.jsx("div", { className: `stl-wrapper ${orientation}`, style: {
|
|
454
|
+
["--tl-bg"]: isDarkMode ? tco.backgroundDark2 : "#fff",
|
|
455
|
+
["--tl-text"]: isDarkMode ? tco.textDark : "#333",
|
|
456
|
+
["--tl-line"]: isDarkMode ? tco.borderDark : "#ddd",
|
|
457
|
+
}, children: items.map((item, index) => (jsxRuntime.jsx(TimelineRow, { item: item, index: index, last: index === items.length - 1, orientation: orientation, showLine: showLine, clickable: clickable, onClick: onItemClick, isDarkMode: isDarkMode }, item.id))) }));
|
|
458
|
+
};
|
|
459
|
+
const TimelineRow = ({ item, last, orientation, showLine, clickable, onClick, isDarkMode, }) => {
|
|
460
|
+
var _a;
|
|
461
|
+
return (jsxRuntime.jsxs("div", { className: `stl-item ${clickable ? "clickable" : ""}`, onClick: () => clickable && (onClick === null || onClick === void 0 ? void 0 : onClick(item)), children: [jsxRuntime.jsxs("div", { className: "stl-indicator", children: [jsxRuntime.jsx("div", { className: `stl-dot status-${(_a = item.status) !== null && _a !== void 0 ? _a : "default"}`, children: item.icon }), showLine && !last && (jsxRuntime.jsx("span", { className: `stl-line ${orientation}` }))] }), jsxRuntime.jsxs("div", { className: "stl-content", children: [item.date && jsxRuntime.jsx("span", { className: "stl-date", children: item.date }), jsxRuntime.jsx("h4", { className: "stl-title", children: item.title }), item.description && (jsxRuntime.jsx("p", { className: "stl-desc", children: item.description })), item.content && (jsxRuntime.jsx("div", { className: "stl-custom", children: item.content }))] })] }));
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
var css_248z$9 = ".sc-wrapper{background:var(--sc-bg);border-radius:12px;overflow:hidden;position:relative;width:100%}.sc-track{display:flex;height:100%;transition:transform .4s ease-in-out}.sc-image{flex-shrink:0;height:100%;object-fit:cover;width:100%}.sc-arrow{align-items:center;background:rgba(0,0,0,.5);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;font-size:22px;height:36px;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);width:36px;z-index:2}.sc-arrow.left{left:12px}.sc-arrow.right{right:12px}.sc-arrow:hover{background:rgba(0,0,0,.8)}.sc-dots{bottom:12px;display:flex;gap:8px;justify-content:center;position:absolute;width:100%}.sc-dot{background:var(--sc-dot);border-radius:50%;cursor:pointer;height:10px;opacity:.5;width:10px}.sc-dot.active{background:var(--sc-dot-active);opacity:1}@media (max-width:768px){.sc-arrow{font-size:18px;height:30px;width:30px}}";
|
|
465
|
+
styleInject(css_248z$9);
|
|
466
|
+
|
|
467
|
+
const SmartCarousel = ({ images, autoPlay = false, interval = 5000, showArrows = true, showDots = true, isDarkMode = false, height = 320, activeDotColor = tco.primary, }) => {
|
|
468
|
+
const [index, setIndex] = React.useState(0);
|
|
469
|
+
const next = () => setIndex((prev) => (prev + 1) % images.length);
|
|
470
|
+
const prev = () => setIndex((prev) => (prev - 1 + images.length) % images.length);
|
|
471
|
+
React.useEffect(() => {
|
|
472
|
+
if (!autoPlay)
|
|
473
|
+
return;
|
|
474
|
+
const timer = setInterval(next, interval);
|
|
475
|
+
return () => clearInterval(timer);
|
|
476
|
+
}, [autoPlay, interval]);
|
|
477
|
+
if (!images.length)
|
|
478
|
+
return null;
|
|
479
|
+
return (jsxRuntime.jsxs("div", { className: "sc-wrapper", style: {
|
|
480
|
+
height,
|
|
481
|
+
["--sc-bg"]: isDarkMode ? tco.backgroundDark2 : "#000",
|
|
482
|
+
["--sc-dot"]: isDarkMode ? tco.textDark : "#fff",
|
|
483
|
+
["--sc-dot-active"]: activeDotColor,
|
|
484
|
+
}, children: [jsxRuntime.jsx("div", { className: "sc-track", style: { transform: `translateX(-${index * 100}%)` }, children: images.map((img, i) => {
|
|
485
|
+
var _a;
|
|
486
|
+
return (jsxRuntime.jsx("img", { src: img.src, alt: (_a = img.alt) !== null && _a !== void 0 ? _a : `slide-${i}`, className: "sc-image" }, i));
|
|
487
|
+
}) }), showArrows && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { className: "sc-arrow left", onClick: prev, "aria-label": "Previous", children: jsxRuntime.jsx("span", { children: " \u2039" }) }), jsxRuntime.jsx("button", { className: "sc-arrow right", onClick: next, "aria-label": "Next", children: jsxRuntime.jsx("span", { children: " \u203A" }) })] })), showDots && (jsxRuntime.jsx("div", { className: "sc-dots", children: images.map((_, i) => (jsxRuntime.jsx("span", { className: `sc-dot ${i === index ? "active" : ""}`, onClick: () => setIndex(i) }, i))) }))] }));
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
var css_248z$8 = ".navbar{background:#fff;border-bottom:1px solid #eee;font-family:sans-serif;width:100%;z-index:1000}.navbar.dark{background:#0f172a;border-color:#1e293b;color:#fff}.navbar.sticky{position:sticky;top:0}.navbar-container{align-items:center;display:flex;height:100%;justify-content:space-between;margin:auto;max-width:1280px;padding:0 16px}.navbar-logo{font-size:18px;font-weight:700}.navbar-links{display:flex;gap:20px;list-style:none}.navbar-links.center{left:50%;position:absolute;transform:translateX(-50%)}.navbar-links.left{margin-right:auto}.navbar-links.right{margin-left:auto;margin-right:24px}.navbar-link{cursor:pointer;font-weight:500}.navbar-link a{color:inherit;text-decoration:none}.navbar-link.active{color:#2563eb}.navbar-actions{align-items:center;display:flex;gap:10px}.navbar-burger{cursor:pointer;display:none;flex-direction:column;gap:4px}.navbar-burger span{background:currentColor;height:2px;width:22px}@media (max-width:768px){.navbar-links{background:inherit;display:none;flex-direction:column;left:0;padding:12px;position:absolute;right:0;top:100%}.navbar-burger,.navbar-links.open{display:flex}.navbar-links.center,.navbar-links.left,.navbar-links.right{margin:0;position:static;transform:none}}";
|
|
491
|
+
styleInject(css_248z$8);
|
|
492
|
+
|
|
493
|
+
const Navbar = ({ logo, links = [], actions = [], position = "left", sticky = true, isDarkMode = false, height = 64 }) => {
|
|
494
|
+
const [open, setOpen] = React.useState(false);
|
|
495
|
+
return (jsxRuntime.jsx("nav", { className: `navbar ${isDarkMode ? "dark" : ""} ${sticky ? "sticky" : ""}`, style: { height }, children: jsxRuntime.jsxs("div", { className: "navbar-container", children: [jsxRuntime.jsx("div", { className: "navbar-logo", children: logo }), jsxRuntime.jsx("ul", { className: `navbar-links ${position} ${open ? "open" : ""}`, children: links.map((link, i) => (jsxRuntime.jsx("li", { className: `navbar-link ${link.active ? "active" : ""}`, onClick: () => {
|
|
496
|
+
var _a;
|
|
497
|
+
(_a = link.onClick) === null || _a === void 0 ? void 0 : _a.call(link);
|
|
498
|
+
setOpen(false);
|
|
499
|
+
}, children: link.href ? jsxRuntime.jsx("a", { href: link.href, children: link.label }) : link.label }, i))) }), jsxRuntime.jsxs("div", { className: "navbar-actions", children: [actions.map((action, i) => {
|
|
500
|
+
var _a;
|
|
501
|
+
return (action.element ? action.element : jsxRuntime.jsx(Button, { label: (_a = action.label) !== null && _a !== void 0 ? _a : "", icon: action.icon, variant: "primary", size: "small", onClick: action.onClick }, i));
|
|
502
|
+
}), jsxRuntime.jsxs("div", { className: "navbar-burger", onClick: () => setOpen(!open), children: [jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", {})] })] })] }) }));
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
var css_248z$7 = ".sidebar{background:#fff;border-right:1px solid #e0e0e0;display:flex;flex-direction:column;font-family:sans-serif;height:100%!important;transition:width .25s ease}.sidebar.dark{background:#0f172a;border-color:#2a2a2a;color:#fff}.sidebar.sticky{position:sticky;top:0}.sidebar-header{align-items:center;display:flex;justify-content:space-between;padding:12px}.sidebar-toggle{background:none;border:none;cursor:pointer;font-size:18px}.sidebar-items{flex:1;list-style:none;margin:0;padding:0}.sidebar-item{align-items:center;cursor:pointer;display:flex;gap:12px;padding:10px 14px;transition:background .2s}.sidebar-item:hover{background:rgba(0,0,0,.05)}.sidebar.dark .sidebar-item:hover{background:hsla(0,0%,100%,.08)}.sidebar-item.active{background:rgba(0,0,0,.08);font-weight:600}.sidebar-icon{font-size:18px}.sidebar-actions{display:flex;flex-direction:column;gap:8px;padding:12px}";
|
|
506
|
+
styleInject(css_248z$7);
|
|
507
|
+
|
|
508
|
+
const Sidebar = ({ logo, items = [], collapsed: controlledCollapsed, onToggle, width = 200, collapsedWidth = 50, isDarkMode = false, sticky = true, style = {} }) => {
|
|
509
|
+
const [internalCollapsed, setInternalCollapsed] = React.useState(false);
|
|
510
|
+
const collapsed = controlledCollapsed !== null && controlledCollapsed !== void 0 ? controlledCollapsed : internalCollapsed;
|
|
511
|
+
const toggle = () => {
|
|
512
|
+
const next = !collapsed;
|
|
513
|
+
setInternalCollapsed(next);
|
|
514
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(next);
|
|
515
|
+
};
|
|
516
|
+
return (jsxRuntime.jsxs("aside", { className: `sidebar ${isDarkMode ? "dark" : ""} ${collapsed ? "collapsed" : ""} ${sticky ? "sticky" : ""}`, style: Object.assign(Object.assign({}, style), { width: collapsed ? collapsedWidth : width }), children: [jsxRuntime.jsxs("div", { className: "sidebar-header", children: [jsxRuntime.jsx("div", { className: "sidebar-logo", children: logo }), jsxRuntime.jsx("button", { className: "sidebar-toggle", onClick: toggle, children: "\u2630" })] }), jsxRuntime.jsx("ul", { className: "sidebar-items", children: items.map((item, i) => (jsxRuntime.jsxs("li", { className: `sidebar-item ${item.active ? "active" : ""}`, onClick: item.onClick, children: [item.icon && jsxRuntime.jsx("span", { className: "sidebar-icon", children: item.icon }), !collapsed && jsxRuntime.jsx("span", { className: "sidebar-label", children: item.label })] }, i))) })] }));
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
var css_248z$6 = ".footer{background:#fff;border-top:1px solid #e0e0e0;display:flex;flex-direction:column;font-family:sans-serif;width:100%}.footer.dark{background:#0f172a;border-color:#2a2a2a}.footer.fixed{bottom:0;left:0;position:fixed;z-index:999}.footer-container{align-items:center;display:flex;height:100%;justify-content:space-between;padding:0 16px}.footer-center,.footer-left,.footer-right{align-items:center;display:flex;gap:12px}.footer-sections{display:flex;font-size:13px;gap:40px;padding:12px 16px}.footer-section{display:flex;flex-direction:column;gap:6px}.footer-title{font-weight:600;opacity:.8}.footer-link{cursor:pointer;opacity:.7}.footer-link:hover{opacity:1;text-decoration:underline}@media (max-width:768px){.footer-container{flex-direction:column;gap:8px;padding:8px}.footer-sections{flex-direction:column;gap:16px}}";
|
|
520
|
+
styleInject(css_248z$6);
|
|
521
|
+
|
|
522
|
+
const Footer = ({ left, center, right, sections = [], isDarkMode = false, height = 56, fixed = false }) => {
|
|
523
|
+
return (jsxRuntime.jsxs("footer", { className: `footer ${isDarkMode ? "dark" : ""} ${fixed ? "fixed" : ""}`, style: { height }, children: [jsxRuntime.jsxs("div", { className: "footer-container", children: [jsxRuntime.jsx("div", { className: "footer-left", children: left }), jsxRuntime.jsx("div", { className: "footer-center", children: center }), jsxRuntime.jsx("div", { className: "footer-right", children: right })] }), sections.length > 0 && (jsxRuntime.jsx("div", { className: "footer-sections", children: sections.map((section, i) => {
|
|
524
|
+
var _a;
|
|
525
|
+
return (jsxRuntime.jsxs("div", { className: "footer-section", children: [section.title && (jsxRuntime.jsx("span", { className: "footer-title", children: section.title })), (_a = section.links) === null || _a === void 0 ? void 0 : _a.map((link, j) => (jsxRuntime.jsx("span", { className: "footer-link", onClick: link.onClick, children: link.href ? (jsxRuntime.jsx("a", { href: link.href, children: link.label })) : (link.label) }, j)))] }, i));
|
|
526
|
+
}) }))] }));
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var css_248z$5 = "*{box-sizing:border-box}body,html{height:100%;margin:0;padding:0}.layout{display:flex;flex-direction:column;font-family:sans-serif;min-height:70vh}.layout.dark{background:#0f172a;color:#fff}.layout-main{display:flex;flex:1;overflow:hidden}.layout-content{flex:1;overflow-y:auto;padding:16px}";
|
|
530
|
+
styleInject(css_248z$5);
|
|
531
|
+
|
|
532
|
+
const Layout = ({ header, sidebar, footer, children, withSidebar = true, withHeader = true, withFooter = true, sidebarWidth = 260, isDarkMode = false }) => {
|
|
533
|
+
return (jsxRuntime.jsxs("div", { className: `layout ${isDarkMode ? "dark" : ""}`, children: [withHeader && header, jsxRuntime.jsxs("div", { className: "layout-main", children: [withSidebar && sidebar && (jsxRuntime.jsx("aside", { className: "layout-sidebar", style: { width: sidebarWidth }, children: sidebar })), jsxRuntime.jsx("main", { className: "layout-content", children: children })] }), withFooter && footer] }));
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
var css_248z$4 = ".dd-wrapper{display:flex;font-family:sans-serif}.dd-wrapper.vertical{flex-direction:column}.dd-wrapper.horizontal{flex-direction:row;overflow-x:auto}.dd-item{cursor:grab;transition:transform .2s ease,opacity .2s ease;user-select:none}.dd-item.dragging{opacity:.5;transform:scale(.98)}.dd-wrapper.dark .dd-item{background:#0f172a;color:#fff}";
|
|
537
|
+
styleInject(css_248z$4);
|
|
538
|
+
|
|
539
|
+
function DragDrop({ items, onChange, renderItem, direction = "vertical", gap = 12, draggable = true, isDarkMode = false, }) {
|
|
540
|
+
const [draggedId, setDraggedId] = React.useState(null);
|
|
541
|
+
const handleDragStart = (id) => {
|
|
542
|
+
setDraggedId(id);
|
|
543
|
+
};
|
|
544
|
+
const handleDragOver = (e) => {
|
|
545
|
+
e.preventDefault();
|
|
546
|
+
};
|
|
547
|
+
const handleDrop = (targetId) => {
|
|
548
|
+
if (!draggedId || draggedId === targetId)
|
|
549
|
+
return;
|
|
550
|
+
const newItems = [...items];
|
|
551
|
+
const fromIndex = newItems.findIndex(i => i.id === draggedId);
|
|
552
|
+
const toIndex = newItems.findIndex(i => i.id === targetId);
|
|
553
|
+
const [moved] = newItems.splice(fromIndex, 1);
|
|
554
|
+
newItems.splice(toIndex, 0, moved);
|
|
555
|
+
onChange(newItems);
|
|
556
|
+
setDraggedId(null);
|
|
557
|
+
};
|
|
558
|
+
return (jsxRuntime.jsx("div", { className: `dd-wrapper ${direction} ${isDarkMode ? "dark" : ""}`, style: { gap }, children: items.map(item => (jsxRuntime.jsx("div", { className: `dd-item ${draggedId === item.id ? "dragging" : ""}`, draggable: draggable, onDragStart: () => handleDragStart(item.id), onDragOver: handleDragOver, onDrop: () => handleDrop(item.id), children: renderItem(item.data) }, item.id))) }));
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/******************************************************************************
|
|
562
|
+
Copyright (c) Microsoft Corporation.
|
|
563
|
+
|
|
564
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
565
|
+
purpose with or without fee is hereby granted.
|
|
566
|
+
|
|
567
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
568
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
569
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
570
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
571
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
572
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
573
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
574
|
+
***************************************************************************** */
|
|
575
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
579
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
580
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
581
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
582
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
583
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
584
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
589
|
+
var e = new Error(message);
|
|
590
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
var css_248z$3 = ".secure-text{align-items:center;background:#fff;border:1px solid #ddd;border-radius:8px;color:#333;display:flex;font-family:monospace;gap:12px;justify-content:space-between;padding:8px 12px}.secure-text.dark{background:#0f172a;border-color:#1e293b;color:#e5e7eb}.secure-text-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.secure-text-actions{display:flex;gap:6px}.secure-text-actions button{background:transparent;border:none;cursor:pointer;font-size:16px;padding:4px}.secure-text-actions button:hover{opacity:.7}";
|
|
594
|
+
styleInject(css_248z$3);
|
|
595
|
+
|
|
596
|
+
const SecureText = ({ value, masked = true, copyable = true, maskChar = "•", revealLabel = "Show", copyLabel = "Copy", onCopy, isDarkMode = false, width = "100%", }) => {
|
|
597
|
+
const [visible, setVisible] = React.useState(!masked);
|
|
598
|
+
const [copied, setCopied] = React.useState(false);
|
|
599
|
+
const displayValue = visible
|
|
600
|
+
? value
|
|
601
|
+
: maskChar.repeat(value.length);
|
|
602
|
+
const handleCopy = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
603
|
+
yield navigator.clipboard.writeText(value);
|
|
604
|
+
setCopied(true);
|
|
605
|
+
onCopy === null || onCopy === void 0 ? void 0 : onCopy();
|
|
606
|
+
setTimeout(() => setCopied(false), 1500);
|
|
607
|
+
});
|
|
608
|
+
return (jsxRuntime.jsxs("div", { className: `secure-text ${isDarkMode ? "dark" : ""}`, style: { width }, children: [jsxRuntime.jsx("span", { className: "secure-text-value", children: displayValue }), jsxRuntime.jsxs("div", { className: "secure-text-actions", children: [jsxRuntime.jsx("button", { type: "button", onClick: () => setVisible(!visible), title: visible ? "Hide" : revealLabel, children: visible ? "🙈" : "👀" }), copyable && (jsxRuntime.jsx("button", { type: "button", onClick: handleCopy, title: copyLabel, children: copied ? "✅" : "📋" }))] })] }));
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
var css_248z$2 = ":root{--loading-color:#2563eb}.loading-wrapper{align-items:center;display:flex;flex-direction:column;font-family:sans-serif;gap:12px;justify-content:center}.loading-wrapper.fullscreen{inset:0;position:fixed;z-index:9999}.loading-wrapper.overlay{background:hsla(0,0%,100%,.7)}.loading-wrapper.dark.overlay{background:#0f172a}.loading.spinner{align-items:center;display:flex;justify-content:center}.loading.spinner .spinner{animation:spin 1s linear infinite;border:4px solid #e5e7eb;border-radius:50%;border-top:4px solid var(--loading-color)}.loading.dots{display:flex;gap:6px}.loading.dots span{animation:bounce 1.4s ease-in-out infinite both;background:var(--loading-color);border-radius:50%;height:8px;width:8px}.loading.dots span:first-child{animation-delay:-.32s}.loading.dots span:nth-child(2){animation-delay:-.16s}.bar-container{background:#e5e7eb;border-radius:4px;height:4px;overflow:hidden;width:200px}.bar-progress{animation:barMove 1.2s ease-in-out infinite;background:var(--loading-color);height:100%;width:40%}.loading.xs .spinner{height:16px;width:16px}.loading.sm .spinner{height:24px;width:24px}.loading.md .spinner{height:40px;width:40px}.loading.lg .spinner{height:56px;width:56px}.loading-text{color:#6b7280;font-size:14px}.loading-wrapper.dark .loading-text{color:#cbd5f5}@keyframes spin{to{transform:rotate(1turn)}}@keyframes bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}@keyframes barMove{0%{transform:translateX(-100%)}to{transform:translateX(250%)}}";
|
|
612
|
+
styleInject(css_248z$2);
|
|
613
|
+
|
|
614
|
+
const Loading = ({ variant = "spinner", size = "md", text, fullscreen = false, overlay = false, color, isDarkMode = false, }) => {
|
|
615
|
+
return (jsxRuntime.jsxs("div", { className: `loading-wrapper
|
|
616
|
+
${fullscreen ? "fullscreen" : ""}
|
|
617
|
+
${overlay ? "overlay" : ""}
|
|
618
|
+
${isDarkMode ? "dark" : ""}`, children: [jsxRuntime.jsxs("div", { className: `loading ${variant} ${size}`, style: { ["--loading-color"]: color }, children: [variant === "spinner" && jsxRuntime.jsx("span", { className: "spinner" }), variant === "dots" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", {})] })), variant === "bar" && (jsxRuntime.jsx("div", { className: "bar-container", children: jsxRuntime.jsx("div", { className: "bar-progress" }) }))] }), text && jsxRuntime.jsx("p", { className: "loading-text", children: text })] }));
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
var css_248z$1 = ".avatar{align-items:center;background:#e5e7eb;color:#111827;display:inline-flex;font-weight:600;justify-content:center;overflow:hidden;position:relative;user-select:none}.avatar.circle{border-radius:50%}.avatar.rounded{border-radius:12px}.avatar.square{border-radius:4px}.avatar.xs{font-size:10px;height:24px;width:24px}.avatar.sm{font-size:12px;height:32px;width:32px}.avatar.md{font-size:14px;height:40px;width:40px}.avatar.lg{font-size:18px;height:56px;width:56px}.avatar.xl{font-size:22px;height:72px;width:72px}.avatar img{height:100%;object-fit:cover;width:100%}.avatar-initials{text-transform:uppercase}.avatar-status{border:2px solid #fff;border-radius:50%;bottom:2px;height:10px;position:absolute;right:2px;width:10px}.avatar-status.online{background:#22c55e}.avatar-status.offline{background:#9ca3af}.avatar-status.away{background:#f59e0b}.avatar.clickable{cursor:pointer;transition:transform .2s ease}.avatar.clickable:hover{transform:scale(1.05)}.avatar.dark{background:#1f2937;color:#f9fafb}";
|
|
622
|
+
styleInject(css_248z$1);
|
|
623
|
+
|
|
624
|
+
const Avatar = ({ src, alt = "avatar", name, size = "md", shape = "circle", status, backgroundColor, color, onClick, isDarkMode = false, }) => {
|
|
625
|
+
const getInitials = () => {
|
|
626
|
+
if (!name)
|
|
627
|
+
return "?";
|
|
628
|
+
const parts = name.trim().split(" ");
|
|
629
|
+
return parts.length === 1
|
|
630
|
+
? parts[0][0]
|
|
631
|
+
: `${parts[0][0]}${parts[1][0]}`;
|
|
632
|
+
};
|
|
633
|
+
return (jsxRuntime.jsxs("div", { className: `
|
|
634
|
+
avatar
|
|
635
|
+
${size}
|
|
636
|
+
${shape}
|
|
637
|
+
${onClick ? "clickable" : ""}
|
|
638
|
+
${isDarkMode ? "dark" : ""}
|
|
639
|
+
`, style: {
|
|
640
|
+
backgroundColor,
|
|
641
|
+
color,
|
|
642
|
+
}, onClick: onClick, children: [src ? (jsxRuntime.jsx("img", { src: src, alt: alt })) : (jsxRuntime.jsx("span", { className: "avatar-initials", children: getInitials() })), status && jsxRuntime.jsx("span", { className: `avatar-status ${status}` })] }));
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
var css_248z = ".profile-menu-wrapper{position:relative}.profile-menu{background:#fff;border:1px solid #e5e7eb;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.1);font-family:sans-serif;position:absolute;right:0;top:110%;width:260px;z-index:1000}.profile-menu.dark{background:#0f172a;border-color:#1e293b;color:#f9fafb}.profile-header{border-bottom:1px solid #e5e7eb;display:flex;gap:12px;padding:14px}.profile-menu.dark .profile-header{border-color:#1e293b}.profile-name{font-weight:600}.profile-email{font-size:12px;opacity:.7}.profile-actions{list-style:none;margin:0;padding:6px 0}.profile-actions .action{align-items:center;cursor:pointer;display:flex;gap:10px;padding:10px 14px}.profile-actions .action:hover{background:#f3f4f6}.profile-menu.dark .action:hover{background:#1e293b}.profile-actions .action.danger{color:#ef4444}.profile-actions .divider{background:#e5e7eb;height:1px;margin:6px 0}.profile-menu.dark .divider{background:#1e293b}";
|
|
646
|
+
styleInject(css_248z);
|
|
647
|
+
|
|
648
|
+
const ProfileMenu = ({ user, actions, isDarkMode = false, }) => {
|
|
649
|
+
const [open, setOpen] = React.useState(false);
|
|
650
|
+
const ref = React.useRef(null);
|
|
651
|
+
// Close on outside click
|
|
652
|
+
React.useEffect(() => {
|
|
653
|
+
const handleClickOutside = (e) => {
|
|
654
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
655
|
+
setOpen(false);
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
659
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
660
|
+
}, []);
|
|
661
|
+
return (jsxRuntime.jsxs("div", { className: "profile-menu-wrapper", ref: ref, children: [jsxRuntime.jsx(Avatar, { src: user.avatar, name: user.name, size: "sm", onClick: () => setOpen(!open), isDarkMode: isDarkMode }), open && (jsxRuntime.jsxs("div", { className: `profile-menu ${isDarkMode ? "dark" : ""}`, children: [jsxRuntime.jsxs("div", { className: "profile-header", children: [jsxRuntime.jsx(Avatar, { src: user.avatar, name: user.name, size: "md", isDarkMode: isDarkMode }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "profile-name", children: user.name }), user.email && (jsxRuntime.jsx("div", { className: "profile-email", children: user.email }))] })] }), jsxRuntime.jsx("ul", { className: "profile-actions", children: actions.map((action, i) => action.divider ? (jsxRuntime.jsx("li", { className: "divider" }, i)) : (jsxRuntime.jsxs("li", { className: `action ${action.danger ? "danger" : ""}`, onClick: () => {
|
|
662
|
+
var _a;
|
|
663
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
664
|
+
setOpen(false);
|
|
665
|
+
}, children: [action.icon && jsxRuntime.jsx("span", { className: "icon", children: action.icon }), action.label] }, i))) })] }))] }));
|
|
196
666
|
};
|
|
197
667
|
|
|
668
|
+
exports.Avatar = Avatar;
|
|
198
669
|
exports.Bloc = Bloc;
|
|
199
670
|
exports.Button = Button;
|
|
200
671
|
exports.Card = Card;
|
|
@@ -203,12 +674,30 @@ exports.Checkbox = Checkbox;
|
|
|
203
674
|
exports.Column = Column;
|
|
204
675
|
exports.Container = Container;
|
|
205
676
|
exports.Divider = Divider;
|
|
677
|
+
exports.DragDrop = DragDrop;
|
|
678
|
+
exports.Footer = Footer;
|
|
206
679
|
exports.Grid = Grid;
|
|
680
|
+
exports.Layout = Layout;
|
|
681
|
+
exports.Loading = Loading;
|
|
682
|
+
exports.Modal = Modal;
|
|
683
|
+
exports.Navbar = Navbar;
|
|
684
|
+
exports.Pagination = Pagination;
|
|
685
|
+
exports.ProfileMenu = ProfileMenu;
|
|
207
686
|
exports.Radio = Radio;
|
|
208
687
|
exports.Row = Row;
|
|
688
|
+
exports.SecureText = SecureText;
|
|
209
689
|
exports.Select = Select;
|
|
690
|
+
exports.Sidebar = Sidebar;
|
|
691
|
+
exports.SmartCarousel = SmartCarousel;
|
|
692
|
+
exports.SmartTable = SmartTable;
|
|
693
|
+
exports.SmartTimeline = SmartTimeline;
|
|
210
694
|
exports.Spacer = Spacer;
|
|
695
|
+
exports.TableFilterBar = TableFilterBar;
|
|
696
|
+
exports.Tag = Tag;
|
|
697
|
+
exports.Text = Text;
|
|
211
698
|
exports.TextField = TextField;
|
|
699
|
+
exports.ThemeProvider = ThemeProvider;
|
|
212
700
|
exports.ToastProvider = ToastProvider;
|
|
701
|
+
exports.useTheme = useTheme;
|
|
213
702
|
exports.useToast = useToast;
|
|
214
703
|
//# sourceMappingURL=index.js.map
|