@imc0nt0/wooris 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +363 -47
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +361 -50
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -4
- package/dist/tokens.css +0 -1
- package/src/tokens.css +0 -33
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect, useContext, useState, useCallback, createContext } from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
function _arrayLikeToArray(r, a) {
|
|
5
|
+
(null == a || a > r.length) && (a = r.length);
|
|
6
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
function _arrayWithHoles(r) {
|
|
10
|
+
if (Array.isArray(r)) return r;
|
|
11
|
+
}
|
|
12
|
+
function _arrayWithoutHoles(r) {
|
|
13
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
14
|
+
}
|
|
4
15
|
function _defineProperty(e, r, t) {
|
|
5
16
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
6
17
|
value: t,
|
|
@@ -9,6 +20,42 @@ function _defineProperty(e, r, t) {
|
|
|
9
20
|
writable: !0
|
|
10
21
|
}) : e[r] = t, e;
|
|
11
22
|
}
|
|
23
|
+
function _iterableToArray(r) {
|
|
24
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
25
|
+
}
|
|
26
|
+
function _iterableToArrayLimit(r, l) {
|
|
27
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
28
|
+
if (null != t) {
|
|
29
|
+
var e,
|
|
30
|
+
n,
|
|
31
|
+
i,
|
|
32
|
+
u,
|
|
33
|
+
a = [],
|
|
34
|
+
f = !0,
|
|
35
|
+
o = !1;
|
|
36
|
+
try {
|
|
37
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
38
|
+
if (Object(t) !== t) return;
|
|
39
|
+
f = !1;
|
|
40
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
41
|
+
} catch (r) {
|
|
42
|
+
o = !0, n = r;
|
|
43
|
+
} finally {
|
|
44
|
+
try {
|
|
45
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
46
|
+
} finally {
|
|
47
|
+
if (o) throw n;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return a;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function _nonIterableRest() {
|
|
54
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
55
|
+
}
|
|
56
|
+
function _nonIterableSpread() {
|
|
57
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
+
}
|
|
12
59
|
function ownKeys(e, r) {
|
|
13
60
|
var t = Object.keys(e);
|
|
14
61
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -50,6 +97,12 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
50
97
|
}
|
|
51
98
|
return t;
|
|
52
99
|
}
|
|
100
|
+
function _slicedToArray(r, e) {
|
|
101
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
102
|
+
}
|
|
103
|
+
function _toConsumableArray(r) {
|
|
104
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
105
|
+
}
|
|
53
106
|
function _toPrimitive(t, r) {
|
|
54
107
|
if ("object" != typeof t || !t) return t;
|
|
55
108
|
var e = t[Symbol.toPrimitive];
|
|
@@ -64,6 +117,13 @@ function _toPropertyKey(t) {
|
|
|
64
117
|
var i = _toPrimitive(t, "string");
|
|
65
118
|
return "symbol" == typeof i ? i : i + "";
|
|
66
119
|
}
|
|
120
|
+
function _unsupportedIterableToArray(r, a) {
|
|
121
|
+
if (r) {
|
|
122
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
123
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
124
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
67
127
|
|
|
68
128
|
var propTypesExports = {};
|
|
69
129
|
var propTypes = {
|
|
@@ -1255,61 +1315,39 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1255
1315
|
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1256
1316
|
}
|
|
1257
1317
|
|
|
1258
|
-
var _excluded$
|
|
1259
|
-
var VARIANT_STYLE = {
|
|
1260
|
-
primary: 'background: var(--color-primary); color: white;',
|
|
1261
|
-
success: 'background: var(--color-success); color: white;',
|
|
1262
|
-
error: 'background: var(--color-error); color: white;',
|
|
1263
|
-
info: 'background: var(--color-info); color: white;',
|
|
1264
|
-
warning: 'background: var(--color-warning); color: black;'
|
|
1265
|
-
};
|
|
1318
|
+
var _excluded$3 = ["children", "variant", "type", "onClick", "className", "disabled"];
|
|
1266
1319
|
var Button = function Button(_ref) {
|
|
1267
1320
|
var children = _ref.children,
|
|
1268
1321
|
_ref$variant = _ref.variant,
|
|
1269
1322
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
1323
|
+
_ref$type = _ref.type,
|
|
1324
|
+
type = _ref$type === void 0 ? 'md' : _ref$type,
|
|
1270
1325
|
onClick = _ref.onClick,
|
|
1271
1326
|
_ref$className = _ref.className,
|
|
1272
1327
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1273
1328
|
_ref$disabled = _ref.disabled,
|
|
1274
1329
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1275
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1330
|
+
rest = _objectWithoutProperties(_ref, _excluded$3);
|
|
1331
|
+
var variantClass = "wooris-btn-".concat(variant);
|
|
1332
|
+
var typeClass = "wooris-btn-".concat(type);
|
|
1333
|
+
return /*#__PURE__*/jsx("button", _objectSpread2(_objectSpread2({
|
|
1334
|
+
className: "wooris-btn ".concat(variantClass, " ").concat(typeClass, " ").concat(className),
|
|
1279
1335
|
onClick: onClick,
|
|
1280
|
-
disabled: disabled
|
|
1281
|
-
style: {},
|
|
1282
|
-
"data-variant": variant
|
|
1336
|
+
disabled: disabled
|
|
1283
1337
|
}, rest), {}, {
|
|
1284
|
-
children:
|
|
1285
|
-
style: {
|
|
1286
|
-
display: 'inline-flex',
|
|
1287
|
-
alignItems: 'center',
|
|
1288
|
-
gap: 8
|
|
1289
|
-
},
|
|
1290
|
-
dangerouslySetInnerHTML: {
|
|
1291
|
-
__html: ''
|
|
1292
|
-
}
|
|
1293
|
-
}), /*#__PURE__*/jsx("span", {
|
|
1294
|
-
style: {},
|
|
1295
|
-
children: children
|
|
1296
|
-
}), /*#__PURE__*/jsx("style", {
|
|
1297
|
-
jsx: true,
|
|
1298
|
-
children: ""
|
|
1299
|
-
}), /*#__PURE__*/jsx("style", {
|
|
1300
|
-
children: "button[data-variant=\"".concat(variant, "\"]{ ").concat(styleString, " }")
|
|
1301
|
-
})]
|
|
1338
|
+
children: children
|
|
1302
1339
|
}));
|
|
1303
1340
|
};
|
|
1304
1341
|
Button.propTypes = {
|
|
1305
1342
|
children: propTypesExports.node,
|
|
1306
1343
|
variant: propTypesExports.oneOf(['primary', 'success', 'error', 'info', 'warning']),
|
|
1344
|
+
type: propTypesExports.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xl2', 'xl3']),
|
|
1307
1345
|
onClick: propTypesExports.func,
|
|
1308
1346
|
className: propTypesExports.string,
|
|
1309
1347
|
disabled: propTypesExports.bool
|
|
1310
1348
|
};
|
|
1311
1349
|
|
|
1312
|
-
var _excluded = ["placeholder", "value", "onChange", "className", "type"];
|
|
1350
|
+
var _excluded$2 = ["placeholder", "value", "onChange", "className", "type"];
|
|
1313
1351
|
var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1314
1352
|
var _ref$placeholder = _ref.placeholder,
|
|
1315
1353
|
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
@@ -1319,7 +1357,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1319
1357
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1320
1358
|
_ref$type = _ref.type,
|
|
1321
1359
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1322
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
1360
|
+
rest = _objectWithoutProperties(_ref, _excluded$2);
|
|
1323
1361
|
return /*#__PURE__*/jsx("input", _objectSpread2({
|
|
1324
1362
|
ref: ref,
|
|
1325
1363
|
className: "wooris-input ".concat(className),
|
|
@@ -1344,19 +1382,9 @@ var Badge = function Badge(_ref) {
|
|
|
1344
1382
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
1345
1383
|
_ref$className = _ref.className,
|
|
1346
1384
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
1347
|
-
var
|
|
1348
|
-
primary: 'var(--color-primary)',
|
|
1349
|
-
success: 'var(--color-success)',
|
|
1350
|
-
error: 'var(--color-error)',
|
|
1351
|
-
info: 'var(--color-info)',
|
|
1352
|
-
warning: 'var(--color-warning)'
|
|
1353
|
-
}[variant] || 'var(--color-primary)';
|
|
1385
|
+
var variantClass = "wooris-badge-".concat(variant);
|
|
1354
1386
|
return /*#__PURE__*/jsx("span", {
|
|
1355
|
-
className: "wooris-badge ".concat(className),
|
|
1356
|
-
style: {
|
|
1357
|
-
background: bg,
|
|
1358
|
-
color: '#fff'
|
|
1359
|
-
},
|
|
1387
|
+
className: "wooris-badge ".concat(variantClass, " ").concat(className),
|
|
1360
1388
|
children: children
|
|
1361
1389
|
});
|
|
1362
1390
|
};
|
|
@@ -1421,6 +1449,286 @@ Modal.propTypes = {
|
|
|
1421
1449
|
closeOnBackdrop: propTypesExports.bool
|
|
1422
1450
|
};
|
|
1423
1451
|
|
|
1452
|
+
var _excluded$1 = ["children", "container", "item", "spacing", "type", "xs", "sm", "md", "lg"];
|
|
1453
|
+
var Grid = function Grid(_ref) {
|
|
1454
|
+
var children = _ref.children,
|
|
1455
|
+
_ref$container = _ref.container,
|
|
1456
|
+
container = _ref$container === void 0 ? false : _ref$container,
|
|
1457
|
+
_ref$item = _ref.item,
|
|
1458
|
+
item = _ref$item === void 0 ? false : _ref$item,
|
|
1459
|
+
_ref$spacing = _ref.spacing,
|
|
1460
|
+
spacing = _ref$spacing === void 0 ? 0 : _ref$spacing,
|
|
1461
|
+
_ref$type = _ref.type,
|
|
1462
|
+
type = _ref$type === void 0 ? 'md' : _ref$type,
|
|
1463
|
+
xs = _ref.xs,
|
|
1464
|
+
sm = _ref.sm,
|
|
1465
|
+
md = _ref.md,
|
|
1466
|
+
lg = _ref.lg,
|
|
1467
|
+
rest = _objectWithoutProperties(_ref, _excluded$1);
|
|
1468
|
+
var classNames = ['wooris-grid'];
|
|
1469
|
+
var styles = {};
|
|
1470
|
+
if (container) {
|
|
1471
|
+
classNames.push('wooris-grid-container');
|
|
1472
|
+
if (spacing > 0) {
|
|
1473
|
+
styles.gap = "".concat(spacing * 8, "px");
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
if (item) {
|
|
1477
|
+
classNames.push('wooris-grid-item');
|
|
1478
|
+
classNames.push("wooris-grid-item-".concat(type)); // Apply type class to items
|
|
1479
|
+
if (xs) classNames.push("wooris-grid-xs-".concat(xs));
|
|
1480
|
+
if (sm) classNames.push("wooris-grid-sm-".concat(sm));
|
|
1481
|
+
if (md) classNames.push("wooris-grid-md-".concat(md));
|
|
1482
|
+
if (lg) classNames.push("wooris-grid-lg-".concat(lg));
|
|
1483
|
+
}
|
|
1484
|
+
return /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({
|
|
1485
|
+
className: classNames.join(' '),
|
|
1486
|
+
style: styles
|
|
1487
|
+
}, rest), {}, {
|
|
1488
|
+
children: children
|
|
1489
|
+
}));
|
|
1490
|
+
};
|
|
1491
|
+
Grid.propTypes = {
|
|
1492
|
+
children: propTypesExports.node,
|
|
1493
|
+
container: propTypesExports.bool,
|
|
1494
|
+
item: propTypesExports.bool,
|
|
1495
|
+
spacing: propTypesExports.number,
|
|
1496
|
+
type: propTypesExports.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xl2', 'xl3']),
|
|
1497
|
+
// Updated type prop types
|
|
1498
|
+
xs: propTypesExports.number,
|
|
1499
|
+
sm: propTypesExports.number,
|
|
1500
|
+
md: propTypesExports.number,
|
|
1501
|
+
lg: propTypesExports.number
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
var _excluded = ["children", "type", "className"];
|
|
1505
|
+
var Card = function Card(_ref) {
|
|
1506
|
+
var children = _ref.children,
|
|
1507
|
+
_ref$type = _ref.type,
|
|
1508
|
+
type = _ref$type === void 0 ? 'md' : _ref$type,
|
|
1509
|
+
_ref$className = _ref.className,
|
|
1510
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1511
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
1512
|
+
var typeClass = "wooris-card-".concat(type);
|
|
1513
|
+
return /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({
|
|
1514
|
+
className: "wooris-card ".concat(typeClass, " ").concat(className)
|
|
1515
|
+
}, rest), {}, {
|
|
1516
|
+
children: children
|
|
1517
|
+
}));
|
|
1518
|
+
};
|
|
1519
|
+
Card.propTypes = {
|
|
1520
|
+
children: propTypesExports.node,
|
|
1521
|
+
type: propTypesExports.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xl2', 'xl3']),
|
|
1522
|
+
className: propTypesExports.string
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
function styleInject(css, ref) {
|
|
1526
|
+
if ( ref === void 0 ) ref = {};
|
|
1527
|
+
var insertAt = ref.insertAt;
|
|
1528
|
+
|
|
1529
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
1530
|
+
|
|
1531
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
1532
|
+
var style = document.createElement('style');
|
|
1533
|
+
style.type = 'text/css';
|
|
1534
|
+
|
|
1535
|
+
if (insertAt === 'top') {
|
|
1536
|
+
if (head.firstChild) {
|
|
1537
|
+
head.insertBefore(style, head.firstChild);
|
|
1538
|
+
} else {
|
|
1539
|
+
head.appendChild(style);
|
|
1540
|
+
}
|
|
1541
|
+
} else {
|
|
1542
|
+
head.appendChild(style);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
if (style.styleSheet) {
|
|
1546
|
+
style.styleSheet.cssText = css;
|
|
1547
|
+
} else {
|
|
1548
|
+
style.appendChild(document.createTextNode(css));
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
var css_248z$1 = ".wooris-toast-container {\n position: fixed;\n bottom: 20px;\n right: 20px;\n z-index: 1000;\n display: flex;\n flex-direction: column;\n gap: 10px; /* Space between toasts */\n align-items: flex-end; /* Align toasts to the right */\n}\n\n.wooris-toast {\n padding: 10px 20px;\n border-radius: 5px;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);\n min-width: 250px;\n opacity: 0;\n transform: translateX(100%); /* Slide in from right */\n animation: slideInToast 0.3s forwards;\n}\n\n.wooris-toast-message {\n margin-right: 10px;\n}\n\n.wooris-toast-close {\n background: none;\n border: none;\n color: #fff;\n font-size: 1.2em;\n cursor: pointer;\n}\n\n/* Types */\n\n.wooris-toast-info {\n background-color: #2196f3; /* Blue */\n}\n\n.wooris-toast-success {\n background-color: #4caf50; /* Green */\n}\n\n.wooris-toast-error {\n background-color: #f44336; /* Red */\n}\n\n.wooris-toast-warning {\n background-color: #ff9800; /* Orange */\n}\n\n@keyframes slideInToast {\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n";
|
|
1553
|
+
styleInject(css_248z$1,{"insertAt":"top"});
|
|
1554
|
+
|
|
1555
|
+
var ToastAlert = function ToastAlert(_ref) {
|
|
1556
|
+
var message = _ref.message,
|
|
1557
|
+
_ref$type = _ref.type,
|
|
1558
|
+
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
1559
|
+
_ref$duration = _ref.duration,
|
|
1560
|
+
duration = _ref$duration === void 0 ? 3000 : _ref$duration,
|
|
1561
|
+
onClose = _ref.onClose;
|
|
1562
|
+
useEffect(function () {
|
|
1563
|
+
var timer = setTimeout(function () {
|
|
1564
|
+
if (onClose) {
|
|
1565
|
+
onClose();
|
|
1566
|
+
}
|
|
1567
|
+
}, duration);
|
|
1568
|
+
return function () {
|
|
1569
|
+
return clearTimeout(timer);
|
|
1570
|
+
};
|
|
1571
|
+
}, [duration, onClose]);
|
|
1572
|
+
var toastClass = "wooris-toast wooris-toast-".concat(type);
|
|
1573
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1574
|
+
className: toastClass,
|
|
1575
|
+
role: "alert",
|
|
1576
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
1577
|
+
className: "wooris-toast-message",
|
|
1578
|
+
children: message
|
|
1579
|
+
}), /*#__PURE__*/jsx("button", {
|
|
1580
|
+
className: "wooris-toast-close",
|
|
1581
|
+
onClick: onClose,
|
|
1582
|
+
children: "\xD7"
|
|
1583
|
+
})]
|
|
1584
|
+
});
|
|
1585
|
+
};
|
|
1586
|
+
ToastAlert.propTypes = {
|
|
1587
|
+
message: propTypesExports.string.isRequired,
|
|
1588
|
+
type: propTypesExports.oneOf(['success', 'error', 'info', 'warning']),
|
|
1589
|
+
duration: propTypesExports.number,
|
|
1590
|
+
onClose: propTypesExports.func
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
const byteToHex = [];
|
|
1594
|
+
for (let i = 0; i < 256; ++i) {
|
|
1595
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
1596
|
+
}
|
|
1597
|
+
function unsafeStringify(arr, offset = 0) {
|
|
1598
|
+
return (byteToHex[arr[offset + 0]] +
|
|
1599
|
+
byteToHex[arr[offset + 1]] +
|
|
1600
|
+
byteToHex[arr[offset + 2]] +
|
|
1601
|
+
byteToHex[arr[offset + 3]] +
|
|
1602
|
+
'-' +
|
|
1603
|
+
byteToHex[arr[offset + 4]] +
|
|
1604
|
+
byteToHex[arr[offset + 5]] +
|
|
1605
|
+
'-' +
|
|
1606
|
+
byteToHex[arr[offset + 6]] +
|
|
1607
|
+
byteToHex[arr[offset + 7]] +
|
|
1608
|
+
'-' +
|
|
1609
|
+
byteToHex[arr[offset + 8]] +
|
|
1610
|
+
byteToHex[arr[offset + 9]] +
|
|
1611
|
+
'-' +
|
|
1612
|
+
byteToHex[arr[offset + 10]] +
|
|
1613
|
+
byteToHex[arr[offset + 11]] +
|
|
1614
|
+
byteToHex[arr[offset + 12]] +
|
|
1615
|
+
byteToHex[arr[offset + 13]] +
|
|
1616
|
+
byteToHex[arr[offset + 14]] +
|
|
1617
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
let getRandomValues;
|
|
1621
|
+
const rnds8 = new Uint8Array(16);
|
|
1622
|
+
function rng() {
|
|
1623
|
+
if (!getRandomValues) {
|
|
1624
|
+
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
1625
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
1626
|
+
}
|
|
1627
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
1628
|
+
}
|
|
1629
|
+
return getRandomValues(rnds8);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
1633
|
+
var native = { randomUUID };
|
|
1634
|
+
|
|
1635
|
+
function _v4(options, buf, offset) {
|
|
1636
|
+
options = options || {};
|
|
1637
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
1638
|
+
if (rnds.length < 16) {
|
|
1639
|
+
throw new Error('Random bytes length must be >= 16');
|
|
1640
|
+
}
|
|
1641
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
1642
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
1643
|
+
if (buf) {
|
|
1644
|
+
offset = offset || 0;
|
|
1645
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
1646
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
1647
|
+
}
|
|
1648
|
+
for (let i = 0; i < 16; ++i) {
|
|
1649
|
+
buf[offset + i] = rnds[i];
|
|
1650
|
+
}
|
|
1651
|
+
return buf;
|
|
1652
|
+
}
|
|
1653
|
+
return unsafeStringify(rnds);
|
|
1654
|
+
}
|
|
1655
|
+
function v4(options, buf, offset) {
|
|
1656
|
+
if (native.randomUUID && !buf && !options) {
|
|
1657
|
+
return native.randomUUID();
|
|
1658
|
+
}
|
|
1659
|
+
return _v4(options, buf, offset);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
var ToastContext = /*#__PURE__*/createContext();
|
|
1663
|
+
|
|
1664
|
+
// Custom hook to use the toast functions
|
|
1665
|
+
var useToast = function useToast() {
|
|
1666
|
+
return useContext(ToastContext);
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
// Toast Provider component
|
|
1670
|
+
var ToastProvider = function ToastProvider(_ref) {
|
|
1671
|
+
var children = _ref.children;
|
|
1672
|
+
var _useState = useState([]),
|
|
1673
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1674
|
+
toasts = _useState2[0],
|
|
1675
|
+
setToasts = _useState2[1];
|
|
1676
|
+
var addToast = useCallback(function (message) {
|
|
1677
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'info';
|
|
1678
|
+
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3000;
|
|
1679
|
+
var id = v4();
|
|
1680
|
+
setToasts(function (prevToasts) {
|
|
1681
|
+
return [].concat(_toConsumableArray(prevToasts), [{
|
|
1682
|
+
id: id,
|
|
1683
|
+
message: message,
|
|
1684
|
+
type: type,
|
|
1685
|
+
duration: duration
|
|
1686
|
+
}]);
|
|
1687
|
+
});
|
|
1688
|
+
}, []);
|
|
1689
|
+
var removeToast = useCallback(function (id) {
|
|
1690
|
+
setToasts(function (prevToasts) {
|
|
1691
|
+
return prevToasts.filter(function (toast) {
|
|
1692
|
+
return toast.id !== id;
|
|
1693
|
+
});
|
|
1694
|
+
});
|
|
1695
|
+
}, []);
|
|
1696
|
+
var showInfo = useCallback(function (message, duration) {
|
|
1697
|
+
return addToast(message, 'info', duration);
|
|
1698
|
+
}, [addToast]);
|
|
1699
|
+
var showSuccess = useCallback(function (message, duration) {
|
|
1700
|
+
return addToast(message, 'success', duration);
|
|
1701
|
+
}, [addToast]);
|
|
1702
|
+
var showError = useCallback(function (message, duration) {
|
|
1703
|
+
return addToast(message, 'error', duration);
|
|
1704
|
+
}, [addToast]);
|
|
1705
|
+
var showWarning = useCallback(function (message, duration) {
|
|
1706
|
+
return addToast(message, 'warning', duration);
|
|
1707
|
+
}, [addToast]);
|
|
1708
|
+
var contextValue = {
|
|
1709
|
+
showInfo: showInfo,
|
|
1710
|
+
showSuccess: showSuccess,
|
|
1711
|
+
showError: showError,
|
|
1712
|
+
showWarning: showWarning
|
|
1713
|
+
};
|
|
1714
|
+
return /*#__PURE__*/jsxs(ToastContext.Provider, {
|
|
1715
|
+
value: contextValue,
|
|
1716
|
+
children: [children, /*#__PURE__*/jsxs("div", {
|
|
1717
|
+
className: "wooris-toast-container",
|
|
1718
|
+
children: [" ", toasts.map(function (toast) {
|
|
1719
|
+
return /*#__PURE__*/jsx(ToastAlert, {
|
|
1720
|
+
message: toast.message,
|
|
1721
|
+
type: toast.type,
|
|
1722
|
+
duration: toast.duration,
|
|
1723
|
+
onClose: function onClose() {
|
|
1724
|
+
return removeToast(toast.id);
|
|
1725
|
+
}
|
|
1726
|
+
}, toast.id);
|
|
1727
|
+
})]
|
|
1728
|
+
})]
|
|
1729
|
+
});
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1424
1732
|
var colors = {
|
|
1425
1733
|
success: "#10B981",
|
|
1426
1734
|
error: "#EF4444",
|
|
@@ -1438,5 +1746,8 @@ var tokens = {
|
|
|
1438
1746
|
fonts: fonts
|
|
1439
1747
|
};
|
|
1440
1748
|
|
|
1441
|
-
|
|
1749
|
+
var css_248z = "@font-face {\n font-family: \"Freesentation-5Medium\";\n src: url(\"https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-5Medium.woff2\") format(\"woff2\");\n font-weight: 500;\n font-style: normal;\n font-display: swap;\n}\n\n\n:root {\n --color-success: #10B981;\n --color-error: #EF4444;\n --color-info: #3B82F6;\n --color-warning: #F59E0B;\n\n\n --color-primary: var(--color-info);\n --color-text: #111827;\n --color-bg: #ffffff;\n\n\n --font-sans: \"Freesentation-5Medium\", system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial;\n --font-size-base: 16px;\n --radius-sm: 6px;\n --radius-md: 10px;\n\n --breakpoint-sm: 600px;\n --breakpoint-md: 960px;\n --breakpoint-lg: 1280px;\n}\n\n\n.wooris-btn { font-family: var(--font-sans); border-radius: var(--radius-md); padding: 0.5rem 1rem; border: none; cursor: pointer; }\n\n\n.wooris-btn-primary { background: var(--color-primary); color: white; }\n\n\n.wooris-btn-success { background: var(--color-success); color: white; }\n\n\n.wooris-btn-error { background: var(--color-error); color: white; }\n\n\n.wooris-btn-info { background: var(--color-info); color: white; }\n\n\n.wooris-btn-warning { background: var(--color-warning); color: black; }\n\n\n.wooris-btn:disabled { opacity: 0.5; cursor: not-allowed; }\n\n\n/* Button Sizes */\n\n\n.wooris-btn-xs {\n padding: 0.2rem 0.5rem;\n font-size: 0.7rem;\n}\n\n\n.wooris-btn-sm {\n padding: 0.3rem 0.7rem;\n font-size: 0.8rem;\n}\n\n\n.wooris-btn-md {\n padding: 0.5rem 1rem;\n font-size: 1rem;\n}\n\n\n.wooris-btn-lg {\n padding: 0.7rem 1.2rem;\n font-size: 1.2rem;\n}\n\n\n.wooris-btn-xl {\n padding: 0.9rem 1.4rem;\n font-size: 1.4rem;\n}\n\n\n.wooris-btn-xl2 {\n padding: 1.1rem 1.6rem;\n font-size: 1.6rem;\n}\n\n\n.wooris-btn-xl3 {\n padding: 1.3rem 1.8rem;\n font-size: 1.8rem;\n}\n\n\n.wooris-badge { display:inline-flex; align-items:center; gap:0.4rem; font-family:var(--font-sans); padding: 0.2rem 0.5rem; border-radius: 9999px; font-size: 0.875rem; color: white; }\n\n\n.wooris-badge-primary { background: var(--color-primary); }\n\n\n.wooris-badge-success { background: var(--color-success); }\n\n\n.wooris-badge-error { background: var(--color-error); }\n\n\n.wooris-badge-info { background: var(--color-info); }\n\n\n.wooris-badge-warning { background: var(--color-warning); color: black; }\n\n\n.wooris-input { font-family:var(--font-sans); padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid #e5e7eb; }\n\n\n.wooris-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display:flex; align-items:center; justify-content:center; z-index: 9999; }\n\n\n.wooris-modal-sheet { background: white; border-radius: 12px; padding: 1rem; min-width: 320px; max-width: 720px; box-shadow: 0 10px 30px rgba(2,6,23,0.2); }\n\n\n/* Grid Styles */\n\n\n.wooris-grid-container {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n}\n\n\n.wooris-grid-item {\n min-width: 0; /* Ensures item can shrink */\n}\n\n\n/* Grid Item Sizes */\n\n\n.wooris-grid-item-xs {\n padding: 0.25rem;\n}\n\n\n.wooris-grid-item-sm {\n padding: 0.5rem;\n}\n\n\n.wooris-grid-item-md {\n padding: 1rem;\n}\n\n\n.wooris-grid-item-lg {\n padding: 1.5rem;\n}\n\n\n.wooris-grid-item-xl {\n padding: 2rem;\n}\n\n\n.wooris-grid-item-xl2 {\n padding: 2.5rem;\n}\n\n\n.wooris-grid-item-xl3 {\n padding: 3rem;\n}\n\n\n/* XS (default mobile-first) */\n\n\n.wooris-grid-xs-1 { grid-column: span 1 / span 1; }\n\n\n.wooris-grid-xs-2 { grid-column: span 2 / span 2; }\n\n\n.wooris-grid-xs-3 { grid-column: span 3 / span 3; }\n\n\n.wooris-grid-xs-4 { grid-column: span 4 / span 4; }\n\n\n.wooris-grid-xs-5 { grid-column: span 5 / span 5; }\n\n\n.wooris-grid-xs-6 { grid-column: span 6 / span 6; }\n\n\n.wooris-grid-xs-7 { grid-column: span 7 / span 7; }\n\n\n.wooris-grid-xs-8 { grid-column: span 8 / span 8; }\n\n\n.wooris-grid-xs-9 { grid-column: span 9 / span 9; }\n\n\n.wooris-grid-xs-10 { grid-column: span 10 / span 10; }\n\n\n.wooris-grid-xs-11 { grid-column: span 11 / span 11; }\n\n\n.wooris-grid-xs-12 { grid-column: span 12 / span 12; }\n\n\n/* SM breakpoint */\n\n\n@media (min-width: var(--breakpoint-sm)) {\n .wooris-grid-sm-1 { grid-column: span 1 / span 1; }\n .wooris-grid-sm-2 { grid-column: span 2 / span 2; }\n .wooris-grid-sm-3 { grid-column: span 3 / span 3; }\n .wooris-grid-sm-4 { grid-column: span 4 / span 4; }\n .wooris-grid-sm-5 { grid-column: span 5 / span 5; }\n .wooris-grid-sm-6 { grid-column: span 6 / span 6; }\n .wooris-grid-sm-7 { grid-column: span 7 / span 7; }\n .wooris-grid-sm-8 { grid-column: span 8 / span 8; }\n .wooris-grid-sm-9 { grid-column: span 9 / span 9; }\n .wooris-grid-sm-10 { grid-column: span 10 / span 10; }\n .wooris-grid-sm-11 { grid-column: span 11 / span 11; }\n .wooris-grid-sm-12 { grid-column: span 12 / span 12; }\n}\n\n\n/* MD breakpoint */\n\n\n@media (min-width: var(--breakpoint-md)) {\n .wooris-grid-md-1 { grid-column: span 1 / span 1; }\n .wooris-grid-md-2 { grid-column: span 2 / span 2; }\n .wooris-grid-md-3 { grid-column: span 3 / span 3; }\n .wooris-grid-md-4 { grid-column: span 4 / span 4; }\n .wooris-grid-md-5 { grid-column: span 5 / span 5; }\n .wooris-grid-md-6 { grid-column: span 6 / span 6; }\n .wooris-grid-md-7 { grid-column: span 7 / span 7; }\n .wooris-grid-md-8 { grid-column: span 8 / span 8; }\n .wooris-grid-md-9 { grid-column: span 9 / span 9; }\n .wooris-grid-md-10 { grid-column: span 10 / span 10; }\n .wooris-grid-md-11 { grid-column: span 11 / span 11; }\n .wooris-grid-md-12 { grid-column: span 12 / span 12; }\n}\n\n\n/* LG breakpoint */\n\n\n@media (min-width: var(--breakpoint-lg)) {\n .wooris-grid-lg-1 { grid-column: span 1 / span 1; }\n .wooris-grid-lg-2 { grid-column: span 2 / span 2; }\n .wooris-grid-lg-3 { grid-column: span 3 / span 3; }\n .wooris-grid-lg-4 { grid-column: span 4 / span 4; }\n .wooris-grid-lg-5 { grid-column: span 5 / span 5; }\n .wooris-grid-lg-6 { grid-column: span 6 / span 6; }\n .wooris-grid-lg-7 { grid-column: span 7 / span 7; }\n .wooris-grid-lg-8 { grid-column: span 8 / span 8; }\n .wooris-grid-lg-9 { grid-column: span 9 / span 9; }\n .wooris-grid-lg-10 { grid-column: span 10 / span 10; }\n .wooris-grid-lg-11 { grid-column: span 11 / span 11; }\n .wooris-grid-lg-12 { grid-column: span 12 / span 12; }\n}\n\n\n/* Card Styles */\n\n\n.wooris-card {\n background: var(--color-bg);\n border-radius: var(--radius-md);\n box-shadow: 0 1px 3px rgba(0,0,0,0.1);\n border: 1px solid #e5e7eb;\n}\n\n\n.wooris-card-xs {\n padding: 0.5rem;\n font-size: 0.75rem;\n}\n\n\n.wooris-card-sm {\n padding: 0.75rem;\n font-size: 0.875rem;\n}\n\n\n.wooris-card-md {\n padding: 1rem;\n font-size: 1rem;\n}\n\n\n.wooris-card-lg {\n padding: 1.5rem;\n font-size: 1.125rem;\n}\n\n\n.wooris-card-xl {\n padding: 2rem;\n font-size: 1.25rem;\n}\n\n\n.wooris-card-xl2 {\n padding: 2.5rem;\n font-size: 1.375rem;\n}\n\n\n.wooris-card-xl3 {\n padding: 3rem;\n font-size: 1.5rem;\n}\n\n\n* { box-sizing: border-box; }\n\n\nbody { margin: 0; font-family: var(--font-sans); color: var(--color-text); }";
|
|
1750
|
+
styleInject(css_248z,{"insertAt":"top"});
|
|
1751
|
+
|
|
1752
|
+
export { Badge, Button, Card, Grid, Input, Modal, ToastAlert, ToastProvider, colors, fonts, tokens, useToast };
|
|
1442
1753
|
//# sourceMappingURL=index.esm.js.map
|