@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.js
CHANGED
|
@@ -10,8 +10,8 @@ var reactSplide = require('@splidejs/react-splide');
|
|
|
10
10
|
var currency = require('currency.js');
|
|
11
11
|
var DatePicker = require('react-datepicker');
|
|
12
12
|
var dateFns = require('date-fns');
|
|
13
|
-
var mask = require('@react-input/mask');
|
|
14
13
|
var Select = require('react-select');
|
|
14
|
+
var mask = require('@react-input/mask');
|
|
15
15
|
var ResponsivePagination = require('react-responsive-pagination');
|
|
16
16
|
var react = require('@floating-ui/react');
|
|
17
17
|
var ContentLoader = require('react-content-loader');
|
|
@@ -100,29 +100,31 @@ function usePortal(portalName) {
|
|
|
100
100
|
* @returns The list and controls to modify the stack
|
|
101
101
|
* @see https://react-hooks.org/docs/useStackState
|
|
102
102
|
*/
|
|
103
|
-
function useStackState(initialList) {
|
|
103
|
+
function useStackState(initialList = []) {
|
|
104
104
|
const [list, setList] = React.useState(initialList);
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
]);
|
|
111
|
-
}, []);
|
|
112
|
-
const pop = React.useCallback(() => {
|
|
113
|
-
setList((prevList) => (prevList.slice(0, prevList.length - 1)));
|
|
114
|
-
}, []);
|
|
105
|
+
const push = React.useCallback((item) => (setList((prevList) => [
|
|
106
|
+
...prevList,
|
|
107
|
+
item,
|
|
108
|
+
])), []);
|
|
109
|
+
const pop = React.useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);
|
|
115
110
|
const peek = React.useCallback(() => list.at(-1), [list]);
|
|
116
|
-
const clear = () => setList([]);
|
|
117
|
-
const isEmpty = React.useCallback(() => list.length === 0, [list]);
|
|
118
|
-
const controls = {
|
|
111
|
+
const clear = React.useCallback(() => setList([]), []);
|
|
112
|
+
const isEmpty = React.useCallback(() => list.length === 0, [list.length]);
|
|
113
|
+
const controls = React.useMemo(() => ({
|
|
119
114
|
clear,
|
|
120
115
|
isEmpty,
|
|
121
|
-
length,
|
|
116
|
+
length: list.length,
|
|
122
117
|
peek,
|
|
123
118
|
pop,
|
|
124
119
|
push,
|
|
125
|
-
}
|
|
120
|
+
}), [
|
|
121
|
+
clear,
|
|
122
|
+
isEmpty,
|
|
123
|
+
list.length,
|
|
124
|
+
peek,
|
|
125
|
+
pop,
|
|
126
|
+
push,
|
|
127
|
+
]);
|
|
126
128
|
return [list, controls];
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -156,7 +158,7 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
156
158
|
openPortal,
|
|
157
159
|
closePortal,
|
|
158
160
|
}), [stack, openPortal, closePortal]);
|
|
159
|
-
return (jsxRuntime.jsxs(DPortalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxRuntime.jsxs(
|
|
161
|
+
return (jsxRuntime.jsxs(DPortalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: "backdrop fade show" }), jsxRuntime.jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
|
|
160
162
|
}
|
|
161
163
|
function useDPortalContext() {
|
|
162
164
|
const context = React.useContext(DPortalContext);
|
|
@@ -471,58 +473,187 @@ var DInput$1 = ForwardedDInput;
|
|
|
471
473
|
|
|
472
474
|
function DDatePickerTime(_a) {
|
|
473
475
|
var { value, onChange, id, label, className, style } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
474
|
-
return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsxRuntime.jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsxRuntime.jsx(DInput$1, Object.assign({}, onChange && {
|
|
476
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsxRuntime.jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsxRuntime.jsx(DInput$1, Object.assign({ className: "w-100" }, onChange && {
|
|
475
477
|
onChange,
|
|
476
478
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
477
479
|
}
|
|
478
480
|
|
|
479
481
|
function DDatePickerInput(_a, ref) {
|
|
480
|
-
var { value, onClick, id, iconEnd, className, style } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
481
|
-
return (jsxRuntime.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)));
|
|
482
|
+
var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
|
|
483
|
+
return (jsxRuntime.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)));
|
|
482
484
|
}
|
|
483
485
|
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
484
486
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
485
487
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
486
488
|
|
|
487
|
-
function
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
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, }) {
|
|
498
|
-
const onChangeDate = React.useCallback((value) => {
|
|
499
|
-
if (value) {
|
|
500
|
-
changeMonth(dateFns.getMonth(value));
|
|
501
|
-
changeYear(dateFns.getYear(value));
|
|
489
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
490
|
+
const innerRef = React.useRef(null);
|
|
491
|
+
const handleChange = React.useCallback((event) => {
|
|
492
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
493
|
+
}, [onChange]);
|
|
494
|
+
React.useEffect(() => {
|
|
495
|
+
if (innerRef.current) {
|
|
496
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
502
497
|
}
|
|
503
|
-
}, [
|
|
504
|
-
|
|
498
|
+
}, [indeterminate]);
|
|
499
|
+
React.useEffect(() => {
|
|
500
|
+
if (innerRef.current) {
|
|
501
|
+
innerRef.current.checked = checked;
|
|
502
|
+
}
|
|
503
|
+
}, [checked]);
|
|
504
|
+
if (!label) {
|
|
505
|
+
return (jsxRuntime.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 }));
|
|
506
|
+
}
|
|
507
|
+
return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function DSelectOptionCheck(_a) {
|
|
511
|
+
var { innerProps, children, isSelected } = _a, props = tslib.__rest(_a, ["innerProps", "children", "isSelected"]);
|
|
512
|
+
return (jsxRuntime.jsx(Select.components.Option, Object.assign({ className: classNames({
|
|
513
|
+
'd-select__option': true,
|
|
514
|
+
'd-select__option--is-checkbox': true,
|
|
515
|
+
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function DSelectOptionIcon(_a) {
|
|
519
|
+
var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
|
|
520
|
+
return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
|
|
521
|
+
'd-select__option--has-icon': true,
|
|
522
|
+
}), data: data }, props, { children: [jsxRuntime.jsx(DIcon, { icon: data.icon }), children] })));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function DSelectSingleValueIconText(_a) {
|
|
526
|
+
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
527
|
+
const [value] = getValue();
|
|
528
|
+
return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
529
|
+
'd-select__control--has-icon': true,
|
|
530
|
+
}), getValue: getValue }, props, { children: [jsxRuntime.jsx(DIcon, { icon: value.icon }), children] })));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function DSelectDropdownIndicator(props) {
|
|
534
|
+
const { iconMap: { chevronDown, }, } = useDContext();
|
|
535
|
+
return (jsxRuntime.jsx(Select.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: chevronDown }) })));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function DSelectClearIndicator(props) {
|
|
539
|
+
const { iconMap: { xLg, }, } = useDContext();
|
|
540
|
+
return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: xLg }) })));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function DSelectMultiValueRemove(props) {
|
|
544
|
+
const { iconMap: { x, }, } = useDContext();
|
|
545
|
+
return (jsxRuntime.jsx(Select.components.MultiValueRemove, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: x }) })));
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function DSelectLoadingIndicator({ innerProps, }) {
|
|
549
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames({
|
|
550
|
+
'd-select__indicator': true,
|
|
551
|
+
'd-select__loading-indicator': true,
|
|
552
|
+
}) }, innerProps, { children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function DSelectOptionEmoji(_a) {
|
|
556
|
+
var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
|
|
557
|
+
return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
|
|
558
|
+
'd-select__option--has-icon': true,
|
|
559
|
+
}), data: data }, props, { children: [jsxRuntime.jsx("span", { children: data.emoji }), jsxRuntime.jsx("span", { children: children })] })));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function DSelectSingleValueEmoji(_a) {
|
|
563
|
+
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
564
|
+
const [value] = getValue();
|
|
565
|
+
return (jsxRuntime.jsx(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
566
|
+
'd-select__control--has-icon': true,
|
|
567
|
+
}), getValue: getValue }, props, { children: value.emoji })));
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function DSelectSingleValueEmojiText(_a) {
|
|
571
|
+
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
572
|
+
const [value] = getValue();
|
|
573
|
+
return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
574
|
+
'd-select__control--has-icon': true,
|
|
575
|
+
}), getValue: getValue }, props, { children: [jsxRuntime.jsx("span", { children: value.emoji }), jsxRuntime.jsx("span", { children: children })] })));
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function DSelect(_a) {
|
|
579
|
+
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 = tslib.__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"]);
|
|
580
|
+
const handleOnIconStartClick = React.useCallback(() => {
|
|
581
|
+
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
582
|
+
}, [onIconStartClick, defaultValue]);
|
|
583
|
+
const handleOnIconEndClick = React.useCallback(() => {
|
|
584
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
585
|
+
}, [onIconEndClick, defaultValue]);
|
|
586
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-select', className, {
|
|
587
|
+
disabled: disabled || loading,
|
|
588
|
+
}), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: classNames({
|
|
589
|
+
'input-group': true,
|
|
590
|
+
'has-validation': invalid,
|
|
591
|
+
disabled: disabled || loading,
|
|
592
|
+
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ styles: {
|
|
593
|
+
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
594
|
+
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
595
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
596
|
+
}, className: classNames('d-select-component', {
|
|
597
|
+
'is-invalid': invalid,
|
|
598
|
+
'is-valid': valid,
|
|
599
|
+
}), 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) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
600
|
+
}
|
|
601
|
+
var DSelect$1 = Object.assign(DSelect, {
|
|
602
|
+
OptionCheck: DSelectOptionCheck,
|
|
603
|
+
OptionIcon: DSelectOptionIcon,
|
|
604
|
+
SingleValueIconText: DSelectSingleValueIconText,
|
|
605
|
+
DropdownIndicator: DSelectDropdownIndicator,
|
|
606
|
+
ClearIndicator: DSelectClearIndicator,
|
|
607
|
+
MultiValueRemove: DSelectMultiValueRemove,
|
|
608
|
+
LoadingIndicator: DSelectLoadingIndicator,
|
|
609
|
+
OptionEmoji: DSelectOptionEmoji,
|
|
610
|
+
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
611
|
+
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
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, }) {
|
|
615
|
+
const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
616
|
+
const years = React.useMemo(() => arrayYears.map((year) => ({
|
|
617
|
+
label: year.toString(),
|
|
618
|
+
value: year,
|
|
619
|
+
})), [arrayYears]);
|
|
620
|
+
const defaultYear = React.useMemo(() => years.find((year) => year.value === dateFns.getYear(date)), [date, years]);
|
|
621
|
+
const arrayMonths = React.useMemo(() => Array.from({ length: 12 }, (_, i) => dateFns.format(new Date(2000, i), 'LLLL', { locale })), [locale]);
|
|
622
|
+
const months = React.useMemo(() => arrayMonths.map((month, i) => ({
|
|
623
|
+
label: month,
|
|
624
|
+
value: i,
|
|
625
|
+
})), [arrayMonths]);
|
|
626
|
+
const defaultMonth = React.useMemo(() => ({
|
|
627
|
+
label: arrayMonths[dateFns.getMonth(date)],
|
|
628
|
+
value: dateFns.getMonth(date),
|
|
629
|
+
}), [arrayMonths, date]);
|
|
630
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center d-datepicker-header', className), style: style, children: [jsxRuntime.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" }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-center flex-grow-1", children: [jsxRuntime.jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false }), jsxRuntime.jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })] }), jsxRuntime.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" })] }));
|
|
505
631
|
}
|
|
506
632
|
|
|
507
633
|
function DDatePicker(_a) {
|
|
508
|
-
var { date, selectsRange = false,
|
|
634
|
+
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 = tslib.__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"]);
|
|
509
635
|
const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
|
|
510
636
|
const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
|
|
511
637
|
const iconInput = React.useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
|
|
638
|
+
const handleFormatWeekDay = React.useMemo(() => (formatWeekDayProp
|
|
639
|
+
? (day) => formatWeekDayProp(day)
|
|
640
|
+
: (day) => day.substring(0, 1)), [formatWeekDayProp]);
|
|
512
641
|
const iconPrevMonth = React.useMemo(() => iconHeaderPrevMonthProp || chevronLeft, [chevronLeft, iconHeaderPrevMonthProp]);
|
|
513
642
|
const iconNextMonth = React.useMemo(() => iconHeaderNextMonthProp || chevronRight, [chevronRight, iconHeaderNextMonthProp]);
|
|
514
|
-
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize:
|
|
643
|
+
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.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 }))), [
|
|
644
|
+
locale,
|
|
515
645
|
iconPrevMonth,
|
|
516
646
|
iconNextMonth,
|
|
517
647
|
iconMaterialStyleProp,
|
|
518
648
|
headerPrevMonthAriaLabel,
|
|
519
649
|
headerNextMonthAriaLabel,
|
|
520
|
-
|
|
650
|
+
iconHeaderSize,
|
|
521
651
|
headerButtonVariant,
|
|
522
652
|
headerButtonTheme,
|
|
523
|
-
|
|
653
|
+
minYearSelect,
|
|
654
|
+
maxYearSelect,
|
|
524
655
|
]);
|
|
525
|
-
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsxRuntime.jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, className: className, style: style })), customTimeInput: jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })
|
|
656
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.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: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
|
|
526
657
|
}
|
|
527
658
|
|
|
528
659
|
function DInputMask(props, ref) {
|
|
@@ -691,40 +822,39 @@ const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
|
691
822
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
692
823
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
693
824
|
|
|
694
|
-
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
695
|
-
const innerRef = React.useRef(null);
|
|
696
|
-
const handleChange = React.useCallback((event) => {
|
|
697
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
698
|
-
}, [onChange]);
|
|
699
|
-
React.useEffect(() => {
|
|
700
|
-
if (innerRef.current) {
|
|
701
|
-
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
702
|
-
}
|
|
703
|
-
}, [indeterminate]);
|
|
704
|
-
React.useEffect(() => {
|
|
705
|
-
if (innerRef.current) {
|
|
706
|
-
innerRef.current.checked = checked;
|
|
707
|
-
}
|
|
708
|
-
}, [checked]);
|
|
709
|
-
if (!label) {
|
|
710
|
-
return (jsxRuntime.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 }));
|
|
711
|
-
}
|
|
712
|
-
return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
713
|
-
}
|
|
714
|
-
|
|
715
825
|
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, }) {
|
|
716
826
|
const [pattern, setPattern] = React.useState('');
|
|
827
|
+
const [activeInput, setActiveInput] = React.useState(Array.from({ length: characters }).fill(''));
|
|
828
|
+
const isInputNum = React.useMemo(() => type === 'number' || type === 'tel', [type]);
|
|
717
829
|
React.useEffect(() => {
|
|
718
830
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
719
831
|
}, [type]);
|
|
720
|
-
const
|
|
832
|
+
const handleOTPChange = React.useCallback((otp) => {
|
|
833
|
+
const otpValue = otp.join('');
|
|
834
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(otpValue);
|
|
835
|
+
}, [onChange]);
|
|
836
|
+
const handlePaste = React.useCallback((event) => {
|
|
837
|
+
event.preventDefault();
|
|
838
|
+
const pastedData = event.clipboardData.getData('text/plain');
|
|
839
|
+
const cleanData = isInputNum ? pastedData.replace(/[^0-9]/gmi, '') : pastedData;
|
|
840
|
+
const newInput = Array.from({ length: characters }).map((_, index) => cleanData[index] || '');
|
|
841
|
+
setActiveInput(newInput);
|
|
842
|
+
handleOTPChange(newInput);
|
|
843
|
+
event.currentTarget.blur();
|
|
844
|
+
}, [characters, handleOTPChange, isInputNum]);
|
|
845
|
+
const nextInput = React.useCallback((event, index) => {
|
|
721
846
|
var _a;
|
|
722
|
-
const input = event.target;
|
|
723
847
|
const regex = new RegExp(pattern);
|
|
848
|
+
const input = event.currentTarget;
|
|
724
849
|
if (!regex.test(input.value)) {
|
|
725
850
|
input.value = '';
|
|
726
851
|
}
|
|
727
852
|
if (input.value !== '') {
|
|
853
|
+
setActiveInput((prev) => {
|
|
854
|
+
const newValue = prev.with(index, input.value);
|
|
855
|
+
handleOTPChange(newValue);
|
|
856
|
+
return newValue;
|
|
857
|
+
});
|
|
728
858
|
if (input.nextSibling) {
|
|
729
859
|
(_a = input.nextSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
730
860
|
}
|
|
@@ -732,43 +862,39 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
732
862
|
input.blur();
|
|
733
863
|
}
|
|
734
864
|
}
|
|
735
|
-
}, [pattern]);
|
|
736
|
-
const prevInput = React.useCallback((
|
|
865
|
+
}, [handleOTPChange, pattern]);
|
|
866
|
+
const prevInput = React.useCallback(({ key, currentTarget }, index) => {
|
|
737
867
|
var _a;
|
|
738
|
-
if (
|
|
739
|
-
const { value } =
|
|
740
|
-
|
|
741
|
-
|
|
868
|
+
if (key === 'Backspace') {
|
|
869
|
+
const { value } = currentTarget;
|
|
870
|
+
setActiveInput((prev) => {
|
|
871
|
+
const newVal = prev.with(index, '');
|
|
872
|
+
handleOTPChange(newVal);
|
|
873
|
+
return newVal;
|
|
874
|
+
});
|
|
875
|
+
if (currentTarget.previousSibling && value === '') {
|
|
876
|
+
(_a = currentTarget.previousSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
742
877
|
}
|
|
743
878
|
else {
|
|
744
|
-
|
|
745
|
-
|
|
879
|
+
currentTarget.blur();
|
|
880
|
+
currentTarget.focus();
|
|
746
881
|
}
|
|
747
882
|
}
|
|
748
|
-
}, []);
|
|
749
|
-
const focusInput = React.useCallback((
|
|
750
|
-
|
|
751
|
-
event.currentTarget.value = '';
|
|
883
|
+
}, [handleOTPChange]);
|
|
884
|
+
const focusInput = React.useCallback((index) => {
|
|
885
|
+
setActiveInput((prev) => prev.with(index, ''));
|
|
752
886
|
}, []);
|
|
753
887
|
const wheelInput = React.useCallback((event) => {
|
|
754
888
|
event.currentTarget.blur();
|
|
755
889
|
}, []);
|
|
756
|
-
const formChange = React.useCallback((event) => {
|
|
757
|
-
const formData = new FormData(event.currentTarget);
|
|
758
|
-
const values = Array.from(formData.values()).join('');
|
|
759
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(values);
|
|
760
|
-
}, [onChange]);
|
|
761
|
-
const preventDefaultEvent = React.useCallback((event) => {
|
|
762
|
-
event.preventDefault();
|
|
763
|
-
}, []);
|
|
764
890
|
const { iconMap: { input } } = useDContext();
|
|
765
891
|
const invalidIcon = React.useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
766
892
|
const validIcon = React.useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
767
|
-
return (jsxRuntime.jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("
|
|
893
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsxRuntime.jsx("input", Object.assign({ className: classNames({
|
|
768
894
|
'form-control': true,
|
|
769
895
|
'is-invalid': invalid,
|
|
770
896
|
'is-valid': valid,
|
|
771
|
-
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1,
|
|
897
|
+
}), 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 && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
772
898
|
}
|
|
773
899
|
|
|
774
900
|
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, }) {
|
|
@@ -862,110 +988,6 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
|
|
|
862
988
|
return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.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 && (jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
863
989
|
}
|
|
864
990
|
|
|
865
|
-
function DSelectOptionCheck(_a) {
|
|
866
|
-
var { innerProps, children, isSelected } = _a, props = tslib.__rest(_a, ["innerProps", "children", "isSelected"]);
|
|
867
|
-
return (jsxRuntime.jsx(Select.components.Option, Object.assign({ className: classNames({
|
|
868
|
-
'd-select__option': true,
|
|
869
|
-
'd-select__option--is-checkbox': true,
|
|
870
|
-
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function DSelectOptionIcon(_a) {
|
|
874
|
-
var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
|
|
875
|
-
return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
|
|
876
|
-
'd-select__option--has-icon': true,
|
|
877
|
-
}), data: data }, props, { children: [jsxRuntime.jsx(DIcon, { icon: data.icon }), children] })));
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
function DSelectSingleValueIconText(_a) {
|
|
881
|
-
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
882
|
-
const [value] = getValue();
|
|
883
|
-
return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
884
|
-
'd-select__control--has-icon': true,
|
|
885
|
-
}), getValue: getValue }, props, { children: [jsxRuntime.jsx(DIcon, { icon: value.icon }), children] })));
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
function DSelectDropdownIndicator(props) {
|
|
889
|
-
const { iconMap: { chevronDown, }, } = useDContext();
|
|
890
|
-
return (jsxRuntime.jsx(Select.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: chevronDown }) })));
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
function DSelectClearIndicator(props) {
|
|
894
|
-
const { iconMap: { xLg, }, } = useDContext();
|
|
895
|
-
return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: xLg }) })));
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function DSelectMultiValueRemove(props) {
|
|
899
|
-
const { iconMap: { x, }, } = useDContext();
|
|
900
|
-
return (jsxRuntime.jsx(Select.components.MultiValueRemove, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: x }) })));
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
function DSelectLoadingIndicator({ innerProps, }) {
|
|
904
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames({
|
|
905
|
-
'd-select__indicator': true,
|
|
906
|
-
'd-select__loading-indicator': true,
|
|
907
|
-
}) }, innerProps, { children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
function DSelectOptionEmoji(_a) {
|
|
911
|
-
var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
|
|
912
|
-
return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
|
|
913
|
-
'd-select__option--has-icon': true,
|
|
914
|
-
}), data: data }, props, { children: [jsxRuntime.jsx("span", { children: data.emoji }), jsxRuntime.jsx("span", { children: children })] })));
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
function DSelectSingleValueEmoji(_a) {
|
|
918
|
-
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
919
|
-
const [value] = getValue();
|
|
920
|
-
return (jsxRuntime.jsx(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
921
|
-
'd-select__control--has-icon': true,
|
|
922
|
-
}), getValue: getValue }, props, { children: value.emoji })));
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
function DSelectSingleValueEmojiText(_a) {
|
|
926
|
-
var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
|
|
927
|
-
const [value] = getValue();
|
|
928
|
-
return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
|
|
929
|
-
'd-select__control--has-icon': true,
|
|
930
|
-
}), getValue: getValue }, props, { children: [jsxRuntime.jsx("span", { children: value.emoji }), jsxRuntime.jsx("span", { children: children })] })));
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
function DSelect(_a) {
|
|
934
|
-
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 = tslib.__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"]);
|
|
935
|
-
const handleOnIconStartClick = React.useCallback(() => {
|
|
936
|
-
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
937
|
-
}, [onIconStartClick, defaultValue]);
|
|
938
|
-
const handleOnIconEndClick = React.useCallback(() => {
|
|
939
|
-
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
|
|
940
|
-
}, [onIconEndClick, defaultValue]);
|
|
941
|
-
return (jsxRuntime.jsxs("div", { className: classNames('d-select', className, {
|
|
942
|
-
disabled: disabled || loading,
|
|
943
|
-
}), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: classNames({
|
|
944
|
-
'input-group': true,
|
|
945
|
-
'has-validation': invalid,
|
|
946
|
-
disabled: disabled || loading,
|
|
947
|
-
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ styles: {
|
|
948
|
-
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
949
|
-
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
950
|
-
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
951
|
-
}, className: classNames('d-select-component', {
|
|
952
|
-
'is-invalid': invalid,
|
|
953
|
-
'is-valid': valid,
|
|
954
|
-
}), 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) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
955
|
-
}
|
|
956
|
-
var DSelect$1 = Object.assign(DSelect, {
|
|
957
|
-
OptionCheck: DSelectOptionCheck,
|
|
958
|
-
OptionIcon: DSelectOptionIcon,
|
|
959
|
-
SingleValueIconText: DSelectSingleValueIconText,
|
|
960
|
-
DropdownIndicator: DSelectDropdownIndicator,
|
|
961
|
-
ClearIndicator: DSelectClearIndicator,
|
|
962
|
-
MultiValueRemove: DSelectMultiValueRemove,
|
|
963
|
-
LoadingIndicator: DSelectLoadingIndicator,
|
|
964
|
-
OptionEmoji: DSelectOptionEmoji,
|
|
965
|
-
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
966
|
-
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
967
|
-
});
|
|
968
|
-
|
|
969
991
|
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
970
992
|
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
971
993
|
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
@@ -1398,8 +1420,6 @@ exports.DOffcanvasFooter = DOffcanvasFooter;
|
|
|
1398
1420
|
exports.DOffcanvasHeader = DOffcanvasHeader;
|
|
1399
1421
|
exports.DPaginator = DPaginator;
|
|
1400
1422
|
exports.DPopover = DPopover;
|
|
1401
|
-
exports.DPortalContext = DPortalContext;
|
|
1402
|
-
exports.DPortalContextProvider = DPortalContextProvider;
|
|
1403
1423
|
exports.DProgress = DProgress;
|
|
1404
1424
|
exports.DQuickActionButton = DQuickActionButton;
|
|
1405
1425
|
exports.DQuickActionCheck = DQuickActionCheck;
|