@dynamic-framework/ui-react 1.32.3 → 1.34.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/bootstrap-icons.css +2078 -0
- package/dist/css/bootstrap-icons.json +2052 -0
- package/dist/css/bootstrap-icons.min.css +5 -0
- package/dist/css/bootstrap-icons.scss +2090 -0
- package/dist/css/dynamic-ui-non-root.css +21 -8
- package/dist/css/dynamic-ui-non-root.min.css +3 -3
- 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 +21 -8
- package/dist/css/dynamic-ui.min.css +3 -3
- package/dist/css/fonts/bootstrap-icons.woff +0 -0
- package/dist/css/fonts/bootstrap-icons.woff2 +0 -0
- package/dist/index.esm.js +148 -57
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +164 -63
- package/dist/index.js.map +1 -1
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +2 -1
- package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +4 -9
- package/dist/types/components/DSelect/DSelect.d.ts +3 -1
- package/dist/types/components/DSelect/components/DSelectPlaceholder.d.ts +2 -0
- package/dist/types/contexts/DContext.d.ts +9 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useMediaBreakpointUp.d.ts +6 -0
- package/dist/types/hooks/useMediaQuery.d.ts +1 -0
- package/dist/types/utils/getCssVariable.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/mediaQuery.d.ts +2 -0
- package/package.json +96 -88
- package/src/style/abstracts/variables/_forms.scss +1 -1
- package/src/style/base/_form-check.scss +18 -0
- package/src/style/components/_d-quick-action-button.scss +4 -2
package/dist/index.js
CHANGED
|
@@ -202,7 +202,12 @@ function useDPortalContext() {
|
|
|
202
202
|
return context;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
function getCssVariable(variable) {
|
|
206
|
+
const computedStyle = getComputedStyle(document.documentElement);
|
|
207
|
+
return computedStyle.getPropertyValue(variable).trim();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const DEFAULT_STATE = {
|
|
206
211
|
language: 'en',
|
|
207
212
|
currency: {
|
|
208
213
|
symbol: '$',
|
|
@@ -245,18 +250,40 @@ const defaultState = {
|
|
|
245
250
|
decrease: 'dash-square',
|
|
246
251
|
},
|
|
247
252
|
},
|
|
253
|
+
breakpoints: {
|
|
254
|
+
xs: '',
|
|
255
|
+
sm: '',
|
|
256
|
+
md: '',
|
|
257
|
+
lg: '',
|
|
258
|
+
xl: '',
|
|
259
|
+
xxl: '',
|
|
260
|
+
},
|
|
248
261
|
setContext: () => { },
|
|
249
262
|
portalName: 'd-portal',
|
|
250
263
|
};
|
|
251
|
-
const DContext = React.createContext(
|
|
252
|
-
function DContextProvider({ language =
|
|
264
|
+
const DContext = React.createContext(DEFAULT_STATE);
|
|
265
|
+
function DContextProvider({ language = DEFAULT_STATE.language, currency = DEFAULT_STATE.currency, icon = DEFAULT_STATE.icon, iconMap = DEFAULT_STATE.iconMap, portalName = DEFAULT_STATE.portalName, availablePortals, children, }) {
|
|
253
266
|
const [internalContext, setInternalContext,] = React.useState({
|
|
254
267
|
language,
|
|
255
268
|
currency,
|
|
256
269
|
icon,
|
|
257
270
|
iconMap,
|
|
271
|
+
breakpoints: DEFAULT_STATE.breakpoints,
|
|
258
272
|
});
|
|
259
273
|
const setContext = React.useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
|
|
274
|
+
React.useLayoutEffect(() => {
|
|
275
|
+
console.log('context');
|
|
276
|
+
setContext({
|
|
277
|
+
breakpoints: {
|
|
278
|
+
xs: getCssVariable(`--${PREFIX_BS}breakpoint-xs`),
|
|
279
|
+
sm: getCssVariable(`--${PREFIX_BS}breakpoint-sm`),
|
|
280
|
+
md: getCssVariable(`--${PREFIX_BS}breakpoint-md`),
|
|
281
|
+
lg: getCssVariable(`--${PREFIX_BS}breakpoint-lg`),
|
|
282
|
+
xl: getCssVariable(`--${PREFIX_BS}breakpoint-xl`),
|
|
283
|
+
xxl: getCssVariable(`--${PREFIX_BS}breakpoint-xxl`),
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
}, [setContext]);
|
|
260
287
|
const value = React.useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
|
|
261
288
|
return (jsxRuntime.jsx(DContext.Provider, { value: value, children: jsxRuntime.jsx(DPortalContextProvider, { portalName: portalName, availablePortals: availablePortals, children: children }) }));
|
|
262
289
|
}
|
|
@@ -562,31 +589,37 @@ function DInput(_a, ref) {
|
|
|
562
589
|
}
|
|
563
590
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
564
591
|
ForwardedDInput.displayName = 'DInput';
|
|
565
|
-
var DInput$1 = ForwardedDInput;
|
|
566
592
|
|
|
567
593
|
function DDatePickerTime(_a) {
|
|
568
594
|
var { value, onChange, id, label, className, style } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
569
|
-
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(
|
|
595
|
+
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(ForwardedDInput, Object.assign({ className: "w-100" }, onChange && {
|
|
570
596
|
onChange,
|
|
571
597
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
572
598
|
}
|
|
573
599
|
|
|
574
600
|
function DDatePickerInput(_a, ref) {
|
|
575
601
|
var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
|
|
576
|
-
return (jsxRuntime.jsx(
|
|
602
|
+
return (jsxRuntime.jsx(ForwardedDInput, 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)));
|
|
577
603
|
}
|
|
578
604
|
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
579
605
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
580
|
-
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
581
606
|
|
|
582
607
|
function DInputCheck(_a) {
|
|
583
|
-
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "value", "onChange", "className", "style", "dataAttributes"]);
|
|
608
|
+
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
584
609
|
const innerRef = React.useRef(null);
|
|
585
610
|
const innerId = React.useId();
|
|
586
611
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
587
612
|
const handleChange = React.useCallback((event) => {
|
|
588
613
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
589
614
|
}, [onChange]);
|
|
615
|
+
const ariaDescribedby = React.useMemo(() => ([
|
|
616
|
+
!!hint && `${id}Hint`,
|
|
617
|
+
]
|
|
618
|
+
.filter(Boolean)
|
|
619
|
+
.join(' ')), [
|
|
620
|
+
id,
|
|
621
|
+
hint,
|
|
622
|
+
]);
|
|
590
623
|
React.useEffect(() => {
|
|
591
624
|
if (innerRef.current) {
|
|
592
625
|
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
@@ -600,24 +633,25 @@ function DInputCheck(_a) {
|
|
|
600
633
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
601
634
|
'is-invalid': invalid,
|
|
602
635
|
'is-valid': valid,
|
|
603
|
-
}, className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, props))), [
|
|
604
|
-
ariaLabel,
|
|
605
|
-
className,
|
|
606
|
-
disabled,
|
|
607
|
-
valid,
|
|
608
|
-
props,
|
|
609
|
-
invalid,
|
|
636
|
+
}, className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
610
637
|
handleChange,
|
|
611
|
-
|
|
612
|
-
|
|
638
|
+
invalid,
|
|
639
|
+
valid,
|
|
640
|
+
className,
|
|
613
641
|
style,
|
|
642
|
+
id,
|
|
643
|
+
disabled,
|
|
614
644
|
type,
|
|
645
|
+
name,
|
|
615
646
|
value,
|
|
647
|
+
ariaLabel,
|
|
648
|
+
ariaDescribedby,
|
|
649
|
+
props,
|
|
616
650
|
]);
|
|
617
651
|
if (!label) {
|
|
618
652
|
return inputComponent;
|
|
619
653
|
}
|
|
620
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: "form-check" }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] })));
|
|
654
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: "form-check" }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
621
655
|
}
|
|
622
656
|
|
|
623
657
|
function DSelectOptionCheck(_a) {
|
|
@@ -688,8 +722,17 @@ function DSelectSingleValueEmojiText(_a) {
|
|
|
688
722
|
}), getValue: getValue }, props, { children: [jsxRuntime.jsx("span", { children: value.emoji }), jsxRuntime.jsx("span", { children: children })] })));
|
|
689
723
|
}
|
|
690
724
|
|
|
725
|
+
function DSelectPlaceholder(_a) {
|
|
726
|
+
var { selectProps, innerProps: innerPropsProp, children } = _a, props = tslib.__rest(_a, ["selectProps", "innerProps", "children"]);
|
|
727
|
+
const id = React.useMemo(() => `${selectProps.inputId}Placeholder`, [selectProps.inputId]);
|
|
728
|
+
const innerProps = React.useMemo(() => (Object.assign(Object.assign({}, innerPropsProp), { id })), [innerPropsProp, id]);
|
|
729
|
+
return (jsxRuntime.jsx(Select.components.Placeholder, Object.assign({ innerProps: innerProps, selectProps: selectProps }, props, { children: children })));
|
|
730
|
+
}
|
|
731
|
+
|
|
691
732
|
function DSelect(_a) {
|
|
692
|
-
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, dataAttributes } = _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", "dataAttributes"]);
|
|
733
|
+
var { id: idProp, 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, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _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", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
|
|
734
|
+
const innerId = React.useId();
|
|
735
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
693
736
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
694
737
|
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
|
|
695
738
|
}, [onIconStartClick, defaultValue]);
|
|
@@ -702,14 +745,14 @@ function DSelect(_a) {
|
|
|
702
745
|
'input-group': true,
|
|
703
746
|
'has-validation': invalid,
|
|
704
747
|
disabled: disabled || loading,
|
|
705
|
-
}), 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: {
|
|
748
|
+
}), 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({ id: `${id}Container`, inputId: id, styles: {
|
|
706
749
|
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
707
750
|
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
708
751
|
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
|
|
709
752
|
}, className: classNames('d-select-component', {
|
|
710
753
|
'is-invalid': invalid,
|
|
711
754
|
'is-valid': valid,
|
|
712
|
-
}), 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)), (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 }))] })));
|
|
755
|
+
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, placeholder: placeholder, unstyled: true, components: Object.assign({ Placeholder: DSelectPlaceholder, DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), (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 }))] })));
|
|
713
756
|
}
|
|
714
757
|
var DSelect$1 = Object.assign(DSelect, {
|
|
715
758
|
OptionCheck: DSelectOptionCheck,
|
|
@@ -722,6 +765,7 @@ var DSelect$1 = Object.assign(DSelect, {
|
|
|
722
765
|
OptionEmoji: DSelectOptionEmoji,
|
|
723
766
|
SingleValueEmoji: DSelectSingleValueEmoji,
|
|
724
767
|
SingleValueEmojiText: DSelectSingleValueEmojiText,
|
|
768
|
+
Placeholder: DSelectPlaceholder,
|
|
725
769
|
});
|
|
726
770
|
|
|
727
771
|
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, }) {
|
|
@@ -771,15 +815,14 @@ function DDatePicker(_a) {
|
|
|
771
815
|
]);
|
|
772
816
|
const defaultRenderCustomHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
|
|
773
817
|
const renderCustomHeader = React.useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
|
|
774
|
-
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.jsx(
|
|
818
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { 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 })), placeholderText: placeholder }, locale && { locale }, dataAttributes, props)));
|
|
775
819
|
}
|
|
776
820
|
|
|
777
821
|
function DInputMask(props, ref) {
|
|
778
|
-
return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component:
|
|
822
|
+
return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
|
|
779
823
|
}
|
|
780
824
|
const ForwardedDInputMask = React.forwardRef(DInputMask);
|
|
781
825
|
ForwardedDInputMask.displayName = 'DInputMask';
|
|
782
|
-
var DInputMask$1 = ForwardedDInputMask;
|
|
783
826
|
|
|
784
827
|
function formatValue(value, currencyOptions) {
|
|
785
828
|
if (value === undefined) {
|
|
@@ -879,6 +922,47 @@ function useItemSelection({ getItemIdentifier: getItemIdentifierProp, previousSe
|
|
|
879
922
|
};
|
|
880
923
|
}
|
|
881
924
|
|
|
925
|
+
function subscribeToMediaQuery(query, callback) {
|
|
926
|
+
const mediaQueryList = window.matchMedia(query);
|
|
927
|
+
mediaQueryList.addEventListener('change', callback);
|
|
928
|
+
return () => {
|
|
929
|
+
mediaQueryList.removeEventListener('change', callback);
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function checkMediaQuery(query) {
|
|
933
|
+
return window.matchMedia(query).matches;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function useMediaQuery(mediaQuery, useListener = false) {
|
|
937
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
938
|
+
const noop = (_) => () => { };
|
|
939
|
+
return React.useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function useMediaBreakpointUp(breakpoint, useListener = false) {
|
|
943
|
+
const { breakpoints } = useDContext();
|
|
944
|
+
const mediaQuery = React.useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
|
|
945
|
+
return useMediaQuery(mediaQuery, useListener);
|
|
946
|
+
}
|
|
947
|
+
function useMediaBreakpointUpXs(useListener = false) {
|
|
948
|
+
return useMediaBreakpointUp('xs', useListener);
|
|
949
|
+
}
|
|
950
|
+
function useMediaBreakpointUpSm(useListener = false) {
|
|
951
|
+
return useMediaBreakpointUp('sm', useListener);
|
|
952
|
+
}
|
|
953
|
+
function useMediaBreakpointUpMd(useListener = false) {
|
|
954
|
+
return useMediaBreakpointUp('md', useListener);
|
|
955
|
+
}
|
|
956
|
+
function useMediaBreakpointUpLg(useListener = false) {
|
|
957
|
+
return useMediaBreakpointUp('lg', useListener);
|
|
958
|
+
}
|
|
959
|
+
function useMediaBreakpointUpXl(useListener = false) {
|
|
960
|
+
return useMediaBreakpointUp('xl', useListener);
|
|
961
|
+
}
|
|
962
|
+
function useMediaBreakpointUpXxl(useListener = false) {
|
|
963
|
+
return useMediaBreakpointUp('xxl', useListener);
|
|
964
|
+
}
|
|
965
|
+
|
|
882
966
|
function DInputCounter(_a, ref) {
|
|
883
967
|
var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = tslib.__rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
884
968
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
@@ -908,7 +992,7 @@ function DInputCounter(_a, ref) {
|
|
|
908
992
|
const { iconMap: { input } } = useDContext();
|
|
909
993
|
const iconEnd = React.useMemo(() => iconEndProp || input.increase, [iconEndProp, input.increase]);
|
|
910
994
|
const iconStart = React.useMemo(() => iconStartProp || input.decrease, [iconStartProp, input.decrease]);
|
|
911
|
-
return (jsxRuntime.jsx(
|
|
995
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onWheel: handleOnWheel, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick, iconStartAriaLabel: iconStartAriaLabel, iconEndAriaLabel: iconEndAriaLabel }, internalValue === minValue && {
|
|
912
996
|
iconStartDisabled: true,
|
|
913
997
|
}, internalValue === maxValue && {
|
|
914
998
|
iconEndDisabled: true,
|
|
@@ -916,7 +1000,6 @@ function DInputCounter(_a, ref) {
|
|
|
916
1000
|
}
|
|
917
1001
|
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
918
1002
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
919
|
-
var DInputCounter$1 = ForwardedDInputCounter;
|
|
920
1003
|
|
|
921
1004
|
/**
|
|
922
1005
|
* @deprecated
|
|
@@ -925,22 +1008,20 @@ function DInputCurrencyBase(_a, ref) {
|
|
|
925
1008
|
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
926
1009
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
927
1010
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
928
|
-
return (jsxRuntime.jsx(
|
|
1011
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
929
1012
|
}
|
|
930
1013
|
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
931
1014
|
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
932
|
-
var DInputCurrencyBase$1 = ForwardedDInputCurrencyBase$1;
|
|
933
1015
|
|
|
934
1016
|
function DInputCurrency(_a, ref) {
|
|
935
1017
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
936
1018
|
const { currency: currencyOptions } = useDContext();
|
|
937
1019
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
938
1020
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
939
|
-
return (jsxRuntime.jsx(
|
|
1021
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
940
1022
|
}
|
|
941
1023
|
const ForwardedDInputCurrencyBase = React.forwardRef(DInputCurrency);
|
|
942
1024
|
ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|
|
943
|
-
var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
944
1025
|
|
|
945
1026
|
/**
|
|
946
1027
|
* @deprecated
|
|
@@ -948,11 +1029,10 @@ var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
|
948
1029
|
function DInputSearch(_a, ref) {
|
|
949
1030
|
var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = tslib.__rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
|
|
950
1031
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
951
|
-
return (jsxRuntime.jsx(
|
|
1032
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
952
1033
|
}
|
|
953
1034
|
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
954
1035
|
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
955
|
-
var DInputSearch$1 = ForwardedDInputSearch;
|
|
956
1036
|
|
|
957
1037
|
function DInputPassword(_a, ref) {
|
|
958
1038
|
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = tslib.__rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
@@ -964,11 +1044,10 @@ function DInputPassword(_a, ref) {
|
|
|
964
1044
|
}, [onIconEndClick]);
|
|
965
1045
|
const { iconMap: { input } } = useDContext();
|
|
966
1046
|
const iconEnd = React.useMemo(() => (!visible ? input.hide : input.show), [input.hide, input.show, visible]);
|
|
967
|
-
return (jsxRuntime.jsx(
|
|
1047
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, iconEnd: iconEnd, type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
968
1048
|
}
|
|
969
1049
|
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
970
1050
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
971
|
-
var DInputPassword$1 = ForwardedDInputPassword;
|
|
972
1051
|
|
|
973
1052
|
function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
|
|
974
1053
|
const innerId = React.useId();
|
|
@@ -1184,7 +1263,6 @@ function DInputRange(_a, ref) {
|
|
|
1184
1263
|
}
|
|
1185
1264
|
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1186
1265
|
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1187
|
-
var DInputRange$1 = ForwardedDInputRange;
|
|
1188
1266
|
|
|
1189
1267
|
/**
|
|
1190
1268
|
* @deprecated Please use DListGroup.Item or DListGroupItem instead
|
|
@@ -1407,29 +1485,42 @@ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 10
|
|
|
1407
1485
|
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: formatProgress }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) })));
|
|
1408
1486
|
}
|
|
1409
1487
|
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
const globalClickHandler = React.useCallback(() => {
|
|
1415
|
-
if (actionLinkText) {
|
|
1416
|
-
return;
|
|
1488
|
+
function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
|
|
1489
|
+
const Tag = React.useMemo(() => {
|
|
1490
|
+
if (href) {
|
|
1491
|
+
return 'a';
|
|
1417
1492
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
const actionLinkClickHandler = React.useCallback(() => {
|
|
1421
|
-
if (!actionLinkText) {
|
|
1422
|
-
return;
|
|
1493
|
+
if (onClick) {
|
|
1494
|
+
return 'button';
|
|
1423
1495
|
}
|
|
1424
|
-
|
|
1425
|
-
}, [
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1496
|
+
return 'div';
|
|
1497
|
+
}, [href, onClick]);
|
|
1498
|
+
const tagProps = React.useMemo(() => {
|
|
1499
|
+
if (href) {
|
|
1500
|
+
return {
|
|
1501
|
+
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1502
|
+
href,
|
|
1503
|
+
target: hrefTarget,
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
if (onClick) {
|
|
1507
|
+
return {
|
|
1508
|
+
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1509
|
+
onClick,
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
return {
|
|
1513
|
+
className: classNames('d-quick-action-button', className),
|
|
1514
|
+
};
|
|
1515
|
+
}, [
|
|
1516
|
+
className,
|
|
1517
|
+
href,
|
|
1518
|
+
hrefTarget,
|
|
1519
|
+
onClick,
|
|
1520
|
+
]);
|
|
1521
|
+
return (jsxRuntime.jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1431
1522
|
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1432
|
-
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }),
|
|
1523
|
+
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), actionIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, theme: actionIconTheme, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] })));
|
|
1433
1524
|
}
|
|
1434
1525
|
|
|
1435
1526
|
/**
|
|
@@ -1749,16 +1840,16 @@ exports.DCurrencyText = DCurrencyText;
|
|
|
1749
1840
|
exports.DDatePicker = DDatePicker;
|
|
1750
1841
|
exports.DIcon = DIcon;
|
|
1751
1842
|
exports.DIconBase = DIconBase;
|
|
1752
|
-
exports.DInput =
|
|
1843
|
+
exports.DInput = ForwardedDInput;
|
|
1753
1844
|
exports.DInputCheck = DInputCheck;
|
|
1754
|
-
exports.DInputCounter =
|
|
1755
|
-
exports.DInputCurrency =
|
|
1756
|
-
exports.DInputCurrencyBase =
|
|
1757
|
-
exports.DInputMask =
|
|
1758
|
-
exports.DInputPassword =
|
|
1845
|
+
exports.DInputCounter = ForwardedDInputCounter;
|
|
1846
|
+
exports.DInputCurrency = ForwardedDInputCurrencyBase;
|
|
1847
|
+
exports.DInputCurrencyBase = ForwardedDInputCurrencyBase$1;
|
|
1848
|
+
exports.DInputMask = ForwardedDInputMask;
|
|
1849
|
+
exports.DInputPassword = ForwardedDInputPassword;
|
|
1759
1850
|
exports.DInputPin = DInputPin;
|
|
1760
|
-
exports.DInputRange =
|
|
1761
|
-
exports.DInputSearch =
|
|
1851
|
+
exports.DInputRange = ForwardedDInputRange;
|
|
1852
|
+
exports.DInputSearch = ForwardedDInputSearch;
|
|
1762
1853
|
exports.DInputSelect = DInputSelect;
|
|
1763
1854
|
exports.DInputSwitch = DInputSwitch;
|
|
1764
1855
|
exports.DList = DList$1;
|
|
@@ -1792,9 +1883,12 @@ exports.DToast = DToast$1;
|
|
|
1792
1883
|
exports.DToastContainer = DToastContainer;
|
|
1793
1884
|
exports.DTooltip = DTooltip;
|
|
1794
1885
|
exports.changeQueryString = changeQueryString;
|
|
1886
|
+
exports.checkMediaQuery = checkMediaQuery;
|
|
1795
1887
|
exports.configureI18n = configureI8n;
|
|
1796
1888
|
exports.formatCurrency = formatCurrency;
|
|
1889
|
+
exports.getCssVariable = getCssVariable;
|
|
1797
1890
|
exports.getQueryString = getQueryString;
|
|
1891
|
+
exports.subscribeToMediaQuery = subscribeToMediaQuery;
|
|
1798
1892
|
exports.useDContext = useDContext;
|
|
1799
1893
|
exports.useDPortalContext = useDPortalContext;
|
|
1800
1894
|
exports.useDToast = useDToast;
|
|
@@ -1803,6 +1897,13 @@ exports.useDisableInputWheel = useDisableInputWheel;
|
|
|
1803
1897
|
exports.useFormatCurrency = useFormatCurrency;
|
|
1804
1898
|
exports.useInputCurrency = useInputCurrency;
|
|
1805
1899
|
exports.useItemSelection = useItemSelection;
|
|
1900
|
+
exports.useMediaBreakpointUpLg = useMediaBreakpointUpLg;
|
|
1901
|
+
exports.useMediaBreakpointUpMd = useMediaBreakpointUpMd;
|
|
1902
|
+
exports.useMediaBreakpointUpSm = useMediaBreakpointUpSm;
|
|
1903
|
+
exports.useMediaBreakpointUpXl = useMediaBreakpointUpXl;
|
|
1904
|
+
exports.useMediaBreakpointUpXs = useMediaBreakpointUpXs;
|
|
1905
|
+
exports.useMediaBreakpointUpXxl = useMediaBreakpointUpXxl;
|
|
1906
|
+
exports.useMediaQuery = useMediaQuery;
|
|
1806
1907
|
exports.usePortal = usePortal;
|
|
1807
1908
|
exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
|
|
1808
1909
|
exports.useStackState = useStackState;
|