kiban-design-system 1.0.236-alpha.0 → 1.0.238-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/AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.d.ts +4 -0
- package/dist/components/AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.props.d.ts +14 -0
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/Picker.d.ts +5 -0
- package/dist/components/{AlphaTimeSelector/components/TimePicker/TimePicker.props.d.ts → AlphaMultiSelectionPicker/components/Picker/Picker.props.d.ts} +3 -3
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/components/List/List.props.d.ts +6 -0
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/index.d.ts +3 -0
- package/dist/components/AlphaMultiSelectionPicker/components/index.d.ts +1 -0
- package/dist/components/AlphaMultiSelectionPicker/index.d.ts +3 -0
- package/dist/components/AlphaTimeSelector/TimeSelector.d.ts +1 -1
- package/dist/components/AlphaTimeSelector/TimeSelector.props.d.ts +14 -8
- package/dist/components/index.d.ts +1 -0
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +77 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/TimePicker.d.ts +0 -5
- package/dist/components/AlphaTimeSelector/components/TimePicker/TimePicker.test.d.ts +0 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/components/List/List.props.d.ts +0 -6
- package/dist/components/AlphaTimeSelector/components/TimePicker/components/List/List.test.d.ts +0 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/index.d.ts +0 -3
- package/dist/components/AlphaTimeSelector/components/index.d.ts +0 -1
- /package/dist/components/{AlphaTimeSelector/TimeSelector.test.d.ts → AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.test.d.ts} +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/List/List.d.ts +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/List/index.d.ts +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/index.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -30166,7 +30166,7 @@ const Totalizer = ({ action, direction, icon, isDisabled, isFocused, label, plac
|
|
|
30166
30166
|
return (jsxs("div", Object.assign({ className: className }, { children: [headerMarkup, contentMarkup] }), void 0));
|
|
30167
30167
|
};
|
|
30168
30168
|
|
|
30169
|
-
const COMPONENT_NAME$5 = '
|
|
30169
|
+
const COMPONENT_NAME$5 = 'AlphaMultiSelectionPicker__Picker__List';
|
|
30170
30170
|
const List = ({ items, selected, onChange }) => {
|
|
30171
30171
|
const listWrapperRef = useRef(null);
|
|
30172
30172
|
const scrollToSelected = () => {
|
|
@@ -30203,8 +30203,8 @@ const List = ({ items, selected, onChange }) => {
|
|
|
30203
30203
|
return (jsx("div", Object.assign({ className: className, ref: listWrapperRef }, { children: jsx("ul", { children: itemsMarkup }, void 0) }), void 0));
|
|
30204
30204
|
};
|
|
30205
30205
|
|
|
30206
|
-
const COMPONENT_NAME$4 = '
|
|
30207
|
-
const
|
|
30206
|
+
const COMPONENT_NAME$4 = 'AlphaMultiSelectionPicker__Picker';
|
|
30207
|
+
const Picker = ({ headers, items, onChange, selected, theme: ThemeProp, }) => {
|
|
30208
30208
|
const { theme: themeValue } = useTheme();
|
|
30209
30209
|
const theme = ThemeProp || themeValue;
|
|
30210
30210
|
if (!theme) {
|
|
@@ -30228,35 +30228,82 @@ const TimePicker = ({ headers, items, onChange, selected, theme: ThemeProp, }) =
|
|
|
30228
30228
|
return (jsxs("div", Object.assign({ className: className }, { children: [headersMarkup, itemsListsMarkup] }), void 0));
|
|
30229
30229
|
};
|
|
30230
30230
|
|
|
30231
|
+
const AlphaMultiSelectionPicker = ({ items, onChange, theme, }) => {
|
|
30232
|
+
const getLabel = (value) => {
|
|
30233
|
+
return value < 10 ? `0${value}` : `${value}`;
|
|
30234
|
+
};
|
|
30235
|
+
const getListItem = (min, max) => {
|
|
30236
|
+
const numbersArray = Array.from({ length: max - min + 1 }, (_, i) => i + min);
|
|
30237
|
+
return numbersArray.map((number) => ({
|
|
30238
|
+
label: getLabel(number),
|
|
30239
|
+
value: number,
|
|
30240
|
+
}));
|
|
30241
|
+
};
|
|
30242
|
+
const headersPicker = useMemo(() => items.map((item) => item.plural), [items]);
|
|
30243
|
+
const itemsPicker = useMemo(() => items.map((item) => getListItem(item.min, item.max)), [items]);
|
|
30244
|
+
const valuesSelected = useMemo(() => items.map((item) => item.value), [items]);
|
|
30245
|
+
const pickerMarkup = (jsx(Picker, { items: itemsPicker, headers: headersPicker, onChange: onChange, selected: valuesSelected, theme: theme }, void 0));
|
|
30246
|
+
return jsx("div", { children: pickerMarkup }, void 0);
|
|
30247
|
+
};
|
|
30248
|
+
|
|
30231
30249
|
const COMPONENT_NAME$3 = 'TimeSelector';
|
|
30232
|
-
const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, label, onChange, readOnly, placeholderValues,
|
|
30250
|
+
const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, label, onChange, readOnly, placeholderValues, minMaxYears, minMaxMonths, minMaxDays, minMaxHours, minMaxMinutes, minMaxSeconds, theme: themeProp, isRequired, }) => {
|
|
30233
30251
|
const { theme: themeValue } = useTheme();
|
|
30234
30252
|
const theme = themeProp || themeValue;
|
|
30235
30253
|
if (!theme) {
|
|
30236
30254
|
return null;
|
|
30237
30255
|
}
|
|
30256
|
+
const [items, setItems] = useState([]);
|
|
30257
|
+
const [keysValues, setKeysValues] = useState([]);
|
|
30238
30258
|
const fieldRef = useRef(null);
|
|
30239
30259
|
const [isFocused, setIsFocused] = useState(false);
|
|
30240
30260
|
const [isActive, setIsActive] = useState(false);
|
|
30241
30261
|
const toggleTimePicker = () => setIsActive(!isActive);
|
|
30242
30262
|
const hasError = !!error;
|
|
30243
|
-
const
|
|
30244
|
-
|
|
30245
|
-
|
|
30246
|
-
|
|
30263
|
+
const getMaxMins = () => {
|
|
30264
|
+
const maxMins = {
|
|
30265
|
+
years: minMaxYears,
|
|
30266
|
+
months: minMaxMonths,
|
|
30267
|
+
days: minMaxDays,
|
|
30268
|
+
hours: minMaxHours,
|
|
30269
|
+
minutes: minMaxMinutes,
|
|
30270
|
+
seconds: minMaxSeconds,
|
|
30271
|
+
};
|
|
30272
|
+
return maxMins;
|
|
30273
|
+
};
|
|
30274
|
+
const getItemMultiSelectionPicker = (key, minMax) => ({
|
|
30275
|
+
id: key,
|
|
30276
|
+
plural: plurals[key] || '',
|
|
30277
|
+
singular: singulars[key] || '',
|
|
30278
|
+
min: minMax[0],
|
|
30279
|
+
max: minMax[1],
|
|
30280
|
+
value: value ? value[key] : 0,
|
|
30281
|
+
});
|
|
30282
|
+
const getItemsMultiSelectionPicker = () => {
|
|
30283
|
+
const catalogMinMax = getMaxMins();
|
|
30284
|
+
const items = [];
|
|
30285
|
+
const keys = [];
|
|
30286
|
+
Object.keys(catalogMinMax).forEach((key) => {
|
|
30287
|
+
const valueMinMax = catalogMinMax[key];
|
|
30288
|
+
if (valueMinMax) {
|
|
30289
|
+
keys.push(key);
|
|
30290
|
+
items.push(getItemMultiSelectionPicker(key, valueMinMax));
|
|
30291
|
+
}
|
|
30292
|
+
});
|
|
30293
|
+
setKeysValues(keys);
|
|
30294
|
+
return items;
|
|
30295
|
+
};
|
|
30247
30296
|
const handleClosePopover = () => {
|
|
30248
30297
|
if (isActive) {
|
|
30249
30298
|
toggleTimePicker();
|
|
30250
30299
|
}
|
|
30251
30300
|
};
|
|
30252
30301
|
const handleTimePickerChange = (values) => {
|
|
30253
|
-
const
|
|
30254
|
-
|
|
30255
|
-
|
|
30256
|
-
|
|
30257
|
-
|
|
30258
|
-
seconds: seconds || 0,
|
|
30259
|
-
};
|
|
30302
|
+
const newValue = {};
|
|
30303
|
+
keysValues.forEach((key, index) => {
|
|
30304
|
+
const valueByKey = values[index];
|
|
30305
|
+
newValue[key] = valueByKey || 0;
|
|
30306
|
+
});
|
|
30260
30307
|
if (onChange) {
|
|
30261
30308
|
onChange(newValue);
|
|
30262
30309
|
}
|
|
@@ -30297,15 +30344,6 @@ const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, la
|
|
|
30297
30344
|
fullValue[fieldName] = fieldVal;
|
|
30298
30345
|
return fullValue;
|
|
30299
30346
|
};
|
|
30300
|
-
const getMaxMins = () => {
|
|
30301
|
-
const maxMins = {
|
|
30302
|
-
days: minMaxDays,
|
|
30303
|
-
hours: minMaxHours,
|
|
30304
|
-
minutes: minMaxMinutes,
|
|
30305
|
-
seconds: minMaxSeconds,
|
|
30306
|
-
};
|
|
30307
|
-
return maxMins;
|
|
30308
|
-
};
|
|
30309
30347
|
const renderField = (field, index) => {
|
|
30310
30348
|
const label = !value || (value && value[field] !== 1)
|
|
30311
30349
|
? plurals[field]
|
|
@@ -30317,8 +30355,11 @@ const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, la
|
|
|
30317
30355
|
? getTimeValue(value[field])
|
|
30318
30356
|
: '';
|
|
30319
30357
|
const separator = index === Object.keys(singulars).length - 1 ? '' : ', ';
|
|
30320
|
-
const
|
|
30321
|
-
|
|
30358
|
+
const valuesMaxMin = getMaxMins()[field];
|
|
30359
|
+
let max;
|
|
30360
|
+
let min;
|
|
30361
|
+
if (valuesMaxMin)
|
|
30362
|
+
[min, max] = valuesMaxMin;
|
|
30322
30363
|
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$3}__InnerField` }, { children: [jsx("input", { type: 'number', value: elValue, placeholder: placeholderValue, onFocus: handleFocusField, onBlur: handleBlurField, disabled: disabled, onChange: handleInputChange, name: field, min: min, max: max }, void 0), jsxs("span", { children: [label, separator] }, void 0)] }), index));
|
|
30323
30364
|
};
|
|
30324
30365
|
const fieldsMarkup = Object.keys(singulars).map(renderField);
|
|
@@ -30328,28 +30369,21 @@ const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, la
|
|
|
30328
30369
|
? helpText && (jsx("div", Object.assign({ className: `${COMPONENT_NAME$3}__HelpTextWrapper` }, { children: helpText }), void 0))
|
|
30329
30370
|
: null;
|
|
30330
30371
|
const fieldMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$3}__FieldWrapper` }, { children: jsxs(AlphaTooltip, Object.assign({ content: error, appearance: 'error', persistence: true, isActive: hasError }, { children: [labelMarkup, jsx("div", Object.assign({ className: fieldClass, onClick: handleFieldClick, ref: fieldRef }, { children: fieldsMarkup }), void 0)] }), void 0) }), void 0));
|
|
30331
|
-
const
|
|
30332
|
-
if (value) {
|
|
30333
|
-
const { days, hours, minutes, seconds } = value;
|
|
30334
|
-
return [days, hours, minutes, seconds];
|
|
30335
|
-
}
|
|
30336
|
-
return undefined;
|
|
30337
|
-
}, [value]);
|
|
30338
|
-
const timePickerHeaders = useMemo(() => [plurals.days, plurals.hours, plurals.minutes, plurals.seconds], [plurals]);
|
|
30339
|
-
const timePickerMarkup = (jsx(TimePicker, { items: [daysList, hoursList, minutesList, secondsList], headers: timePickerHeaders, onChange: handleTimePickerChange, selected: timePickerValue, theme: theme }, void 0));
|
|
30372
|
+
const timePickerMarkup = (jsx(AlphaMultiSelectionPicker, { items: items, onChange: handleTimePickerChange, theme: themeProp }, void 0));
|
|
30340
30373
|
const popoverMarkup = (jsx(Popover$1, Object.assign({ activator: fieldMarkup, isActive: isActive, isFullWidth: true, onClose: handleClosePopover }, { children: timePickerMarkup }), void 0));
|
|
30374
|
+
useEffect(() => {
|
|
30375
|
+
setItems(getItemsMultiSelectionPicker());
|
|
30376
|
+
}, []);
|
|
30377
|
+
useEffect(() => {
|
|
30378
|
+
setItems(getItemsMultiSelectionPicker());
|
|
30379
|
+
}, [value]);
|
|
30341
30380
|
const className = cssClassName(COMPONENT_NAME$3, theme, !value && 'isEmpty');
|
|
30342
30381
|
return (jsxs("div", Object.assign({ className: className }, { children: [popoverMarkup, helpTextMarkup] }), void 0));
|
|
30343
30382
|
};
|
|
30344
30383
|
function getTimeValue(value) {
|
|
30384
|
+
if (value === undefined)
|
|
30385
|
+
return '';
|
|
30345
30386
|
return value < 10 ? `0${value}` : `${value}`;
|
|
30346
|
-
}
|
|
30347
|
-
function getTimeList(min, max) {
|
|
30348
|
-
const numbersArray = Array.from({ length: max - min + 1 }, (_, i) => i + min);
|
|
30349
|
-
return numbersArray.map((number) => ({
|
|
30350
|
-
label: getTimeValue(number),
|
|
30351
|
-
value: number,
|
|
30352
|
-
}));
|
|
30353
30387
|
}
|
|
30354
30388
|
|
|
30355
30389
|
const COMPONENT_NAME$2 = 'FilterField';
|
|
@@ -30454,5 +30488,5 @@ const AlphaSegmentedControl = ({ children, title, segments, selected, onSelected
|
|
|
30454
30488
|
return (jsxs("div", Object.assign({ className: `${MAINCLASS}__Container` }, { children: [headerMarkup, contentMarkup] }), void 0));
|
|
30455
30489
|
};
|
|
30456
30490
|
|
|
30457
|
-
export { ActionList, Alert, AlertProvider, AlphaAttributeInput, AlphaBadge, AlphaButton, AlphaChip, AlphaFilterControl, AlphaGraphicCard, AlphaIcon, AlphaInlineError, AlphaInputDate, InputTag$1 as AlphaInputTag, AlphaInputText, AlphaLabel, AlphaLabelledField, AlphaSegmentedControl, AlphaSpinner, AlphaStepper, AlphaTag, AlphaTile, AlphaTooltip, Totalizer as AlphaTotalizer, AnnotatedSection, Avatar, Badge, Banner, Button, CalendarPicker, Card, Checkbox, ChoiceList, Collapsible, Connector, Container, Cover, DataTable, DatePicker, DeletableSection, Divider, DynamicForm, EmptyState, ErrorIcon, FileDownloader, Filedrop, FilterControl, Filters, Footer, Form, FormField, FormLayout, Frame, Grid, GridItem, Header$1 as Header, Icon, IconButton, IndexList, InlineEdit, InputPhoneNumber, InputTag, InputText, JsonViewer, Label, Link, ListInfo, Loader, Logo, Media, Modal, ModalHeader, Nip, OptionList, Page, PageActions, Pagination, Pane, Panel, PanelFooter, PanelHeader, PendingIcon, Popover$1 as Popover, Progress, RadioButton, SectionForm, Select, SideMenu, SkeletonInput, SkeletonMedia, SkeletonTabs, SkeletonText, SkeletonTitle, SortableList, Spinner, Stack, StepDefault, SuccessIcon, Table, Tabs, Tag, ThemeProvider, ThreadItem, Thumbnail, Tile, TimeSelector, Title, Toggle, Tooltip, WarningIcon, capitalize, cssClassName, formatDate, isComponentTypeOf, isValidIcon, themeClassConverter, useShowAlert, useTheme };
|
|
30491
|
+
export { ActionList, Alert, AlertProvider, AlphaAttributeInput, AlphaBadge, AlphaButton, AlphaChip, AlphaFilterControl, AlphaGraphicCard, AlphaIcon, AlphaInlineError, AlphaInputDate, InputTag$1 as AlphaInputTag, AlphaInputText, AlphaLabel, AlphaLabelledField, AlphaMultiSelectionPicker, AlphaSegmentedControl, AlphaSpinner, AlphaStepper, AlphaTag, AlphaTile, AlphaTooltip, Totalizer as AlphaTotalizer, AnnotatedSection, Avatar, Badge, Banner, Button, CalendarPicker, Card, Checkbox, ChoiceList, Collapsible, Connector, Container, Cover, DataTable, DatePicker, DeletableSection, Divider, DynamicForm, EmptyState, ErrorIcon, FileDownloader, Filedrop, FilterControl, Filters, Footer, Form, FormField, FormLayout, Frame, Grid, GridItem, Header$1 as Header, Icon, IconButton, IndexList, InlineEdit, InputPhoneNumber, InputTag, InputText, JsonViewer, Label, Link, ListInfo, Loader, Logo, Media, Modal, ModalHeader, Nip, OptionList, Page, PageActions, Pagination, Pane, Panel, PanelFooter, PanelHeader, PendingIcon, Popover$1 as Popover, Progress, RadioButton, SectionForm, Select, SideMenu, SkeletonInput, SkeletonMedia, SkeletonTabs, SkeletonText, SkeletonTitle, SortableList, Spinner, Stack, StepDefault, SuccessIcon, Table, Tabs, Tag, ThemeProvider, ThreadItem, Thumbnail, Tile, TimeSelector, Title, Toggle, Tooltip, WarningIcon, capitalize, cssClassName, formatDate, isComponentTypeOf, isValidIcon, themeClassConverter, useShowAlert, useTheme };
|
|
30458
30492
|
//# sourceMappingURL=index.js.map
|