bianic-ui 2.13.0-alpha.1 → 2.14.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +102 -26
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Button/NavButton/NavButton.d.ts +10 -0
- package/dist/cjs/types/components/Button/NavButton/index.d.ts +1 -0
- package/dist/cjs/types/components/Button/index.d.ts +1 -0
- package/dist/cjs/types/components/Forms/FileUploader/SimpleFileUploader.d.ts +3 -6
- package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +1 -1
- package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
- package/dist/cjs/types/components/Forms/TagLabelInput/index.d.ts +0 -1
- package/dist/cjs/types/components/index.d.ts +3 -2
- package/dist/cjs/types/stories/Form/FileUploader/SimpleFileUploader.stories.d.ts +1 -0
- package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +3 -1
- package/dist/cjs/types/stories/Form/Radio.stories.d.ts +3 -1
- package/dist/cjs/types/utility/index.d.ts +2 -1
- package/dist/cjs/types/utility/public/words.d.ts +14 -0
- package/dist/esm/index.js +102 -27
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Button/NavButton/NavButton.d.ts +10 -0
- package/dist/esm/types/components/Button/NavButton/index.d.ts +1 -0
- package/dist/esm/types/components/Button/index.d.ts +1 -0
- package/dist/esm/types/components/Forms/FileUploader/SimpleFileUploader.d.ts +3 -6
- package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +1 -1
- package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
- package/dist/esm/types/components/Forms/TagLabelInput/index.d.ts +0 -1
- package/dist/esm/types/components/index.d.ts +3 -2
- package/dist/esm/types/stories/Form/FileUploader/SimpleFileUploader.stories.d.ts +1 -0
- package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +3 -1
- package/dist/esm/types/stories/Form/Radio.stories.d.ts +3 -1
- package/dist/esm/types/utility/index.d.ts +2 -1
- package/dist/esm/types/utility/public/words.d.ts +14 -0
- package/dist/index.d.ts +19 -8
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1665,7 +1665,7 @@ var ContextualButton = React.forwardRef(function (_a, ref) {
|
|
|
1665
1665
|
: 'text-primary-white'
|
|
1666
1666
|
: textColorConfig[variant];
|
|
1667
1667
|
var stateColor = stateColorConfig[isSelected ? 'selected' : 'default'];
|
|
1668
|
-
return (React.createElement("button", __assign({ ref: ref, className: "bianic-contextual-button box-border flex min-h-[
|
|
1668
|
+
return (React.createElement("button", __assign({ ref: ref, className: "bianic-contextual-button box-border flex min-h-[23px] flex-row items-center rounded-radius-sm border border-transparent p-[1px] outline-none ".concat(stateColor, " ").concat(textColor) }, props, { disabled: disabled }),
|
|
1669
1669
|
icon,
|
|
1670
1670
|
label && (React.createElement("div", { className: "label flex max-h-[46px] items-center gap-x-0.5 px-[5px] text-[12px] leading-none" },
|
|
1671
1671
|
React.createElement("span", null, label),
|
|
@@ -2507,8 +2507,8 @@ var Radio = React.forwardRef(function Radio(_a, ref) {
|
|
|
2507
2507
|
return (React.createElement("div", { className: cn$1('flex items-center', containerClassName) },
|
|
2508
2508
|
React.createElement("div", { className: cn$1('relative flex flex-shrink-0 items-center justify-center rounded-full', checkSize, backgroundClass) },
|
|
2509
2509
|
React.createElement("input", { ref: ref, id: id, type: "radio", className: cn$1('checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue disabled:cursor-not-allowed disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50', inputFocusClass, inputClassName, className), name: name, value: value, required: required, readOnly: readOnly, autoComplete: autoComplete, tabIndex: tabIndex, role: role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, onChange: onChange, onClick: onClick, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, checked: checked, defaultChecked: defaultChecked, disabled: disabled }),
|
|
2510
|
-
React.createElement("div", { className: cn$1('check-icon z-1 group flex h-full w-full justify-center rounded-full border-2 border-primary-white text-bia-grey outline-2 outline-
|
|
2511
|
-
React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label))));
|
|
2510
|
+
React.createElement("div", { className: cn$1('check-icon z-1 group flex h-full w-full justify-center rounded-full border-2 border-primary-white text-bia-grey outline-2 outline-transparent peer-checked:bg-bia-blue peer-checked:hover:border-bia-blue-hover peer-checked:hover:outline-bia-blue-hover peer-focus-visible:outline-bia-blue peer-disabled:border-transparent peer-disabled:bg-bia-grey-light-80 peer-disabled:peer-checked:border-primary-white peer-disabled:peer-checked:bg-bia-blue-disabled', peerCheckedClass) })),
|
|
2511
|
+
label && (React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label)))));
|
|
2512
2512
|
});
|
|
2513
2513
|
Radio.defaultProps = {
|
|
2514
2514
|
label: '',
|
|
@@ -2615,8 +2615,8 @@ function Checkbox(_a) {
|
|
|
2615
2615
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2616
2616
|
React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full ".concat(backgroundClass, " ").concat(checkClass) },
|
|
2617
2617
|
React.createElement("input", __assign({ id: id, type: "checkbox", className: "checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50", onChange: function (e) { return onChange(e); }, disabled: disabled }, props)),
|
|
2618
|
-
React.createElement("div", { className: "check-icon z-1 group flex h-full w-full items-center justify-center rounded-full text-bia-grey outline-2 outline-
|
|
2619
|
-
React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label))));
|
|
2618
|
+
React.createElement("div", { className: "check-icon z-1 group flex h-full w-full items-center justify-center rounded-full text-bia-grey outline-2 outline-transparent peer-checked:border-primary-white peer-checked:bg-bia-blue peer-checked:hover:border-bia-blue-hover peer-checked:hover:outline-bia-blue-hover peer-checked:peer-hover:bg-bia-blue-hover peer-focus-visible:outline-bia-blue peer-disabled:bg-bia-grey-light-80 peer-disabled:peer-checked:bg-bia-blue-light-50 peer-disabled:peer-checked:outline-bia-blue-light-50 ".concat(peerCheckedClass) }, isValidIndeterminate ? (React.createElement(TbMinus, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })) : (React.createElement(TbCheck, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })))),
|
|
2619
|
+
label && (React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label)))));
|
|
2620
2620
|
}
|
|
2621
2621
|
Checkbox.defaultProps = {
|
|
2622
2622
|
disabled: false,
|
|
@@ -3018,6 +3018,9 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3018
3018
|
setSearchTerm(getItemLabel(value));
|
|
3019
3019
|
}
|
|
3020
3020
|
}, [isOpen, value]);
|
|
3021
|
+
React.useEffect(function () {
|
|
3022
|
+
setSearchTerm(getItemLabel(value));
|
|
3023
|
+
}, [value]);
|
|
3021
3024
|
var handleInputChange = function (e) {
|
|
3022
3025
|
var newSearchTerm = e.target.value;
|
|
3023
3026
|
setSearchTerm(newSearchTerm);
|
|
@@ -3041,16 +3044,16 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3041
3044
|
};
|
|
3042
3045
|
|
|
3043
3046
|
function LiveSearch(_a) {
|
|
3044
|
-
var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, dropContProps = _a.dropContProps, id = _a.id, label = _a.label, _e = _a.onChangeText, onChangeText = _e === void 0 ? function () { } : _e, _f = _a.onClickDropdown, onClickDropdown =
|
|
3047
|
+
var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, dropContProps = _a.dropContProps, id = _a.id, label = _a.label, _e = _a.onChangeText, onChangeText = _e === void 0 ? function () { } : _e, _f = _a.onChangeButton, onChangeButton = _f === void 0 ? undefined : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, options = _a.options, placeholder = _a.placeholder, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.searchVariant, searchVariant = _k === void 0 ? 'include' : _k, setValue = _a.setValue, _l = _a.size, size = _l === void 0 ? 'md' : _l, _m = _a.isValid, isValid = _m === void 0 ? null : _m, value = _a.value;
|
|
3045
3048
|
var inputRef = React.useRef(null);
|
|
3046
|
-
var
|
|
3049
|
+
var _o = useLiveSearch$1({
|
|
3047
3050
|
value: value,
|
|
3048
3051
|
setValue: setValue,
|
|
3049
3052
|
onChangeText: onChangeText,
|
|
3050
3053
|
dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
|
|
3051
|
-
}), isOpen =
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
+
}), isOpen = _o.isOpen, setIsOpen = _o.setIsOpen, searchTerm = _o.searchTerm, handleInputChange = _o.handleInputChange, handleDropdownItemClick = _o.handleDropdownItemClick;
|
|
3055
|
+
var _p = sizeConfig$7[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
|
|
3056
|
+
var _q = dropContProps || {}, dropContClassName = _q.className; _q.onClickItem; _q.anchorRef; var restDropContProps = __rest(_q, ["className", "onClickItem", "anchorRef"]);
|
|
3054
3057
|
var isSearchTermExist = searchTerm && searchTerm !== '';
|
|
3055
3058
|
var descColor = 'text-primary-cool';
|
|
3056
3059
|
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
@@ -3059,7 +3062,7 @@ function LiveSearch(_a) {
|
|
|
3059
3062
|
if (!disabled && isExistValidation && !isValid)
|
|
3060
3063
|
descColor = 'text-bia-red';
|
|
3061
3064
|
var filteredOptions = filterOptions(options || [], value.label);
|
|
3062
|
-
var
|
|
3065
|
+
var _r = processRenderedChildren$1(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _r.renderedChildren, hasFilteredResults = _r.hasFilteredResults;
|
|
3063
3066
|
var disabledClass = disabled ? 'cursor-not-allowed' : '';
|
|
3064
3067
|
return (React.createElement("div", { className: "bianic-livesearch bianic-fgc-container bianic-text-input-container field-group group/form flex w-full flex-col gap-y-2" },
|
|
3065
3068
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
@@ -3068,10 +3071,15 @@ function LiveSearch(_a) {
|
|
|
3068
3071
|
onChangeText(e);
|
|
3069
3072
|
handleInputChange(e);
|
|
3070
3073
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
3071
|
-
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass)
|
|
3074
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass), style: {
|
|
3075
|
+
zIndex: (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex)
|
|
3076
|
+
? (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex) + 20
|
|
3077
|
+
: 20,
|
|
3078
|
+
} },
|
|
3072
3079
|
!isSearchTermExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
|
|
3073
|
-
isSearchTermExist && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
|
|
3074
|
-
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } })))
|
|
3080
|
+
isSearchTermExist && !onChangeButton && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
|
|
3081
|
+
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
|
|
3082
|
+
isSearchTermExist && onChangeButton),
|
|
3075
3083
|
children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
|
|
3076
3084
|
var isSelected = value && value.id && option.id === value.id;
|
|
3077
3085
|
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|
|
@@ -3341,11 +3349,11 @@ TagLabel.defaultProps = {
|
|
|
3341
3349
|
};
|
|
3342
3350
|
|
|
3343
3351
|
var TagLabelInputInner = function (_a, ref) {
|
|
3344
|
-
var children = _a.children, className = _a.className, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.dropContProps, dropContProps = _c === void 0 ? {} : _c, customId = _a.id, _d = _a.isValid, isValid = _d === void 0 ? null : _d, _e = _a.label, label = _e === void 0 ? '' : _e, onBlur = _a.onBlur, onChange = _a.onChange, onChangeText = _a.onChangeText, onFocus = _a.onFocus, placeholder = _a.placeholder, _f = _a.readOnly, readOnly = _f === void 0 ? false : _f, _g = _a.required, required = _g === void 0 ? false : _g, _h = _a.size, size = _h === void 0 ? 'md' : _h, _j = _a.value, value = _j === void 0 ? [] : _j,
|
|
3352
|
+
var children = _a.children, className = _a.className, description = _a.description, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.dropContProps, dropContProps = _c === void 0 ? {} : _c, customId = _a.id, _d = _a.isValid, isValid = _d === void 0 ? null : _d, _e = _a.label, label = _e === void 0 ? '' : _e, onBlur = _a.onBlur, onChange = _a.onChange, onChangeText = _a.onChangeText, onFocus = _a.onFocus, placeholder = _a.placeholder, _f = _a.readOnly, readOnly = _f === void 0 ? false : _f, _g = _a.required, required = _g === void 0 ? false : _g, _h = _a.size, size = _h === void 0 ? 'md' : _h, _j = _a.value, value = _j === void 0 ? [] : _j, restInputProps = __rest(_a, ["children", "className", "description", "disabled", "dropContProps", "id", "isValid", "label", "onBlur", "onChange", "onChangeText", "onFocus", "placeholder", "readOnly", "required", "size", "value"]);
|
|
3345
3353
|
var generatedId = React.useId();
|
|
3346
3354
|
var inputId = customId || generatedId;
|
|
3347
|
-
var
|
|
3348
|
-
var
|
|
3355
|
+
var _k = React.useState(false), isFocused = _k[0], setIsFocused = _k[1];
|
|
3356
|
+
var _l = React.useState(false), isHovered = _l[0], setIsHovered = _l[1];
|
|
3349
3357
|
var internalInputRef = React.useRef(null);
|
|
3350
3358
|
var containerRef = React.useRef(null);
|
|
3351
3359
|
React.useImperativeHandle(ref, function () { return internalInputRef.current; });
|
|
@@ -3369,12 +3377,12 @@ var TagLabelInputInner = function (_a, ref) {
|
|
|
3369
3377
|
var updatedValues = value.filter(function (_, idx) { return idx !== indexToRemove; });
|
|
3370
3378
|
onChange(updatedValues);
|
|
3371
3379
|
};
|
|
3372
|
-
var
|
|
3380
|
+
var _m = useLiveSearch({
|
|
3373
3381
|
value: value,
|
|
3374
3382
|
setValue: onChange,
|
|
3375
3383
|
onChangeText: onChangeText,
|
|
3376
3384
|
dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
|
|
3377
|
-
}), isOpen =
|
|
3385
|
+
}), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
|
|
3378
3386
|
var handleKeyDown = function (e) {
|
|
3379
3387
|
var _a;
|
|
3380
3388
|
if (e.key === 'Backspace' && searchTerm === '' && value.length > 0) {
|
|
@@ -3408,9 +3416,9 @@ var TagLabelInputInner = function (_a, ref) {
|
|
|
3408
3416
|
? 'text-bia-green'
|
|
3409
3417
|
: 'text-bia-red'
|
|
3410
3418
|
: 'text-primary-cool';
|
|
3411
|
-
var
|
|
3412
|
-
var
|
|
3413
|
-
var
|
|
3419
|
+
var _o = sizeConfig$6[size], inputClass = _o.inputClass, paddingClass = _o.paddingClass, resizePosition = _o.resizePosition;
|
|
3420
|
+
var _p = dropContProps || {}, dropContClassName = _p.dropContClassName, restDropContProps = __rest(_p, ["dropContClassName"]);
|
|
3421
|
+
var _q = processRenderedChildren(children, searchTerm, 'include', handleDropdownItemClick, value), renderedChildren = _q.renderedChildren, hasFilteredResults = _q.hasFilteredResults;
|
|
3414
3422
|
var showPlaceholder = !disabled && !readOnly && value.length === 0;
|
|
3415
3423
|
console.log('showPlaceholder', showPlaceholder);
|
|
3416
3424
|
return (React.createElement("div", { className: cn$1('relative w-full', className) },
|
|
@@ -3437,7 +3445,7 @@ var TagLabelInputInner = function (_a, ref) {
|
|
|
3437
3445
|
}, onKeyDown: handleKeyDown, placeholder: showPlaceholder ? placeholder || 'Select options...' : '', readOnly: readOnly, ref: internalInputRef, role: "combobox", type: "text", value: disabled || readOnly ? '' : searchTerm, className: cn$1(inputClass, 'min-w-[80px] flex-1 border-none bg-transparent p-0 outline-none focus:ring-0', disabled && 'cursor-not-allowed', readOnly && 'pointer-events-none') })),
|
|
3438
3446
|
React.createElement(ResizeIcon, { className: cn$1('absolute', resizePosition) })),
|
|
3439
3447
|
description && (React.createElement("p", { className: cn$1('mt-1.5 text-xs transition-colors', descColor) }, description)),
|
|
3440
|
-
children && (React.createElement(DropdownContainer, __assign({ anchorRef: containerRef, className: cn$1('bianic-livesearch-dropdown w-full overflow-hidden bg-white shadow-lg', dropContClassName), isTopFlat: true, matchAnchorWidth: "min", onClose: function () { return setIsOpen(false); }, open: isOpen && !disabled && !readOnly, size: size, zIndex:
|
|
3448
|
+
children && (React.createElement(DropdownContainer, __assign({ anchorRef: containerRef, className: cn$1('bianic-livesearch-dropdown w-full overflow-hidden bg-white shadow-lg', dropContClassName), isTopFlat: true, matchAnchorWidth: "min", onClose: function () { return setIsOpen(false); }, open: isOpen && !disabled && !readOnly, size: size, zIndex: 10 }, restDropContProps), hasFilteredResults
|
|
3441
3449
|
? renderedChildren
|
|
3442
3450
|
: searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))));
|
|
3443
3451
|
};
|
|
@@ -4632,7 +4640,7 @@ var useFileHandler = function (_a) {
|
|
|
4632
4640
|
};
|
|
4633
4641
|
|
|
4634
4642
|
var SimpleFileUploader = function (_a) {
|
|
4635
|
-
var _b = _a.size, size = _b === void 0 ? 'md' : _b, accept = _a.accept, _c = _a.multiple, multiple = _c === void 0 ? false : _c, maxSize = _a.maxSize, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.label, label = _e === void 0 ? 'Choose File' : _e, _f = _a.variant, variant = _f === void 0 ? 'form-group' : _f, errorMessage = _a.errorMessage, _g = _a.value, value = _g === void 0 ? [] : _g, onChange = _a.onChange, onError = _a.onError, className = _a.className;
|
|
4643
|
+
var _b = _a.size, size = _b === void 0 ? 'md' : _b, accept = _a.accept, _c = _a.multiple, multiple = _c === void 0 ? false : _c, maxSize = _a.maxSize, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.label, label = _e === void 0 ? 'Choose File' : _e, _f = _a.variant, variant = _f === void 0 ? 'form-group' : _f, errorMessage = _a.errorMessage, _g = _a.value, value = _g === void 0 ? [] : _g, onChange = _a.onChange, onError = _a.onError, className = _a.className, iconLeft = _a.iconLeft, buttonProps = __rest(_a, ["size", "accept", "multiple", "maxSize", "disabled", "label", "variant", "errorMessage", "value", "onChange", "onError", "className", "iconLeft"]);
|
|
4636
4644
|
var _h = useFileHandler({
|
|
4637
4645
|
accept: accept,
|
|
4638
4646
|
multiple: multiple,
|
|
@@ -4651,7 +4659,9 @@ var SimpleFileUploader = function (_a) {
|
|
|
4651
4659
|
}[size];
|
|
4652
4660
|
return (React.createElement("div", { className: cn$1('inline-flex flex-col items-start gap-1.5', className) },
|
|
4653
4661
|
React.createElement("input", { ref: inputRef, type: "file", accept: accept, multiple: multiple, disabled: disabled, onChange: handleInputChange, className: "hidden", "aria-label": "File input" }),
|
|
4654
|
-
React.createElement(Button
|
|
4662
|
+
React.createElement(Button
|
|
4663
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4664
|
+
, __assign({}, buttonProps, { label: label, onClick: triggerClick, disabled: disabled, size: size, variant: variant, iconLeft: iconLeft !== null && iconLeft !== void 0 ? iconLeft : (React.createElement(TbFolderOpen, { size: iconSizes, className: "shrink-0 text-bia-black" })) })),
|
|
4655
4665
|
activeError && (React.createElement("div", { className: "flex items-center gap-1 text-xs font-medium text-bia-red" },
|
|
4656
4666
|
React.createElement(TbAlertCircle, { size: 14, className: "shrink-0" }),
|
|
4657
4667
|
React.createElement("span", null, activeError)))));
|
|
@@ -5650,7 +5660,7 @@ var SidebarProfile = React.forwardRef(function (_a, ref) {
|
|
|
5650
5660
|
}, className: cn$1('cubic-bezier(0.68, -0.1, 0.32, 1.2) flex w-full items-center gap-x-2.5 delay-500 duration-300', buttonClass, className) }),
|
|
5651
5661
|
avatarImage,
|
|
5652
5662
|
React.createElement("div", { className: "flex flex-col" },
|
|
5653
|
-
React.createElement(Text, { variant: "normal-text", className: cn$1('truncate text-bia-white delay-[400ms]', isMinimized
|
|
5663
|
+
React.createElement(Text, { variant: "normal-text", className: cn$1('truncate text-left text-bia-white delay-[400ms]', isMinimized
|
|
5654
5664
|
? 'opacity-0 duration-300 ease-in-out'
|
|
5655
5665
|
: 'opacity-100 delay-1000 duration-700 ease-in-out') }, username),
|
|
5656
5666
|
React.createElement(Text, { variant: "small-text", className: cn$1('truncate text-left text-bia-white delay-[400ms]', isMinimized
|
|
@@ -9401,6 +9411,71 @@ function getRelativeTime(date) {
|
|
|
9401
9411
|
return "".concat(Math.floor(diffMs / month), " months ago");
|
|
9402
9412
|
return "".concat(Math.floor(diffMs / year), " years ago");
|
|
9403
9413
|
}
|
|
9414
|
+
/**
|
|
9415
|
+
* formatDateTime
|
|
9416
|
+
* Accepts a date value and formats it into one of several human-readable
|
|
9417
|
+
* or machine-sortable string formats.
|
|
9418
|
+
* Formats:
|
|
9419
|
+
* - 'short': "'24 Feb 4"
|
|
9420
|
+
* - 'long' (default): "4 February 2024"
|
|
9421
|
+
* - 'long-with-time': "4 February 2024, 16:30"
|
|
9422
|
+
* - 'table': "2024-02-04"
|
|
9423
|
+
* - 'table-with-time': "2024-02-04, 16:30"
|
|
9424
|
+
* - 'time24': "16:30"
|
|
9425
|
+
*/
|
|
9426
|
+
var formatDateTime = function (dateString, type) {
|
|
9427
|
+
if (type === void 0) { type = null; }
|
|
9428
|
+
var date = new Date(dateString);
|
|
9429
|
+
var year;
|
|
9430
|
+
var month = '';
|
|
9431
|
+
var day = '';
|
|
9432
|
+
var timeResult = date.toLocaleTimeString('en-GB', {
|
|
9433
|
+
hour: '2-digit',
|
|
9434
|
+
minute: '2-digit',
|
|
9435
|
+
hour12: false,
|
|
9436
|
+
});
|
|
9437
|
+
switch (type) {
|
|
9438
|
+
case 'short':
|
|
9439
|
+
// example: '24 Feb 4
|
|
9440
|
+
year = date.getFullYear().toString().substring(2, 4);
|
|
9441
|
+
month = date.toLocaleString('en-US', { month: 'short' });
|
|
9442
|
+
day = String(date.getDate());
|
|
9443
|
+
return "'".concat(year, " ").concat(month, " ").concat(day);
|
|
9444
|
+
case 'long':
|
|
9445
|
+
// example: 4 February 2024
|
|
9446
|
+
year = date.getFullYear().toString();
|
|
9447
|
+
month = date.toLocaleString('en-US', { month: 'long' });
|
|
9448
|
+
day = String(date.getDate());
|
|
9449
|
+
return "".concat(day, " ").concat(month, " ").concat(year);
|
|
9450
|
+
case 'long-with-time':
|
|
9451
|
+
// example: 4 February 2024, 16:30
|
|
9452
|
+
year = date.getFullYear().toString();
|
|
9453
|
+
month = date.toLocaleString('en-US', { month: 'long' });
|
|
9454
|
+
day = String(date.getDate());
|
|
9455
|
+
return "".concat(day, " ").concat(month, " ").concat(year, ", ").concat(timeResult);
|
|
9456
|
+
case 'table':
|
|
9457
|
+
// example: 2024-02-04
|
|
9458
|
+
year = date.getFullYear();
|
|
9459
|
+
month = String(date.getMonth() + 1).padStart(2, '0');
|
|
9460
|
+
day = String(date.getDate()).padStart(2, '0');
|
|
9461
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
9462
|
+
case 'table-with-time':
|
|
9463
|
+
// example: 2024-02-04, 16:30
|
|
9464
|
+
year = date.getFullYear();
|
|
9465
|
+
month = String(date.getMonth() + 1).padStart(2, '0');
|
|
9466
|
+
day = String(date.getDate()).padStart(2, '0');
|
|
9467
|
+
return "".concat(year, "-").concat(month, "-").concat(day, ", ").concat(timeResult);
|
|
9468
|
+
case 'time24':
|
|
9469
|
+
// example: 16:30
|
|
9470
|
+
return "".concat(timeResult);
|
|
9471
|
+
default:
|
|
9472
|
+
// default to long format (4 February 2024)
|
|
9473
|
+
year = date.getFullYear().toString();
|
|
9474
|
+
month = date.toLocaleString('en-US', { month: 'long' });
|
|
9475
|
+
day = String(date.getDate());
|
|
9476
|
+
return "".concat(day, " ").concat(month, " ").concat(year);
|
|
9477
|
+
}
|
|
9478
|
+
};
|
|
9404
9479
|
|
|
9405
9480
|
/**
|
|
9406
9481
|
* A custom hook to handle data processing for tables, managing internal states
|
|
@@ -9623,6 +9698,7 @@ exports.TreeItem = TreeItem;
|
|
|
9623
9698
|
exports.VerticalStepper = StepperItem;
|
|
9624
9699
|
exports.Window = Window;
|
|
9625
9700
|
exports.YearPicker = YearPicker;
|
|
9701
|
+
exports.formatDateTime = formatDateTime;
|
|
9626
9702
|
exports.getRelativeTime = getRelativeTime;
|
|
9627
9703
|
exports.useFileTree = useFileTree;
|
|
9628
9704
|
exports.useTableDataHandler = useTableDataHandler;
|