@allxsmith/bestax-bulma 5.6.0 → 5.6.2
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.cjs.js +77 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +77 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Navbar.d.ts +1 -0
- package/package.json +7 -2
package/dist/index.esm.js
CHANGED
|
@@ -1681,8 +1681,12 @@ const Loading = ({ active = false, isFullPage = false, size, color, canCancel =
|
|
|
1681
1681
|
[`is-${size}`]: size,
|
|
1682
1682
|
});
|
|
1683
1683
|
const combinedClasses = classNames(loadingClasses, bulmaHelperClasses, className);
|
|
1684
|
-
const combinedOverlayClasses = classNames('loading-overlay', overlayClassName);
|
|
1684
|
+
const combinedOverlayClasses = classNames(usePrefixedClassNames('loading-overlay'), overlayClassName);
|
|
1685
1685
|
const combinedIconClasses = classNames(iconClasses, iconClassName);
|
|
1686
|
+
const loadingContentClass = usePrefixedClassNames('loading-content');
|
|
1687
|
+
const loadingIconCustomClass = usePrefixedClassNames('loading-icon-custom');
|
|
1688
|
+
const loadingTextClass = usePrefixedClassNames('loading-text');
|
|
1689
|
+
const loadingCancelClass = usePrefixedClassNames('loading-cancel');
|
|
1686
1690
|
const handleOverlayClick = () => {
|
|
1687
1691
|
if (canCancel && onCancel) {
|
|
1688
1692
|
onCancel();
|
|
@@ -1711,7 +1715,7 @@ const Loading = ({ active = false, isFullPage = false, size, color, canCancel =
|
|
|
1711
1715
|
if (!active) {
|
|
1712
1716
|
return null;
|
|
1713
1717
|
}
|
|
1714
|
-
return (jsxs("div", { className: combinedClasses, role: "alert", "aria-busy": "true", "aria-label": "Loading", ...rest, children: [jsx("div", { className: combinedOverlayClasses, onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { className:
|
|
1718
|
+
return (jsxs("div", { className: combinedClasses, role: "alert", "aria-busy": "true", "aria-label": "Loading", ...rest, children: [jsx("div", { className: combinedOverlayClasses, onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { className: loadingContentClass, children: [indicator ? (jsx("span", { className: loadingIconCustomClass, children: indicator })) : (jsx("span", { className: combinedIconClasses })), children && jsx("div", { className: loadingTextClass, children: children }), canCancel && (jsx("button", { type: "button", className: loadingCancelClass, onClick: onCancel, "aria-label": "Cancel loading", children: "Cancel" }))] })] }));
|
|
1715
1719
|
};
|
|
1716
1720
|
|
|
1717
1721
|
const Collapse = ({ open: controlledOpen, defaultOpen = false, onOpen, onClose, trigger, animation = 'fade', position = 'top', ariaId, bordered, children, className, triggerClassName, contentClassName, ...props }) => {
|
|
@@ -1774,10 +1778,10 @@ const Collapse = ({ open: controlledOpen, defaultOpen = false, onOpen, onClose,
|
|
|
1774
1778
|
'is-bordered': bordered,
|
|
1775
1779
|
});
|
|
1776
1780
|
const combinedClasses = classNames(collapseClasses, bulmaHelperClasses, className);
|
|
1777
|
-
const combinedTriggerClasses = classNames('collapse-trigger', triggerClassName);
|
|
1778
|
-
const combinedContentClasses = classNames('collapse-content',
|
|
1781
|
+
const combinedTriggerClasses = classNames(usePrefixedClassNames('collapse-trigger'), triggerClassName);
|
|
1782
|
+
const combinedContentClasses = classNames(usePrefixedClassNames('collapse-content', {
|
|
1779
1783
|
'is-active': isOpen,
|
|
1780
|
-
});
|
|
1784
|
+
}), contentClassName);
|
|
1781
1785
|
let contentWrapperStyle;
|
|
1782
1786
|
if (animation === 'slide') {
|
|
1783
1787
|
contentWrapperStyle = {
|
|
@@ -1959,10 +1963,14 @@ const Tooltip = ({ label, content, position = 'top', color, size, active: always
|
|
|
1959
1963
|
|
|
1960
1964
|
const Step = ({ isActive = false, isCompleted = false, label, icon, clickable = false, onClick, stepNumber, completedIcon, className, children, ...props }) => {
|
|
1961
1965
|
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
1962
|
-
const stepClasses = classNames('steps-segment', {
|
|
1966
|
+
const stepClasses = classNames(usePrefixedClassNames('steps-segment', {
|
|
1963
1967
|
'is-active': isActive,
|
|
1964
1968
|
'is-completed': isCompleted,
|
|
1965
|
-
}, bulmaHelperClasses, className);
|
|
1969
|
+
}), bulmaHelperClasses, className);
|
|
1970
|
+
const stepsLinkClass = usePrefixedClassNames('steps-link');
|
|
1971
|
+
const stepsMarkerClass = usePrefixedClassNames('steps-marker');
|
|
1972
|
+
const stepsContentClass = usePrefixedClassNames('steps-content');
|
|
1973
|
+
const stepsTitleClass = usePrefixedClassNames('steps-title');
|
|
1966
1974
|
const handleClick = () => {
|
|
1967
1975
|
if (clickable && onClick) {
|
|
1968
1976
|
onClick();
|
|
@@ -1979,7 +1987,7 @@ const Step = ({ isActive = false, isCompleted = false, label, icon, clickable =
|
|
|
1979
1987
|
(isCompleted && resolvedCompletedIcon
|
|
1980
1988
|
? resolvedCompletedIcon
|
|
1981
1989
|
: (stepNumber ?? null));
|
|
1982
|
-
return (jsx("li", { className: stepClasses, onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: clickable ? 0 : undefined, role: clickable ? 'button' : undefined, "aria-current": isActive ? 'step' : undefined, ...rest, children: jsxs("div", { className:
|
|
1990
|
+
return (jsx("li", { className: stepClasses, onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: clickable ? 0 : undefined, role: clickable ? 'button' : undefined, "aria-current": isActive ? 'step' : undefined, ...rest, children: jsxs("div", { className: stepsLinkClass, children: [jsx("span", { className: stepsMarkerClass, children: markerContent }), (label || children) && (jsx("div", { className: stepsContentClass, children: jsx("p", { className: stepsTitleClass, children: label || children }) }))] }) }));
|
|
1983
1991
|
};
|
|
1984
1992
|
const Steps = ({ value = 0, items, size, color, hasMarker = true, animated = true, rounded = true, vertical = false, labelPosition = 'bottom', mobileMode, showStepNumbers = true, hasNavigation = false, prevLabel, nextLabel, onPrev, onNext, onStepClick, className, children, ...props }) => {
|
|
1985
1993
|
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
@@ -1994,9 +2002,14 @@ const Steps = ({ value = 0, items, size, color, hasMarker = true, animated = tru
|
|
|
1994
2002
|
[`is-${mobileMode}`]: mobileMode,
|
|
1995
2003
|
});
|
|
1996
2004
|
const combinedClasses = classNames(stepsClasses, bulmaHelperClasses, className);
|
|
1997
|
-
const listClasses =
|
|
2005
|
+
const listClasses = usePrefixedClassNames('steps-list', {
|
|
1998
2006
|
'is-vertical': vertical,
|
|
1999
2007
|
});
|
|
2008
|
+
const stepsNavigationClass = usePrefixedClassNames('steps-navigation');
|
|
2009
|
+
const prevButtonClass = usePrefixedClassNames('button');
|
|
2010
|
+
const nextButtonClass = usePrefixedClassNames('button', {
|
|
2011
|
+
'is-primary': true,
|
|
2012
|
+
});
|
|
2000
2013
|
const totalSteps = items ? items.length : React.Children.count(children);
|
|
2001
2014
|
const renderSteps = () => {
|
|
2002
2015
|
if (items && items.length > 0) {
|
|
@@ -2019,7 +2032,7 @@ const Steps = ({ value = 0, items, size, color, hasMarker = true, animated = tru
|
|
|
2019
2032
|
}
|
|
2020
2033
|
return null;
|
|
2021
2034
|
};
|
|
2022
|
-
return (jsxs("div", { className: combinedClasses, ...rest, children: [jsx("ul", { className: listClasses, children: renderSteps() }), hasNavigation && (jsxs("div", { className:
|
|
2035
|
+
return (jsxs("div", { className: combinedClasses, ...rest, children: [jsx("ul", { className: listClasses, children: renderSteps() }), hasNavigation && (jsxs("div", { className: stepsNavigationClass, children: [jsx("button", { className: prevButtonClass, disabled: value === 0, onClick: onPrev ?? (() => onStepClick?.(value - 1)), children: prevLabel ?? 'Previous' }), jsx("button", { className: nextButtonClass, disabled: value === totalSteps - 1, onClick: onNext ?? (() => onStepClick?.(value + 1)), children: nextLabel ?? 'Next' })] }))] }));
|
|
2023
2036
|
};
|
|
2024
2037
|
Steps.Step = Step;
|
|
2025
2038
|
|
|
@@ -2086,16 +2099,16 @@ const SidebarComponent = forwardRef(({ isOpen, onClose, position = 'left', width
|
|
|
2086
2099
|
[`is-${position}`]: position,
|
|
2087
2100
|
'is-fullwidth': fullWidth,
|
|
2088
2101
|
});
|
|
2089
|
-
const backgroundClass = usePrefixedClassNames('sidebar-background'
|
|
2102
|
+
const backgroundClass = usePrefixedClassNames('sidebar-background', {
|
|
2103
|
+
'is-active': isOpen,
|
|
2104
|
+
});
|
|
2090
2105
|
const contentClass = usePrefixedClassNames('sidebar-content');
|
|
2091
2106
|
const combinedClasses = classNames(sidebarClasses, bulmaHelperClasses, className);
|
|
2092
2107
|
const sidebarStyle = {
|
|
2093
2108
|
...style,
|
|
2094
2109
|
'--bulma-sidebar-width': fullWidth ? '100%' : width,
|
|
2095
2110
|
};
|
|
2096
|
-
const sidebarContent = (jsxs(Fragment, { children: [overlay && (jsx("div", { className:
|
|
2097
|
-
'is-active': isOpen,
|
|
2098
|
-
}), onClick: handleOverlayClick, "aria-hidden": "true" })), jsx("aside", { ref: combinedRef, className: combinedClasses, style: sidebarStyle, role: "dialog", "aria-modal": overlay ? 'true' : undefined, "aria-hidden": !isOpen, tabIndex: -1, ...rest, children: jsx("div", { className: contentClass, children: children }) })] }));
|
|
2111
|
+
const sidebarContent = (jsxs(Fragment, { children: [overlay && (jsx("div", { className: backgroundClass, onClick: handleOverlayClick, "aria-hidden": "true" })), jsx("aside", { ref: combinedRef, className: combinedClasses, style: sidebarStyle, role: "dialog", "aria-modal": overlay ? 'true' : undefined, "aria-hidden": !isOpen, tabIndex: -1, ...rest, children: jsx("div", { className: contentClass, children: children }) })] }));
|
|
2099
2112
|
if (inline) {
|
|
2100
2113
|
return sidebarContent;
|
|
2101
2114
|
}
|
|
@@ -2200,6 +2213,12 @@ const Toast = forwardRef(({ message, type = 'default', actionType, position = 't
|
|
|
2200
2213
|
'is-rounded': rounded,
|
|
2201
2214
|
});
|
|
2202
2215
|
const combinedClasses = classNames(toastClasses, bulmaHelperClasses, className);
|
|
2216
|
+
const toastMessageClass = usePrefixedClassNames('toast-message');
|
|
2217
|
+
const toastActionsClass = usePrefixedClassNames('toast-actions');
|
|
2218
|
+
const toastCancelClass = usePrefixedClassNames('toast-cancel');
|
|
2219
|
+
const toastActionClass = usePrefixedClassNames('toast-action');
|
|
2220
|
+
const toastButtonClass = usePrefixedClassNames('button');
|
|
2221
|
+
const toastCloseClass = usePrefixedClassNames('delete', 'is-small');
|
|
2203
2222
|
if (!isVisible) {
|
|
2204
2223
|
return null;
|
|
2205
2224
|
}
|
|
@@ -2221,13 +2240,13 @@ const Toast = forwardRef(({ message, type = 'default', actionType, position = 't
|
|
|
2221
2240
|
ref.current = node;
|
|
2222
2241
|
}
|
|
2223
2242
|
};
|
|
2224
|
-
const toastElement = (jsxs("div", { ref: setRef, className: combinedClasses, role: "alert", "aria-live": type === 'danger' || type === 'warning' ? 'assertive' : 'polite', onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: dismissible ? handleClose : undefined, ...rest, children: [jsx("span", { className:
|
|
2243
|
+
const toastElement = (jsxs("div", { ref: setRef, className: combinedClasses, role: "alert", "aria-live": type === 'danger' || type === 'warning' ? 'assertive' : 'polite', onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: dismissible ? handleClose : undefined, ...rest, children: [jsx("span", { className: toastMessageClass, children: message }), (cancelText || actionText) && (jsxs("div", { className: toastActionsClass, children: [cancelText && (jsx("span", { className: toastCancelClass, children: jsx("button", { type: "button", className: toastButtonClass, onClick: e => {
|
|
2225
2244
|
e.stopPropagation();
|
|
2226
2245
|
handleClose();
|
|
2227
|
-
}, children: cancelText }) })), actionText && (jsx("span", { className:
|
|
2246
|
+
}, children: cancelText }) })), actionText && (jsx("span", { className: toastActionClass, children: jsx("button", { type: "button", className: toastButtonClass, onClick: e => {
|
|
2228
2247
|
e.stopPropagation();
|
|
2229
2248
|
handleAction();
|
|
2230
|
-
}, children: actionText }) }))] })), closable && (jsx("button", { type: "button", className:
|
|
2249
|
+
}, children: actionText }) }))] })), closable && (jsx("button", { type: "button", className: toastCloseClass, onClick: e => {
|
|
2231
2250
|
e.stopPropagation();
|
|
2232
2251
|
handleClose();
|
|
2233
2252
|
}, "aria-label": "Close" }))] }));
|
|
@@ -2508,9 +2527,7 @@ const Button = ({ color, size, isLight, isRounded, isLoading, isStatic, isFullWi
|
|
|
2508
2527
|
};
|
|
2509
2528
|
|
|
2510
2529
|
const CarouselItem = forwardRef(({ active, className, children, ...props }, ref) => {
|
|
2511
|
-
const itemClasses = classNames('carousel-item',
|
|
2512
|
-
'is-active': active,
|
|
2513
|
-
});
|
|
2530
|
+
const itemClasses = classNames(usePrefixedClassNames('carousel-item', { 'is-active': active }), className);
|
|
2514
2531
|
return (jsx("div", { ref: ref, className: itemClasses, ...props, children: children }));
|
|
2515
2532
|
});
|
|
2516
2533
|
CarouselItem.displayName = 'CarouselItem';
|
|
@@ -2696,6 +2713,15 @@ const Carousel = forwardRef(({ value: controlledValue, autoplay = false, interva
|
|
|
2696
2713
|
[`is-indicator-${indicatorStyle}`]: indicatorStyle !== 'dots',
|
|
2697
2714
|
[`is-arrow-${arrowColor}`]: !!arrowColor,
|
|
2698
2715
|
});
|
|
2716
|
+
const classPrefix = useClassPrefix();
|
|
2717
|
+
const carouselContainerClass = usePrefixedClassNames('carousel-container');
|
|
2718
|
+
const carouselSlidesClass = usePrefixedClassNames('carousel-slides');
|
|
2719
|
+
const carouselArrowPrevClass = usePrefixedClassNames('carousel-arrow', 'is-prev', { 'is-transparent': !arrowBackground });
|
|
2720
|
+
const carouselArrowNextClass = usePrefixedClassNames('carousel-arrow', 'is-next', { 'is-transparent': !arrowBackground });
|
|
2721
|
+
const carouselIndicatorClass = usePrefixedClassNames('carousel-indicator', {
|
|
2722
|
+
'is-inside': indicatorInside,
|
|
2723
|
+
'is-top': indicatorPosition === 'top',
|
|
2724
|
+
});
|
|
2699
2725
|
const combinedClasses = classNames(carouselClasses, bulmaHelperClasses, className);
|
|
2700
2726
|
const renderSlides = () => {
|
|
2701
2727
|
const slides = items.map((item, index) => {
|
|
@@ -2726,22 +2752,15 @@ const Carousel = forwardRef(({ value: controlledValue, autoplay = false, interva
|
|
|
2726
2752
|
}
|
|
2727
2753
|
return slides;
|
|
2728
2754
|
};
|
|
2729
|
-
return (jsxs("div", { ref: combinedRef, className: combinedClasses, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, role: "region", "aria-roledescription": "carousel", "aria-label": ariaLabel, ...rest, children: [jsxs("div", { ref: containerRef, className:
|
|
2755
|
+
return (jsxs("div", { ref: combinedRef, className: combinedClasses, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, role: "region", "aria-roledescription": "carousel", "aria-label": ariaLabel, ...rest, children: [jsxs("div", { ref: containerRef, className: carouselContainerClass, onMouseDown: hasDrag ? handleMouseDown : undefined, onMouseMove: hasDrag && isDragging ? handleMouseMove : undefined, onMouseUp: hasDrag ? handleMouseUp : undefined, onMouseLeave: hasDrag ? handleMouseUp : undefined, onTouchStart: hasDrag ? handleTouchStart : undefined, onTouchMove: hasDrag ? handleTouchMove : undefined, onTouchEnd: hasDrag ? handleTouchEnd : undefined, style: {
|
|
2730
2756
|
transform: isDragging ? `translateX(${dragOffset}px)` : undefined,
|
|
2731
2757
|
cursor: hasDrag ? (isDragging ? 'grabbing' : 'grab') : undefined,
|
|
2732
|
-
}, children: [jsx("div", { className:
|
|
2758
|
+
}, children: [jsx("div", { className: carouselSlidesClass, style: {
|
|
2733
2759
|
transform: `translateX(-${(repeat && itemCount > 1 ? displayIndex + 1 : displayIndex) * 100}%)`,
|
|
2734
2760
|
transition: isDragging || skipTransition
|
|
2735
2761
|
? 'none'
|
|
2736
2762
|
: 'transform 0.3s ease-in-out',
|
|
2737
|
-
}, onTransitionEnd: handleTransitionEnd, children: renderSlides() }), arrow && itemCount > 1 && (jsxs(Fragment, { children: [jsx(Button, { className:
|
|
2738
|
-
'is-transparent': !arrowBackground,
|
|
2739
|
-
}), onClick: goToPrev, isDisabled: !canGoPrev, "aria-label": "Previous slide", children: iconPrev ? (jsx(Icon, { name: iconPrev, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })) : (jsx(DefaultPrevIcon, {})) }), jsx(Button, { className: classNames('carousel-arrow is-next', {
|
|
2740
|
-
'is-transparent': !arrowBackground,
|
|
2741
|
-
}), onClick: goToNext, isDisabled: !canGoNext, "aria-label": "Next slide", children: iconNext ? (jsx(Icon, { name: iconNext, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })) : (jsx(DefaultNextIcon, {})) })] }))] }), indicator && itemCount > 1 && (jsx("div", { className: classNames('carousel-indicator', {
|
|
2742
|
-
'is-inside': indicatorInside,
|
|
2743
|
-
'is-top': indicatorPosition === 'top',
|
|
2744
|
-
}), role: "tablist", children: items.map((_, index) => (jsx(Button, { className: classNames('indicator-item', {
|
|
2763
|
+
}, onTransitionEnd: handleTransitionEnd, children: renderSlides() }), arrow && itemCount > 1 && (jsxs(Fragment, { children: [jsx(Button, { className: carouselArrowPrevClass, onClick: goToPrev, isDisabled: !canGoPrev, "aria-label": "Previous slide", children: iconPrev ? (jsx(Icon, { name: iconPrev, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })) : (jsx(DefaultPrevIcon, {})) }), jsx(Button, { className: carouselArrowNextClass, onClick: goToNext, isDisabled: !canGoNext, "aria-label": "Next slide", children: iconNext ? (jsx(Icon, { name: iconNext, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })) : (jsx(DefaultNextIcon, {})) })] }))] }), indicator && itemCount > 1 && (jsx("div", { className: carouselIndicatorClass, role: "tablist", children: items.map((_, index) => (jsx(Button, { className: prefixedClassNames(classPrefix, 'indicator-item', {
|
|
2745
2764
|
'is-active': index === activeIndex,
|
|
2746
2765
|
}), onClick: () => goToSlide(index), role: "tab", "aria-selected": index === activeIndex, "aria-label": `Go to slide ${index + 1}` }, index))) }))] }));
|
|
2747
2766
|
});
|
|
@@ -3465,7 +3484,9 @@ const Checkbox = forwardRef(({ color, size, className, children, textColor, disa
|
|
|
3465
3484
|
[`is-${size}`]: size && checkboxSizes.includes(size),
|
|
3466
3485
|
});
|
|
3467
3486
|
const checkboxClass = classNames(mainClass, bulmaHelperClasses, className);
|
|
3468
|
-
|
|
3487
|
+
const checkClass = usePrefixedClassNames('check');
|
|
3488
|
+
const controlLabelClass = usePrefixedClassNames('control-label');
|
|
3489
|
+
return (jsxs("label", { className: checkboxClass, children: [jsx("input", { ref: ref, type: "checkbox", disabled: disabled, name: effectiveName, value: value, checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, onChange: handleChange, ...rest }), jsx("span", { className: checkClass }), children && jsx("span", { className: controlLabelClass, children: children })] }));
|
|
3469
3490
|
});
|
|
3470
3491
|
Checkbox.displayName = 'Checkbox';
|
|
3471
3492
|
|
|
@@ -3694,7 +3715,9 @@ const Radio = forwardRef(({ color, size, className, children, textColor, disable
|
|
|
3694
3715
|
[`is-${size}`]: size && radioSizes.includes(size),
|
|
3695
3716
|
});
|
|
3696
3717
|
const radioClass = classNames(mainClass, bulmaHelperClasses, className);
|
|
3697
|
-
|
|
3718
|
+
const checkClass = usePrefixedClassNames('check');
|
|
3719
|
+
const controlLabelClass = usePrefixedClassNames('control-label');
|
|
3720
|
+
return (jsxs("label", { className: radioClass, children: [jsx("input", { ref: ref, type: "radio", disabled: disabled, name: effectiveName, value: value, checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, onChange: handleChange, ...rest }), jsx("span", { className: checkClass }), children && jsx("span", { className: controlLabelClass, children: children })] }));
|
|
3698
3721
|
});
|
|
3699
3722
|
Radio.displayName = 'Radio';
|
|
3700
3723
|
|
|
@@ -3758,7 +3781,9 @@ const Switch = forwardRef(({ color, size, isRounded, isThin, isOutlined, isRtl,
|
|
|
3758
3781
|
[`is-${passiveType}-passive`]: passiveType && switchColors.includes(passiveType),
|
|
3759
3782
|
});
|
|
3760
3783
|
const labelClasses = classNames(switchClasses, bulmaHelperClasses, className);
|
|
3761
|
-
|
|
3784
|
+
const checkClass = usePrefixedClassNames('check');
|
|
3785
|
+
const controlLabelClass = usePrefixedClassNames('control-label');
|
|
3786
|
+
return (jsxs("label", { className: labelClasses, children: [jsx("input", { ref: ref, type: "checkbox", disabled: disabled, ...rest }), jsx("span", { className: checkClass }), children && jsx("span", { className: controlLabelClass, children: children })] }));
|
|
3762
3787
|
});
|
|
3763
3788
|
Switch.displayName = 'Switch';
|
|
3764
3789
|
|
|
@@ -3926,6 +3951,7 @@ const Slider = forwardRef((props, ref) => {
|
|
|
3926
3951
|
}
|
|
3927
3952
|
return isCircle ? px * 1.2 : px;
|
|
3928
3953
|
};
|
|
3954
|
+
const classPrefix = useClassPrefix();
|
|
3929
3955
|
const sliderClasses = usePrefixedClassNames('slider', {
|
|
3930
3956
|
[`is-${size}`]: size,
|
|
3931
3957
|
[`is-${color}`]: color,
|
|
@@ -4030,24 +4056,24 @@ const Slider = forwardRef((props, ref) => {
|
|
|
4030
4056
|
const renderTicks = () => {
|
|
4031
4057
|
if (tickPositions.length === 0)
|
|
4032
4058
|
return null;
|
|
4033
|
-
return (jsx("div", { className:
|
|
4059
|
+
return (jsx("div", { className: prefixedClassNames(classPrefix, 'slider-ticks'), children: tickPositions.map((tick, i) => {
|
|
4034
4060
|
const pct = ((tick.value - min) / (max - min)) * 100;
|
|
4035
4061
|
const posStyle = isVertical
|
|
4036
4062
|
? { bottom: `${pct}%` }
|
|
4037
4063
|
: { left: `${pct}%` };
|
|
4038
4064
|
const isEndpoint = tick.value === min || tick.value === max;
|
|
4039
|
-
return (jsx("span", { className:
|
|
4065
|
+
return (jsx("span", { className: prefixedClassNames(classPrefix, 'slider-tick', {
|
|
4040
4066
|
'is-endpoint': isEndpoint,
|
|
4041
|
-
}), style: posStyle, children: tick.label !== undefined && (jsx("span", { className:
|
|
4067
|
+
}), style: posStyle, children: tick.label !== undefined && (jsx("span", { className: prefixedClassNames(classPrefix, 'slider-tick-label'), children: tick.label })) }, i));
|
|
4042
4068
|
}) }));
|
|
4043
4069
|
};
|
|
4044
4070
|
const helpClass = usePrefixedClassNames('help', {
|
|
4045
4071
|
[`is-${messageColor}`]: !!messageColor,
|
|
4046
4072
|
});
|
|
4047
4073
|
const messageEl = message ? jsx("p", { className: helpClass, children: message }) : null;
|
|
4048
|
-
const sliderElement = !range ? (jsxs("div", { ref: wrapperRef, className: combinedClasses, style: wrapperStyle, children: [jsx("input", { ref: combinedRef, type: "range", min: min, max: max, step: step, value: currentSingle, disabled: disabled, onChange: handleSingleChange, onKeyDown: handleKeyDown, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), className:
|
|
4074
|
+
const sliderElement = !range ? (jsxs("div", { ref: wrapperRef, className: combinedClasses, style: wrapperStyle, children: [jsx("input", { ref: combinedRef, type: "range", min: min, max: max, step: step, value: currentSingle, disabled: disabled, onChange: handleSingleChange, onKeyDown: handleKeyDown, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), className: prefixedClassNames(classPrefix, 'slider-input'), style: {
|
|
4049
4075
|
'--slider-progress': `${progressSingle}%`,
|
|
4050
|
-
}, "aria-valuenow": currentSingle, "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": isVertical ? 'vertical' : undefined, "aria-label": ariaLabel, ...getAriaProps(currentSingle), ...rest }), tooltipMode !== 'hidden' && (jsx("output", { ref: outputRef, className:
|
|
4076
|
+
}, "aria-valuenow": currentSingle, "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": isVertical ? 'vertical' : undefined, "aria-label": ariaLabel, ...getAriaProps(currentSingle), ...rest }), tooltipMode !== 'hidden' && (jsx("output", { ref: outputRef, className: prefixedClassNames(classPrefix, 'slider-output', {
|
|
4051
4077
|
'is-visible': showTipLow,
|
|
4052
4078
|
'is-flipped': flipped,
|
|
4053
4079
|
'is-flipped-left': isVertical && verticalFlippedLeft,
|
|
@@ -4067,7 +4093,7 @@ const Slider = forwardRef((props, ref) => {
|
|
|
4067
4093
|
left: getThumbLeft(progressSingle),
|
|
4068
4094
|
transform: `translateX(calc(-50% + ${nudgeX}px))`,
|
|
4069
4095
|
'--slider-output-arrow-offset': `calc(50% - ${nudgeX}px)`,
|
|
4070
|
-
}, children: formatValue(currentSingle) })), renderTicks()] })) : (jsxs("div", { ref: wrapperRef, className: combinedClasses, style: wrapperStyle, children: [jsx("div", { className:
|
|
4096
|
+
}, children: formatValue(currentSingle) })), renderTicks()] })) : (jsxs("div", { ref: wrapperRef, className: combinedClasses, style: wrapperStyle, children: [jsx("div", { className: prefixedClassNames(classPrefix, 'slider-track'), style: isVertical
|
|
4071
4097
|
? {
|
|
4072
4098
|
'--slider-progress-low': `${progressLow}%`,
|
|
4073
4099
|
'--slider-progress-high': `${progressHigh}%`,
|
|
@@ -4075,7 +4101,7 @@ const Slider = forwardRef((props, ref) => {
|
|
|
4075
4101
|
: {
|
|
4076
4102
|
'--slider-progress-low': `${progressLow}%`,
|
|
4077
4103
|
'--slider-progress-high': `${progressHigh}%`,
|
|
4078
|
-
} }), jsx("input", { ref: combinedRef, type: "range", min: min, max: max, step: step, value: currentRange[0], disabled: disabled, onChange: handleRangeLowChange, onKeyDown: handleKeyDown, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), className:
|
|
4104
|
+
} }), jsx("input", { ref: combinedRef, type: "range", min: min, max: max, step: step, value: currentRange[0], disabled: disabled, onChange: handleRangeLowChange, onKeyDown: handleKeyDown, onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), className: prefixedClassNames(classPrefix, 'slider-input', 'slider-input-low'), "aria-valuenow": currentRange[0], "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": isVertical ? 'vertical' : undefined, "aria-label": ariaLabel?.[0] ?? 'Minimum value', ...getAriaProps(currentRange[0]), ...rest, ...(nameLow !== undefined ? { name: nameLow } : {}) }), jsx("input", { ref: inputHighRef, type: "range", min: min, max: max, step: step, value: currentRange[1], disabled: disabled, onChange: handleRangeHighChange, onMouseEnter: () => setShowTooltipHigh(true), onMouseLeave: () => setShowTooltipHigh(false), onFocus: () => setShowTooltipHigh(true), onBlur: () => setShowTooltipHigh(false), className: prefixedClassNames(classPrefix, 'slider-input', 'slider-input-high'), "aria-valuenow": currentRange[1], "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": isVertical ? 'vertical' : undefined, "aria-label": ariaLabel?.[1] ?? 'Maximum value', ...getAriaProps(currentRange[1]), name: nameHigh }), tooltipMode !== 'hidden' && (jsx("output", { ref: outputRef, className: prefixedClassNames(classPrefix, 'slider-output', 'slider-output-low', {
|
|
4079
4105
|
'is-visible': showTipLow,
|
|
4080
4106
|
'is-flipped': flipped,
|
|
4081
4107
|
'is-flipped-left': isVertical && verticalFlippedLeft,
|
|
@@ -4095,7 +4121,7 @@ const Slider = forwardRef((props, ref) => {
|
|
|
4095
4121
|
left: getThumbLeft(progressLow),
|
|
4096
4122
|
transform: `translateX(calc(-50% + ${nudgeX}px))`,
|
|
4097
4123
|
'--slider-output-arrow-offset': `calc(50% - ${nudgeX}px)`,
|
|
4098
|
-
}, children: formatValue(currentRange[0]) })), tooltipMode !== 'hidden' && (jsx("output", { ref: outputHighRef, className:
|
|
4124
|
+
}, children: formatValue(currentRange[0]) })), tooltipMode !== 'hidden' && (jsx("output", { ref: outputHighRef, className: prefixedClassNames(classPrefix, 'slider-output', 'slider-output-high', {
|
|
4099
4125
|
'is-visible': showTipHigh,
|
|
4100
4126
|
'is-flipped': flippedHigh,
|
|
4101
4127
|
'is-flipped-left': isVertical && verticalFlippedLeft,
|
|
@@ -4381,6 +4407,7 @@ const Rate = forwardRef(({ label, labelSize, labelProps, horizontal, message, me
|
|
|
4381
4407
|
}
|
|
4382
4408
|
return currentValue;
|
|
4383
4409
|
};
|
|
4410
|
+
const classPrefix = useClassPrefix();
|
|
4384
4411
|
const rateClasses = usePrefixedClassNames('rate', {
|
|
4385
4412
|
[`is-${size}`]: size,
|
|
4386
4413
|
'is-disabled': disabled,
|
|
@@ -4417,9 +4444,9 @@ const Rate = forwardRef(({ label, labelSize, labelProps, horizontal, message, me
|
|
|
4417
4444
|
return customIcon(iconProps);
|
|
4418
4445
|
}
|
|
4419
4446
|
if (iconName) {
|
|
4420
|
-
return (jsxs("span", { className:
|
|
4447
|
+
return (jsxs("span", { className: prefixedClassNames(classPrefix, 'rate-icon-partial'), style: {
|
|
4421
4448
|
'--rate-fill-percent': `${fillPercent}%`,
|
|
4422
|
-
}, children: [jsx("span", { className:
|
|
4449
|
+
}, children: [jsx("span", { className: prefixedClassNames(classPrefix, 'rate-icon-bg'), children: jsx(Icon, { name: iconName, library: resolvedLibrary, variant: iconVariant, features: iconFeatures }) }), jsx("span", { className: prefixedClassNames(classPrefix, 'rate-icon-fg'), children: jsx(Icon, { name: iconName, library: resolvedLibrary, variant: iconVariant, features: iconFeatures }) })] }));
|
|
4423
4450
|
}
|
|
4424
4451
|
const clipId = `rate-clip-${iconIndex}`;
|
|
4425
4452
|
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", "aria-hidden": "true", children: [jsx("defs", { children: jsx("clipPath", { id: clipId, children: jsx("rect", { x: "0", y: "0", width: `${(fillPercent / 100) * 24}`, height: "24" }) }) }), jsx("path", { fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", d: "M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" }), jsx("path", { clipPath: `url(#${clipId})`, fill: "currentColor", d: "M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" })] }));
|
|
@@ -4435,7 +4462,7 @@ const Rate = forwardRef(({ label, labelSize, labelProps, horizontal, message, me
|
|
|
4435
4462
|
const icon = isPartial
|
|
4436
4463
|
? renderPartialIcon(iconIndex, fillPercent)
|
|
4437
4464
|
: renderIcon(iconIndex, isActive, fillPercent);
|
|
4438
|
-
icons.push(jsx("span", { className:
|
|
4465
|
+
icons.push(jsx("span", { className: prefixedClassNames(classPrefix, 'rate-item', {
|
|
4439
4466
|
'is-active': isActive,
|
|
4440
4467
|
'is-hovered': isHovered,
|
|
4441
4468
|
}), onClick: e => handleClick(iconIndex, e), onMouseEnter: () => handleMouseEnter(iconIndex), onMouseMove: e => handleMouseMove(iconIndex, e), onMouseLeave: handleMouseLeave, role: "radio", "aria-checked": currentValue === iconIndex + 1 ||
|
|
@@ -4453,7 +4480,11 @@ const Rate = forwardRef(({ label, labelSize, labelProps, horizontal, message, me
|
|
|
4453
4480
|
[`is-${messageColor}`]: !!messageColor,
|
|
4454
4481
|
});
|
|
4455
4482
|
const messageEl = message ? jsx("p", { className: helpClass, children: message }) : null;
|
|
4456
|
-
const
|
|
4483
|
+
const rateItemsClass = usePrefixedClassNames('rate-items');
|
|
4484
|
+
const rateScoreClass = usePrefixedClassNames('rate-score');
|
|
4485
|
+
const rateTextClass = usePrefixedClassNames('rate-text');
|
|
4486
|
+
const rateCustomTextClass = usePrefixedClassNames('rate-custom-text');
|
|
4487
|
+
const rateElement = (jsxs("div", { ref: ref, className: combinedClasses, role: "radiogroup", "aria-label": "Rating", "aria-valuenow": currentValue, "aria-valuemin": 0, "aria-valuemax": max, "aria-valuetext": ariaValueText, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, ...rest, children: [jsx("div", { className: rateItemsClass, children: renderIcons() }), showScore && (jsx("span", { className: rateScoreClass, children: getScoreDisplay() })), text && jsx("span", { className: rateTextClass, children: text }), customText && (jsx("span", { className: rateCustomTextClass, children: customText })), name && (jsx("input", { type: "hidden", name: name, value: currentValue, form: form }))] }));
|
|
4457
4488
|
let content = rateElement;
|
|
4458
4489
|
if (!insideControl) {
|
|
4459
4490
|
content = jsx(Control, { children: content });
|
|
@@ -4914,7 +4945,7 @@ const Taginput = forwardRef(({ label, labelSize, labelProps, horizontal, message
|
|
|
4914
4945
|
const messageEl = message ? jsx("p", { className: helpClass, children: message }) : null;
|
|
4915
4946
|
const taginputElement = (jsxs("div", { ref: containerRef, className: combinedClasses, onClick: handleContainerClick, ...rest, children: [jsxs("div", { className: containerClasses, children: [icon && (jsx(Icon, { name: icon, library: resolvedLibrary, variant: iconVariant, features: iconFeatures, containerClassName: pcn('icon', 'is-left') })), jsxs("div", { className: tagsClasses, children: [tags.map((tag, index) => {
|
|
4916
4947
|
const displayVal = getDisplayValue(tag);
|
|
4917
|
-
return (jsxs("span", { className: tagClasses, children: [tagTemplate ? (tagTemplate(tag)) : ellipsis ? (jsx("span", { title: displayVal, children: displayVal })) : (displayVal), closable && !disabled && !readonly && (jsx("button", { type: "button", className:
|
|
4948
|
+
return (jsxs("span", { className: tagClasses, children: [tagTemplate ? (tagTemplate(tag)) : ellipsis ? (jsx("span", { title: displayVal, children: displayVal })) : (displayVal), closable && !disabled && !readonly && (jsx("button", { type: "button", className: pcn('delete', 'is-small'), onClick: e => {
|
|
4918
4949
|
e.stopPropagation();
|
|
4919
4950
|
removeTag(index);
|
|
4920
4951
|
}, "aria-label": ariaCloseLabel || `Remove ${displayVal}` }))] }, index));
|