@dynamic-framework/ui-react 1.19.0 → 1.19.1

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/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 { length } = list;
106
- const push = React.useCallback((item) => {
107
- setList((prevList) => [
108
- ...prevList,
109
- item,
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(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "backdrop fade show" }), jsxRuntime.jsx(Component, { name: name, payload: payload })] }))) }), document.getElementById(portalName))] }));
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 } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel"]);
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 DMonthPicker(_a) {
488
- var { onChange, date, locale, className, calendarClassName, headerPrevYearAriaLabel = 'decrease year', headerNextYearAriaLabel = 'increase year', iconFamilyClass, iconFamilyPrefix, iconPrevMonth: iconPrevMonthProp, iconNextMonth: iconNextMonthProp } = _a, props = tslib.__rest(_a, ["onChange", "date", "locale", "className", "calendarClassName", "headerPrevYearAriaLabel", "headerNextYearAriaLabel", "iconFamilyClass", "iconFamilyPrefix", "iconPrevMonth", "iconNextMonth"]);
489
- const selected = React.useMemo(() => dateFns.parseISO(date), [date]);
490
- const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
491
- const iconPrevMonth = React.useMemo(() => iconPrevMonthProp || chevronLeft, [chevronLeft, iconPrevMonthProp]);
492
- const iconNextMonth = React.useMemo(() => iconNextMonthProp || chevronRight, [chevronRight, iconNextMonthProp]);
493
- const dateFormatted = React.useMemo(() => (dateFns.format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
494
- return (jsxRuntime.jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, className: className, calendarClassName: classNames('d-month-picker', calendarClassName), onChange: onChange }, locale && { locale }, { customInput: (jsxRuntime.jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between gap-6 fs-6 bg-dark", children: [jsxRuntime.jsx(DButton, { iconStart: iconPrevMonth, size: "sm", variant: "link", theme: "light", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: headerPrevYearAriaLabel, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsxRuntime.jsx(DButton, { iconStart: iconNextMonth, size: "sm", variant: "link", theme: "light", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: headerNextYearAriaLabel, iconEndFamilyClass: iconFamilyPrefix, iconEndFamilyPrefix: iconFamilyPrefix })] })) }, props)));
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);
497
+ }
498
+ }, [indeterminate]);
499
+ React.useEffect(() => {
500
+ if (innerRef.current) {
501
+ innerRef.current.checked = checked;
502
502
  }
503
- }, [changeMonth, changeYear]);
504
- return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center justify-content-between 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 }), jsxRuntime.jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, withMonthSelector && { className: 'cursor-pointer' }, { date: monthDate.toISOString(), onChange: onChangeDate, iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth }, locale && { locale })), jsxRuntime.jsx(DButton, { iconStart: iconNextMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel })] }));
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, withMonthSelector, inputLabel, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
634
+ var { date, selectsRange = false, inputLabel, 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', locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "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: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [locale,
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
- headerIconSize,
650
+ iconHeaderSize,
521
651
  headerButtonVariant,
522
652
  headerButtonTheme,
523
- withMonthSelector,
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 }), selectsRange: selectsRange }, locale && { locale }, props)));
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 })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
526
657
  }
527
658
 
528
659
  function DInputMask(props, ref) {
@@ -691,27 +822,6 @@ 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('');
717
827
  React.useEffect(() => {
@@ -862,110 +972,6 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
862
972
  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
973
  }
864
974
 
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
975
  function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
970
976
  const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
971
977
  return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
@@ -1398,8 +1404,6 @@ exports.DOffcanvasFooter = DOffcanvasFooter;
1398
1404
  exports.DOffcanvasHeader = DOffcanvasHeader;
1399
1405
  exports.DPaginator = DPaginator;
1400
1406
  exports.DPopover = DPopover;
1401
- exports.DPortalContext = DPortalContext;
1402
- exports.DPortalContextProvider = DPortalContextProvider;
1403
1407
  exports.DProgress = DProgress;
1404
1408
  exports.DQuickActionButton = DQuickActionButton;
1405
1409
  exports.DQuickActionCheck = DQuickActionCheck;