kiban-design-system 1.0.241-alpha.0 → 1.0.243-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/components/ActionList/ActionList.props.d.ts +4 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +62 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import react, { createElement, createContext, useState, useEffect, useContext,
|
|
1
|
+
import react, { createElement, isValidElement, createContext, useState, useEffect, useContext, Fragment as Fragment$1, useRef, useCallback, useMemo, Children, memo, cloneElement, useLayoutEffect, forwardRef } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import _extends$2 from '@babel/runtime/helpers/esm/extends';
|
|
@@ -897,6 +897,61 @@ var Icons = /*#__PURE__*/Object.freeze({
|
|
|
897
897
|
*/
|
|
898
898
|
const Icon = ({ name }) => (jsx("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, { children: createElement(Icons[name]) }), void 0));
|
|
899
899
|
|
|
900
|
+
const isComponentTypeOf = (childComponent, parentComponent) => {
|
|
901
|
+
var _a;
|
|
902
|
+
if (childComponent === null ||
|
|
903
|
+
!isValidElement(childComponent) ||
|
|
904
|
+
typeof childComponent === 'string') {
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
907
|
+
const { type: childComponentType } = childComponent;
|
|
908
|
+
const Components = Array.isArray(parentComponent)
|
|
909
|
+
? parentComponent
|
|
910
|
+
: [parentComponent];
|
|
911
|
+
const type = ((_a = childComponent.props) === null || _a === void 0 ? void 0 : _a.__type__) || childComponentType;
|
|
912
|
+
return Components.some((Component) => typeof type !== 'string' && type === Component);
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
function formatFileSize(bytes) {
|
|
916
|
+
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
917
|
+
let unitIndex = 0;
|
|
918
|
+
let size = bytes;
|
|
919
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
920
|
+
size /= 1024;
|
|
921
|
+
unitIndex += 1;
|
|
922
|
+
}
|
|
923
|
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const cssClassName = (mainClass, ...classes) => {
|
|
927
|
+
const filteredClasses = classes
|
|
928
|
+
.filter(Boolean)
|
|
929
|
+
.map((clss) => `${mainClass}--${clss}`);
|
|
930
|
+
filteredClasses.unshift(mainClass);
|
|
931
|
+
return filteredClasses.join(' ');
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
935
|
+
const isValidIcon = (icon) => typeof icon === 'string' || typeof icon === 'function';
|
|
936
|
+
|
|
937
|
+
const themeClassConverter = (themeClass) => {
|
|
938
|
+
const classConverter = themeClass.charAt(0).toLocaleUpperCase() +
|
|
939
|
+
themeClass.slice(1).toLocaleLowerCase();
|
|
940
|
+
return classConverter;
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
function capitalize(str) {
|
|
944
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
const SuccessIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("path", { d: 'M22 11.08V12a10 10 0 1 1-5.93-9.14' }, void 0), jsx("polyline", { points: '22 4 12 14.01 9 11.01' }, void 0)] }), void 0));
|
|
948
|
+
|
|
949
|
+
const ErrorIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("circle", { cx: '12', cy: '12', r: '10' }, void 0), jsx("line", { x1: '15', y1: '9', x2: '9', y2: '15' }, void 0), jsx("line", { x1: '9', y1: '9', x2: '15', y2: '15' }, void 0)] }), void 0));
|
|
950
|
+
|
|
951
|
+
const PendingIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("circle", { cx: '12', cy: '12', r: '10' }, void 0), jsx("line", { x1: '8', y1: '12', x2: '16', y2: '12' }, void 0)] }), void 0));
|
|
952
|
+
|
|
953
|
+
const WarningIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, { children: [jsx("path", { d: 'M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z' }, void 0), jsx("line", { x1: '12', y1: '9', x2: '12', y2: '13' }, void 0), jsx("line", { x1: '12', y1: '17', x2: '12.01', y2: '17' }, void 0)] }), void 0));
|
|
954
|
+
|
|
900
955
|
/**
|
|
901
956
|
* It is necessary to create a list that receives
|
|
902
957
|
* strings or Nodes as elements, clicking on
|
|
@@ -928,7 +983,11 @@ const ActionList = ({ header, items, sections }) => {
|
|
|
928
983
|
.join(' ');
|
|
929
984
|
return (jsxs("li", Object.assign({ "aria-label": item.ariaLabel, className: classesItem, onClick: () => item.onClick && item.onClick() }, { children: [item.icon && (jsx("span", Object.assign({ className: 'Action-list__item-icon' }, { children: jsx(Icon, { name: item.icon }, void 0) }), void 0)), item.content] }), j));
|
|
930
985
|
}) }), void 0)] }), i));
|
|
931
|
-
})), items && !sections && (jsx("ul", Object.assign({ className: 'Action-list__items-container' }, { children: items === null || items === void 0 ? void 0 : items.map((item, j) =>
|
|
986
|
+
})), items && !sections && (jsx("ul", Object.assign({ className: 'Action-list__items-container' }, { children: items === null || items === void 0 ? void 0 : items.map((item, j) => {
|
|
987
|
+
const { ariaLabel, content, icon, isActive, isDisabled, onClick } = item;
|
|
988
|
+
const className = cssClassName('Action-list__item', isActive && 'active', isDisabled && 'disabled');
|
|
989
|
+
return (jsxs("li", Object.assign({ "aria-label": ariaLabel, className: className, onClick: () => onClick && !isDisabled && onClick() }, { children: [icon && (jsx("span", Object.assign({ className: 'Action-list__item-icon' }, { children: jsx(Icon, { name: icon }, void 0) }), void 0)), content] }), j));
|
|
990
|
+
}) }), void 0))] }), void 0));
|
|
932
991
|
};
|
|
933
992
|
|
|
934
993
|
const MAIN_CLASS$t = 'Alert';
|
|
@@ -1017,61 +1076,6 @@ const useShowAlert = () => {
|
|
|
1017
1076
|
return addAlert;
|
|
1018
1077
|
};
|
|
1019
1078
|
|
|
1020
|
-
const isComponentTypeOf = (childComponent, parentComponent) => {
|
|
1021
|
-
var _a;
|
|
1022
|
-
if (childComponent === null ||
|
|
1023
|
-
!isValidElement(childComponent) ||
|
|
1024
|
-
typeof childComponent === 'string') {
|
|
1025
|
-
return false;
|
|
1026
|
-
}
|
|
1027
|
-
const { type: childComponentType } = childComponent;
|
|
1028
|
-
const Components = Array.isArray(parentComponent)
|
|
1029
|
-
? parentComponent
|
|
1030
|
-
: [parentComponent];
|
|
1031
|
-
const type = ((_a = childComponent.props) === null || _a === void 0 ? void 0 : _a.__type__) || childComponentType;
|
|
1032
|
-
return Components.some((Component) => typeof type !== 'string' && type === Component);
|
|
1033
|
-
};
|
|
1034
|
-
|
|
1035
|
-
function formatFileSize(bytes) {
|
|
1036
|
-
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
1037
|
-
let unitIndex = 0;
|
|
1038
|
-
let size = bytes;
|
|
1039
|
-
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
1040
|
-
size /= 1024;
|
|
1041
|
-
unitIndex += 1;
|
|
1042
|
-
}
|
|
1043
|
-
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
const cssClassName = (mainClass, ...classes) => {
|
|
1047
|
-
const filteredClasses = classes
|
|
1048
|
-
.filter(Boolean)
|
|
1049
|
-
.map((clss) => `${mainClass}--${clss}`);
|
|
1050
|
-
filteredClasses.unshift(mainClass);
|
|
1051
|
-
return filteredClasses.join(' ');
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1055
|
-
const isValidIcon = (icon) => typeof icon === 'string' || typeof icon === 'function';
|
|
1056
|
-
|
|
1057
|
-
const themeClassConverter = (themeClass) => {
|
|
1058
|
-
const classConverter = themeClass.charAt(0).toLocaleUpperCase() +
|
|
1059
|
-
themeClass.slice(1).toLocaleLowerCase();
|
|
1060
|
-
return classConverter;
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
function capitalize(str) {
|
|
1064
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
const SuccessIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("path", { d: 'M22 11.08V12a10 10 0 1 1-5.93-9.14' }, void 0), jsx("polyline", { points: '22 4 12 14.01 9 11.01' }, void 0)] }), void 0));
|
|
1068
|
-
|
|
1069
|
-
const ErrorIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("circle", { cx: '12', cy: '12', r: '10' }, void 0), jsx("line", { x1: '15', y1: '9', x2: '9', y2: '15' }, void 0), jsx("line", { x1: '9', y1: '9', x2: '15', y2: '15' }, void 0)] }), void 0));
|
|
1070
|
-
|
|
1071
|
-
const PendingIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2' }, { children: [jsx("circle", { cx: '12', cy: '12', r: '10' }, void 0), jsx("line", { x1: '8', y1: '12', x2: '16', y2: '12' }, void 0)] }), void 0));
|
|
1072
|
-
|
|
1073
|
-
const WarningIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, { children: [jsx("path", { d: 'M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z' }, void 0), jsx("line", { x1: '12', y1: '9', x2: '12', y2: '13' }, void 0), jsx("line", { x1: '12', y1: '17', x2: '12.01', y2: '17' }, void 0)] }), void 0));
|
|
1074
|
-
|
|
1075
1079
|
const COMPONENT_NAME$B = 'AlphaAttributeInput';
|
|
1076
1080
|
const AlphaAttributeInput = ({ items, divider, label, isRequired, }) => {
|
|
1077
1081
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -30562,7 +30566,7 @@ const AlphaZipCodeInput = ({ label, isRequired, items, onBlur, onFocus, onChange
|
|
|
30562
30566
|
}));
|
|
30563
30567
|
const optionListMarkup = items.length > 0 ? (jsx(OptionList, { items: itemsOptions, selected: [''], onChange: handleOnSelectItem }, void 0)) : null;
|
|
30564
30568
|
const emptyItemsMarkup = items.length === 0 ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME}__EmptyItems` }, { children: labelEmpty }), void 0)) : null;
|
|
30565
|
-
const popoverMarkup = useMemo(() => (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: showPopover, isFullWidth: true, onClose: () => setShowPopover(false), isFixed: true }, { children: jsxs(Popover$1.Pane, { children: [optionListMarkup, emptyItemsMarkup] }, void 0) }), void 0)), [items, value, showPopover]);
|
|
30569
|
+
const popoverMarkup = useMemo(() => (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: showPopover, isFullWidth: true, onClose: () => setShowPopover(false), isFixed: true }, { children: jsxs(Popover$1.Pane, { children: [optionListMarkup, emptyItemsMarkup] }, void 0) }), void 0)), [items, value, showPopover, isFocusActive]);
|
|
30566
30570
|
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__Wrapper` }, { children: [labelMarkup, popoverMarkup] }), void 0));
|
|
30567
30571
|
};
|
|
30568
30572
|
|