@imc0nt0/wooris 0.0.4 → 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 +341 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +338 -21
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useContext, useState, useCallback, createContext } from 'react';
|
|
2
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,20 +1315,23 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1255
1315
|
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1256
1316
|
}
|
|
1257
1317
|
|
|
1258
|
-
var _excluded$
|
|
1318
|
+
var _excluded$3 = ["children", "variant", "type", "onClick", "className", "disabled"];
|
|
1259
1319
|
var Button = function Button(_ref) {
|
|
1260
1320
|
var children = _ref.children,
|
|
1261
1321
|
_ref$variant = _ref.variant,
|
|
1262
1322
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
1323
|
+
_ref$type = _ref.type,
|
|
1324
|
+
type = _ref$type === void 0 ? 'md' : _ref$type,
|
|
1263
1325
|
onClick = _ref.onClick,
|
|
1264
1326
|
_ref$className = _ref.className,
|
|
1265
1327
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1266
1328
|
_ref$disabled = _ref.disabled,
|
|
1267
1329
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1268
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
1330
|
+
rest = _objectWithoutProperties(_ref, _excluded$3);
|
|
1269
1331
|
var variantClass = "wooris-btn-".concat(variant);
|
|
1332
|
+
var typeClass = "wooris-btn-".concat(type);
|
|
1270
1333
|
return /*#__PURE__*/jsx("button", _objectSpread2(_objectSpread2({
|
|
1271
|
-
className: "wooris-btn ".concat(variantClass, " ").concat(className),
|
|
1334
|
+
className: "wooris-btn ".concat(variantClass, " ").concat(typeClass, " ").concat(className),
|
|
1272
1335
|
onClick: onClick,
|
|
1273
1336
|
disabled: disabled
|
|
1274
1337
|
}, rest), {}, {
|
|
@@ -1278,12 +1341,13 @@ var Button = function Button(_ref) {
|
|
|
1278
1341
|
Button.propTypes = {
|
|
1279
1342
|
children: propTypesExports.node,
|
|
1280
1343
|
variant: propTypesExports.oneOf(['primary', 'success', 'error', 'info', 'warning']),
|
|
1344
|
+
type: propTypesExports.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xl2', 'xl3']),
|
|
1281
1345
|
onClick: propTypesExports.func,
|
|
1282
1346
|
className: propTypesExports.string,
|
|
1283
1347
|
disabled: propTypesExports.bool
|
|
1284
1348
|
};
|
|
1285
1349
|
|
|
1286
|
-
var _excluded = ["placeholder", "value", "onChange", "className", "type"];
|
|
1350
|
+
var _excluded$2 = ["placeholder", "value", "onChange", "className", "type"];
|
|
1287
1351
|
var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1288
1352
|
var _ref$placeholder = _ref.placeholder,
|
|
1289
1353
|
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
@@ -1293,7 +1357,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1293
1357
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1294
1358
|
_ref$type = _ref.type,
|
|
1295
1359
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1296
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
1360
|
+
rest = _objectWithoutProperties(_ref, _excluded$2);
|
|
1297
1361
|
return /*#__PURE__*/jsx("input", _objectSpread2({
|
|
1298
1362
|
ref: ref,
|
|
1299
1363
|
className: "wooris-input ".concat(className),
|
|
@@ -1385,21 +1449,77 @@ Modal.propTypes = {
|
|
|
1385
1449
|
closeOnBackdrop: propTypesExports.bool
|
|
1386
1450
|
};
|
|
1387
1451
|
|
|
1388
|
-
var
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
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
|
+
}));
|
|
1396
1490
|
};
|
|
1397
|
-
|
|
1398
|
-
|
|
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
|
|
1399
1502
|
};
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
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
|
|
1403
1523
|
};
|
|
1404
1524
|
|
|
1405
1525
|
function styleInject(css, ref) {
|
|
@@ -1429,8 +1549,205 @@ function styleInject(css, ref) {
|
|
|
1429
1549
|
}
|
|
1430
1550
|
}
|
|
1431
1551
|
|
|
1432
|
-
var css_248z = "
|
|
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
|
+
|
|
1732
|
+
var colors = {
|
|
1733
|
+
success: "#10B981",
|
|
1734
|
+
error: "#EF4444",
|
|
1735
|
+
info: "#3B82F6",
|
|
1736
|
+
warning: "#F59E0B",
|
|
1737
|
+
primary: "#3B82F6",
|
|
1738
|
+
text: "#111827",
|
|
1739
|
+
bg: "#ffffff"
|
|
1740
|
+
};
|
|
1741
|
+
var fonts = {
|
|
1742
|
+
sans: 'Freesentation-5Medium, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial'
|
|
1743
|
+
};
|
|
1744
|
+
var tokens = {
|
|
1745
|
+
colors: colors,
|
|
1746
|
+
fonts: fonts
|
|
1747
|
+
};
|
|
1748
|
+
|
|
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); }";
|
|
1433
1750
|
styleInject(css_248z,{"insertAt":"top"});
|
|
1434
1751
|
|
|
1435
|
-
export { Badge, Button, Input, Modal, colors, fonts, tokens };
|
|
1752
|
+
export { Badge, Button, Card, Grid, Input, Modal, ToastAlert, ToastProvider, colors, fonts, tokens, useToast };
|
|
1436
1753
|
//# sourceMappingURL=index.esm.js.map
|