@dynamic-framework/ui-react 1.19.0 → 1.20.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/css/dynamic-ui-non-root.css +293 -172
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +2 -2
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +294 -173
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +217 -195
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +214 -194
- package/dist/index.js.map +1 -1
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +8 -4
- package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +5 -4
- package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +2 -1
- package/dist/types/contexts/index.d.ts +1 -1
- package/dist/types/hooks/useStackState.d.ts +1 -1
- package/package.json +2 -2
- package/src/style/abstracts/_utilities.scss +12 -0
- package/src/style/abstracts/variables/_forms.scss +2 -1
- package/src/style/components/_+import.scss +0 -1
- package/src/style/components/_d-datepicker.scss +89 -39
- package/src/style/components/_d-icon.scss +1 -1
- package/src/style/components/_d-input-pin.scss +6 -1
- package/src/style/components/_d-select.scss +1 -0
- package/src/style/helpers/_+import.scss +2 -1
- package/src/style/helpers/_colored-links.scss +70 -0
- package/src/style/root/_root.scss +1 -1
- package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +0 -12
- package/dist/types/components/DMonthPicker/index.d.ts +0 -2
- package/src/style/components/_d-monthpicker.scss +0 -98
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo, useEffect, useState, useCallback, createContext, useContext, forwardRef, useRef } from 'react';
|
|
2
|
+
import React, { useMemo, useEffect, useState, useCallback, createContext, useContext, Fragment as Fragment$1, forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -7,9 +7,9 @@ import { useDropzone } from 'react-dropzone';
|
|
|
7
7
|
import { SplideSlide, Splide } from '@splidejs/react-splide';
|
|
8
8
|
import currency from 'currency.js';
|
|
9
9
|
import DatePicker from 'react-datepicker';
|
|
10
|
-
import {
|
|
11
|
-
import { InputMask } from '@react-input/mask';
|
|
10
|
+
import { getYear, format, getMonth, parseISO } from 'date-fns';
|
|
12
11
|
import Select, { components } from 'react-select';
|
|
12
|
+
import { InputMask } from '@react-input/mask';
|
|
13
13
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
14
14
|
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
15
15
|
import ContentLoader from 'react-content-loader';
|
|
@@ -98,29 +98,31 @@ function usePortal(portalName) {
|
|
|
98
98
|
* @returns The list and controls to modify the stack
|
|
99
99
|
* @see https://react-hooks.org/docs/useStackState
|
|
100
100
|
*/
|
|
101
|
-
function useStackState(initialList) {
|
|
101
|
+
function useStackState(initialList = []) {
|
|
102
102
|
const [list, setList] = useState(initialList);
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
]);
|
|
109
|
-
}, []);
|
|
110
|
-
const pop = useCallback(() => {
|
|
111
|
-
setList((prevList) => (prevList.slice(0, prevList.length - 1)));
|
|
112
|
-
}, []);
|
|
103
|
+
const push = useCallback((item) => (setList((prevList) => [
|
|
104
|
+
...prevList,
|
|
105
|
+
item,
|
|
106
|
+
])), []);
|
|
107
|
+
const pop = useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);
|
|
113
108
|
const peek = useCallback(() => list.at(-1), [list]);
|
|
114
|
-
const clear = () => setList([]);
|
|
115
|
-
const isEmpty = useCallback(() => list.length === 0, [list]);
|
|
116
|
-
const controls = {
|
|
109
|
+
const clear = useCallback(() => setList([]), []);
|
|
110
|
+
const isEmpty = useCallback(() => list.length === 0, [list.length]);
|
|
111
|
+
const controls = useMemo(() => ({
|
|
117
112
|
clear,
|
|
118
113
|
isEmpty,
|
|
119
|
-
length,
|
|
114
|
+
length: list.length,
|
|
120
115
|
peek,
|
|
121
116
|
pop,
|
|
122
117
|
push,
|
|
123
|
-
}
|
|
118
|
+
}), [
|
|
119
|
+
clear,
|
|
120
|
+
isEmpty,
|
|
121
|
+
list.length,
|
|
122
|
+
peek,
|
|
123
|
+
pop,
|
|
124
|
+
push,
|
|
125
|
+
]);
|
|
124
126
|
return [list, controls];
|
|
125
127
|
}
|
|
126
128
|
|
|
@@ -154,7 +156,7 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
154
156
|
openPortal,
|
|
155
157
|
closePortal,
|
|
156
158
|
}), [stack, openPortal, closePortal]);
|
|
157
|
-
return (jsxs(DPortalContext.Provider, { value: value, children: [children, created && createPortal(jsx(Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxs(Fragment, { children: [jsx("div", { className: "backdrop fade show" }), jsx(Component, { name: name, payload: payload })] }))) }), document.getElementById(portalName))] }));
|
|
159
|
+
return (jsxs(DPortalContext.Provider, { value: value, children: [children, created && createPortal(jsx(Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxs(Fragment$1, { children: [jsx("div", { className: "backdrop fade show" }), jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
|
|
158
160
|
}
|
|
159
161
|
function useDPortalContext() {
|
|
160
162
|
const context = useContext(DPortalContext);
|
|
@@ -469,58 +471,187 @@ var DInput$1 = ForwardedDInput;
|
|
|
469
471
|
|
|
470
472
|
function DDatePickerTime(_a) {
|
|
471
473
|
var { value, onChange, id, label, className, style } = _a, props = __rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
472
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
|
|
474
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({ className: "w-100" }, onChange && {
|
|
473
475
|
onChange,
|
|
474
476
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
475
477
|
}
|
|
476
478
|
|
|
477
479
|
function DDatePickerInput(_a, ref) {
|
|
478
|
-
var { value, onClick, id, iconEnd, className, style } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
479
|
-
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)));
|
|
480
|
+
var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
|
|
481
|
+
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style, label: inputLabel }, props)));
|
|
480
482
|
}
|
|
481
483
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
482
484
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
483
485
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
484
486
|
|
|
485
|
-
function
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
496
|
-
const onChangeDate = useCallback((value) => {
|
|
497
|
-
if (value) {
|
|
498
|
-
changeMonth(getMonth(value));
|
|
499
|
-
changeYear(getYear(value));
|
|
487
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
488
|
+
const innerRef = useRef(null);
|
|
489
|
+
const handleChange = useCallback((event) => {
|
|
490
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
491
|
+
}, [onChange]);
|
|
492
|
+
useEffect(() => {
|
|
493
|
+
if (innerRef.current) {
|
|
494
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
500
495
|
}
|
|
501
|
-
}, [
|
|
502
|
-
|
|
496
|
+
}, [indeterminate]);
|
|
497
|
+
useEffect(() => {
|
|
498
|
+
if (innerRef.current) {
|
|
499
|
+
innerRef.current.checked = checked;
|
|
500
|
+
}
|
|
501
|
+
}, [checked]);
|
|
502
|
+
if (!label) {
|
|
503
|
+
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
504
|
+
}
|
|
505
|
+
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function DSelectOptionCheck(_a) {
|
|
509
|
+
var { innerProps, children, isSelected } = _a, props = __rest(_a, ["innerProps", "children", "isSelected"]);
|
|
510
|
+
return (jsx(components.Option, Object.assign({ className: classNames({
|
|
511
|
+
'd-select__option': true,
|
|
512
|
+
'd-select__option--is-checkbox': true,
|
|
513
|
+
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function DSelectOptionIcon(_a) {
|
|
517
|
+
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
518
|
+
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
519
|
+
'd-select__option--has-icon': true,
|
|
520
|
+
}), data: data }, props, { children: [jsx(DIcon, { icon: data.icon }), children] })));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function DSelectSingleValueIconText(_a) {
|
|
524
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
525
|
+
const [value] = getValue();
|
|
526
|
+
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
527
|
+
'd-select__control--has-icon': true,
|
|
528
|
+
}), getValue: getValue }, props, { children: [jsx(DIcon, { icon: value.icon }), children] })));
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function DSelectDropdownIndicator(props) {
|
|
532
|
+
const { iconMap: { chevronDown, }, } = useDContext();
|
|
533
|
+
return (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: chevronDown }) })));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function DSelectClearIndicator(props) {
|
|
537
|
+
const { iconMap: { xLg, }, } = useDContext();
|
|
538
|
+
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: xLg }) })));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function DSelectMultiValueRemove(props) {
|
|
542
|
+
const { iconMap: { x, }, } = useDContext();
|
|
543
|
+
return (jsx(components.MultiValueRemove, Object.assign({}, props, { children: jsx(DIcon, { icon: x }) })));
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function DSelectLoadingIndicator({ innerProps, }) {
|
|
547
|
+
return (jsx("div", Object.assign({ className: classNames({
|
|
548
|
+
'd-select__indicator': true,
|
|
549
|
+
'd-select__loading-indicator': true,
|
|
550
|
+
}) }, innerProps, { children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function DSelectOptionEmoji(_a) {
|
|
554
|
+
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
555
|
+
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
556
|
+
'd-select__option--has-icon': true,
|
|
557
|
+
}), data: data }, props, { children: [jsx("span", { children: data.emoji }), jsx("span", { children: children })] })));
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function DSelectSingleValueEmoji(_a) {
|
|
561
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
562
|
+
const [value] = getValue();
|
|
563
|
+
return (jsx(components.SingleValue, Object.assign({ className: classNames({
|
|
564
|
+
'd-select__control--has-icon': true,
|
|
565
|
+
}), getValue: getValue }, props, { children: value.emoji })));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function DSelectSingleValueEmojiText(_a) {
|
|
569
|
+
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
570
|
+
const [value] = getValue();
|
|
571
|
+
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
572
|
+
'd-select__control--has-icon': true,
|
|
573
|
+
}), getValue: getValue }, props, { children: [jsx("span", { children: value.emoji }), jsx("span", { children: children })] })));
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function DSelect(_a) {
|
|
577
|
+
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = __rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
578
|
+
const handleOnIconStartClick = useCallback(() => {
|
|
579
|
+
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
580
|
+
}, [onIconStartClick, defaultValue]);
|
|
581
|
+
const handleOnIconEndClick = useCallback(() => {
|
|
582
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
583
|
+
}, [onIconEndClick, defaultValue]);
|
|
584
|
+
return (jsxs("div", { className: classNames('d-select', className, {
|
|
585
|
+
disabled: disabled || loading,
|
|
586
|
+
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
587
|
+
'input-group': true,
|
|
588
|
+
'has-validation': invalid,
|
|
589
|
+
disabled: disabled || loading,
|
|
590
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ styles: {
|
|
591
|
+
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
592
|
+
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
593
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
594
|
+
}, className: classNames('d-select-component', {
|
|
595
|
+
'is-invalid': invalid,
|
|
596
|
+
'is-valid': valid,
|
|
597
|
+
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
598
|
+
}
|
|
599
|
+
var DSelect$1 = Object.assign(DSelect, {
|
|
600
|
+
OptionCheck: DSelectOptionCheck,
|
|
601
|
+
OptionIcon: DSelectOptionIcon,
|
|
602
|
+
SingleValueIconText: DSelectSingleValueIconText,
|
|
603
|
+
DropdownIndicator: DSelectDropdownIndicator,
|
|
604
|
+
ClearIndicator: DSelectClearIndicator,
|
|
605
|
+
MultiValueRemove: DSelectMultiValueRemove,
|
|
606
|
+
LoadingIndicator: DSelectLoadingIndicator,
|
|
607
|
+
OptionEmoji: DSelectOptionEmoji,
|
|
608
|
+
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
609
|
+
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
function DDatePickerHeader({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, minYearSelect, maxYearSelect, }) {
|
|
613
|
+
const arrayYears = useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
614
|
+
const years = useMemo(() => arrayYears.map((year) => ({
|
|
615
|
+
label: year.toString(),
|
|
616
|
+
value: year,
|
|
617
|
+
})), [arrayYears]);
|
|
618
|
+
const defaultYear = useMemo(() => years.find((year) => year.value === getYear(date)), [date, years]);
|
|
619
|
+
const arrayMonths = useMemo(() => Array.from({ length: 12 }, (_, i) => format(new Date(2000, i), 'LLLL', { locale })), [locale]);
|
|
620
|
+
const months = useMemo(() => arrayMonths.map((month, i) => ({
|
|
621
|
+
label: month,
|
|
622
|
+
value: i,
|
|
623
|
+
})), [arrayMonths]);
|
|
624
|
+
const defaultMonth = useMemo(() => ({
|
|
625
|
+
label: arrayMonths[getMonth(date)],
|
|
626
|
+
value: getMonth(date),
|
|
627
|
+
}), [arrayMonths, date]);
|
|
628
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart: iconPrevMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button" }), jsxs("div", { className: "d-flex justify-content-center flex-grow-1", children: [jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false }), jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })] }), jsx(DButton, { iconStart: iconNextMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button" })] }));
|
|
503
629
|
}
|
|
504
630
|
|
|
505
631
|
function DDatePicker(_a) {
|
|
506
|
-
var { date, selectsRange = false,
|
|
632
|
+
var { date, selectsRange = false, inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, minYearSelect = 1900, maxYearSelect = 2100, iconHeaderSize = 'sm', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerButtonVariant = 'link', headerButtonTheme = 'dark', invalid = false, valid = false, locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = __rest(_a, ["date", "selectsRange", "inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "locale", "className", "formatWeekDay", "style"]);
|
|
507
633
|
const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
|
|
508
634
|
const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
|
|
509
635
|
const iconInput = useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
|
|
636
|
+
const handleFormatWeekDay = useMemo(() => (formatWeekDayProp
|
|
637
|
+
? (day) => formatWeekDayProp(day)
|
|
638
|
+
: (day) => day.substring(0, 1)), [formatWeekDayProp]);
|
|
510
639
|
const iconPrevMonth = useMemo(() => iconHeaderPrevMonthProp || chevronLeft, [chevronLeft, iconHeaderPrevMonthProp]);
|
|
511
640
|
const iconNextMonth = useMemo(() => iconHeaderNextMonthProp || chevronRight, [chevronRight, iconHeaderNextMonthProp]);
|
|
512
|
-
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize:
|
|
641
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect }))), [
|
|
642
|
+
locale,
|
|
513
643
|
iconPrevMonth,
|
|
514
644
|
iconNextMonth,
|
|
515
645
|
iconMaterialStyleProp,
|
|
516
646
|
headerPrevMonthAriaLabel,
|
|
517
647
|
headerNextMonthAriaLabel,
|
|
518
|
-
|
|
648
|
+
iconHeaderSize,
|
|
519
649
|
headerButtonVariant,
|
|
520
650
|
headerButtonTheme,
|
|
521
|
-
|
|
651
|
+
minYearSelect,
|
|
652
|
+
maxYearSelect,
|
|
522
653
|
]);
|
|
523
|
-
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel })
|
|
654
|
+
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
|
|
524
655
|
}
|
|
525
656
|
|
|
526
657
|
function DInputMask(props, ref) {
|
|
@@ -689,40 +820,39 @@ const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
|
689
820
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
690
821
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
691
822
|
|
|
692
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
693
|
-
const innerRef = useRef(null);
|
|
694
|
-
const handleChange = useCallback((event) => {
|
|
695
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
696
|
-
}, [onChange]);
|
|
697
|
-
useEffect(() => {
|
|
698
|
-
if (innerRef.current) {
|
|
699
|
-
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
700
|
-
}
|
|
701
|
-
}, [indeterminate]);
|
|
702
|
-
useEffect(() => {
|
|
703
|
-
if (innerRef.current) {
|
|
704
|
-
innerRef.current.checked = checked;
|
|
705
|
-
}
|
|
706
|
-
}, [checked]);
|
|
707
|
-
if (!label) {
|
|
708
|
-
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
709
|
-
}
|
|
710
|
-
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
711
|
-
}
|
|
712
|
-
|
|
713
823
|
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, invalidIcon: invalidIconProp, validIcon: validIconProp, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
714
824
|
const [pattern, setPattern] = useState('');
|
|
825
|
+
const [activeInput, setActiveInput] = useState(Array.from({ length: characters }).fill(''));
|
|
826
|
+
const isInputNum = useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
715
827
|
useEffect(() => {
|
|
716
828
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
717
829
|
}, [type]);
|
|
718
|
-
const
|
|
830
|
+
const handleOTPChange = useCallback((otp) => {
|
|
831
|
+
const otpValue = otp.join('');
|
|
832
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(otpValue);
|
|
833
|
+
}, [onChange]);
|
|
834
|
+
const handlePaste = useCallback((event) => {
|
|
835
|
+
event.preventDefault();
|
|
836
|
+
const pastedData = event.clipboardData.getData('text/plain');
|
|
837
|
+
const cleanData = isInputNum ? pastedData.replace(/[^0-9]/gmi, '') : pastedData;
|
|
838
|
+
const newInput = Array.from({ length: characters }).map((_, index) => cleanData[index] || '');
|
|
839
|
+
setActiveInput(newInput);
|
|
840
|
+
handleOTPChange(newInput);
|
|
841
|
+
event.currentTarget.blur();
|
|
842
|
+
}, [characters, handleOTPChange, isInputNum]);
|
|
843
|
+
const nextInput = useCallback((event, index) => {
|
|
719
844
|
var _a;
|
|
720
|
-
const input = event.target;
|
|
721
845
|
const regex = new RegExp(pattern);
|
|
846
|
+
const input = event.currentTarget;
|
|
722
847
|
if (!regex.test(input.value)) {
|
|
723
848
|
input.value = '';
|
|
724
849
|
}
|
|
725
850
|
if (input.value !== '') {
|
|
851
|
+
setActiveInput((prev) => {
|
|
852
|
+
const newValue = prev.with(index, input.value);
|
|
853
|
+
handleOTPChange(newValue);
|
|
854
|
+
return newValue;
|
|
855
|
+
});
|
|
726
856
|
if (input.nextSibling) {
|
|
727
857
|
(_a = input.nextSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
728
858
|
}
|
|
@@ -730,43 +860,39 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
730
860
|
input.blur();
|
|
731
861
|
}
|
|
732
862
|
}
|
|
733
|
-
}, [pattern]);
|
|
734
|
-
const prevInput = useCallback((
|
|
863
|
+
}, [handleOTPChange, pattern]);
|
|
864
|
+
const prevInput = useCallback(({ key, currentTarget }, index) => {
|
|
735
865
|
var _a;
|
|
736
|
-
if (
|
|
737
|
-
const { value } =
|
|
738
|
-
|
|
739
|
-
|
|
866
|
+
if (key === 'Backspace') {
|
|
867
|
+
const { value } = currentTarget;
|
|
868
|
+
setActiveInput((prev) => {
|
|
869
|
+
const newVal = prev.with(index, '');
|
|
870
|
+
handleOTPChange(newVal);
|
|
871
|
+
return newVal;
|
|
872
|
+
});
|
|
873
|
+
if (currentTarget.previousSibling && value === '') {
|
|
874
|
+
(_a = currentTarget.previousSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
740
875
|
}
|
|
741
876
|
else {
|
|
742
|
-
|
|
743
|
-
|
|
877
|
+
currentTarget.blur();
|
|
878
|
+
currentTarget.focus();
|
|
744
879
|
}
|
|
745
880
|
}
|
|
746
|
-
}, []);
|
|
747
|
-
const focusInput = useCallback((
|
|
748
|
-
|
|
749
|
-
event.currentTarget.value = '';
|
|
881
|
+
}, [handleOTPChange]);
|
|
882
|
+
const focusInput = useCallback((index) => {
|
|
883
|
+
setActiveInput((prev) => prev.with(index, ''));
|
|
750
884
|
}, []);
|
|
751
885
|
const wheelInput = useCallback((event) => {
|
|
752
886
|
event.currentTarget.blur();
|
|
753
887
|
}, []);
|
|
754
|
-
const formChange = useCallback((event) => {
|
|
755
|
-
const formData = new FormData(event.currentTarget);
|
|
756
|
-
const values = Array.from(formData.values()).join('');
|
|
757
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(values);
|
|
758
|
-
}, [onChange]);
|
|
759
|
-
const preventDefaultEvent = useCallback((event) => {
|
|
760
|
-
event.preventDefault();
|
|
761
|
-
}, []);
|
|
762
888
|
const { iconMap: { input } } = useDContext();
|
|
763
889
|
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
764
890
|
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
765
|
-
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("
|
|
891
|
+
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
|
|
766
892
|
'form-control': true,
|
|
767
893
|
'is-invalid': invalid,
|
|
768
894
|
'is-valid': valid,
|
|
769
|
-
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1,
|
|
895
|
+
}), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsx("div", { className: "input-group-text", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
770
896
|
}
|
|
771
897
|
|
|
772
898
|
function DInputSelect({ id, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, floatingLabel = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
@@ -860,110 +986,6 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
860
986
|
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
861
987
|
}
|
|
862
988
|
|
|
863
|
-
function DSelectOptionCheck(_a) {
|
|
864
|
-
var { innerProps, children, isSelected } = _a, props = __rest(_a, ["innerProps", "children", "isSelected"]);
|
|
865
|
-
return (jsx(components.Option, Object.assign({ className: classNames({
|
|
866
|
-
'd-select__option': true,
|
|
867
|
-
'd-select__option--is-checkbox': true,
|
|
868
|
-
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
function DSelectOptionIcon(_a) {
|
|
872
|
-
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
873
|
-
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
874
|
-
'd-select__option--has-icon': true,
|
|
875
|
-
}), data: data }, props, { children: [jsx(DIcon, { icon: data.icon }), children] })));
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function DSelectSingleValueIconText(_a) {
|
|
879
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
880
|
-
const [value] = getValue();
|
|
881
|
-
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
882
|
-
'd-select__control--has-icon': true,
|
|
883
|
-
}), getValue: getValue }, props, { children: [jsx(DIcon, { icon: value.icon }), children] })));
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
function DSelectDropdownIndicator(props) {
|
|
887
|
-
const { iconMap: { chevronDown, }, } = useDContext();
|
|
888
|
-
return (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: chevronDown }) })));
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
function DSelectClearIndicator(props) {
|
|
892
|
-
const { iconMap: { xLg, }, } = useDContext();
|
|
893
|
-
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(DIcon, { icon: xLg }) })));
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
function DSelectMultiValueRemove(props) {
|
|
897
|
-
const { iconMap: { x, }, } = useDContext();
|
|
898
|
-
return (jsx(components.MultiValueRemove, Object.assign({}, props, { children: jsx(DIcon, { icon: x }) })));
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
function DSelectLoadingIndicator({ innerProps, }) {
|
|
902
|
-
return (jsx("div", Object.assign({ className: classNames({
|
|
903
|
-
'd-select__indicator': true,
|
|
904
|
-
'd-select__loading-indicator': true,
|
|
905
|
-
}) }, innerProps, { children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
function DSelectOptionEmoji(_a) {
|
|
909
|
-
var { children, data } = _a, props = __rest(_a, ["children", "data"]);
|
|
910
|
-
return (jsxs(components.Option, Object.assign({ className: classNames({
|
|
911
|
-
'd-select__option--has-icon': true,
|
|
912
|
-
}), data: data }, props, { children: [jsx("span", { children: data.emoji }), jsx("span", { children: children })] })));
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
function DSelectSingleValueEmoji(_a) {
|
|
916
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
917
|
-
const [value] = getValue();
|
|
918
|
-
return (jsx(components.SingleValue, Object.assign({ className: classNames({
|
|
919
|
-
'd-select__control--has-icon': true,
|
|
920
|
-
}), getValue: getValue }, props, { children: value.emoji })));
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
function DSelectSingleValueEmojiText(_a) {
|
|
924
|
-
var { children, getValue } = _a, props = __rest(_a, ["children", "getValue"]);
|
|
925
|
-
const [value] = getValue();
|
|
926
|
-
return (jsxs(components.SingleValue, Object.assign({ className: classNames({
|
|
927
|
-
'd-select__control--has-icon': true,
|
|
928
|
-
}), getValue: getValue }, props, { children: [jsx("span", { children: value.emoji }), jsx("span", { children: children })] })));
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
function DSelect(_a) {
|
|
932
|
-
var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = __rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
|
|
933
|
-
const handleOnIconStartClick = useCallback(() => {
|
|
934
|
-
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
935
|
-
}, [onIconStartClick, defaultValue]);
|
|
936
|
-
const handleOnIconEndClick = useCallback(() => {
|
|
937
|
-
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
938
|
-
}, [onIconEndClick, defaultValue]);
|
|
939
|
-
return (jsxs("div", { className: classNames('d-select', className, {
|
|
940
|
-
disabled: disabled || loading,
|
|
941
|
-
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
942
|
-
'input-group': true,
|
|
943
|
-
'has-validation': invalid,
|
|
944
|
-
disabled: disabled || loading,
|
|
945
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ styles: {
|
|
946
|
-
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
947
|
-
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
948
|
-
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
949
|
-
}, className: classNames('d-select-component', {
|
|
950
|
-
'is-invalid': invalid,
|
|
951
|
-
'is-valid': valid,
|
|
952
|
-
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
953
|
-
}
|
|
954
|
-
var DSelect$1 = Object.assign(DSelect, {
|
|
955
|
-
OptionCheck: DSelectOptionCheck,
|
|
956
|
-
OptionIcon: DSelectOptionIcon,
|
|
957
|
-
SingleValueIconText: DSelectSingleValueIconText,
|
|
958
|
-
DropdownIndicator: DSelectDropdownIndicator,
|
|
959
|
-
ClearIndicator: DSelectClearIndicator,
|
|
960
|
-
MultiValueRemove: DSelectMultiValueRemove,
|
|
961
|
-
LoadingIndicator: DSelectLoadingIndicator,
|
|
962
|
-
OptionEmoji: DSelectOptionEmoji,
|
|
963
|
-
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
964
|
-
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
965
|
-
});
|
|
966
|
-
|
|
967
989
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
968
990
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
969
991
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1355,5 +1377,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1355
1377
|
.then((t) => t);
|
|
1356
1378
|
}
|
|
1357
1379
|
|
|
1358
|
-
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover,
|
|
1380
|
+
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext };
|
|
1359
1381
|
//# sourceMappingURL=index.esm.js.map
|