thailife-react 0.0.22 → 0.0.23
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/Autocomplete/Autocomplete.d.ts +17 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts.map +1 -0
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +9 -0
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts.map +1 -0
- package/dist/components/Box/Box.d.ts +86 -0
- package/dist/components/Box/Box.d.ts.map +1 -0
- package/dist/components/Box/Box.stories.d.ts +15 -0
- package/dist/components/Box/Box.stories.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +5 -5
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.stories.d.ts +0 -7
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +3 -8
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -8
- package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/components/Container/Container.d.ts +9 -0
- package/dist/components/Container/Container.d.ts.map +1 -0
- package/dist/components/Container/Container.stories.d.ts +12 -0
- package/dist/components/Container/Container.stories.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +30 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +7 -0
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +8 -15
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -11
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/Grid/Grid.d.ts +30 -0
- package/dist/components/Grid/Grid.d.ts.map +1 -0
- package/dist/components/Grid/Grid.stories.d.ts +13 -0
- package/dist/components/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/components/Input/Input.d.ts +5 -8
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.stories.d.ts +0 -8
- package/dist/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/components/InputFile/InputFile.d.ts +3 -11
- package/dist/components/InputFile/InputFile.d.ts.map +1 -1
- package/dist/components/InputFile/InputFile.stories.d.ts +0 -8
- package/dist/components/InputFile/InputFile.stories.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts +3 -7
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.stories.d.ts +0 -7
- package/dist/components/Radio/Radio.stories.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +3 -9
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.stories.d.ts +0 -8
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +3 -8
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -8
- package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +764 -218
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +767 -217
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -602
- package/dist/styles/index.d.ts +0 -76
- package/dist/styles/index.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { forwardRef, createElement, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import React__default, { forwardRef, createElement, useState, useRef, useEffect, useMemo } from 'react';
|
|
3
3
|
export { default as React, default } from 'react';
|
|
4
4
|
|
|
5
5
|
function _defineProperty(e, r, t) {
|
|
@@ -1427,363 +1427,270 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
1427
1427
|
|
|
1428
1428
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1429
1429
|
|
|
1430
|
-
|
|
1431
|
-
const cssClasses = {
|
|
1432
|
-
// Button
|
|
1433
|
-
button: "btn",
|
|
1434
|
-
buttonContained: "btn--contained",
|
|
1435
|
-
buttonOutlined: "btn--outlined",
|
|
1436
|
-
buttonLink: "btn--link",
|
|
1437
|
-
buttonSmall: "btn--sm",
|
|
1438
|
-
buttonMedium: "btn--md",
|
|
1439
|
-
buttonLarge: "btn--lg",
|
|
1440
|
-
buttonError: "btn--error",
|
|
1441
|
-
buttonDark: "btn--dark",
|
|
1442
|
-
buttonLight: "btn--light",
|
|
1443
|
-
buttonFullWidth: "btn--full-width",
|
|
1444
|
-
// Input
|
|
1445
|
-
inputContainer: "input-container",
|
|
1446
|
-
inputContainerFullWidth: "input-container--full-width",
|
|
1447
|
-
inputLabel: "input-label",
|
|
1448
|
-
input: "input",
|
|
1449
|
-
inputError: "input--error",
|
|
1450
|
-
inputFullWidth: "input--full-width",
|
|
1451
|
-
inputHelperText: "input-helper-text",
|
|
1452
|
-
inputHelperTextError: "input-helper-text--error",
|
|
1453
|
-
// Checkbox
|
|
1454
|
-
checkboxContainer: "checkbox-container",
|
|
1455
|
-
checkboxContainerFullWidth: "checkbox-container--full-width",
|
|
1456
|
-
checkboxWrapper: "checkbox-wrapper",
|
|
1457
|
-
checkbox: "checkbox",
|
|
1458
|
-
checkboxError: "checkbox--error",
|
|
1459
|
-
checkboxLabelContainer: "checkbox-label-container",
|
|
1460
|
-
checkboxLabel: "checkbox-label",
|
|
1461
|
-
// Radio
|
|
1462
|
-
radioContainer: "radio-container",
|
|
1463
|
-
radioContainerFullWidth: "radio-container--full-width",
|
|
1464
|
-
radioWrapper: "radio-wrapper",
|
|
1465
|
-
radio: "radio",
|
|
1466
|
-
radioError: "radio--error",
|
|
1467
|
-
radioLabelContainer: "radio-label-container",
|
|
1468
|
-
radioLabel: "radio-label",
|
|
1469
|
-
// Select
|
|
1470
|
-
selectContainer: "select-container",
|
|
1471
|
-
selectContainerFullWidth: "select-container--full-width",
|
|
1472
|
-
selectLabel: "select-label",
|
|
1473
|
-
selectWrapper: "select-wrapper",
|
|
1474
|
-
select: "select",
|
|
1475
|
-
selectError: "select--error",
|
|
1476
|
-
selectFullWidth: "select--full-width",
|
|
1477
|
-
selectIcon: "select-icon",
|
|
1478
|
-
// Textarea
|
|
1479
|
-
textareaContainer: "textarea-container",
|
|
1480
|
-
textareaContainerFullWidth: "textarea-container--full-width",
|
|
1481
|
-
textareaLabel: "textarea-label",
|
|
1482
|
-
textarea: "textarea",
|
|
1483
|
-
textareaError: "textarea--error",
|
|
1484
|
-
textareaFullWidth: "textarea--full-width",
|
|
1485
|
-
// InputFile
|
|
1486
|
-
inputFileContainer: "input-file-container",
|
|
1487
|
-
inputFileContainerFullWidth: "input-file-container--full-width",
|
|
1488
|
-
inputFileLabel: "input-file-label",
|
|
1489
|
-
inputFileWrapper: "input-file-wrapper",
|
|
1490
|
-
inputFileHidden: "input-file-hidden",
|
|
1491
|
-
inputFileUploadArea: "input-file-upload-area",
|
|
1492
|
-
inputFileUploadAreaError: "input-file-upload-area--error",
|
|
1493
|
-
inputFileUploadAreaFullWidth: "input-file-upload-area--full-width",
|
|
1494
|
-
inputFileButtonText: "input-file-button-text",
|
|
1495
|
-
inputFileMultipleText: "input-file-multiple-text",
|
|
1496
|
-
// Utility
|
|
1497
|
-
textCenter: "text-center",
|
|
1498
|
-
textLeft: "text-left",
|
|
1499
|
-
textRight: "text-right",
|
|
1500
|
-
fontBold: "font-bold",
|
|
1501
|
-
fontNormal: "font-normal",
|
|
1502
|
-
fontLight: "font-light",
|
|
1503
|
-
rounded: "rounded",
|
|
1504
|
-
roundedSm: "rounded-sm",
|
|
1505
|
-
roundedLg: "rounded-lg",
|
|
1506
|
-
roundedFull: "rounded-full",
|
|
1507
|
-
shadow: "shadow",
|
|
1508
|
-
shadowSm: "shadow-sm",
|
|
1509
|
-
shadowMd: "shadow-md",
|
|
1510
|
-
shadowLg: "shadow-lg",
|
|
1511
|
-
shadowXl: "shadow-xl"
|
|
1512
|
-
};
|
|
1513
|
-
|
|
1514
|
-
const _excluded$8 = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
|
|
1430
|
+
const _excluded$d = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
|
|
1515
1431
|
const Button = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1516
1432
|
let {
|
|
1517
1433
|
className,
|
|
1518
|
-
color =
|
|
1519
|
-
variant =
|
|
1520
|
-
size =
|
|
1434
|
+
color = 'primary',
|
|
1435
|
+
variant = 'contained',
|
|
1436
|
+
size = 'md',
|
|
1521
1437
|
fullWidth = false,
|
|
1522
1438
|
loading = false,
|
|
1523
1439
|
disabled,
|
|
1524
1440
|
children
|
|
1525
1441
|
} = _ref,
|
|
1526
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
const colorClass = color === "error" ? cssClasses.buttonError : color === "dark" ? cssClasses.buttonDark : color === "light" ? cssClasses.buttonLight : "";
|
|
1531
|
-
const fullWidthClass = fullWidth ? cssClasses.buttonFullWidth : "";
|
|
1532
|
-
const combinedClasses = [baseClass, variantClass, sizeClass, colorClass, fullWidthClass, className].filter(Boolean).join(" ");
|
|
1533
|
-
return jsxRuntimeExports.jsx("button", _objectSpread2(_objectSpread2({
|
|
1534
|
-
className: combinedClasses,
|
|
1442
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
1443
|
+
const classNames = ['btn', "btn--".concat(variant), "btn--".concat(size), "btn--".concat(color), fullWidth ? 'btn--full-width' : '', loading ? 'btn--loading' : '', disabled ? 'btn--disabled' : '', className].filter(Boolean).join(' ');
|
|
1444
|
+
return jsxRuntimeExports.jsxs("button", _objectSpread2(_objectSpread2({
|
|
1445
|
+
className: classNames,
|
|
1535
1446
|
disabled: disabled || loading,
|
|
1536
1447
|
ref: ref
|
|
1537
1448
|
}, props), {}, {
|
|
1538
|
-
children:
|
|
1449
|
+
children: [loading && jsxRuntimeExports.jsx("span", {
|
|
1450
|
+
className: "btn__loader"
|
|
1451
|
+
}), children]
|
|
1539
1452
|
}));
|
|
1540
1453
|
});
|
|
1541
|
-
Button.displayName =
|
|
1454
|
+
Button.displayName = 'Button';
|
|
1455
|
+
|
|
1456
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
1542
1457
|
|
|
1543
|
-
const _excluded$
|
|
1458
|
+
const _excluded$c = ["className", "type", "label", "error", "helperText", "size", "fullWidth", "id", "unit"];
|
|
1544
1459
|
const Input = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1545
1460
|
let {
|
|
1546
1461
|
className,
|
|
1547
|
-
type =
|
|
1462
|
+
type = 'text',
|
|
1548
1463
|
label,
|
|
1549
1464
|
error,
|
|
1550
1465
|
helperText,
|
|
1551
|
-
size =
|
|
1466
|
+
size = 'md',
|
|
1552
1467
|
fullWidth = false,
|
|
1553
|
-
id
|
|
1468
|
+
id,
|
|
1469
|
+
unit
|
|
1554
1470
|
} = _ref,
|
|
1555
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1471
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
1556
1472
|
const inputId = id || "input-".concat(Math.random().toString(36).substr(2, 9));
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1473
|
+
return (
|
|
1474
|
+
// <div className={clsx('input-container', fullWidth && 'input-container--full-width', className)}>
|
|
1475
|
+
// {label && (
|
|
1476
|
+
// <label className="input-label" htmlFor={inputId}>
|
|
1477
|
+
// {label}
|
|
1478
|
+
// </label>
|
|
1479
|
+
// )}
|
|
1480
|
+
// <input
|
|
1481
|
+
// type={type}
|
|
1482
|
+
// className={clsx('input', error && 'input--error', fullWidth && 'input--full-width')}
|
|
1483
|
+
// ref={ref}
|
|
1484
|
+
// id={inputId}
|
|
1485
|
+
// {...props}
|
|
1486
|
+
// />
|
|
1487
|
+
// {(error || helperText) && <p className={clsx('input-helper-text', error && 'input-helper-text--error')}>{error || helperText}</p>}
|
|
1488
|
+
// </div>
|
|
1489
|
+
jsxRuntimeExports.jsxs("div", {
|
|
1490
|
+
className: clsx('input-container', fullWidth && 'input-container--full-width', unit && 'input-container--has-unit', className),
|
|
1491
|
+
children: [jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
1492
|
+
type: type,
|
|
1493
|
+
className: clsx('input', error && 'input--error', fullWidth && 'input--full-width'),
|
|
1494
|
+
ref: ref,
|
|
1495
|
+
id: inputId
|
|
1496
|
+
}, props)), unit && jsxRuntimeExports.jsx("span", {
|
|
1497
|
+
className: "input-unit",
|
|
1498
|
+
children: unit
|
|
1499
|
+
})]
|
|
1500
|
+
})
|
|
1501
|
+
);
|
|
1577
1502
|
});
|
|
1578
|
-
Input.displayName =
|
|
1503
|
+
Input.displayName = 'Input';
|
|
1579
1504
|
|
|
1580
|
-
const _excluded$
|
|
1505
|
+
const _excluded$b = ["className", "label", "error", "helperText", "size", "fullWidth", "rows", "id"];
|
|
1581
1506
|
const Textarea = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1582
1507
|
let {
|
|
1583
1508
|
className,
|
|
1584
1509
|
label,
|
|
1585
1510
|
error,
|
|
1586
1511
|
helperText,
|
|
1587
|
-
size =
|
|
1512
|
+
size = 'md',
|
|
1588
1513
|
fullWidth = false,
|
|
1589
1514
|
rows = 3,
|
|
1590
1515
|
id
|
|
1591
1516
|
} = _ref,
|
|
1592
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1517
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
1593
1518
|
const textareaId = id || "textarea-".concat(Math.random().toString(36).substr(2, 9));
|
|
1594
|
-
const containerClass = fullWidth ? cssClasses.textareaContainerFullWidth : cssClasses.textareaContainer;
|
|
1595
|
-
const textareaClass = error ? "".concat(cssClasses.textarea, " ").concat(cssClasses.textareaError) : cssClasses.textarea;
|
|
1596
|
-
const textareaFullWidthClass = fullWidth ? cssClasses.textareaFullWidth : "";
|
|
1597
|
-
const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
|
|
1598
1519
|
return jsxRuntimeExports.jsxs("div", {
|
|
1599
|
-
className:
|
|
1520
|
+
className: clsx('textarea-container', fullWidth && 'textarea-container--full-width', className),
|
|
1600
1521
|
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1601
|
-
className:
|
|
1522
|
+
className: "textarea-label",
|
|
1602
1523
|
htmlFor: textareaId,
|
|
1603
1524
|
children: label
|
|
1604
1525
|
}), jsxRuntimeExports.jsx("textarea", _objectSpread2({
|
|
1605
|
-
className:
|
|
1526
|
+
className: clsx('textarea', error && 'textarea--error', fullWidth && 'textarea--full-width'),
|
|
1606
1527
|
ref: ref,
|
|
1607
1528
|
id: textareaId,
|
|
1608
1529
|
rows: rows
|
|
1609
1530
|
}, props)), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
1610
|
-
className:
|
|
1531
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
1611
1532
|
children: error || helperText
|
|
1612
1533
|
})]
|
|
1613
1534
|
});
|
|
1614
1535
|
});
|
|
1615
|
-
Textarea.displayName =
|
|
1536
|
+
Textarea.displayName = 'Textarea';
|
|
1616
1537
|
|
|
1617
|
-
const _excluded$
|
|
1538
|
+
const _excluded$a = ["className", "label", "error", "helperText", "size", "fullWidth", "multiple", "accept", "buttonText", "id"];
|
|
1618
1539
|
const InputFile = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1619
1540
|
let {
|
|
1620
1541
|
className,
|
|
1621
1542
|
label,
|
|
1622
1543
|
error,
|
|
1623
1544
|
helperText,
|
|
1624
|
-
size =
|
|
1545
|
+
size = 'md',
|
|
1625
1546
|
fullWidth = false,
|
|
1626
1547
|
multiple = false,
|
|
1627
1548
|
accept,
|
|
1628
|
-
buttonText =
|
|
1549
|
+
buttonText = 'Choose File',
|
|
1629
1550
|
id
|
|
1630
1551
|
} = _ref,
|
|
1631
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1552
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
1632
1553
|
const inputId = id || "input-file-".concat(Math.random().toString(36).substr(2, 9));
|
|
1633
|
-
const containerClass = fullWidth ? cssClasses.inputFileContainerFullWidth : cssClasses.inputFileContainer;
|
|
1634
|
-
const uploadAreaClass = error ? "".concat(cssClasses.inputFileUploadArea, " ").concat(cssClasses.inputFileUploadAreaError) : cssClasses.inputFileUploadArea;
|
|
1635
|
-
const uploadAreaFullWidthClass = fullWidth ? cssClasses.inputFileUploadAreaFullWidth : "";
|
|
1636
|
-
const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
|
|
1637
1554
|
return jsxRuntimeExports.jsxs("div", {
|
|
1638
|
-
className:
|
|
1555
|
+
className: clsx('input-file-container', fullWidth && 'input-file-container--full-width', className),
|
|
1639
1556
|
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1640
|
-
className:
|
|
1557
|
+
className: "input-file-label",
|
|
1641
1558
|
htmlFor: inputId,
|
|
1642
1559
|
children: label
|
|
1643
1560
|
}), jsxRuntimeExports.jsxs("div", {
|
|
1644
|
-
className:
|
|
1561
|
+
className: "input-file-wrapper",
|
|
1645
1562
|
children: [jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
1646
1563
|
type: "file",
|
|
1647
|
-
className:
|
|
1564
|
+
className: "input-file-hidden",
|
|
1648
1565
|
ref: ref,
|
|
1649
1566
|
id: inputId,
|
|
1650
1567
|
multiple: multiple,
|
|
1651
1568
|
accept: accept
|
|
1652
1569
|
}, props)), jsxRuntimeExports.jsxs("div", {
|
|
1653
|
-
className:
|
|
1570
|
+
className: clsx('input-file-upload-area', error && 'input-file-upload-area--error', fullWidth && 'input-file-upload-area--full-width'),
|
|
1654
1571
|
children: [jsxRuntimeExports.jsx("span", {
|
|
1655
|
-
className:
|
|
1572
|
+
className: "input-file-button-text",
|
|
1656
1573
|
children: buttonText
|
|
1657
1574
|
}), multiple && jsxRuntimeExports.jsx("span", {
|
|
1658
|
-
className:
|
|
1575
|
+
className: "input-file-multiple-text",
|
|
1659
1576
|
children: "or drag and drop"
|
|
1660
1577
|
})]
|
|
1661
1578
|
})]
|
|
1662
1579
|
}), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
1663
|
-
className:
|
|
1580
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
1664
1581
|
children: error || helperText
|
|
1665
1582
|
})]
|
|
1666
1583
|
});
|
|
1667
1584
|
});
|
|
1668
|
-
InputFile.displayName =
|
|
1585
|
+
InputFile.displayName = 'InputFile';
|
|
1669
1586
|
|
|
1670
|
-
const _excluded$
|
|
1587
|
+
const _excluded$9 = ["className", "label", "error", "helperText", "size", "fullWidth", "indeterminate", "id"];
|
|
1671
1588
|
const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1672
1589
|
let {
|
|
1673
1590
|
className,
|
|
1674
1591
|
label,
|
|
1675
1592
|
error,
|
|
1676
1593
|
helperText,
|
|
1677
|
-
size =
|
|
1594
|
+
size = 'md',
|
|
1678
1595
|
fullWidth = false,
|
|
1679
1596
|
indeterminate = false,
|
|
1680
1597
|
id
|
|
1681
1598
|
} = _ref,
|
|
1682
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1599
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
1683
1600
|
const checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
1684
1601
|
React__default.useEffect(() => {
|
|
1685
|
-
if (ref && typeof ref ===
|
|
1602
|
+
if (ref && typeof ref === 'object' && ref.current) {
|
|
1686
1603
|
ref.current.indeterminate = indeterminate;
|
|
1687
1604
|
}
|
|
1688
1605
|
}, [indeterminate, ref]);
|
|
1689
|
-
const containerClass = fullWidth ? cssClasses.checkboxContainerFullWidth : cssClasses.checkboxContainer;
|
|
1690
|
-
const checkboxClass = error ? "".concat(cssClasses.checkbox, " ").concat(cssClasses.checkboxError) : cssClasses.checkbox;
|
|
1691
|
-
const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
|
|
1692
1606
|
return jsxRuntimeExports.jsxs("div", {
|
|
1693
|
-
className:
|
|
1607
|
+
className: clsx('checkbox-container', fullWidth && 'checkbox-container--full-width', className),
|
|
1694
1608
|
children: [jsxRuntimeExports.jsx("div", {
|
|
1695
|
-
className:
|
|
1609
|
+
className: "checkbox-wrapper",
|
|
1696
1610
|
children: jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
1697
1611
|
type: "checkbox",
|
|
1698
|
-
className:
|
|
1612
|
+
className: clsx('checkbox', "checkbox--".concat(size), error && 'checkbox--error'),
|
|
1699
1613
|
ref: ref,
|
|
1700
1614
|
id: checkboxId
|
|
1701
1615
|
}, props))
|
|
1702
1616
|
}), jsxRuntimeExports.jsxs("div", {
|
|
1703
|
-
className:
|
|
1617
|
+
className: "checkbox-label-container",
|
|
1704
1618
|
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1705
|
-
className:
|
|
1619
|
+
className: "checkbox-label",
|
|
1706
1620
|
htmlFor: checkboxId,
|
|
1707
1621
|
children: label
|
|
1708
1622
|
}), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
1709
|
-
className:
|
|
1623
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
1710
1624
|
children: error || helperText
|
|
1711
1625
|
})]
|
|
1712
1626
|
})]
|
|
1713
1627
|
});
|
|
1714
1628
|
});
|
|
1715
|
-
Checkbox.displayName =
|
|
1629
|
+
Checkbox.displayName = 'Checkbox';
|
|
1716
1630
|
|
|
1717
|
-
const _excluded$
|
|
1631
|
+
const _excluded$8 = ["className", "label", "error", "helperText", "size", "fullWidth", "id"];
|
|
1718
1632
|
const Radio = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1719
1633
|
let {
|
|
1720
1634
|
className,
|
|
1721
1635
|
label,
|
|
1722
1636
|
error,
|
|
1723
1637
|
helperText,
|
|
1724
|
-
size =
|
|
1638
|
+
size = 'md',
|
|
1725
1639
|
fullWidth = false,
|
|
1726
1640
|
id
|
|
1727
1641
|
} = _ref,
|
|
1728
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1642
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
1729
1643
|
const radioId = id || "radio-".concat(Math.random().toString(36).substr(2, 9));
|
|
1730
|
-
const containerClass = fullWidth ? cssClasses.radioContainerFullWidth : cssClasses.radioContainer;
|
|
1731
|
-
const radioClass = error ? "".concat(cssClasses.radio, " ").concat(cssClasses.radioError) : cssClasses.radio;
|
|
1732
|
-
const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
|
|
1733
1644
|
return jsxRuntimeExports.jsxs("div", {
|
|
1734
|
-
className:
|
|
1645
|
+
className: clsx('radio-container', fullWidth && 'radio-container--full-width', className),
|
|
1735
1646
|
children: [jsxRuntimeExports.jsx("div", {
|
|
1736
|
-
className:
|
|
1647
|
+
className: "radio-wrapper",
|
|
1737
1648
|
children: jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
1738
1649
|
type: "radio",
|
|
1739
|
-
className:
|
|
1650
|
+
className: clsx('radio', error && 'radio--error'),
|
|
1740
1651
|
ref: ref,
|
|
1741
1652
|
id: radioId
|
|
1742
1653
|
}, props))
|
|
1743
1654
|
}), jsxRuntimeExports.jsxs("div", {
|
|
1744
|
-
className:
|
|
1655
|
+
className: "radio-label-container",
|
|
1745
1656
|
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1746
|
-
className:
|
|
1657
|
+
className: "radio-label",
|
|
1747
1658
|
htmlFor: radioId,
|
|
1748
1659
|
children: label
|
|
1749
1660
|
}), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
1750
|
-
className:
|
|
1661
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
1751
1662
|
children: error || helperText
|
|
1752
1663
|
})]
|
|
1753
1664
|
})]
|
|
1754
1665
|
});
|
|
1755
1666
|
});
|
|
1756
|
-
Radio.displayName =
|
|
1667
|
+
Radio.displayName = 'Radio';
|
|
1757
1668
|
|
|
1758
|
-
const _excluded$
|
|
1669
|
+
const _excluded$7 = ["className", "label", "error", "helperText", "size", "fullWidth", "options", "placeholder", "id"];
|
|
1759
1670
|
const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1760
1671
|
let {
|
|
1761
1672
|
className,
|
|
1762
1673
|
label,
|
|
1763
1674
|
error,
|
|
1764
1675
|
helperText,
|
|
1765
|
-
size =
|
|
1676
|
+
size = 'md',
|
|
1766
1677
|
fullWidth = false,
|
|
1767
1678
|
options,
|
|
1768
1679
|
placeholder,
|
|
1769
1680
|
id
|
|
1770
1681
|
} = _ref,
|
|
1771
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1682
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1772
1683
|
const selectId = id || "select-".concat(Math.random().toString(36).substr(2, 9));
|
|
1773
|
-
const containerClass = fullWidth ? cssClasses.selectContainerFullWidth : cssClasses.selectContainer;
|
|
1774
|
-
const selectClass = error ? "".concat(cssClasses.select, " ").concat(cssClasses.selectError) : cssClasses.select;
|
|
1775
|
-
const selectFullWidthClass = fullWidth ? cssClasses.selectFullWidth : "";
|
|
1776
|
-
const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
|
|
1777
1684
|
return jsxRuntimeExports.jsxs("div", {
|
|
1778
|
-
className:
|
|
1685
|
+
className: clsx('select-container', fullWidth && 'select-container--full-width', className),
|
|
1779
1686
|
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1780
|
-
className:
|
|
1687
|
+
className: "select-label",
|
|
1781
1688
|
htmlFor: selectId,
|
|
1782
1689
|
children: label
|
|
1783
1690
|
}), jsxRuntimeExports.jsxs("div", {
|
|
1784
|
-
className:
|
|
1691
|
+
className: "select-wrapper",
|
|
1785
1692
|
children: [jsxRuntimeExports.jsxs("select", _objectSpread2(_objectSpread2({
|
|
1786
|
-
className:
|
|
1693
|
+
className: clsx('select', error && 'select--error', fullWidth && 'select--full-width'),
|
|
1787
1694
|
ref: ref,
|
|
1788
1695
|
id: selectId
|
|
1789
1696
|
}, props), {}, {
|
|
@@ -1797,7 +1704,7 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1797
1704
|
children: option.label
|
|
1798
1705
|
}, option.value))]
|
|
1799
1706
|
})), jsxRuntimeExports.jsx("div", {
|
|
1800
|
-
className:
|
|
1707
|
+
className: "select-icon",
|
|
1801
1708
|
children: jsxRuntimeExports.jsx("svg", {
|
|
1802
1709
|
width: "16",
|
|
1803
1710
|
height: "16",
|
|
@@ -1805,7 +1712,7 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1805
1712
|
stroke: "currentColor",
|
|
1806
1713
|
viewBox: "0 0 24 24",
|
|
1807
1714
|
style: {
|
|
1808
|
-
color:
|
|
1715
|
+
color: '#9ca3af'
|
|
1809
1716
|
},
|
|
1810
1717
|
children: jsxRuntimeExports.jsx("path", {
|
|
1811
1718
|
strokeLinecap: "round",
|
|
@@ -1816,12 +1723,12 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1816
1723
|
})
|
|
1817
1724
|
})]
|
|
1818
1725
|
}), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
1819
|
-
className:
|
|
1726
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
1820
1727
|
children: error || helperText
|
|
1821
1728
|
})]
|
|
1822
1729
|
});
|
|
1823
1730
|
});
|
|
1824
|
-
Select.displayName =
|
|
1731
|
+
Select.displayName = 'Select';
|
|
1825
1732
|
|
|
1826
1733
|
/**
|
|
1827
1734
|
* @license lucide-react v0.542.0 - ISC
|
|
@@ -1871,7 +1778,7 @@ var defaultAttributes = {
|
|
|
1871
1778
|
strokeLinejoin: "round"
|
|
1872
1779
|
};
|
|
1873
1780
|
|
|
1874
|
-
const _excluded$
|
|
1781
|
+
const _excluded$6 = ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children", "iconNode"];
|
|
1875
1782
|
const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
1876
1783
|
let {
|
|
1877
1784
|
color = "currentColor",
|
|
@@ -1882,7 +1789,7 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1882
1789
|
children,
|
|
1883
1790
|
iconNode
|
|
1884
1791
|
} = _ref,
|
|
1885
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
1792
|
+
rest = _objectWithoutProperties(_ref, _excluded$6);
|
|
1886
1793
|
return /*#__PURE__*/createElement("svg", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1887
1794
|
ref
|
|
1888
1795
|
}, defaultAttributes), {}, {
|
|
@@ -1899,13 +1806,13 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1899
1806
|
}), ...(Array.isArray(children) ? children : [children])]);
|
|
1900
1807
|
});
|
|
1901
1808
|
|
|
1902
|
-
const _excluded = ["className"];
|
|
1809
|
+
const _excluded$5 = ["className"];
|
|
1903
1810
|
const createLucideIcon = (iconName, iconNode) => {
|
|
1904
1811
|
const Component = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
1905
1812
|
let {
|
|
1906
1813
|
className
|
|
1907
1814
|
} = _ref,
|
|
1908
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
1815
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1909
1816
|
return /*#__PURE__*/createElement(Icon, _objectSpread2({
|
|
1910
1817
|
ref,
|
|
1911
1818
|
iconNode,
|
|
@@ -2011,7 +1918,7 @@ const isDisabled = (date, disabledPast, disabledFuture) => {
|
|
|
2011
1918
|
}
|
|
2012
1919
|
return false;
|
|
2013
1920
|
};
|
|
2014
|
-
const DatePicker =
|
|
1921
|
+
const DatePicker = _ref => {
|
|
2015
1922
|
let {
|
|
2016
1923
|
format = 'DD/MM/YYYY',
|
|
2017
1924
|
language = 'en',
|
|
@@ -2024,8 +1931,13 @@ const DatePicker = (_ref, props) => {
|
|
|
2024
1931
|
showClear = true,
|
|
2025
1932
|
showToday = true,
|
|
2026
1933
|
disabledPast = false,
|
|
2027
|
-
|
|
2028
|
-
|
|
1934
|
+
disabledFuture = false,
|
|
1935
|
+
fullWidth = false,
|
|
1936
|
+
label,
|
|
1937
|
+
error,
|
|
1938
|
+
helperText,
|
|
1939
|
+
id,
|
|
1940
|
+
showIcon = true
|
|
2029
1941
|
} = _ref;
|
|
2030
1942
|
// State
|
|
2031
1943
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -2040,6 +1952,7 @@ const DatePicker = (_ref, props) => {
|
|
|
2040
1952
|
// Constants
|
|
2041
1953
|
const includeTime = format.includes('HH:mm');
|
|
2042
1954
|
const t = translations[language];
|
|
1955
|
+
const inputId = id || "datepicker-".concat(Math.random().toString(36).substr(2, 9));
|
|
2043
1956
|
// Initialize from value prop
|
|
2044
1957
|
useEffect(() => {
|
|
2045
1958
|
if (value) {
|
|
@@ -2200,32 +2113,37 @@ const DatePicker = (_ref, props) => {
|
|
|
2200
2113
|
const calendarDays = generateCalendarDays();
|
|
2201
2114
|
const today = new Date();
|
|
2202
2115
|
const displayYear = yearType === 'be' ? convertYear(currentYear) : currentYear;
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2116
|
+
const containerClasses = ['datepicker-container', fullWidth ? 'datepicker-container-full-width' : '', className].filter(Boolean).join(' ');
|
|
2117
|
+
const inputClasses = ['datepicker-input', error ? 'datepicker-input-error' : ''].filter(Boolean).join(' ');
|
|
2118
|
+
return jsxRuntimeExports.jsxs("div", {
|
|
2119
|
+
className: containerClasses,
|
|
2120
|
+
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2121
|
+
className: "input-label",
|
|
2122
|
+
htmlFor: inputId,
|
|
2123
|
+
children: label
|
|
2206
2124
|
}), jsxRuntimeExports.jsxs("div", {
|
|
2207
2125
|
ref: containerRef,
|
|
2208
|
-
className: "
|
|
2126
|
+
className: "datepicker ".concat(fullWidth ? 'datepicker-full-width' : ''),
|
|
2209
2127
|
children: [jsxRuntimeExports.jsxs("div", {
|
|
2210
|
-
className: "
|
|
2211
|
-
children: [jsxRuntimeExports.jsx("input",
|
|
2128
|
+
className: "datepicker-input-wrapper",
|
|
2129
|
+
children: [jsxRuntimeExports.jsx("input", {
|
|
2212
2130
|
type: "text",
|
|
2213
2131
|
value: inputValue,
|
|
2214
2132
|
placeholder: placeholder || format,
|
|
2215
2133
|
disabled: disabled,
|
|
2216
2134
|
readOnly: true,
|
|
2217
2135
|
onClick: () => !disabled && setIsOpen(true),
|
|
2218
|
-
className:
|
|
2219
|
-
|
|
2220
|
-
|
|
2136
|
+
className: inputClasses,
|
|
2137
|
+
id: inputId
|
|
2138
|
+
}), showIcon && jsxRuntimeExports.jsx("div", {
|
|
2139
|
+
className: "datepicker-icon",
|
|
2221
2140
|
children: jsxRuntimeExports.jsx(CalendarDays, {
|
|
2222
2141
|
size: "18"
|
|
2223
2142
|
})
|
|
2224
2143
|
})]
|
|
2225
2144
|
}), isOpen && jsxRuntimeExports.jsx("div", {
|
|
2226
|
-
className: "
|
|
2145
|
+
className: "datepicker-dropdown",
|
|
2227
2146
|
children: jsxRuntimeExports.jsxs("div", {
|
|
2228
|
-
className: "datetime-picker-calendar",
|
|
2229
2147
|
children: [jsxRuntimeExports.jsxs("div", {
|
|
2230
2148
|
className: "calendar-header",
|
|
2231
2149
|
children: [jsxRuntimeExports.jsx("button", {
|
|
@@ -2273,6 +2191,7 @@ const DatePicker = (_ref, props) => {
|
|
|
2273
2191
|
const isSelected = selectedDate && isSameDay(actualDate, selectedDate);
|
|
2274
2192
|
const isToday = isSameDay(actualDate, today);
|
|
2275
2193
|
const isDayDisabled = isDisabled(actualDate, disabledPast, disabledFuture);
|
|
2194
|
+
const dayClasses = ['calendar-day', dateInfo.isOtherMonth ? 'calendar-day-other-month' : '', isSelected ? 'calendar-day-selected' : '', isToday ? 'calendar-day-today' : '', isDayDisabled ? 'calendar-day-disabled' : ''].filter(Boolean).join(' ');
|
|
2276
2195
|
return jsxRuntimeExports.jsx("button", {
|
|
2277
2196
|
type: "button",
|
|
2278
2197
|
onClick: () => {
|
|
@@ -2299,7 +2218,7 @@ const DatePicker = (_ref, props) => {
|
|
|
2299
2218
|
}
|
|
2300
2219
|
},
|
|
2301
2220
|
disabled: isDayDisabled,
|
|
2302
|
-
className:
|
|
2221
|
+
className: dayClasses,
|
|
2303
2222
|
children: dateInfo.day
|
|
2304
2223
|
}, index);
|
|
2305
2224
|
})
|
|
@@ -2342,7 +2261,7 @@ const DatePicker = (_ref, props) => {
|
|
|
2342
2261
|
type: "button",
|
|
2343
2262
|
onClick: handleToday,
|
|
2344
2263
|
disabled: isDisabled(today, disabledPast, disabledFuture),
|
|
2345
|
-
className: "footer-button today-button ".concat(isDisabled(today, disabledPast, disabledFuture) ? 'disabled' : ''),
|
|
2264
|
+
className: "footer-button today-button ".concat(isDisabled(today, disabledPast, disabledFuture) ? 'calendar-day-disabled' : ''),
|
|
2346
2265
|
children: t.today
|
|
2347
2266
|
}), showClear && jsxRuntimeExports.jsx("button", {
|
|
2348
2267
|
type: "button",
|
|
@@ -2358,11 +2277,638 @@ const DatePicker = (_ref, props) => {
|
|
|
2358
2277
|
})]
|
|
2359
2278
|
})
|
|
2360
2279
|
})]
|
|
2280
|
+
}), (error || helperText) && jsxRuntimeExports.jsx("p", {
|
|
2281
|
+
className: "input-helper-text ".concat(error ? 'input-helper-text-error' : ''),
|
|
2282
|
+
children: error || helperText
|
|
2283
|
+
})]
|
|
2284
|
+
});
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2287
|
+
const _excluded$4 = ["columns", "data", "className", "emptyMessage", "pagination", "paginationPerPage", "paginationRowsPerPageOptions", "search", "searchPlaceholder", "searchableColumns", "onSort", "onPageChange", "onRowsPerPageChange", "onSearch"];
|
|
2288
|
+
const DataTable = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
2289
|
+
let {
|
|
2290
|
+
columns,
|
|
2291
|
+
data,
|
|
2292
|
+
className,
|
|
2293
|
+
emptyMessage = "No data available",
|
|
2294
|
+
pagination = false,
|
|
2295
|
+
paginationPerPage = 10,
|
|
2296
|
+
paginationRowsPerPageOptions = [10, 25, 50, 100],
|
|
2297
|
+
search = false,
|
|
2298
|
+
searchPlaceholder = "Search...",
|
|
2299
|
+
searchableColumns,
|
|
2300
|
+
onSort,
|
|
2301
|
+
onPageChange,
|
|
2302
|
+
onRowsPerPageChange,
|
|
2303
|
+
onSearch
|
|
2304
|
+
} = _ref,
|
|
2305
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
2306
|
+
const [sortField, setSortField] = useState(null);
|
|
2307
|
+
const [sortDirection, setSortDirection] = useState("asc");
|
|
2308
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
2309
|
+
const [rowsPerPage, setRowsPerPage] = useState(paginationPerPage);
|
|
2310
|
+
const rowsPerPageOptions = useMemo(() => {
|
|
2311
|
+
const options = [...paginationRowsPerPageOptions];
|
|
2312
|
+
if (!options.includes(paginationPerPage)) {
|
|
2313
|
+
options.push(paginationPerPage);
|
|
2314
|
+
options.sort((a, b) => a - b);
|
|
2315
|
+
}
|
|
2316
|
+
return options;
|
|
2317
|
+
}, [paginationRowsPerPageOptions, paginationPerPage]);
|
|
2318
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
2319
|
+
const defaultSearchableColumns = searchableColumns || columns.map(col => col.key);
|
|
2320
|
+
const filteredData = useMemo(() => {
|
|
2321
|
+
if (!searchTerm) return data;
|
|
2322
|
+
return data.filter(row => defaultSearchableColumns.some(key => String(row[key]).toLowerCase().includes(searchTerm.toLowerCase())));
|
|
2323
|
+
}, [data, searchTerm, defaultSearchableColumns]);
|
|
2324
|
+
const sortedData = useMemo(() => {
|
|
2325
|
+
if (!sortField) return filteredData;
|
|
2326
|
+
return [...filteredData].sort((a, b) => {
|
|
2327
|
+
const aValue = a[sortField];
|
|
2328
|
+
const bValue = b[sortField];
|
|
2329
|
+
if (aValue < bValue) return sortDirection === "asc" ? -1 : 1;
|
|
2330
|
+
if (aValue > bValue) return sortDirection === "asc" ? 1 : -1;
|
|
2331
|
+
return 0;
|
|
2332
|
+
});
|
|
2333
|
+
}, [filteredData, sortField, sortDirection]);
|
|
2334
|
+
const paginatedData = useMemo(() => {
|
|
2335
|
+
if (!pagination) return sortedData;
|
|
2336
|
+
const start = (currentPage - 1) * rowsPerPage;
|
|
2337
|
+
return sortedData.slice(start, start + rowsPerPage);
|
|
2338
|
+
}, [sortedData, currentPage, rowsPerPage, pagination]);
|
|
2339
|
+
const totalPages = Math.ceil(sortedData.length / rowsPerPage);
|
|
2340
|
+
const handleSort = columnKey => {
|
|
2341
|
+
const newDirection = sortField === columnKey && sortDirection === "asc" ? "desc" : "asc";
|
|
2342
|
+
setSortField(columnKey);
|
|
2343
|
+
setSortDirection(newDirection);
|
|
2344
|
+
onSort === null || onSort === void 0 || onSort(columnKey, newDirection);
|
|
2345
|
+
};
|
|
2346
|
+
const handlePageChange = page => {
|
|
2347
|
+
setCurrentPage(page);
|
|
2348
|
+
onPageChange === null || onPageChange === void 0 || onPageChange(page);
|
|
2349
|
+
};
|
|
2350
|
+
const handleRowsPerPageChange = newRowsPerPage => {
|
|
2351
|
+
setRowsPerPage(newRowsPerPage);
|
|
2352
|
+
setCurrentPage(1);
|
|
2353
|
+
onRowsPerPageChange === null || onRowsPerPageChange === void 0 || onRowsPerPageChange(newRowsPerPage);
|
|
2354
|
+
};
|
|
2355
|
+
const handleSearchChange = e => {
|
|
2356
|
+
const term = e.target.value;
|
|
2357
|
+
setSearchTerm(term);
|
|
2358
|
+
setCurrentPage(1);
|
|
2359
|
+
onSearch === null || onSearch === void 0 || onSearch(term);
|
|
2360
|
+
};
|
|
2361
|
+
const renderPagination = () => {
|
|
2362
|
+
if (!pagination) return null;
|
|
2363
|
+
const pageNumbers = [];
|
|
2364
|
+
const maxPagesToShow = 5;
|
|
2365
|
+
const halfPages = Math.floor(maxPagesToShow / 2);
|
|
2366
|
+
let startPage = Math.max(1, currentPage - halfPages);
|
|
2367
|
+
let endPage = Math.min(totalPages, startPage + maxPagesToShow - 1);
|
|
2368
|
+
if (endPage - startPage < maxPagesToShow - 1) {
|
|
2369
|
+
startPage = Math.max(1, endPage - maxPagesToShow + 1);
|
|
2370
|
+
}
|
|
2371
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
2372
|
+
pageNumbers.push(i);
|
|
2373
|
+
}
|
|
2374
|
+
return jsxRuntimeExports.jsxs("div", {
|
|
2375
|
+
className: "data-table-pagination-container",
|
|
2376
|
+
children: [jsxRuntimeExports.jsxs("div", {
|
|
2377
|
+
children: ["Rows per page:", jsxRuntimeExports.jsx("select", {
|
|
2378
|
+
value: rowsPerPage,
|
|
2379
|
+
onChange: e => handleRowsPerPageChange(Number(e.target.value)),
|
|
2380
|
+
className: "data-table-pagination-select",
|
|
2381
|
+
children: rowsPerPageOptions.map(option => jsxRuntimeExports.jsx("option", {
|
|
2382
|
+
value: option,
|
|
2383
|
+
children: option
|
|
2384
|
+
}, option))
|
|
2385
|
+
})]
|
|
2386
|
+
}), jsxRuntimeExports.jsxs("div", {
|
|
2387
|
+
className: "data-table-pagination-controls",
|
|
2388
|
+
children: [jsxRuntimeExports.jsx("button", {
|
|
2389
|
+
onClick: () => handlePageChange(1),
|
|
2390
|
+
disabled: currentPage === 1,
|
|
2391
|
+
className: "data-table-pagination-button",
|
|
2392
|
+
children: "First"
|
|
2393
|
+
}), jsxRuntimeExports.jsx("button", {
|
|
2394
|
+
onClick: () => handlePageChange(currentPage - 1),
|
|
2395
|
+
disabled: currentPage === 1,
|
|
2396
|
+
className: "data-table-pagination-button",
|
|
2397
|
+
children: "Previous"
|
|
2398
|
+
}), startPage > 1 && jsxRuntimeExports.jsx("span", {
|
|
2399
|
+
className: "pagination-ellipsis",
|
|
2400
|
+
children: "..."
|
|
2401
|
+
}), pageNumbers.map(page => jsxRuntimeExports.jsx("button", {
|
|
2402
|
+
onClick: () => handlePageChange(page),
|
|
2403
|
+
className: "data-table-pagination-button ".concat(currentPage === page ? 'active' : ''),
|
|
2404
|
+
children: page
|
|
2405
|
+
}, page)), endPage < totalPages && jsxRuntimeExports.jsx("span", {
|
|
2406
|
+
className: "pagination-ellipsis",
|
|
2407
|
+
children: "..."
|
|
2408
|
+
}), jsxRuntimeExports.jsx("button", {
|
|
2409
|
+
onClick: () => handlePageChange(currentPage + 1),
|
|
2410
|
+
disabled: currentPage === totalPages,
|
|
2411
|
+
className: "data-table-pagination-button",
|
|
2412
|
+
children: "Next"
|
|
2413
|
+
}), jsxRuntimeExports.jsx("button", {
|
|
2414
|
+
onClick: () => handlePageChange(totalPages),
|
|
2415
|
+
disabled: currentPage === totalPages,
|
|
2416
|
+
className: "data-table-pagination-button",
|
|
2417
|
+
children: "Last"
|
|
2418
|
+
})]
|
|
2419
|
+
})]
|
|
2420
|
+
});
|
|
2421
|
+
};
|
|
2422
|
+
return jsxRuntimeExports.jsxs("div", {
|
|
2423
|
+
className: "data-table-container",
|
|
2424
|
+
children: [search && jsxRuntimeExports.jsx("div", {
|
|
2425
|
+
className: "data-table-search-container",
|
|
2426
|
+
children: jsxRuntimeExports.jsx(Input, {
|
|
2427
|
+
type: "text",
|
|
2428
|
+
placeholder: searchPlaceholder,
|
|
2429
|
+
value: searchTerm,
|
|
2430
|
+
onChange: handleSearchChange,
|
|
2431
|
+
fullWidth: true
|
|
2432
|
+
})
|
|
2433
|
+
}), jsxRuntimeExports.jsxs("table", _objectSpread2(_objectSpread2({
|
|
2434
|
+
className: "data-table ".concat(className || ''),
|
|
2435
|
+
ref: ref
|
|
2436
|
+
}, props), {}, {
|
|
2437
|
+
children: [jsxRuntimeExports.jsx("thead", {
|
|
2438
|
+
className: "data-table-header",
|
|
2439
|
+
children: jsxRuntimeExports.jsx("tr", {
|
|
2440
|
+
children: columns.map(column => {
|
|
2441
|
+
const thClasses = ["data-table-header-cell", column.align === "center" && "text-center", column.align === "right" && "text-right", column.sortable && "sortable"].filter(Boolean).join(" ");
|
|
2442
|
+
const contentClasses = ["header-cell-content", "justify-".concat(column.align || 'start')].join(' ');
|
|
2443
|
+
return jsxRuntimeExports.jsx("th", {
|
|
2444
|
+
className: thClasses,
|
|
2445
|
+
style: {
|
|
2446
|
+
width: column.width
|
|
2447
|
+
},
|
|
2448
|
+
onClick: column.sortable ? () => handleSort(column.key) : undefined,
|
|
2449
|
+
children: jsxRuntimeExports.jsxs("div", {
|
|
2450
|
+
className: contentClasses,
|
|
2451
|
+
children: [column.label, column.sortable && sortField === column.key && jsxRuntimeExports.jsx("span", {
|
|
2452
|
+
className: "sort-icon",
|
|
2453
|
+
children: sortDirection === "asc" ? "↑" : "↓"
|
|
2454
|
+
})]
|
|
2455
|
+
})
|
|
2456
|
+
}, column.key);
|
|
2457
|
+
})
|
|
2458
|
+
})
|
|
2459
|
+
}), jsxRuntimeExports.jsx("tbody", {
|
|
2460
|
+
className: "data-table-body",
|
|
2461
|
+
children: paginatedData.length === 0 ? jsxRuntimeExports.jsx("tr", {
|
|
2462
|
+
children: jsxRuntimeExports.jsx("td", {
|
|
2463
|
+
colSpan: columns.length,
|
|
2464
|
+
className: "data-table-empty-cell",
|
|
2465
|
+
children: emptyMessage
|
|
2466
|
+
})
|
|
2467
|
+
}) : paginatedData.map((row, rowIndex) => jsxRuntimeExports.jsx("tr", {
|
|
2468
|
+
className: "data-table-row",
|
|
2469
|
+
children: columns.map(column => {
|
|
2470
|
+
const value = row[column.key];
|
|
2471
|
+
const cellContent = column.render ? column.render(value, row, rowIndex) : value;
|
|
2472
|
+
const tdClasses = ["data-table-cell", column.align === "center" && "text-center", column.align === "right" && "text-right"].filter(Boolean).join(" ");
|
|
2473
|
+
return jsxRuntimeExports.jsx("td", {
|
|
2474
|
+
className: tdClasses,
|
|
2475
|
+
children: cellContent
|
|
2476
|
+
}, column.key);
|
|
2477
|
+
})
|
|
2478
|
+
}, rowIndex))
|
|
2479
|
+
})]
|
|
2480
|
+
})), renderPagination()]
|
|
2481
|
+
});
|
|
2482
|
+
});
|
|
2483
|
+
DataTable.displayName = "DataTable";
|
|
2484
|
+
|
|
2485
|
+
const _excluded$3 = ["options", "value", "onChange", "placeholder", "disabled", "fullWidth", "label", "helperText", "error", "multiple"];
|
|
2486
|
+
const Autocomplete = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
2487
|
+
let {
|
|
2488
|
+
options,
|
|
2489
|
+
value,
|
|
2490
|
+
onChange,
|
|
2491
|
+
placeholder = 'Type to search...',
|
|
2492
|
+
disabled = false,
|
|
2493
|
+
fullWidth = false,
|
|
2494
|
+
label,
|
|
2495
|
+
helperText,
|
|
2496
|
+
error = false,
|
|
2497
|
+
multiple = false
|
|
2498
|
+
} = _ref,
|
|
2499
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
2500
|
+
const getInitialInputValue = () => {
|
|
2501
|
+
if (!multiple && value && typeof value === 'string') {
|
|
2502
|
+
return value;
|
|
2503
|
+
}
|
|
2504
|
+
return '';
|
|
2505
|
+
};
|
|
2506
|
+
const [inputValue, setInputValue] = useState(getInitialInputValue);
|
|
2507
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
2508
|
+
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
2509
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
2510
|
+
const inputRef = useRef(null);
|
|
2511
|
+
const dropdownRef = useRef(null);
|
|
2512
|
+
const currentValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
2513
|
+
const isSelected = option => currentValues.includes(option);
|
|
2514
|
+
useEffect(() => {
|
|
2515
|
+
if (!multiple && value && typeof value === 'string') {
|
|
2516
|
+
setInputValue(value);
|
|
2517
|
+
} else if (!multiple && !value) {
|
|
2518
|
+
setInputValue('');
|
|
2519
|
+
}
|
|
2520
|
+
}, [value, multiple]);
|
|
2521
|
+
useEffect(() => {
|
|
2522
|
+
const filtered = options.filter(option => option.toLowerCase().includes(inputValue.toLowerCase()) && (!multiple || !isSelected(option)));
|
|
2523
|
+
setFilteredOptions(filtered);
|
|
2524
|
+
setSelectedIndex(-1);
|
|
2525
|
+
}, [inputValue, options, multiple, currentValues]);
|
|
2526
|
+
useEffect(() => {
|
|
2527
|
+
if (!multiple && showDropdown && inputValue === '' && options.length > 0) {
|
|
2528
|
+
setFilteredOptions(options.filter(option => !isSelected(option)));
|
|
2529
|
+
}
|
|
2530
|
+
}, [showDropdown, inputValue, options, multiple, isSelected]);
|
|
2531
|
+
const handleInputChange = e => {
|
|
2532
|
+
const newValue = e.target.value;
|
|
2533
|
+
setInputValue(newValue);
|
|
2534
|
+
setShowDropdown(true);
|
|
2535
|
+
if (!multiple && value && newValue !== value) {
|
|
2536
|
+
onChange === null || onChange === void 0 || onChange('');
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
const handleInputFocus = () => {
|
|
2540
|
+
setShowDropdown(true);
|
|
2541
|
+
if (!multiple && (inputValue === '' || !value)) {
|
|
2542
|
+
setFilteredOptions(options);
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
const handleInputBlur = () => {
|
|
2546
|
+
setTimeout(() => setShowDropdown(false), 150);
|
|
2547
|
+
};
|
|
2548
|
+
const handleOptionClick = option => {
|
|
2549
|
+
if (multiple) {
|
|
2550
|
+
const newValues = isSelected(option) ? currentValues.filter(v => v !== option) : [...currentValues, option];
|
|
2551
|
+
onChange === null || onChange === void 0 || onChange(newValues);
|
|
2552
|
+
setInputValue('');
|
|
2553
|
+
} else {
|
|
2554
|
+
onChange === null || onChange === void 0 || onChange(option);
|
|
2555
|
+
setInputValue(option);
|
|
2556
|
+
setFilteredOptions([]);
|
|
2557
|
+
}
|
|
2558
|
+
setShowDropdown(false);
|
|
2559
|
+
};
|
|
2560
|
+
const handleRemoveTag = option => {
|
|
2561
|
+
if (multiple) {
|
|
2562
|
+
const newValues = currentValues.filter(v => v !== option);
|
|
2563
|
+
onChange === null || onChange === void 0 || onChange(newValues);
|
|
2564
|
+
}
|
|
2565
|
+
};
|
|
2566
|
+
const handleKeyDown = e => {
|
|
2567
|
+
if (!showDropdown) return;
|
|
2568
|
+
switch (e.key) {
|
|
2569
|
+
case 'ArrowDown':
|
|
2570
|
+
e.preventDefault();
|
|
2571
|
+
setSelectedIndex(prev => Math.min(prev + 1, filteredOptions.length - 1));
|
|
2572
|
+
break;
|
|
2573
|
+
case 'ArrowUp':
|
|
2574
|
+
e.preventDefault();
|
|
2575
|
+
setSelectedIndex(prev => Math.max(prev - 1, -1));
|
|
2576
|
+
break;
|
|
2577
|
+
case 'Enter':
|
|
2578
|
+
e.preventDefault();
|
|
2579
|
+
if (selectedIndex >= 0 && filteredOptions[selectedIndex]) {
|
|
2580
|
+
handleOptionClick(filteredOptions[selectedIndex]);
|
|
2581
|
+
}
|
|
2582
|
+
break;
|
|
2583
|
+
case 'Escape':
|
|
2584
|
+
setShowDropdown(false);
|
|
2585
|
+
setSelectedIndex(-1);
|
|
2586
|
+
break;
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
return jsxRuntimeExports.jsxs("div", {
|
|
2590
|
+
className: clsx('autocomplete-container', fullWidth && 'autocomplete-container--full-width'),
|
|
2591
|
+
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2592
|
+
className: "input-label",
|
|
2593
|
+
children: label
|
|
2594
|
+
}), jsxRuntimeExports.jsxs("div", {
|
|
2595
|
+
className: "autocomplete-wrapper",
|
|
2596
|
+
children: [jsxRuntimeExports.jsxs("div", {
|
|
2597
|
+
className: clsx('autocomplete-input-area', error && 'autocomplete-input-area--error', disabled && 'autocomplete-input-area--disabled', fullWidth && 'autocomplete-input-area--full-width'),
|
|
2598
|
+
children: [multiple && currentValues.map((val, index) => jsxRuntimeExports.jsxs("span", {
|
|
2599
|
+
className: "autocomplete-tag",
|
|
2600
|
+
children: [val, jsxRuntimeExports.jsx("button", {
|
|
2601
|
+
type: "button",
|
|
2602
|
+
onClick: () => handleRemoveTag(val),
|
|
2603
|
+
className: "autocomplete-tag-remove",
|
|
2604
|
+
children: "\u00D7"
|
|
2605
|
+
})]
|
|
2606
|
+
}, "".concat(val, "-").concat(index))), jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
2607
|
+
ref: ref || inputRef,
|
|
2608
|
+
type: "text",
|
|
2609
|
+
value: inputValue,
|
|
2610
|
+
onChange: handleInputChange,
|
|
2611
|
+
onFocus: handleInputFocus,
|
|
2612
|
+
onBlur: handleInputBlur,
|
|
2613
|
+
onKeyDown: handleKeyDown,
|
|
2614
|
+
placeholder: multiple ? currentValues.length > 0 ? '' : placeholder : inputValue ? '' : placeholder,
|
|
2615
|
+
disabled: disabled,
|
|
2616
|
+
className: "autocomplete-input"
|
|
2617
|
+
}, props))]
|
|
2618
|
+
}), showDropdown && filteredOptions.length > 0 && jsxRuntimeExports.jsx("ul", {
|
|
2619
|
+
ref: dropdownRef,
|
|
2620
|
+
className: "autocomplete-dropdown",
|
|
2621
|
+
children: filteredOptions.map((option, index) => jsxRuntimeExports.jsx("li", {
|
|
2622
|
+
onClick: () => handleOptionClick(option),
|
|
2623
|
+
className: clsx('autocomplete-option', selectedIndex === index && 'autocomplete-option--selected'),
|
|
2624
|
+
children: option
|
|
2625
|
+
}, option))
|
|
2626
|
+
})]
|
|
2627
|
+
}), helperText && jsxRuntimeExports.jsx("div", {
|
|
2628
|
+
className: clsx('input-helper-text', error && 'input-helper-text--error'),
|
|
2629
|
+
children: helperText
|
|
2361
2630
|
})]
|
|
2362
2631
|
});
|
|
2632
|
+
});
|
|
2633
|
+
Autocomplete.displayName = 'Autocomplete';
|
|
2634
|
+
|
|
2635
|
+
const _excluded$2 = ["component", "sx", "children", "className", "style", "display", "flexDirection", "justifyContent", "alignItems", "flexWrap", "gap", "p", "pt", "pr", "pb", "pl", "px", "py", "m", "mt", "mr", "mb", "ml", "mx", "my", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "bgcolor", "color", "borderRadius", "boxShadow", "position", "top", "right", "bottom", "left", "zIndex", "overflow", "textAlign"];
|
|
2636
|
+
// Hardcoded theme for now
|
|
2637
|
+
const theme = {
|
|
2638
|
+
spacing: {
|
|
2639
|
+
'0': '0',
|
|
2640
|
+
'1': '0.25rem',
|
|
2641
|
+
'2': '0.5rem',
|
|
2642
|
+
'3': '0.75rem',
|
|
2643
|
+
'4': '1rem',
|
|
2644
|
+
'5': '1.25rem',
|
|
2645
|
+
'6': '1.5rem',
|
|
2646
|
+
'8': '2rem',
|
|
2647
|
+
'10': '2.5rem',
|
|
2648
|
+
'12': '3rem',
|
|
2649
|
+
'16': '4rem',
|
|
2650
|
+
'20': '5rem',
|
|
2651
|
+
'24': '6rem',
|
|
2652
|
+
'32': '8rem',
|
|
2653
|
+
'40': '10rem',
|
|
2654
|
+
'48': '12rem',
|
|
2655
|
+
'56': '14rem',
|
|
2656
|
+
'64': '16rem'
|
|
2657
|
+
},
|
|
2658
|
+
borderRadius: {
|
|
2659
|
+
sm: '0.125rem',
|
|
2660
|
+
md: '0.25rem',
|
|
2661
|
+
lg: '0.5rem',
|
|
2662
|
+
full: '9999px'
|
|
2663
|
+
},
|
|
2664
|
+
shadows: {
|
|
2665
|
+
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
2666
|
+
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
|
2667
|
+
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)'
|
|
2668
|
+
}
|
|
2669
|
+
};
|
|
2670
|
+
// Helper function to convert system props to a style object
|
|
2671
|
+
const createSystemStyles = props => {
|
|
2672
|
+
const styles = {};
|
|
2673
|
+
if (props.display) styles.display = props.display;
|
|
2674
|
+
if (props.flexDirection) styles.flexDirection = props.flexDirection;
|
|
2675
|
+
if (props.justifyContent) styles.justifyContent = props.justifyContent;
|
|
2676
|
+
if (props.alignItems) styles.alignItems = props.alignItems;
|
|
2677
|
+
if (props.flexWrap) styles.flexWrap = props.flexWrap;
|
|
2678
|
+
if (props.gap) styles.gap = theme.spacing[props.gap];
|
|
2679
|
+
// Padding
|
|
2680
|
+
if (props.p) styles.padding = theme.spacing[props.p];
|
|
2681
|
+
if (props.pt) styles.paddingTop = theme.spacing[props.pt];
|
|
2682
|
+
if (props.pr) styles.paddingRight = theme.spacing[props.pr];
|
|
2683
|
+
if (props.pb) styles.paddingBottom = theme.spacing[props.pb];
|
|
2684
|
+
if (props.pl) styles.paddingLeft = theme.spacing[props.pl];
|
|
2685
|
+
if (props.px) {
|
|
2686
|
+
styles.paddingLeft = theme.spacing[props.px];
|
|
2687
|
+
styles.paddingRight = theme.spacing[props.px];
|
|
2688
|
+
}
|
|
2689
|
+
if (props.py) {
|
|
2690
|
+
styles.paddingTop = theme.spacing[props.py];
|
|
2691
|
+
styles.paddingBottom = theme.spacing[props.py];
|
|
2692
|
+
}
|
|
2693
|
+
// Margin
|
|
2694
|
+
if (props.m) styles.margin = theme.spacing[props.m];
|
|
2695
|
+
if (props.mt) styles.marginTop = theme.spacing[props.mt];
|
|
2696
|
+
if (props.mr) styles.marginRight = theme.spacing[props.mr];
|
|
2697
|
+
if (props.mb) styles.marginBottom = theme.spacing[props.mb];
|
|
2698
|
+
if (props.ml) styles.marginLeft = theme.spacing[props.ml];
|
|
2699
|
+
if (props.mx) {
|
|
2700
|
+
styles.marginLeft = theme.spacing[props.mx];
|
|
2701
|
+
styles.marginRight = theme.spacing[props.mx];
|
|
2702
|
+
}
|
|
2703
|
+
if (props.my) {
|
|
2704
|
+
styles.marginTop = theme.spacing[props.my];
|
|
2705
|
+
styles.marginBottom = theme.spacing[props.my];
|
|
2706
|
+
}
|
|
2707
|
+
// Dimensions
|
|
2708
|
+
if (props.width) styles.width = typeof props.width === 'number' ? "".concat(props.width, "px") : props.width;
|
|
2709
|
+
if (props.height) styles.height = typeof props.height === 'number' ? "".concat(props.height, "px") : props.height;
|
|
2710
|
+
if (props.minWidth) styles.minWidth = typeof props.minWidth === 'number' ? "".concat(props.minWidth, "px") : props.minWidth;
|
|
2711
|
+
if (props.minHeight) styles.minHeight = typeof props.minHeight === 'number' ? "".concat(props.minHeight, "px") : props.minHeight;
|
|
2712
|
+
if (props.maxWidth) styles.maxWidth = typeof props.maxWidth === 'number' ? "".concat(props.maxWidth, "px") : props.maxWidth;
|
|
2713
|
+
if (props.maxHeight) styles.maxHeight = typeof props.maxHeight === 'number' ? "".concat(props.maxHeight, "px") : props.maxHeight;
|
|
2714
|
+
// Colors
|
|
2715
|
+
if (props.bgcolor) styles.backgroundColor = props.bgcolor;
|
|
2716
|
+
if (props.color) styles.color = props.color;
|
|
2717
|
+
// Border radius
|
|
2718
|
+
if (props.borderRadius) styles.borderRadius = theme.borderRadius[props.borderRadius];
|
|
2719
|
+
// Box shadow
|
|
2720
|
+
if (props.boxShadow) styles.boxShadow = theme.shadows[props.boxShadow];
|
|
2721
|
+
// Position
|
|
2722
|
+
if (props.position) styles.position = props.position;
|
|
2723
|
+
if (props.top) styles.top = typeof props.top === 'number' ? "".concat(props.top, "px") : props.top;
|
|
2724
|
+
if (props.right) styles.right = typeof props.right === 'number' ? "".concat(props.right, "px") : props.right;
|
|
2725
|
+
if (props.bottom) styles.bottom = typeof props.bottom === 'number' ? "".concat(props.bottom, "px") : props.bottom;
|
|
2726
|
+
if (props.left) styles.left = typeof props.left === 'number' ? "".concat(props.left, "px") : props.left;
|
|
2727
|
+
if (props.zIndex) styles.zIndex = props.zIndex;
|
|
2728
|
+
// Overflow
|
|
2729
|
+
if (props.overflow) styles.overflow = props.overflow;
|
|
2730
|
+
// Text align
|
|
2731
|
+
if (props.textAlign) styles.textAlign = props.textAlign;
|
|
2732
|
+
return styles;
|
|
2363
2733
|
};
|
|
2734
|
+
const Box = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
2735
|
+
const {
|
|
2736
|
+
component = 'div',
|
|
2737
|
+
sx,
|
|
2738
|
+
children,
|
|
2739
|
+
className,
|
|
2740
|
+
style,
|
|
2741
|
+
// System props
|
|
2742
|
+
display,
|
|
2743
|
+
flexDirection,
|
|
2744
|
+
justifyContent,
|
|
2745
|
+
alignItems,
|
|
2746
|
+
flexWrap,
|
|
2747
|
+
gap,
|
|
2748
|
+
p,
|
|
2749
|
+
pt,
|
|
2750
|
+
pr,
|
|
2751
|
+
pb,
|
|
2752
|
+
pl,
|
|
2753
|
+
px,
|
|
2754
|
+
py,
|
|
2755
|
+
m,
|
|
2756
|
+
mt,
|
|
2757
|
+
mr,
|
|
2758
|
+
mb,
|
|
2759
|
+
ml,
|
|
2760
|
+
mx,
|
|
2761
|
+
my,
|
|
2762
|
+
width,
|
|
2763
|
+
height,
|
|
2764
|
+
minWidth,
|
|
2765
|
+
minHeight,
|
|
2766
|
+
maxWidth,
|
|
2767
|
+
maxHeight,
|
|
2768
|
+
bgcolor,
|
|
2769
|
+
color,
|
|
2770
|
+
borderRadius,
|
|
2771
|
+
boxShadow,
|
|
2772
|
+
position,
|
|
2773
|
+
top,
|
|
2774
|
+
right,
|
|
2775
|
+
bottom,
|
|
2776
|
+
left,
|
|
2777
|
+
zIndex,
|
|
2778
|
+
overflow,
|
|
2779
|
+
textAlign
|
|
2780
|
+
} = props,
|
|
2781
|
+
otherProps = _objectWithoutProperties(props, _excluded$2);
|
|
2782
|
+
const Component = component;
|
|
2783
|
+
// Create system styles from individual props
|
|
2784
|
+
const systemProps = {
|
|
2785
|
+
display,
|
|
2786
|
+
flexDirection,
|
|
2787
|
+
justifyContent,
|
|
2788
|
+
alignItems,
|
|
2789
|
+
flexWrap,
|
|
2790
|
+
gap,
|
|
2791
|
+
p,
|
|
2792
|
+
pt,
|
|
2793
|
+
pr,
|
|
2794
|
+
pb,
|
|
2795
|
+
pl,
|
|
2796
|
+
px,
|
|
2797
|
+
py,
|
|
2798
|
+
m,
|
|
2799
|
+
mt,
|
|
2800
|
+
mr,
|
|
2801
|
+
mb,
|
|
2802
|
+
ml,
|
|
2803
|
+
mx,
|
|
2804
|
+
my,
|
|
2805
|
+
width,
|
|
2806
|
+
height,
|
|
2807
|
+
minWidth,
|
|
2808
|
+
minHeight,
|
|
2809
|
+
maxWidth,
|
|
2810
|
+
maxHeight,
|
|
2811
|
+
bgcolor,
|
|
2812
|
+
color,
|
|
2813
|
+
borderRadius,
|
|
2814
|
+
boxShadow,
|
|
2815
|
+
position,
|
|
2816
|
+
top,
|
|
2817
|
+
right,
|
|
2818
|
+
bottom,
|
|
2819
|
+
left,
|
|
2820
|
+
zIndex,
|
|
2821
|
+
overflow,
|
|
2822
|
+
textAlign
|
|
2823
|
+
};
|
|
2824
|
+
const systemStyles = createSystemStyles(systemProps);
|
|
2825
|
+
const sxStyles = sx ? createSystemStyles(sx) : {};
|
|
2826
|
+
const combinedStyles = _objectSpread2(_objectSpread2(_objectSpread2({}, systemStyles), sxStyles), style);
|
|
2827
|
+
return jsxRuntimeExports.jsx(Component, _objectSpread2(_objectSpread2({
|
|
2828
|
+
className: className,
|
|
2829
|
+
style: combinedStyles,
|
|
2830
|
+
ref: ref
|
|
2831
|
+
}, otherProps), {}, {
|
|
2832
|
+
children: children
|
|
2833
|
+
}));
|
|
2834
|
+
});
|
|
2835
|
+
Box.displayName = 'Box';
|
|
2836
|
+
|
|
2837
|
+
const _excluded$1 = ["className", "maxWidth", "disableGutters", "fixed", "children"];
|
|
2838
|
+
const Container = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
2839
|
+
let {
|
|
2840
|
+
className,
|
|
2841
|
+
maxWidth = 'lg',
|
|
2842
|
+
disableGutters = false,
|
|
2843
|
+
fixed = false,
|
|
2844
|
+
children
|
|
2845
|
+
} = _ref,
|
|
2846
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
2847
|
+
const classNames = clsx('container', !disableGutters && 'container--gutters', fixed && 'container--fixed', maxWidth !== 'none' && "container--max-width-".concat(maxWidth), className);
|
|
2848
|
+
return jsxRuntimeExports.jsx("div", _objectSpread2(_objectSpread2({
|
|
2849
|
+
className: classNames,
|
|
2850
|
+
ref: ref
|
|
2851
|
+
}, props), {}, {
|
|
2852
|
+
children: children
|
|
2853
|
+
}));
|
|
2854
|
+
});
|
|
2855
|
+
Container.displayName = 'Container';
|
|
2856
|
+
|
|
2857
|
+
const _excluded = ["children", "className", "container", "item", "spacing", "direction", "justifyContent", "alignItems", "wrap", "xs", "sm", "md", "lg", "xl"];
|
|
2858
|
+
const Grid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
2859
|
+
let {
|
|
2860
|
+
children,
|
|
2861
|
+
className,
|
|
2862
|
+
container = false,
|
|
2863
|
+
item = false,
|
|
2864
|
+
spacing = 0,
|
|
2865
|
+
direction = 'row',
|
|
2866
|
+
justifyContent,
|
|
2867
|
+
alignItems,
|
|
2868
|
+
wrap = 'wrap',
|
|
2869
|
+
xs,
|
|
2870
|
+
sm,
|
|
2871
|
+
md,
|
|
2872
|
+
lg,
|
|
2873
|
+
xl
|
|
2874
|
+
} = _ref,
|
|
2875
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
2876
|
+
const classNames = ['grid'];
|
|
2877
|
+
if (container) {
|
|
2878
|
+
classNames.push('grid-container');
|
|
2879
|
+
classNames.push("grid-direction-".concat(direction));
|
|
2880
|
+
if (justifyContent) {
|
|
2881
|
+
classNames.push("grid-justify-content-".concat(justifyContent));
|
|
2882
|
+
}
|
|
2883
|
+
if (alignItems) {
|
|
2884
|
+
classNames.push("grid-align-items-".concat(alignItems));
|
|
2885
|
+
}
|
|
2886
|
+
classNames.push("grid-wrap-".concat(wrap));
|
|
2887
|
+
if (spacing) {
|
|
2888
|
+
classNames.push("grid-spacing-".concat(spacing));
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
if (item) {
|
|
2892
|
+
classNames.push('grid-item');
|
|
2893
|
+
if (xs) classNames.push("grid-xs-".concat(String(xs)));
|
|
2894
|
+
if (sm) classNames.push("grid-sm-".concat(String(sm)));
|
|
2895
|
+
if (md) classNames.push("grid-md-".concat(String(md)));
|
|
2896
|
+
if (lg) classNames.push("grid-lg-".concat(String(lg)));
|
|
2897
|
+
if (xl) classNames.push("grid-xl-".concat(String(xl)));
|
|
2898
|
+
}
|
|
2899
|
+
if (className) {
|
|
2900
|
+
classNames.push(className);
|
|
2901
|
+
}
|
|
2902
|
+
return jsxRuntimeExports.jsx("div", _objectSpread2(_objectSpread2({
|
|
2903
|
+
className: classNames.join(' '),
|
|
2904
|
+
ref: ref
|
|
2905
|
+
}, props), {}, {
|
|
2906
|
+
children: children
|
|
2907
|
+
}));
|
|
2908
|
+
});
|
|
2909
|
+
Grid.displayName = 'Grid';
|
|
2364
2910
|
|
|
2365
2911
|
// Ensure React is available before importing components
|
|
2366
2912
|
|
|
2367
|
-
export { Button, Checkbox, DatePicker, Input, InputFile, Radio, Select, Textarea
|
|
2913
|
+
export { Autocomplete, Box, Button, Checkbox, Container, DataTable, DatePicker, Grid, Input, InputFile, Radio, Select, Textarea };
|
|
2368
2914
|
//# sourceMappingURL=index.esm.js.map
|