@shohojdhara/atomix 0.3.4 → 0.3.5
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/atomix.css +9 -10
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15108 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6482 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3357 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2450 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4550 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5161 -4990
- package/dist/index.esm.js +1457 -784
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1473 -790
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +1992 -0
- package/dist/theme.js +5348 -0
- package/dist/theme.js.map +1 -0
- package/package.json +66 -20
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -17
- package/src/components/Chart/AreaChart.tsx +5 -1
- package/src/components/Chart/BarChart.tsx +1 -0
- package/src/components/Chart/BubbleChart.tsx +6 -5
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/FunnelChart.tsx +1 -1
- package/src/components/Chart/RadarChart.tsx +19 -12
- package/src/components/Chart/ScatterChart.tsx +3 -3
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Pagination/Pagination.tsx +6 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +5 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +55 -13
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +10 -14
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/composeTheme.ts +1 -1
- package/src/lib/theme/core/ThemeEngine.ts +8 -0
- package/src/lib/theme/core/ThemeValidator.ts +5 -2
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +11 -5
- package/src/lib/theme/generateCSSVariables.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +2 -1
- package/src/lib/theme/runtime/ThemeApplicator.ts +28 -11
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
- package/src/lib/theme/runtime/ThemeManager.ts +4 -0
- package/src/lib/theme-tools.ts +1 -1
- package/src/lib/types/components.ts +183 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/03-generic/_generated-root.css +22 -1
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/themes/themes.config.js +37 -4
- package/scripts/build-themes.js +0 -208
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
package/dist/index.js
CHANGED
|
@@ -1565,14 +1565,14 @@ function useAccordion(initialProps) {
|
|
|
1565
1565
|
};
|
|
1566
1566
|
// Controlled/uncontrolled open state
|
|
1567
1567
|
/**
|
|
1568
|
-
|
|
1569
|
-
|
|
1568
|
+
* Effect to update panel height when open state changes
|
|
1569
|
+
*/
|
|
1570
1570
|
return React.useEffect((() => {
|
|
1571
1571
|
updatePanelHeight();
|
|
1572
1572
|
}), [ isOpen ]),
|
|
1573
1573
|
/**
|
|
1574
|
-
|
|
1575
|
-
|
|
1574
|
+
* Effect to handle window resize and update panel height
|
|
1575
|
+
*/
|
|
1576
1576
|
React.useEffect((() => {
|
|
1577
1577
|
const handleResize = () => {
|
|
1578
1578
|
isOpen && updatePanelHeight();
|
|
@@ -1661,7 +1661,7 @@ const {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
|
|
|
1661
1661
|
const childArray = React__default.default.Children.toArray(children);
|
|
1662
1662
|
for (let i = 0; i < childArray.length; i++) {
|
|
1663
1663
|
const child = childArray[i];
|
|
1664
|
-
if (React__default.default.isValidElement(child)) {
|
|
1664
|
+
if ( React__default.default.isValidElement(child)) {
|
|
1665
1665
|
const radius = extractBorderRadiusFromElement(child);
|
|
1666
1666
|
if (null !== radius) return radius;
|
|
1667
1667
|
}
|
|
@@ -1829,7 +1829,7 @@ const {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
|
|
|
1829
1829
|
*/ GlassFilterComponent.displayName = "GlassFilter";
|
|
1830
1830
|
|
|
1831
1831
|
// Memoize component to prevent unnecessary re-renders
|
|
1832
|
-
const GlassFilter =
|
|
1832
|
+
const GlassFilter = React.memo(GlassFilterComponent, ((prevProps, nextProps) => prevProps.id === nextProps.id && prevProps.displacementScale === nextProps.displacementScale && prevProps.aberrationIntensity === nextProps.aberrationIntensity && prevProps.mode === nextProps.mode && prevProps.shaderMapUrl === nextProps.shaderMapUrl && prevProps.blurAmount === nextProps.blurAmount)), sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({children: children, className: className = "", style: style, displacementScale: displacementScale = 25, blurAmount: blurAmount = .0625, saturation: saturation = 180, aberrationIntensity: aberrationIntensity = 2, mouseOffset: mouseOffset = {
|
|
1833
1833
|
x: 0,
|
|
1834
1834
|
y: 0
|
|
1835
1835
|
}, globalMousePosition: globalMousePosition = {
|
|
@@ -2093,8 +2093,8 @@ class {
|
|
|
2093
2093
|
y: 0
|
|
2094
2094
|
}, this.rafId = null, this.lastEvent = null, this.isTracking = !1,
|
|
2095
2095
|
/**
|
|
2096
|
-
|
|
2097
|
-
|
|
2096
|
+
* Handle mouse move event
|
|
2097
|
+
*/
|
|
2098
2098
|
this.handleMouseMove = e => {
|
|
2099
2099
|
this.lastEvent = e,
|
|
2100
2100
|
// Use requestAnimationFrame to throttle updates
|
|
@@ -2115,10 +2115,10 @@ class {
|
|
|
2115
2115
|
};
|
|
2116
2116
|
}
|
|
2117
2117
|
/**
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2118
|
+
* Subscribe to mouse position updates
|
|
2119
|
+
* @param callback Function to call when mouse position changes
|
|
2120
|
+
* @returns Unsubscribe function
|
|
2121
|
+
*/ subscribe(callback) {
|
|
2122
2122
|
// Return unsubscribe function
|
|
2123
2123
|
return this.listeners.add(callback),
|
|
2124
2124
|
// Start tracking if this is the first subscriber
|
|
@@ -2129,15 +2129,15 @@ class {
|
|
|
2129
2129
|
};
|
|
2130
2130
|
}
|
|
2131
2131
|
/**
|
|
2132
|
-
|
|
2133
|
-
|
|
2132
|
+
* Unsubscribe from mouse position updates
|
|
2133
|
+
*/ unsubscribe(callback) {
|
|
2134
2134
|
this.listeners.delete(callback),
|
|
2135
2135
|
// Stop tracking if no more subscribers
|
|
2136
2136
|
0 === this.listeners.size && this.stopTracking();
|
|
2137
2137
|
}
|
|
2138
2138
|
/**
|
|
2139
|
-
|
|
2140
|
-
|
|
2139
|
+
* Start tracking mouse movement
|
|
2140
|
+
*/ startTracking() {
|
|
2141
2141
|
this.isTracking || (this.isTracking = !0,
|
|
2142
2142
|
// Use document-level listener for global tracking
|
|
2143
2143
|
document.addEventListener("mousemove", this.handleMouseMove, {
|
|
@@ -2145,22 +2145,22 @@ class {
|
|
|
2145
2145
|
}));
|
|
2146
2146
|
}
|
|
2147
2147
|
/**
|
|
2148
|
-
|
|
2149
|
-
|
|
2148
|
+
* Stop tracking mouse movement
|
|
2149
|
+
*/ stopTracking() {
|
|
2150
2150
|
this.isTracking && (this.isTracking = !1, document.removeEventListener("mousemove", this.handleMouseMove),
|
|
2151
2151
|
// Cancel any pending RAF
|
|
2152
2152
|
null !== this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null), this.lastEvent = null);
|
|
2153
2153
|
}
|
|
2154
2154
|
/**
|
|
2155
|
-
|
|
2156
|
-
|
|
2155
|
+
* Get current mouse position (synchronous)
|
|
2156
|
+
*/ getPosition() {
|
|
2157
2157
|
return {
|
|
2158
2158
|
...this.position
|
|
2159
2159
|
};
|
|
2160
2160
|
}
|
|
2161
2161
|
/**
|
|
2162
|
-
|
|
2163
|
-
|
|
2162
|
+
* Get number of active subscribers (for debugging)
|
|
2163
|
+
*/ getSubscriberCount() {
|
|
2164
2164
|
return this.listeners.size;
|
|
2165
2165
|
}
|
|
2166
2166
|
}, {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
|
|
@@ -2504,11 +2504,11 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2504
2504
|
}), [ effectiveCornerRadius, glassRef ]);
|
|
2505
2505
|
// OverLight config
|
|
2506
2506
|
/**
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2507
|
+
* Get effective overLight value based on configuration
|
|
2508
|
+
* - boolean: returns the boolean value directly
|
|
2509
|
+
* - 'auto': returns detectedOverLight (auto-detected from background)
|
|
2510
|
+
* - object: returns detectedOverLight (auto-detected, but config object provides customization)
|
|
2511
|
+
*/
|
|
2512
2512
|
const getEffectiveOverLight = React.useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = React.useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), overLightConfig = React.useMemo((() => {
|
|
2513
2513
|
const isOverLight = getEffectiveOverLight(), mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, baseConfig = {
|
|
2514
2514
|
isOverLight: isOverLight,
|
|
@@ -2538,13 +2538,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2538
2538
|
!onClick || "Enter" !== e.key && " " !== e.key || (e.preventDefault(), onClick());
|
|
2539
2539
|
}), [ onClick ]), handleMouseMove = React.useCallback((_e => {}), []);
|
|
2540
2540
|
/**
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2541
|
+
* Validate and clamp a numeric config value
|
|
2542
|
+
* @param value - The value to validate
|
|
2543
|
+
* @param min - Minimum allowed value
|
|
2544
|
+
* @param max - Maximum allowed value
|
|
2545
|
+
* @param defaultValue - Default value if validation fails
|
|
2546
|
+
* @returns Validated and clamped value
|
|
2547
|
+
*/ return {
|
|
2548
2548
|
// State
|
|
2549
2549
|
isHovered: isHovered,
|
|
2550
2550
|
isActive: isActive,
|
|
@@ -2877,7 +2877,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2877
2877
|
});
|
|
2878
2878
|
}
|
|
2879
2879
|
|
|
2880
|
-
const Accordion =
|
|
2880
|
+
const Accordion = React.memo((({title: title, children: children, defaultOpen: defaultOpen = !1, isOpen: controlledOpen, onOpenChange: onOpenChange, disabled: disabled = !1, iconPosition: iconPosition = "right", icon: icon, className: className = "", style: style, glass: glass}) => {
|
|
2881
2881
|
// Generate unique IDs for accessibility
|
|
2882
2882
|
const instanceId = React.useId(), buttonId = `accordion-header-${instanceId}`, panelId = `accordion-panel-${instanceId}`, {state: state, toggle: toggle, updatePanelHeight: updatePanelHeight, panelRef: panelRef, contentRef: contentRef, generateClassNames: generateClassNames, generateHeaderClassNames: generateHeaderClassNames} = useAccordion({
|
|
2883
2883
|
defaultOpen: defaultOpen,
|
|
@@ -2948,7 +2948,7 @@ const Accordion = ({title: title, children: children, defaultOpen: defaultOpen =
|
|
|
2948
2948
|
});
|
|
2949
2949
|
}
|
|
2950
2950
|
return accordionContent;
|
|
2951
|
-
};
|
|
2951
|
+
}));
|
|
2952
2952
|
|
|
2953
2953
|
// Set display name for debugging
|
|
2954
2954
|
Accordion.displayName = "Accordion";
|
|
@@ -3290,7 +3290,7 @@ const sizeMap = {
|
|
|
3290
3290
|
* Icon component that displays a Phosphor icon
|
|
3291
3291
|
*/ Icon.displayName = "Icon";
|
|
3292
3292
|
|
|
3293
|
-
const Avatar =
|
|
3293
|
+
const Avatar = React.memo((({src: src, alt: alt = "Avatar", initials: initials, icon: icon, size: size = "md", circle: circle = !1, className: className = "", disabled: disabled = !1, onClick: onClick, style: style, glass: glass}) => {
|
|
3294
3294
|
const [imageError, setImageError] = React.useState(!1), avatarClasses = [ AVATAR.CLASSES.BASE, "md" !== size && `c-avatar--${size}`, circle && AVATAR.CLASSES.CIRCLE, disabled && "is-disabled", className ].filter(Boolean).join(" ");
|
|
3295
3295
|
return jsxRuntime.jsx("div", {
|
|
3296
3296
|
className: avatarClasses,
|
|
@@ -3322,18 +3322,18 @@ const Avatar = ({src: src, alt: alt = "Avatar", initials: initials, icon: icon,
|
|
|
3322
3322
|
})
|
|
3323
3323
|
})
|
|
3324
3324
|
});
|
|
3325
|
-
};
|
|
3325
|
+
}));
|
|
3326
3326
|
|
|
3327
3327
|
Avatar.displayName = "Avatar";
|
|
3328
3328
|
|
|
3329
3329
|
const AvatarGroup = ({children: children, max: max, stacked: stacked = !1, className: className = "", style: style, moreText: moreText}) => {
|
|
3330
3330
|
// Generate CSS classes
|
|
3331
|
-
const avatarGroupClasses = [ AVATAR_GROUP.CLASSES.BASE, stacked && AVATAR_GROUP.CLASSES.STACKED, className ].filter(Boolean).join(" "), avatarChildren = React.Children.toArray(children).filter((child =>
|
|
3331
|
+
const avatarGroupClasses = [ AVATAR_GROUP.CLASSES.BASE, stacked && AVATAR_GROUP.CLASSES.STACKED, className ].filter(Boolean).join(" "), avatarChildren = React.Children.toArray(children).filter((child => React.isValidElement(child) && child.type === Avatar)), showMoreIndicator = void 0 !== max && avatarChildren.length > max, visibleAvatars = showMoreIndicator ? avatarChildren.slice(0, max) : avatarChildren, hiddenAvatarCount = avatarChildren.length - (max || 0), firstAvatar = React.isValidElement(avatarChildren[0]) ? avatarChildren[0].props : null, avatarSize = firstAvatar?.size || "md", isCircle = firstAvatar?.circle || !1, moreClasses = [ AVATAR.CLASSES.BASE, AVATAR_GROUP.CLASSES.MORE, "md" !== avatarSize && `c-avatar--${avatarSize}`, isCircle && "c-avatar--circle" ].filter(Boolean).join(" ");
|
|
3332
3332
|
// Get valid Avatar children
|
|
3333
3333
|
return jsxRuntime.jsxs("div", {
|
|
3334
3334
|
className: avatarGroupClasses,
|
|
3335
3335
|
style: style,
|
|
3336
|
-
children: [ visibleAvatars.map(((child, index) =>
|
|
3336
|
+
children: [ visibleAvatars.map(((child, index) => React.isValidElement(child) ? React.cloneElement(child, {
|
|
3337
3337
|
key: index,
|
|
3338
3338
|
...child.props
|
|
3339
3339
|
}) : null)), showMoreIndicator && jsxRuntime.jsx("div", {
|
|
@@ -3357,10 +3357,10 @@ function useBadge(initialProps) {
|
|
|
3357
3357
|
...initialProps
|
|
3358
3358
|
};
|
|
3359
3359
|
/**
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3360
|
+
* Generate badge class based on properties
|
|
3361
|
+
* @param props - Badge properties
|
|
3362
|
+
* @returns Class string
|
|
3363
|
+
*/ return {
|
|
3364
3364
|
defaultProps: defaultProps,
|
|
3365
3365
|
generateBadgeClass: props => {
|
|
3366
3366
|
const {variant: variant = defaultProps.variant, size: size = defaultProps.size, disabled: disabled = defaultProps.disabled, className: className = ""} = props;
|
|
@@ -3371,7 +3371,7 @@ function useBadge(initialProps) {
|
|
|
3371
3371
|
|
|
3372
3372
|
AvatarGroup.displayName = "AvatarGroup";
|
|
3373
3373
|
|
|
3374
|
-
const Badge =
|
|
3374
|
+
const Badge = React.memo((({label: label, variant: variant = "primary", size: size = "md", disabled: disabled = !1, icon: icon, className: className = "", glass: glass, style: style}) => {
|
|
3375
3375
|
const {generateBadgeClass: generateBadgeClass} = useBadge({
|
|
3376
3376
|
variant: variant,
|
|
3377
3377
|
size: size,
|
|
@@ -3410,7 +3410,7 @@ const Badge = ({label: label, variant: variant = "primary", size: size = "md", d
|
|
|
3410
3410
|
});
|
|
3411
3411
|
}
|
|
3412
3412
|
return badgeElement;
|
|
3413
|
-
};
|
|
3413
|
+
}));
|
|
3414
3414
|
|
|
3415
3415
|
Badge.displayName = "Badge";
|
|
3416
3416
|
|
|
@@ -3433,7 +3433,7 @@ Badge.displayName = "Badge";
|
|
|
3433
3433
|
* </Container>
|
|
3434
3434
|
* ```
|
|
3435
3435
|
*/
|
|
3436
|
-
const Container =
|
|
3436
|
+
const Container = React.forwardRef((({children: children, className: className = "", type: type, ...props}, ref) => {
|
|
3437
3437
|
let containerClass = "o-container";
|
|
3438
3438
|
return type && (containerClass = `o-container-${type}`), jsxRuntime.jsx("div", {
|
|
3439
3439
|
ref: ref,
|
|
@@ -3464,7 +3464,7 @@ const useBlock = () => ({
|
|
|
3464
3464
|
// Add custom className
|
|
3465
3465
|
className && classes.push(className), classes.filter(Boolean).join(" ");
|
|
3466
3466
|
}
|
|
3467
|
-
}), Block =
|
|
3467
|
+
}), Block = React.forwardRef((({children: children, as: Component = "section", spacing: spacing = "md", container: container = {}, fullWidth: fullWidth = !1, className: className = "", style: style, background: background = "", ...props}, ref) => {
|
|
3468
3468
|
const {generateBlockClass: generateBlockClass} = useBlock(), blockClasses = generateBlockClass({
|
|
3469
3469
|
spacing: spacing,
|
|
3470
3470
|
background: background,
|
|
@@ -3518,7 +3518,7 @@ const useBlock = () => ({
|
|
|
3518
3518
|
* ```
|
|
3519
3519
|
*/ Block.displayName = "Block";
|
|
3520
3520
|
|
|
3521
|
-
const Breadcrumb =
|
|
3521
|
+
const Breadcrumb = React.memo((({items: items, divider: divider, className: className = "", ariaLabel: ariaLabel = "Breadcrumb", LinkComponent: LinkComponent, style: style}) => {
|
|
3522
3522
|
const breadcrumbClasses = [ BREADCRUMB.CLASSES.BASE, className ].filter(Boolean).join(" ");
|
|
3523
3523
|
return jsxRuntime.jsx("nav", {
|
|
3524
3524
|
"aria-label": ariaLabel,
|
|
@@ -3557,7 +3557,7 @@ const Breadcrumb = ({items: items, divider: divider, className: className = "",
|
|
|
3557
3557
|
}))
|
|
3558
3558
|
})
|
|
3559
3559
|
});
|
|
3560
|
-
};
|
|
3560
|
+
}));
|
|
3561
3561
|
|
|
3562
3562
|
/**
|
|
3563
3563
|
* Button state and functionality
|
|
@@ -3579,10 +3579,10 @@ function useButton(initialProps) {
|
|
|
3579
3579
|
...initialProps
|
|
3580
3580
|
};
|
|
3581
3581
|
/**
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3582
|
+
* Generate button class based on properties
|
|
3583
|
+
* @param props - Button properties
|
|
3584
|
+
* @returns Class string
|
|
3585
|
+
*/ return {
|
|
3586
3586
|
defaultProps: defaultProps,
|
|
3587
3587
|
generateButtonClass: props => {
|
|
3588
3588
|
const {variant: variant = defaultProps.variant, size: size = defaultProps.size, disabled: disabled = defaultProps.disabled, rounded: rounded = defaultProps.rounded, iconOnly: iconOnly = !1, glass: glass = defaultProps.glass, loading: loading = defaultProps.loading, fullWidth: fullWidth = defaultProps.fullWidth, block: block = defaultProps.block, active: active = defaultProps.active, selected: selected = defaultProps.selected, className: className = ""} = props, sizeClass = "md" === size ? "" : `c-btn--${size}`, iconOnlyClass = iconOnly ? "c-btn--icon" : "", roundedClass = rounded ? "c-btn--rounded" : "", disabledClass = disabled ? "c-btn--disabled" : "", glassClass = glass ? "c-btn--glass" : "", loadingClass = loading ? BUTTON.CLASSES.LOADING : "", fullWidthClass = fullWidth ? BUTTON.CLASSES.FULL_WIDTH : "", blockClass = block ? BUTTON.CLASSES.BLOCK : "", activeClass = active ? BUTTON.CLASSES.ACTIVE : "", selectedClass = selected ? BUTTON.CLASSES.SELECTED : "";
|
|
@@ -3607,10 +3607,10 @@ function useButton(initialProps) {
|
|
|
3607
3607
|
...initialProps
|
|
3608
3608
|
};
|
|
3609
3609
|
/**
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3610
|
+
* Generate spinner class based on properties
|
|
3611
|
+
* @param props - Spinner properties
|
|
3612
|
+
* @returns Class string
|
|
3613
|
+
*/ return {
|
|
3614
3614
|
defaultProps: defaultProps,
|
|
3615
3615
|
generateSpinnerClass: props => {
|
|
3616
3616
|
const {variant: variant = defaultProps.variant, size: size = defaultProps.size, fullscreen: fullscreen = defaultProps.fullscreen, className: className = ""} = props;
|
|
@@ -3621,7 +3621,7 @@ function useButton(initialProps) {
|
|
|
3621
3621
|
|
|
3622
3622
|
Breadcrumb.displayName = "Breadcrumb";
|
|
3623
3623
|
|
|
3624
|
-
const Spinner =
|
|
3624
|
+
const Spinner = React.memo((({size: size = "md", variant: variant = "primary", fullscreen: fullscreen = !1, className: className = "", style: style, glass: glass}) => {
|
|
3625
3625
|
const {generateSpinnerClass: generateSpinnerClass} = useSpinner({
|
|
3626
3626
|
size: size,
|
|
3627
3627
|
variant: variant,
|
|
@@ -3656,11 +3656,11 @@ const Spinner = ({size: size = "md", variant: variant = "primary", fullscreen: f
|
|
|
3656
3656
|
});
|
|
3657
3657
|
}
|
|
3658
3658
|
return spinnerContent;
|
|
3659
|
-
};
|
|
3659
|
+
}));
|
|
3660
3660
|
|
|
3661
3661
|
Spinner.displayName = "Spinner";
|
|
3662
3662
|
|
|
3663
|
-
const Button =
|
|
3663
|
+
const Button = React__default.default.memo( React.forwardRef((({label: label, children: children, onClick: onClick, variant: variant = "primary", size: size = "md", disabled: disabled = !1, loading: loading = !1, loadingText: loadingText, icon: icon, iconName: iconName, iconSize: iconSize = "sm", iconPosition: iconPosition = "start", iconOnly: iconOnly = !1, rounded: rounded = !1, fullWidth: fullWidth = !1, block: block = !1, active: active = !1, selected: selected = !1, type: type = "button", className: className = "", as: Component = "button", href: href, target: target, glass: glass, onHover: onHover, onFocus: onFocus, onBlur: onBlur, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, ariaExpanded: ariaExpanded, ariaControls: ariaControls, tabIndex: tabIndex, style: style, LinkComponent: LinkComponent, ...props}, ref) => {
|
|
3664
3664
|
const isDisabled = disabled || loading, shouldRenderAsLink = Boolean(href && !isDisabled), iconElement = React.useMemo((() => loading ? null : iconName ? jsxRuntime.jsx(Icon, {
|
|
3665
3665
|
name: iconName,
|
|
3666
3666
|
size: iconSize
|
|
@@ -3826,6 +3826,378 @@ const Button = React__default.default.memo(React.forwardRef((({label: label, chi
|
|
|
3826
3826
|
|
|
3827
3827
|
Button.displayName = "Button";
|
|
3828
3828
|
|
|
3829
|
+
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
3830
|
+
|
|
3831
|
+
function getDefaultExportFromCjs(x) {
|
|
3832
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
var fails$9 = function(exec) {
|
|
3836
|
+
try {
|
|
3837
|
+
return !!exec();
|
|
3838
|
+
} catch (error) {
|
|
3839
|
+
return !0;
|
|
3840
|
+
}
|
|
3841
|
+
}, functionBindNative = !fails$9((function() {
|
|
3842
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
3843
|
+
var test = function() {/* empty */}.bind();
|
|
3844
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
3845
|
+
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
3846
|
+
})), NATIVE_BIND$3 = functionBindNative, FunctionPrototype$1 = Function.prototype, call$5 = FunctionPrototype$1.call, uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$1.bind.bind(call$5, call$5), functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function(fn) {
|
|
3847
|
+
return function() {
|
|
3848
|
+
return call$5.apply(fn, arguments);
|
|
3849
|
+
};
|
|
3850
|
+
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
3851
|
+
return it && it.Math === Math && it;
|
|
3852
|
+
}, globalThis_1 =
|
|
3853
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
3854
|
+
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
3855
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
3856
|
+
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
3857
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
3858
|
+
function() {
|
|
3859
|
+
return this;
|
|
3860
|
+
}() || Function("return this")(), NATIVE_BIND$2 = functionBindNative, FunctionPrototype = Function.prototype, apply$1 = FunctionPrototype.apply, call$4 = FunctionPrototype.call, functionApply = "object" == typeof Reflect && Reflect.apply || (NATIVE_BIND$2 ? call$4.bind(apply$1) : function() {
|
|
3861
|
+
return call$4.apply(apply$1, arguments);
|
|
3862
|
+
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
3863
|
+
return stringSlice(toString$3(it), 8, -1);
|
|
3864
|
+
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
3865
|
+
// Nashorn bug:
|
|
3866
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
3867
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
3868
|
+
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
3869
|
+
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
3870
|
+
return "function" == typeof argument || argument === documentAll;
|
|
3871
|
+
} : function(argument) {
|
|
3872
|
+
return "function" == typeof argument;
|
|
3873
|
+
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$9((function() {
|
|
3874
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
3875
|
+
return 7 !== Object.defineProperty({}, 1, {
|
|
3876
|
+
get: function() {
|
|
3877
|
+
return 7;
|
|
3878
|
+
}
|
|
3879
|
+
})[1];
|
|
3880
|
+
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
3881
|
+
return call$3.apply(call$3, arguments);
|
|
3882
|
+
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
3883
|
+
1: 2
|
|
3884
|
+
}, 1);
|
|
3885
|
+
|
|
3886
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
3887
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
3888
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
3889
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
3890
|
+
return !!descriptor && descriptor.enumerable;
|
|
3891
|
+
} : $propertyIsEnumerable;
|
|
3892
|
+
|
|
3893
|
+
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
3894
|
+
return {
|
|
3895
|
+
enumerable: !(1 & bitmap),
|
|
3896
|
+
configurable: !(2 & bitmap),
|
|
3897
|
+
writable: !(4 & bitmap),
|
|
3898
|
+
value: value
|
|
3899
|
+
};
|
|
3900
|
+
}, fails$6 = fails$9, classof$4 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$6((function() {
|
|
3901
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
3902
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
3903
|
+
return !$Object$3("z").propertyIsEnumerable(0);
|
|
3904
|
+
})) ? function(it) {
|
|
3905
|
+
return "String" === classof$4(it) ? split(it, "") : $Object$3(it);
|
|
3906
|
+
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
3907
|
+
return null == it;
|
|
3908
|
+
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$7 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
3909
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$7("Can't call method on " + it);
|
|
3910
|
+
return it;
|
|
3911
|
+
}, IndexedObject$1 = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
3912
|
+
return IndexedObject$1(requireObjectCoercible$2(it));
|
|
3913
|
+
}, isCallable$7 = isCallable$8, isObject$6 = function(it) {
|
|
3914
|
+
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
3915
|
+
}, path$3 = {}, path$2 = path$3, globalThis$b = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
3916
|
+
return isCallable$6(variable) ? variable : void 0;
|
|
3917
|
+
}, navigator$1 = globalThis_1.navigator, userAgent$2 = navigator$1 && navigator$1.userAgent, environmentUserAgent = userAgent$2 ? String(userAgent$2) : "", globalThis$9 = globalThis_1, userAgent$1 = environmentUserAgent, process$1 = globalThis$9.process, Deno$1 = globalThis$9.Deno, versions = process$1 && process$1.versions || Deno$1 && Deno$1.version, v8 = versions && versions.v8;
|
|
3918
|
+
|
|
3919
|
+
v8 && (
|
|
3920
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
3921
|
+
// but their correct versions are not interesting for us
|
|
3922
|
+
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
3923
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
3924
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
3925
|
+
!version && userAgent$1 && (!(match = userAgent$1.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent$1.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
3926
|
+
|
|
3927
|
+
var environmentV8Version = version, V8_VERSION = environmentV8Version, fails$5 = fails$9, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5((function() {
|
|
3928
|
+
var symbol = Symbol("symbol detection");
|
|
3929
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
3930
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
3931
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
3932
|
+
// of course, fail.
|
|
3933
|
+
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
3934
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
3935
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
3936
|
+
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$2 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
3937
|
+
return "symbol" == typeof it;
|
|
3938
|
+
} : function(it) {
|
|
3939
|
+
var $Symbol = function(namespace, method) {
|
|
3940
|
+
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$b[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$b[namespace] && globalThis$b[namespace][method];
|
|
3941
|
+
}("Symbol");
|
|
3942
|
+
return isCallable$5($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
|
|
3943
|
+
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$6 = TypeError, aCallable$3 = function(argument) {
|
|
3944
|
+
if (isCallable$4(argument)) return argument;
|
|
3945
|
+
throw new $TypeError$6(function(argument) {
|
|
3946
|
+
try {
|
|
3947
|
+
return $String$2(argument);
|
|
3948
|
+
} catch (error) {
|
|
3949
|
+
return "Object";
|
|
3950
|
+
}
|
|
3951
|
+
}(argument) + " is not a function");
|
|
3952
|
+
}, aCallable$2 = aCallable$3, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$5 = isObject$6, $TypeError$5 = TypeError, sharedStore = {
|
|
3953
|
+
exports: {}
|
|
3954
|
+
}, globalThis$7 = globalThis_1, defineProperty = Object.defineProperty, globalThis$6 = globalThis_1, store$1 = sharedStore.exports = globalThis$6["__core-js_shared__"] || function(key, value) {
|
|
3955
|
+
try {
|
|
3956
|
+
defineProperty(globalThis$7, key, {
|
|
3957
|
+
value: value,
|
|
3958
|
+
configurable: !0,
|
|
3959
|
+
writable: !0
|
|
3960
|
+
});
|
|
3961
|
+
} catch (error) {
|
|
3962
|
+
globalThis$7[key] = value;
|
|
3963
|
+
}
|
|
3964
|
+
return value;
|
|
3965
|
+
}("__core-js_shared__", {});
|
|
3966
|
+
|
|
3967
|
+
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
3968
|
+
version: "3.43.0",
|
|
3969
|
+
mode: "pure",
|
|
3970
|
+
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
3971
|
+
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
3972
|
+
source: "https://github.com/zloirock/core-js"
|
|
3973
|
+
});
|
|
3974
|
+
|
|
3975
|
+
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, toObject$2 = function(argument) {
|
|
3976
|
+
return $Object$1(requireObjectCoercible$1(argument));
|
|
3977
|
+
}, toObject$1 = toObject$2, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
3978
|
+
return hasOwnProperty(toObject$1(it), key);
|
|
3979
|
+
}, uncurryThis$3 = functionUncurryThis, id = 0, postfix = Math.random(), toString$2 = uncurryThis$3(1.1.toString), hasOwn$2 = hasOwnProperty_1, NATIVE_SYMBOL = symbolConstructorDetection, USE_SYMBOL_AS_UID = useSymbolAsUid, Symbol$1 = globalThis_1.Symbol, WellKnownSymbolsStore = store[key = "wks"] || (store[key] = value || {}), createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1.for || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || function(key) {
|
|
3980
|
+
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
3981
|
+
}, wellKnownSymbol$5 = function(name) {
|
|
3982
|
+
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
3983
|
+
WellKnownSymbolsStore[name];
|
|
3984
|
+
}, call$1 = functionCall, isObject$4 = isObject$6, isSymbol$1 = isSymbol$2, $TypeError$4 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
3985
|
+
if (!isObject$4(input) || isSymbol$1(input)) return input;
|
|
3986
|
+
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$2(func));
|
|
3987
|
+
if (exoticToPrim) {
|
|
3988
|
+
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
3989
|
+
!isObject$4(result) || isSymbol$1(result)) return result;
|
|
3990
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
3991
|
+
}
|
|
3992
|
+
return void 0 === pref && (pref = "number"), function(input, pref) {
|
|
3993
|
+
var fn, val;
|
|
3994
|
+
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
3995
|
+
if (isCallable$3(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
|
|
3996
|
+
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
3997
|
+
throw new $TypeError$5("Can't convert object to primitive value");
|
|
3998
|
+
}(input, pref);
|
|
3999
|
+
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
4000
|
+
var key = toPrimitive(argument, "string");
|
|
4001
|
+
return isSymbol(key) ? key : key + "";
|
|
4002
|
+
}, isObject$3 = isObject$6, document$1 = globalThis_1.document, EXISTS = isObject$3(document$1) && isObject$3(document$1.createElement), ie8DomDefine = !descriptors && !fails$9((function() {
|
|
4003
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
4004
|
+
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
4005
|
+
get: function() {
|
|
4006
|
+
return 7;
|
|
4007
|
+
}
|
|
4008
|
+
}).a;
|
|
4009
|
+
var it;
|
|
4010
|
+
})), DESCRIPTORS$3 = descriptors, call = functionCall, propertyIsEnumerableModule = objectPropertyIsEnumerable, createPropertyDescriptor$1 = createPropertyDescriptor$2, toIndexedObject$1 = toIndexedObject$2, toPropertyKey$1 = toPropertyKey$2, hasOwn$1 = hasOwnProperty_1, IE8_DOM_DEFINE$1 = ie8DomDefine, $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
4011
|
+
|
|
4012
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
4013
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
4014
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
4015
|
+
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
4016
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
4017
|
+
} catch (error) {/* empty */}
|
|
4018
|
+
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
4019
|
+
};
|
|
4020
|
+
|
|
4021
|
+
var fails$3 = fails$9, isCallable$2 = isCallable$8, replacement = /#|\.prototype\./, isForced$1 = function(feature, detection) {
|
|
4022
|
+
var value = data[normalize(feature)];
|
|
4023
|
+
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$3(detection) : !!detection);
|
|
4024
|
+
}, normalize = isForced$1.normalize = function(string) {
|
|
4025
|
+
return String(string).replace(replacement, ".").toLowerCase();
|
|
4026
|
+
}, data = isForced$1.data = {}, NATIVE = isForced$1.NATIVE = "N", POLYFILL = isForced$1.POLYFILL = "P", isForced_1 = isForced$1, aCallable$1 = aCallable$3, NATIVE_BIND = functionBindNative, bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind), objectDefineProperty = {}, v8PrototypeDefineBug = descriptors && fails$9((function() {
|
|
4027
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
4028
|
+
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
4029
|
+
value: 42,
|
|
4030
|
+
writable: !1
|
|
4031
|
+
}).prototype;
|
|
4032
|
+
})), isObject$2 = isObject$6, $String$1 = String, $TypeError$3 = TypeError, DESCRIPTORS$1 = descriptors, IE8_DOM_DEFINE = ie8DomDefine, V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug, anObject = function(argument) {
|
|
4033
|
+
if (isObject$2(argument)) return argument;
|
|
4034
|
+
throw new $TypeError$3($String$1(argument) + " is not an object");
|
|
4035
|
+
}, toPropertyKey = toPropertyKey$2, $TypeError$2 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
4036
|
+
|
|
4037
|
+
// `Object.defineProperty` method
|
|
4038
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
4039
|
+
objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function(O, P, Attributes) {
|
|
4040
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), "function" == typeof O && "prototype" === P && "value" in Attributes && "writable" in Attributes && !Attributes.writable) {
|
|
4041
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
4042
|
+
current && current.writable && (O[P] = Attributes.value, Attributes = {
|
|
4043
|
+
configurable: "configurable" in Attributes ? Attributes.configurable : current.configurable,
|
|
4044
|
+
enumerable: "enumerable" in Attributes ? Attributes.enumerable : current.enumerable,
|
|
4045
|
+
writable: !1
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4048
|
+
return $defineProperty(O, P, Attributes);
|
|
4049
|
+
} : $defineProperty : function(O, P, Attributes) {
|
|
4050
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
4051
|
+
return $defineProperty(O, P, Attributes);
|
|
4052
|
+
} catch (error) {/* empty */}
|
|
4053
|
+
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$2("Accessors not supported");
|
|
4054
|
+
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
4055
|
+
};
|
|
4056
|
+
|
|
4057
|
+
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
4058
|
+
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
4059
|
+
} : function(object, key, value) {
|
|
4060
|
+
return object[key] = value, object;
|
|
4061
|
+
}, globalThis$3 = globalThis_1, apply = functionApply, uncurryThis$1 = functionUncurryThisClause, isCallable$1 = isCallable$8, getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f, isForced = isForced_1, path$1 = path$3, bind = function(fn, that) {
|
|
4062
|
+
return aCallable$1(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
4063
|
+
return fn.apply(that, arguments);
|
|
4064
|
+
};
|
|
4065
|
+
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
4066
|
+
var Wrapper = function(a, b, c) {
|
|
4067
|
+
if (this instanceof Wrapper) {
|
|
4068
|
+
switch (arguments.length) {
|
|
4069
|
+
case 0:
|
|
4070
|
+
return new NativeConstructor;
|
|
4071
|
+
|
|
4072
|
+
case 1:
|
|
4073
|
+
return new NativeConstructor(a);
|
|
4074
|
+
|
|
4075
|
+
case 2:
|
|
4076
|
+
return new NativeConstructor(a, b);
|
|
4077
|
+
}
|
|
4078
|
+
return new NativeConstructor(a, b, c);
|
|
4079
|
+
}
|
|
4080
|
+
return apply(NativeConstructor, this, arguments);
|
|
4081
|
+
};
|
|
4082
|
+
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
4083
|
+
}, _export = function(options, source) {
|
|
4084
|
+
var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE, key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor, TARGET = options.target, GLOBAL = options.global, STATIC = options.stat, PROTO = options.proto, nativeSource = GLOBAL ? globalThis$3 : STATIC ? globalThis$3[TARGET] : globalThis$3[TARGET] && globalThis$3[TARGET].prototype, target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty(path$1, TARGET, {})[TARGET], targetPrototype = target.prototype;
|
|
4085
|
+
for (key in source)
|
|
4086
|
+
// contains in native
|
|
4087
|
+
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
4088
|
+
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
4089
|
+
// export native or implementation
|
|
4090
|
+
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
4091
|
+
// bind methods to global for calling from export context
|
|
4092
|
+
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$3) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
4093
|
+
// add a flag to not completely full polyfills
|
|
4094
|
+
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
4095
|
+
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
4096
|
+
// export virtual prototype methods
|
|
4097
|
+
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
4098
|
+
// export real prototype methods
|
|
4099
|
+
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
4100
|
+
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
4101
|
+
var n = +x;
|
|
4102
|
+
return (n > 0 ? floor : ceil)(n);
|
|
4103
|
+
}, toIntegerOrInfinity$2 = function(argument) {
|
|
4104
|
+
var number = +argument;
|
|
4105
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4106
|
+
return number != number || 0 === number ? 0 : trunc(number);
|
|
4107
|
+
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, lengthOfArrayLike$2 = function(obj) {
|
|
4108
|
+
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
4109
|
+
var argument, len;
|
|
4110
|
+
}, toIndexedObject = toIndexedObject$2, lengthOfArrayLike$1 = lengthOfArrayLike$2, createMethod$1 = function(IS_INCLUDES) {
|
|
4111
|
+
return function($this, el, fromIndex) {
|
|
4112
|
+
var O = toIndexedObject($this), length = lengthOfArrayLike$1(O);
|
|
4113
|
+
if (0 === length) return !IS_INCLUDES && -1;
|
|
4114
|
+
var value, index = function(index, length) {
|
|
4115
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
4116
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
4117
|
+
}(fromIndex, length);
|
|
4118
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
4119
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4120
|
+
if (IS_INCLUDES && el != el) {
|
|
4121
|
+
for (;length > index; )
|
|
4122
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4123
|
+
if ((value = O[index++]) != value) return !0;
|
|
4124
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
4125
|
+
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
4126
|
+
return !IS_INCLUDES && -1;
|
|
4127
|
+
};
|
|
4128
|
+
}, $includes = [ createMethod$1(!0), createMethod$1(!1) ][0];
|
|
4129
|
+
|
|
4130
|
+
// `Array.prototype.includes` method
|
|
4131
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
4132
|
+
_export({
|
|
4133
|
+
target: "Array",
|
|
4134
|
+
proto: !0,
|
|
4135
|
+
forced: fails$9((function() {
|
|
4136
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
4137
|
+
return !Array(1).includes();
|
|
4138
|
+
}))
|
|
4139
|
+
}, {
|
|
4140
|
+
includes: function(el /* , fromIndex = 0 */) {
|
|
4141
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4144
|
+
|
|
4145
|
+
var globalThis$2 = globalThis_1, path = path$3, getBuiltInPrototypeMethod$3 = function(CONSTRUCTOR, METHOD) {
|
|
4146
|
+
var Namespace = path[CONSTRUCTOR + "Prototype"], pureMethod = Namespace && Namespace[METHOD];
|
|
4147
|
+
if (pureMethod) return pureMethod;
|
|
4148
|
+
var NativeConstructor = globalThis$2[CONSTRUCTOR], NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
4149
|
+
return NativePrototype && NativePrototype[METHOD];
|
|
4150
|
+
}, includes$4 = getBuiltInPrototypeMethod$3("Array", "includes"), isObject$1 = isObject$6, classof$3 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError$1 = TypeError, test = {};
|
|
4151
|
+
|
|
4152
|
+
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
4153
|
+
|
|
4154
|
+
var TO_STRING_TAG_SUPPORT = "[object z]" === String(test), isCallable = isCallable$8, classofRaw = classofRaw$2, TO_STRING_TAG = wellKnownSymbol$5("toStringTag"), $Object = Object, CORRECT_ARGUMENTS = "Arguments" === classofRaw(function() {
|
|
4155
|
+
return arguments;
|
|
4156
|
+
}()), classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
4157
|
+
var O, tag, result;
|
|
4158
|
+
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
4159
|
+
try {
|
|
4160
|
+
return it[key];
|
|
4161
|
+
} catch (error) {/* empty */}
|
|
4162
|
+
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
4163
|
+
}, $String = String, MATCH = wellKnownSymbol$5("match"), $$1 = _export, notARegExp = function(it) {
|
|
4164
|
+
if (function(it) {
|
|
4165
|
+
var isRegExp;
|
|
4166
|
+
return isObject$1(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$3(it));
|
|
4167
|
+
}(it)) throw new $TypeError$1("The method doesn't accept regular expressions");
|
|
4168
|
+
return it;
|
|
4169
|
+
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
4170
|
+
if ("Symbol" === classof$1(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
4171
|
+
return $String(argument);
|
|
4172
|
+
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
4173
|
+
|
|
4174
|
+
// `String.prototype.includes` method
|
|
4175
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
4176
|
+
$$1({
|
|
4177
|
+
target: "String",
|
|
4178
|
+
proto: !0,
|
|
4179
|
+
forced: !function(METHOD_NAME) {
|
|
4180
|
+
var regexp = /./;
|
|
4181
|
+
try {
|
|
4182
|
+
"/./"[METHOD_NAME](regexp);
|
|
4183
|
+
} catch (error1) {
|
|
4184
|
+
try {
|
|
4185
|
+
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
4186
|
+
} catch (error2) {/* empty */}
|
|
4187
|
+
}
|
|
4188
|
+
return !1;
|
|
4189
|
+
}("includes")
|
|
4190
|
+
}, {
|
|
4191
|
+
includes: function(searchString /* , position = 0 */) {
|
|
4192
|
+
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
4193
|
+
}
|
|
4194
|
+
});
|
|
4195
|
+
|
|
4196
|
+
var includes$3 = getBuiltInPrototypeMethod$3("String", "includes"), isPrototypeOf$1 = objectIsPrototypeOf, arrayMethod = includes$4, stringMethod = includes$3, ArrayPrototype$1 = Array.prototype, StringPrototype = String.prototype, _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
4197
|
+
var own = it.includes;
|
|
4198
|
+
return it === ArrayPrototype$1 || isPrototypeOf$1(ArrayPrototype$1, it) && own === ArrayPrototype$1.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf$1(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
4199
|
+
}));
|
|
4200
|
+
|
|
3829
4201
|
/**
|
|
3830
4202
|
* Callout component for displaying important messages, notifications, or alerts
|
|
3831
4203
|
*/
|
|
@@ -3846,10 +4218,10 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
3846
4218
|
...initialProps
|
|
3847
4219
|
};
|
|
3848
4220
|
/**
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
4221
|
+
* Generate callout class based on properties
|
|
4222
|
+
* @param props - Callout properties
|
|
4223
|
+
* @returns Class string
|
|
4224
|
+
*/ return {
|
|
3853
4225
|
defaultProps: defaultProps,
|
|
3854
4226
|
generateCalloutClass: props => {
|
|
3855
4227
|
const {variant: variant = defaultProps.variant, oneLine: oneLine = defaultProps.oneLine, toast: toast = defaultProps.toast, glass: glass = defaultProps.glass, className: className = ""} = props;
|
|
@@ -3867,12 +4239,13 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
3867
4239
|
className: className,
|
|
3868
4240
|
style: style
|
|
3869
4241
|
}), getAriaAttributes = () => {
|
|
4242
|
+
var _context, _context2;
|
|
3870
4243
|
const baseAttributes = {
|
|
3871
4244
|
role: "region"
|
|
3872
4245
|
};
|
|
3873
4246
|
// For toast notifications or alerts, use appropriate role and live region
|
|
3874
|
-
return toast ? (baseAttributes.role = "alert", baseAttributes["aria-live"] = "polite") : [ "warning", "error" ].
|
|
3875
|
-
baseAttributes["aria-live"] = "assertive") : [ "info", "success" ].
|
|
4247
|
+
return toast ? (baseAttributes.role = "alert", baseAttributes["aria-live"] = "polite") : _includesInstanceProperty(_context = [ "warning", "error" ]).call(_context, variant) ? (baseAttributes.role = "alert",
|
|
4248
|
+
baseAttributes["aria-live"] = "assertive") : _includesInstanceProperty(_context2 = [ "info", "success" ]).call(_context2, variant) && (baseAttributes.role = "status",
|
|
3876
4249
|
baseAttributes["aria-live"] = "polite"), baseAttributes;
|
|
3877
4250
|
}, calloutContent = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3878
4251
|
children: [ jsxRuntime.jsxs("div", {
|
|
@@ -3954,7 +4327,7 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
3954
4327
|
|
|
3955
4328
|
Callout.displayName = "Callout";
|
|
3956
4329
|
|
|
3957
|
-
const Card =
|
|
4330
|
+
const Card = React__default.default.memo( React.forwardRef((({
|
|
3958
4331
|
// Variants
|
|
3959
4332
|
size: size = "md", variant: variant = "", appearance: appearance = "filled", elevation: elevation = "none", hoverable: hoverable = !1, hoverElevation: hoverElevation = "md",
|
|
3960
4333
|
// Layout
|
|
@@ -4085,7 +4458,7 @@ className: className = "", style: style, ...rest}, ref) => {
|
|
|
4085
4458
|
|
|
4086
4459
|
Card.displayName = "Card";
|
|
4087
4460
|
|
|
4088
|
-
const CardHeader =
|
|
4461
|
+
const CardHeader = React.forwardRef((({title: title, subtitle: subtitle, action: action, icon: icon, children: children, className: className = "", ...props}, ref) => {
|
|
4089
4462
|
const headerClasses = `${CARD.SELECTORS.HEADER.substring(1)} ${className}`.trim();
|
|
4090
4463
|
return jsxRuntime.jsxs("div", {
|
|
4091
4464
|
ref: ref,
|
|
@@ -4111,7 +4484,7 @@ const CardHeader = React.forwardRef((({title: title, subtitle: subtitle, action:
|
|
|
4111
4484
|
|
|
4112
4485
|
CardHeader.displayName = "CardHeader";
|
|
4113
4486
|
|
|
4114
|
-
const CardBody =
|
|
4487
|
+
const CardBody = React.forwardRef((({scrollable: scrollable = !1, maxHeight: maxHeight, children: children, className: className = "", style: style, ...props}, ref) => {
|
|
4115
4488
|
const bodyClasses = `${CARD.SELECTORS.BODY.substring(1)} ${scrollable ? "c-card__body--scrollable" : ""} ${className}`.trim(), bodyStyle = {
|
|
4116
4489
|
...style,
|
|
4117
4490
|
...scrollable && maxHeight ? {
|
|
@@ -4130,7 +4503,7 @@ const CardBody = React.forwardRef((({scrollable: scrollable = !1, maxHeight: max
|
|
|
4130
4503
|
|
|
4131
4504
|
CardBody.displayName = "CardBody";
|
|
4132
4505
|
|
|
4133
|
-
const CardFooter =
|
|
4506
|
+
const CardFooter = React.forwardRef((({align: align, children: children, className: className = "", style: style, ...props}, ref) => {
|
|
4134
4507
|
const footerClasses = `${CARD.SELECTORS.FOOTER.substring(1)} ${align ? `c-card__footer--align-${align}` : ""} ${className}`.trim();
|
|
4135
4508
|
return jsxRuntime.jsx("div", {
|
|
4136
4509
|
ref: ref,
|
|
@@ -4222,6 +4595,60 @@ const useCard = (options = {}) => {
|
|
|
4222
4595
|
});
|
|
4223
4596
|
};
|
|
4224
4597
|
|
|
4598
|
+
ElevationCard.displayName = "ElevationCard";
|
|
4599
|
+
|
|
4600
|
+
var aCallable = aCallable$3, toObject = toObject$2, IndexedObject = indexedObject, lengthOfArrayLike = lengthOfArrayLike$2, $TypeError = TypeError, REDUCE_EMPTY = "Reduce of empty array with no initial value", createMethod = function(IS_RIGHT) {
|
|
4601
|
+
return function(that, callbackfn, argumentsLength, memo) {
|
|
4602
|
+
var O = toObject(that), self = IndexedObject(O), length = lengthOfArrayLike(O);
|
|
4603
|
+
if (aCallable(callbackfn), 0 === length && argumentsLength < 2) throw new $TypeError(REDUCE_EMPTY);
|
|
4604
|
+
var index = IS_RIGHT ? length - 1 : 0, i = IS_RIGHT ? -1 : 1;
|
|
4605
|
+
if (argumentsLength < 2) for (;;) {
|
|
4606
|
+
if (index in self) {
|
|
4607
|
+
memo = self[index], index += i;
|
|
4608
|
+
break;
|
|
4609
|
+
}
|
|
4610
|
+
if (index += i, IS_RIGHT ? index < 0 : length <= index) throw new $TypeError(REDUCE_EMPTY);
|
|
4611
|
+
}
|
|
4612
|
+
for (;IS_RIGHT ? index >= 0 : length > index; index += i) index in self && (memo = callbackfn(memo, self[index], index, O));
|
|
4613
|
+
return memo;
|
|
4614
|
+
};
|
|
4615
|
+
}, arrayReduce = {
|
|
4616
|
+
// `Array.prototype.reduce` method
|
|
4617
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
4618
|
+
left: createMethod(!1),
|
|
4619
|
+
// `Array.prototype.reduceRight` method
|
|
4620
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduceright
|
|
4621
|
+
right: createMethod(!0)
|
|
4622
|
+
}, fails = fails$9, globalThis$1 = globalThis_1, userAgent = environmentUserAgent, classof = classofRaw$2, userAgentStartsWith = function(string) {
|
|
4623
|
+
return userAgent.slice(0, string.length) === string;
|
|
4624
|
+
}, environment = userAgentStartsWith("Bun/") ? "BUN" : userAgentStartsWith("Cloudflare-Workers") ? "CLOUDFLARE" : userAgentStartsWith("Deno/") ? "DENO" : userAgentStartsWith("Node.js/") ? "NODE" : globalThis$1.Bun && "string" == typeof Bun.version ? "BUN" : globalThis$1.Deno && "object" == typeof Deno.version ? "DENO" : "process" === classof(globalThis$1.process) ? "NODE" : globalThis$1.window && globalThis$1.document ? "BROWSER" : "REST", $reduce = arrayReduce.left;
|
|
4625
|
+
|
|
4626
|
+
// `Array.prototype.reduce` method
|
|
4627
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
4628
|
+
_export({
|
|
4629
|
+
target: "Array",
|
|
4630
|
+
proto: !0,
|
|
4631
|
+
forced: !("NODE" === environment) && environmentV8Version > 79 && environmentV8Version < 83 || !function(METHOD_NAME, argument) {
|
|
4632
|
+
var method = [][METHOD_NAME];
|
|
4633
|
+
return !!method && fails((function() {
|
|
4634
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
4635
|
+
method.call(null, argument || function() {
|
|
4636
|
+
return 1;
|
|
4637
|
+
}, 1);
|
|
4638
|
+
}));
|
|
4639
|
+
}("reduce")
|
|
4640
|
+
}, {
|
|
4641
|
+
reduce: function(callbackfn /* , initialValue */) {
|
|
4642
|
+
var length = arguments.length;
|
|
4643
|
+
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : void 0);
|
|
4644
|
+
}
|
|
4645
|
+
});
|
|
4646
|
+
|
|
4647
|
+
var reduce$3 = getBuiltInPrototypeMethod$3("Array", "reduce"), isPrototypeOf = objectIsPrototypeOf, method = reduce$3, ArrayPrototype = Array.prototype, _reduceInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
4648
|
+
var own = it.reduce;
|
|
4649
|
+
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce ? method : own;
|
|
4650
|
+
}));
|
|
4651
|
+
|
|
4225
4652
|
/**
|
|
4226
4653
|
* Comprehensive chart hook with shared functionality
|
|
4227
4654
|
* @param initialProps - Initial chart properties
|
|
@@ -4263,8 +4690,8 @@ function useChart(initialProps) {
|
|
|
4263
4690
|
animationFrameRef.current && cancelAnimationFrame(animationFrameRef.current);
|
|
4264
4691
|
}), []);
|
|
4265
4692
|
/**
|
|
4266
|
-
|
|
4267
|
-
|
|
4693
|
+
* Point interaction handlers
|
|
4694
|
+
*/
|
|
4268
4695
|
const handlePointHover = React.useCallback(((datasetIndex, pointIndex, x, y, clientX, clientY) => {
|
|
4269
4696
|
setInteractionState((prev => ({
|
|
4270
4697
|
...prev,
|
|
@@ -4618,9 +5045,7 @@ function useChart(initialProps) {
|
|
|
4618
5045
|
|
|
4619
5046
|
/**
|
|
4620
5047
|
* Hook for chart data processing and transformation
|
|
4621
|
-
*/
|
|
4622
|
-
|
|
4623
|
-
const ChartToolbar = React.memo(React.forwardRef((({chartType: chartType = "line", groups: groups = [], enableDefaults: enableDefaults = !0, defaults: defaults = {
|
|
5048
|
+
*/ const ChartToolbar = React.memo( React.forwardRef((({chartType: chartType = "line", groups: groups = [], enableDefaults: enableDefaults = !0, defaults: defaults = {
|
|
4624
5049
|
refresh: !0,
|
|
4625
5050
|
export: !0,
|
|
4626
5051
|
fullscreen: !0,
|
|
@@ -5007,7 +5432,7 @@ const ChartToolbar = React.memo(React.forwardRef((({chartType: chartType = "line
|
|
|
5007
5432
|
|
|
5008
5433
|
ChartToolbar.displayName = "ChartToolbar";
|
|
5009
5434
|
|
|
5010
|
-
const ChartContext =
|
|
5435
|
+
const ChartContext = React.createContext(null), Chart = React.memo( React.forwardRef((({children: children, type: type = "line", size: size = "md", variant: variant = "primary", title: title, subtitle: subtitle, loading: loading = !1, error: error, className: className = "", "aria-label": ariaLabel, onFullscreen: onFullscreen, onExport: onExport, onRefresh: onRefresh, showToolbar: showToolbar = !1, enableFullscreen: enableFullscreen = !1, enableExport: enableExport = !1, enableRefresh: enableRefresh = !1, exportFormats: exportFormats = [ "png", "svg", "csv" ], datasets: datasets, config: config,
|
|
5011
5436
|
// Destructure non-DOM props to prevent passing to DOM element
|
|
5012
5437
|
toolbarConfig: toolbarConfig, customToolbarActions: customToolbarActions, customToolbarGroups: customToolbarGroups, data: data, showLegend: showLegend, interactive: interactive, fullscreen: fullscreen, onDataPointClick: onDataPointClick, onLegendItemClick: onLegendItemClick, glass: glass, ...props}, ref) => {
|
|
5013
5438
|
const [isFullscreen, setIsFullscreen] = React.useState(!1), [isExporting, setIsExporting] = React.useState(!1), chartContainerRef = React.useRef(null), [zoomLevel, setZoomLevel] = React.useState(1), [panOffset, setPanOffset] = React.useState({
|
|
@@ -5626,7 +6051,7 @@ Chart.displayName = "Chart";
|
|
|
5626
6051
|
/**
|
|
5627
6052
|
* Enhanced chart renderer component with comprehensive functionality
|
|
5628
6053
|
*/
|
|
5629
|
-
const ChartRenderer =
|
|
6054
|
+
const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [], config: config, width: width = CHART.DEFAULT_WIDTH, height: height = CHART.DEFAULT_HEIGHT, onDataPointClick: onDataPointClick, interactive: interactive = !0, enableRealTime: enableRealTime = !1, enableAccessibility: enableAccessibility = !0, enablePerformanceOptimization: enablePerformanceOptimization = !0, renderContent: renderContent}, ref) => {
|
|
5630
6055
|
// Get chart context (zoom/pan state from toolbar) - optional
|
|
5631
6056
|
// Always call useContext to maintain consistent hook order
|
|
5632
6057
|
const chartContext = React.useContext(ChartContext), {calculateScales: calculateScales, getChartColors: getChartColors} = useChart(), {processedData: processedData, isProcessing: isProcessing} = function(datasets, options) {
|
|
@@ -5642,14 +6067,15 @@ const ChartRenderer = React.memo(React.forwardRef((({datasets: datasets = [], co
|
|
|
5642
6067
|
}), [ enableDecimation ]), calculateMovingAverage = React.useCallback(((values, period) => {
|
|
5643
6068
|
const result = [];
|
|
5644
6069
|
for (let i = 0; i < values.length; i++) if (i < period - 1) result.push(null); else {
|
|
5645
|
-
|
|
6070
|
+
var _context;
|
|
6071
|
+
const sum = _reduceInstanceProperty(_context = values.slice(i - period + 1, i + 1)).call(_context, ((a, b) => a + b), 0);
|
|
5646
6072
|
result.push(sum / period);
|
|
5647
6073
|
}
|
|
5648
6074
|
return result;
|
|
5649
6075
|
}), []), calculateTrendLine = React.useCallback((values => {
|
|
5650
6076
|
const n = values.length;
|
|
5651
6077
|
if (n < 2) return values.map((() => null));
|
|
5652
|
-
const xSum = values.
|
|
6078
|
+
const xSum = _reduceInstanceProperty(values).call(values, ((sum, _, i) => sum + i), 0), ySum = _reduceInstanceProperty(values).call(values, ((sum, val) => sum + val), 0), slope = (n * _reduceInstanceProperty(values).call(values, ((sum, val, i) => sum + i * val), 0) - xSum * ySum) / (n * _reduceInstanceProperty(values).call(values, ((sum, _, i) => sum + i * i), 0) - xSum * xSum), intercept = (ySum - slope * xSum) / n;
|
|
5653
6079
|
return values.map(((_, i) => slope * i + intercept));
|
|
5654
6080
|
}), []);
|
|
5655
6081
|
// Process data when datasets change
|
|
@@ -5786,7 +6212,7 @@ const ChartRenderer = React.memo(React.forwardRef((({datasets: datasets = [], co
|
|
|
5786
6212
|
// Announce data changes
|
|
5787
6213
|
React.useEffect((() => {
|
|
5788
6214
|
if (!announceDataChanges || !datasets.length) return;
|
|
5789
|
-
const totalDataPoints = datasets.
|
|
6215
|
+
const totalDataPoints = _reduceInstanceProperty(datasets).call(datasets, ((sum, dataset) => sum + (dataset.data?.length || 0)), 0);
|
|
5790
6216
|
announceData(`Chart updated with ${datasets.length} datasets and ${totalDataPoints} data points`);
|
|
5791
6217
|
}), [ datasets, announceDataChanges, announceData ]);
|
|
5792
6218
|
// Generate accessible description
|
|
@@ -6065,7 +6491,7 @@ const ChartRenderer = React.memo(React.forwardRef((({datasets: datasets = [], co
|
|
|
6065
6491
|
|
|
6066
6492
|
ChartRenderer.displayName = "ChartRenderer";
|
|
6067
6493
|
|
|
6068
|
-
const BaseChart =
|
|
6494
|
+
const BaseChart = React.memo( React.forwardRef((({type: type, datasets: datasets = [], config: config = {}, renderContent: renderContent, interactive: interactive = !0, enableRealTime: enableRealTime = !1, enableAccessibility: enableAccessibility = !0, enablePerformanceOptimization: enablePerformanceOptimization = !0, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6069
6495
|
const renderChartContent = React.useCallback((params => renderContent(params)), [ renderContent ]);
|
|
6070
6496
|
return jsxRuntime.jsx(Chart, {
|
|
6071
6497
|
ref: ref,
|
|
@@ -6088,81 +6514,89 @@ const BaseChart = React.memo(React.forwardRef((({type: type, datasets: datasets
|
|
|
6088
6514
|
|
|
6089
6515
|
BaseChart.displayName = "BaseChart";
|
|
6090
6516
|
|
|
6091
|
-
const AnimatedChart =
|
|
6092
|
-
const animationRef = React.useRef(0), timeRef = React.useRef(0), particlesRef = React.useRef([])
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6517
|
+
const AnimatedChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, chartType: chartType = "line", particleEffects: particleEffects, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6518
|
+
const animationRef = React.useRef(0), timeRef = React.useRef(0), particlesRef = React.useRef([]);
|
|
6519
|
+
// Animation time tracking - moved outside callback
|
|
6520
|
+
React.useEffect((() => {
|
|
6521
|
+
const animateFrame = timestamp => {
|
|
6522
|
+
timeRef.current = timestamp, animationRef.current = requestAnimationFrame(animateFrame);
|
|
6523
|
+
};
|
|
6524
|
+
return animationRef.current = requestAnimationFrame(animateFrame), () => {
|
|
6525
|
+
animationRef.current && cancelAnimationFrame(animationRef.current);
|
|
6526
|
+
};
|
|
6527
|
+
}), []);
|
|
6528
|
+
const renderContent = React.useCallback((({scales: scales, colors: colors, datasets: chartDatasets, handlers: handlers, hoveredPoint: hoveredPoint, toolbarState: toolbarState, config: renderConfig}) => {
|
|
6529
|
+
if (!chartDatasets.length) return null;
|
|
6103
6530
|
const chartWidth = scales.width - 80, chartHeight = scales.height - 80, elements = [];
|
|
6104
6531
|
// Particle effects
|
|
6105
6532
|
if (chartDatasets.forEach(((dataset, datasetIndex) => {
|
|
6106
6533
|
const color = dataset.color || colors[datasetIndex % colors.length];
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
const
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6534
|
+
switch (chartType) {
|
|
6535
|
+
case "bar":
|
|
6536
|
+
// Create animated bars
|
|
6537
|
+
dataset.data.forEach(((point, pointIndex) => {
|
|
6538
|
+
const barWidth = chartWidth / dataset.data.length * .8, x = 40 + pointIndex * (chartWidth / dataset.data.length) + (chartWidth / dataset.data.length - barWidth) / 2, height = point.value / 100 * chartHeight, y = 40 + chartHeight - height;
|
|
6539
|
+
elements.push(jsxRuntime.jsx("rect", {
|
|
6540
|
+
x: x,
|
|
6541
|
+
y: y,
|
|
6542
|
+
width: barWidth,
|
|
6543
|
+
height: height,
|
|
6544
|
+
fill: color,
|
|
6545
|
+
style: {
|
|
6546
|
+
transform: `scaleY(${.1 * Math.sin(.01 * timeRef.current + .2 * pointIndex) + .9})`,
|
|
6547
|
+
transformOrigin: "bottom"
|
|
6548
|
+
},
|
|
6549
|
+
onClick: () => handlers.onDataPointClick?.(point, datasetIndex, pointIndex)
|
|
6550
|
+
}, `bar-${datasetIndex}-${pointIndex}`));
|
|
6551
|
+
}));
|
|
6552
|
+
break;
|
|
6553
|
+
|
|
6554
|
+
default:
|
|
6555
|
+
{
|
|
6556
|
+
// Create animated line/area
|
|
6557
|
+
const points = dataset.data.map(((point, pointIndex) => ({
|
|
6558
|
+
x: 40 + pointIndex / (dataset.data.length - 1) * chartWidth,
|
|
6559
|
+
y: 40 + chartHeight - point.value / 100 * chartHeight
|
|
6560
|
+
})));
|
|
6561
|
+
if (points.length > 0) {
|
|
6562
|
+
const linePath = `M ${points.map((p => `${p.x},${p.y}`)).join(" L ")}`;
|
|
6563
|
+
// Area for area chart
|
|
6564
|
+
if ("area" === chartType) {
|
|
6565
|
+
const areaPath = `${linePath} L ${40 + chartWidth},${40 + chartHeight} L 40,${40 + chartHeight} Z`;
|
|
6566
|
+
elements.push(jsxRuntime.jsx("path", {
|
|
6567
|
+
d: areaPath,
|
|
6568
|
+
fill: color,
|
|
6569
|
+
fillOpacity: "0.3",
|
|
6570
|
+
style: {
|
|
6571
|
+
transform: `translateY(${2 * Math.sin(.01 * timeRef.current)}px)`
|
|
6572
|
+
}
|
|
6573
|
+
}, `area-${datasetIndex}`));
|
|
6574
|
+
}
|
|
6575
|
+
// Line
|
|
6576
|
+
elements.push(jsxRuntime.jsx("path", {
|
|
6577
|
+
d: linePath,
|
|
6578
|
+
stroke: color,
|
|
6579
|
+
fill: "none",
|
|
6580
|
+
className: "c-chart__data-line",
|
|
6138
6581
|
style: {
|
|
6139
6582
|
transform: `translateY(${2 * Math.sin(.01 * timeRef.current)}px)`
|
|
6140
6583
|
}
|
|
6141
|
-
}, `
|
|
6584
|
+
}, `line-${datasetIndex}`)),
|
|
6585
|
+
// Data points
|
|
6586
|
+
points.forEach(((point, pointIndex) => {
|
|
6587
|
+
elements.push(jsxRuntime.jsx("circle", {
|
|
6588
|
+
cx: point.x,
|
|
6589
|
+
cy: point.y,
|
|
6590
|
+
r: "4",
|
|
6591
|
+
fill: color,
|
|
6592
|
+
style: {
|
|
6593
|
+
transform: `scale(${1 + .2 * Math.sin(.01 * timeRef.current + pointIndex)})`
|
|
6594
|
+
},
|
|
6595
|
+
onClick: () => handlers.onDataPointClick?.(dataset.data[pointIndex], datasetIndex, pointIndex)
|
|
6596
|
+
}, `point-${datasetIndex}-${pointIndex}`));
|
|
6597
|
+
}));
|
|
6142
6598
|
}
|
|
6143
|
-
|
|
6144
|
-
elements.push(jsxRuntime.jsx("path", {
|
|
6145
|
-
d: linePath,
|
|
6146
|
-
stroke: color,
|
|
6147
|
-
fill: "none",
|
|
6148
|
-
className: "c-chart__data-line",
|
|
6149
|
-
style: {
|
|
6150
|
-
transform: `translateY(${2 * Math.sin(.01 * timeRef.current)}px)`
|
|
6151
|
-
}
|
|
6152
|
-
}, `line-${datasetIndex}`)),
|
|
6153
|
-
// Data points
|
|
6154
|
-
points.forEach(((point, pointIndex) => {
|
|
6155
|
-
elements.push(jsxRuntime.jsx("circle", {
|
|
6156
|
-
cx: point.x,
|
|
6157
|
-
cy: point.y,
|
|
6158
|
-
r: "4",
|
|
6159
|
-
fill: color,
|
|
6160
|
-
style: {
|
|
6161
|
-
transform: `scale(${1 + .2 * Math.sin(.01 * timeRef.current + pointIndex)})`
|
|
6162
|
-
},
|
|
6163
|
-
onClick: () => handlers.onDataPointClick?.(dataset.data[pointIndex], datasetIndex, pointIndex)
|
|
6164
|
-
}, `point-${datasetIndex}-${pointIndex}`));
|
|
6165
|
-
}));
|
|
6599
|
+
break;
|
|
6166
6600
|
}
|
|
6167
6601
|
}
|
|
6168
6602
|
})), particleEffects?.enabled) for (let i = 0; i < particleEffects.count; i++) {
|
|
@@ -6183,7 +6617,7 @@ const AnimatedChart = React.memo(React.forwardRef((({datasets: datasets = [], co
|
|
|
6183
6617
|
}), [ chartType, particleEffects ]);
|
|
6184
6618
|
return jsxRuntime.jsx(BaseChart, {
|
|
6185
6619
|
ref: ref,
|
|
6186
|
-
type: "
|
|
6620
|
+
type: "line",
|
|
6187
6621
|
datasets: datasets,
|
|
6188
6622
|
config: config,
|
|
6189
6623
|
renderContent: renderContent,
|
|
@@ -6194,7 +6628,7 @@ const AnimatedChart = React.memo(React.forwardRef((({datasets: datasets = [], co
|
|
|
6194
6628
|
|
|
6195
6629
|
AnimatedChart.displayName = "AnimatedChart";
|
|
6196
6630
|
|
|
6197
|
-
const ChartTooltip =
|
|
6631
|
+
const ChartTooltip = React.memo((({dataPoint: dataPoint, datasetLabel: datasetLabel, datasetColor: datasetColor, position: position, visible: visible, customRenderer: customRenderer}) => {
|
|
6198
6632
|
const tooltipRef = React.useRef(null), [adjustedPosition, setAdjustedPosition] = React.useState(position);
|
|
6199
6633
|
// Dynamic positioning to keep tooltip in viewport
|
|
6200
6634
|
return React.useEffect((() => {
|
|
@@ -6211,7 +6645,7 @@ const ChartTooltip = React.memo((({dataPoint: dataPoint, datasetLabel: datasetLa
|
|
|
6211
6645
|
x: newX,
|
|
6212
6646
|
y: newY
|
|
6213
6647
|
});
|
|
6214
|
-
}), [ position, visible ]), visible && dataPoint ?
|
|
6648
|
+
}), [ position, visible ]), visible && dataPoint ? reactDom.createPortal(jsxRuntime.jsx("div", {
|
|
6215
6649
|
ref: tooltipRef,
|
|
6216
6650
|
className: "c-chart__tooltip",
|
|
6217
6651
|
style: {
|
|
@@ -6265,7 +6699,7 @@ const ChartTooltip = React.memo((({dataPoint: dataPoint, datasetLabel: datasetLa
|
|
|
6265
6699
|
|
|
6266
6700
|
ChartTooltip.displayName = "ChartTooltip";
|
|
6267
6701
|
|
|
6268
|
-
const AreaChart =
|
|
6702
|
+
const AreaChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, areaOptions: areaOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6269
6703
|
// Area chart is essentially a line chart with area fill enabled
|
|
6270
6704
|
const enhancedAreaOptions = {
|
|
6271
6705
|
showArea: !0,
|
|
@@ -6320,7 +6754,11 @@ const AreaChart = React.memo(React.forwardRef((({datasets: datasets = [], config
|
|
|
6320
6754
|
})) ]
|
|
6321
6755
|
}, `dataset-${datasetIndex}`);
|
|
6322
6756
|
})), showTooltips && hoveredPoint && jsxRuntime.jsx(ChartTooltip, {
|
|
6323
|
-
dataPoint: renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex]
|
|
6757
|
+
dataPoint: renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] ?? {
|
|
6758
|
+
label: "",
|
|
6759
|
+
value: 0,
|
|
6760
|
+
color: ""
|
|
6761
|
+
},
|
|
6324
6762
|
datasetLabel: renderedDatasets[hoveredPoint.datasetIndex]?.label,
|
|
6325
6763
|
datasetColor: renderedDatasets[hoveredPoint.datasetIndex]?.color || colors[hoveredPoint.datasetIndex],
|
|
6326
6764
|
position: {
|
|
@@ -6469,7 +6907,7 @@ function useBarChart(datasets, options = {}) {
|
|
|
6469
6907
|
|
|
6470
6908
|
AreaChart.displayName = "AreaChart";
|
|
6471
6909
|
|
|
6472
|
-
const BarChart =
|
|
6910
|
+
const BarChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, barOptions: barOptions = {}, horizontal: horizontal = !1, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6473
6911
|
const {calculateBarDimensions: calculateBarDimensions, handleBarHover: handleBarHover, handleBarLeave: handleBarLeave, hoveredBar: hoveredBar, formatValue: formatValue} = useBarChart(0, barOptions);
|
|
6474
6912
|
return jsxRuntime.jsx(BaseChart, {
|
|
6475
6913
|
ref: ref,
|
|
@@ -6482,7 +6920,9 @@ const BarChart = React.memo(React.forwardRef((({datasets: datasets = [], config:
|
|
|
6482
6920
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? !0, barDimensions = calculateBarDimensions(renderedDatasets, scales.width, scales.height, scales.padding, horizontal);
|
|
6483
6921
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6484
6922
|
children: [ barDimensions.map(((bar, index) => {
|
|
6485
|
-
const dataset = renderedDatasets[bar.datasetIndex]
|
|
6923
|
+
const dataset = renderedDatasets[bar.datasetIndex];
|
|
6924
|
+
if (!dataset) return null;
|
|
6925
|
+
const point = dataset.data?.[bar.pointIndex], color = dataset.color || colors[bar.datasetIndex], isHovered = hoveredPoint?.datasetIndex === bar.datasetIndex && hoveredPoint?.pointIndex === bar.pointIndex;
|
|
6486
6926
|
return jsxRuntime.jsxs("g", {
|
|
6487
6927
|
children: [ jsxRuntime.jsx("rect", {
|
|
6488
6928
|
x: bar.x,
|
|
@@ -6524,7 +6964,7 @@ const BarChart = React.memo(React.forwardRef((({datasets: datasets = [], config:
|
|
|
6524
6964
|
|
|
6525
6965
|
BarChart.displayName = "BarChart";
|
|
6526
6966
|
|
|
6527
|
-
const BubbleChart =
|
|
6967
|
+
const BubbleChart = React.memo( React.forwardRef((({bubbleData: bubbleData = [], config: config = {}, bubbleOptions: bubbleOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6528
6968
|
const {minBubbleSize: minBubbleSize = 5, maxBubbleSize: maxBubbleSize = 50, bubbleOpacity: bubbleOpacity = .7, showLabels: showLabels = !0, labelPosition: labelPosition = "center", enableAnimations: enableAnimations = !0, animationDuration: animationDuration = 1e3, showSizeLegend: showSizeLegend = !0, sizeLegendTitle: sizeLegendTitle = "Size", colorScheme: colorScheme = [ "var(--atomix-primary)", "var(--atomix-secondary)", "var(--atomix-success)", "var(--atomix-warning)", "var(--atomix-error)", "var(--atomix-info)" ], sizeBasedColoring: sizeBasedColoring = !1} = bubbleOptions, datasets = [ {
|
|
6529
6969
|
label: "Bubbles",
|
|
6530
6970
|
data: bubbleData
|
|
@@ -6580,7 +7020,7 @@ const BubbleChart = React.memo(React.forwardRef((({bubbleData: bubbleData = [],
|
|
|
6580
7020
|
}));
|
|
6581
7021
|
// Calculate bubble sizes based on data
|
|
6582
7022
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6583
|
-
children: [ bubbles, showTooltips && hoveredPoint && hoveredPoint.pointIndex < bubbleData.length && jsxRuntime.jsx(ChartTooltip, {
|
|
7023
|
+
children: [ bubbles, showTooltips && hoveredPoint && hoveredPoint.pointIndex < bubbleData.length && bubbleData[hoveredPoint.pointIndex] && jsxRuntime.jsx(ChartTooltip, {
|
|
6584
7024
|
dataPoint: bubbleData[hoveredPoint.pointIndex],
|
|
6585
7025
|
datasetLabel: "Bubbles",
|
|
6586
7026
|
datasetColor: bubbleData[hoveredPoint.pointIndex]?.color || colorScheme[hoveredPoint.pointIndex % colorScheme.length],
|
|
@@ -6599,7 +7039,7 @@ const BubbleChart = React.memo(React.forwardRef((({bubbleData: bubbleData = [],
|
|
|
6599
7039
|
|
|
6600
7040
|
BubbleChart.displayName = "BubbleChart";
|
|
6601
7041
|
|
|
6602
|
-
const CandlestickChart =
|
|
7042
|
+
const CandlestickChart = React.memo( React.forwardRef((({candlestickData: candlestickData = [], config: config = {}, candlestickOptions: candlestickOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6603
7043
|
const {showVolume: showVolume = !0, volumeHeightRatio: volumeHeightRatio = .2, upColor: upColor = "var(--atomix-success-bg-subtle)", downColor: downColor = "var(--atomix-error-bg-subtle)", wickColor: wickColor = "var(--atomix-brand-border-subtle)", borderColor: borderColor = "var(--atomix-primary-border-subtle)", showMovingAverages: showMovingAverages = !1, movingAveragePeriods: movingAveragePeriods = [ 7, 21 ], movingAverageColors: movingAverageColors = [ "var(--atomix-warning-bg-subtle)", "var(--atomix-warning-border-subtle)" ], dateFormat: dateFormat = "short", dateFormatter: dateFormatter, showGrid: showGrid = !0, gridColor: gridColor = "var(--atomix-brand-text-emphasis)", showTooltips: showTooltips = !0} = candlestickOptions;
|
|
6604
7044
|
// Calculate moving averages
|
|
6605
7045
|
return jsxRuntime.jsx(BaseChart, {
|
|
@@ -6706,11 +7146,12 @@ const CandlestickChart = React.memo(React.forwardRef((({candlestickData: candles
|
|
|
6706
7146
|
const movingAverage = ((data, period) => {
|
|
6707
7147
|
const result = [];
|
|
6708
7148
|
for (let i = 0; i < data.length; i++) {
|
|
7149
|
+
var _context;
|
|
6709
7150
|
if (i < period - 1) {
|
|
6710
7151
|
result.push(NaN);
|
|
6711
7152
|
continue;
|
|
6712
7153
|
}
|
|
6713
|
-
const sum = data.slice(i - period + 1, i + 1).
|
|
7154
|
+
const sum = _reduceInstanceProperty(_context = data.slice(i - period + 1, i + 1)).call(_context, ((acc, item) => acc + item.close), 0);
|
|
6714
7155
|
result.push(sum / period);
|
|
6715
7156
|
}
|
|
6716
7157
|
return result;
|
|
@@ -6747,7 +7188,7 @@ const CandlestickChart = React.memo(React.forwardRef((({candlestickData: candles
|
|
|
6747
7188
|
|
|
6748
7189
|
CandlestickChart.displayName = "CandlestickChart";
|
|
6749
7190
|
|
|
6750
|
-
const DonutChart =
|
|
7191
|
+
const DonutChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, pieOptions: pieOptions = {
|
|
6751
7192
|
showValues: !1,
|
|
6752
7193
|
showPercentages: !0,
|
|
6753
7194
|
showLabels: !1,
|
|
@@ -6780,9 +7221,10 @@ const DonutChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
6780
7221
|
datasets: datasets,
|
|
6781
7222
|
config: config,
|
|
6782
7223
|
renderContent: ({scales: scales, colors: colors, datasets: renderedDatasets, handlers: handlers, hoveredPoint: hoveredPoint, toolbarState: toolbarState, config: renderConfig}) => {
|
|
7224
|
+
var _context;
|
|
6783
7225
|
if (!chartData) return null;
|
|
6784
7226
|
// Use actual container dimensions from scales
|
|
6785
|
-
const width = scales.width, height = scales.height, outerRadius = Math.min(width, height) / 2 * .8, innerRadius = outerRadius * (donutOptions.innerRadiusRatio ?? .6), centerX = width / 2, centerY = height / 2, defaultColors = [ "var(--atomix-primary-2)", "var(--atomix-primary-3)", "var(--atomix-primary-4)", "var(--atomix-primary-5)", "var(--atomix-primary-6)", "var(--atomix-primary-7)", "var(--atomix-primary-8)", "var(--atomix-primary-9)" ], chartColors = dataset?.color ? [ dataset.color ] : dataset?.data?.map(((_, i) => defaultColors[i % defaultColors.length])) || defaultColors, total = chartData.validDataPoints.
|
|
7227
|
+
const width = scales.width, height = scales.height, outerRadius = Math.min(width, height) / 2 * .8, innerRadius = outerRadius * (donutOptions.innerRadiusRatio ?? .6), centerX = width / 2, centerY = height / 2, defaultColors = [ "var(--atomix-primary-2)", "var(--atomix-primary-3)", "var(--atomix-primary-4)", "var(--atomix-primary-5)", "var(--atomix-primary-6)", "var(--atomix-primary-7)", "var(--atomix-primary-8)", "var(--atomix-primary-9)" ], chartColors = dataset?.color ? [ dataset.color ] : dataset?.data?.map(((_, i) => defaultColors[i % defaultColors.length])) || defaultColors, total = _reduceInstanceProperty(_context = chartData.validDataPoints).call(_context, ((sum, point) => sum + point.value), 0), padAngleRad = (pieOptions.padAngle || 1) * Math.PI / 180;
|
|
6786
7228
|
let currentAngle = (pieOptions.startAngle || 0) * Math.PI / 180;
|
|
6787
7229
|
const slices = chartData.validDataPoints.map(((point, index) => {
|
|
6788
7230
|
const sliceAngle = point.value / total * (2 * Math.PI) - padAngleRad, startAngle = currentAngle, endAngle = currentAngle + sliceAngle, midAngle = (startAngle + endAngle) / 2, labelRadius = .75 * outerRadius, labelX = centerX + Math.cos(midAngle) * labelRadius, labelY = centerY + Math.sin(midAngle) * labelRadius, x1 = centerX + innerRadius * Math.cos(startAngle), y1 = centerY + innerRadius * Math.sin(startAngle), x2 = centerX + outerRadius * Math.cos(startAngle), y2 = centerY + outerRadius * Math.sin(startAngle), x3 = centerX + outerRadius * Math.cos(endAngle), y3 = centerY + outerRadius * Math.sin(endAngle), x4 = centerX + innerRadius * Math.cos(endAngle), y4 = centerY + innerRadius * Math.sin(endAngle), largeArcFlag = sliceAngle > Math.PI ? 1 : 0, path = [ `M ${x1} ${y1}`, `L ${x2} ${y2}`, `A ${outerRadius} ${outerRadius} 0 ${largeArcFlag} 1 ${x3} ${y3}`, `L ${x4} ${y4}`, `A ${innerRadius} ${innerRadius} 0 ${largeArcFlag} 0 ${x1} ${y1}`, "Z" ].join(" ");
|
|
@@ -6862,7 +7304,7 @@ const DonutChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
6862
7304
|
|
|
6863
7305
|
DonutChart.displayName = "DonutChart";
|
|
6864
7306
|
|
|
6865
|
-
const FunnelChart =
|
|
7307
|
+
const FunnelChart = React.memo( React.forwardRef((({funnelData: funnelData = [], config: config = {}, funnelOptions: funnelOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
6866
7308
|
const {direction: direction = "vertical", showLabels: showLabels = !0, showValues: showValues = !0, showPercentages: showPercentages = !1, labelPosition: labelPosition = "outside", neckWidth: neckWidth = .3, neckHeight: neckHeight = .2, segmentGap: segmentGap = 2, colorScheme: colorScheme = [ "var(--atomix-primary)", "var(--atomix-secondary)", "var(--atomix-success)", "var(--atomix-warning)", "var(--atomix-error)", "var(--atomix-info)" ], useGradient: useGradient = !0, animate: animate = !0, animationDuration: animationDuration = 1e3, animationDelay: animationDelay = 200, valueFormatter: valueFormatter = value => value.toLocaleString(), showConversionRates: showConversionRates = !0, conversionRatePosition: conversionRatePosition = "between", proportional: proportional = !0, minSegmentRatio: minSegmentRatio = .1} = funnelOptions, datasets = [ {
|
|
6867
7309
|
label: "Funnel Data",
|
|
6868
7310
|
data: funnelData
|
|
@@ -6971,9 +7413,11 @@ const FunnelChart = React.memo(React.forwardRef((({funnelData: funnelData = [],
|
|
|
6971
7413
|
|
|
6972
7414
|
FunnelChart.displayName = "FunnelChart";
|
|
6973
7415
|
|
|
6974
|
-
const GaugeChart =
|
|
6975
|
-
const {startAngle: startAngle = 180, endAngle:
|
|
6976
|
-
|
|
7416
|
+
const GaugeChart = React.memo( React.forwardRef((({value: value, min: min = 0, max: max = 100, config: config = {}, gaugeOptions: gaugeOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
7417
|
+
const {startAngle: startAngle = 180, endAngle:
|
|
7418
|
+
// Default to left side (180 degrees)
|
|
7419
|
+
endAngle = 0, thickness:
|
|
7420
|
+
// Default to right side (0 degrees)
|
|
6977
7421
|
thickness = .2, showNeedle: showNeedle = !0, needleColor: needleColor = "var(--atomix-brand-text-emphasis)", showValue: showValue = !0, valueFormatter: valueFormatter = val => val.toFixed(1), showMinMaxLabels: showMinMaxLabels = !0, showTicks: showTicks = !0, majorTicks: majorTicks = 5, minorTicks: minorTicks = 4, colorZones: colorZones = [], animate: animate = !0, animationDuration: animationDuration = 1e3, animationEasing: animationEasing = "easeOutCubic", useGradient: useGradient = !1, label: label = "", labelPosition: labelPosition = "bottom"} = gaugeOptions, datasets = [ {
|
|
6978
7422
|
label: "Gauge Value",
|
|
6979
7423
|
data: [ {
|
|
@@ -7102,7 +7546,7 @@ const colorSchemes = {
|
|
|
7102
7546
|
reds: [ "var(--atomix-red-1)", "var(--atomix-red-2)", "var(--atomix-red-3)", "var(--atomix-red-4)", "var(--atomix-red-5)", "var(--atomix-red-6)", "var(--atomix-red-7)", "var(--atomix-red-8)", "var(--atomix-red-9)" ],
|
|
7103
7547
|
greens: [ "var(--atomix-green-1)", "var(--atomix-green-2)", "var(--atomix-green-3)", "var(--atomix-green-4)", "var(--atomix-green-5)", "var(--atomix-green-6)", "var(--atomix-green-7)", "var(--atomix-green-8)", "var(--atomix-green-9)" ],
|
|
7104
7548
|
github: [ "var(--atomix-gray-2)", "var(--atomix-green-3)", "var(--atomix-green-4)", "var(--atomix-green-5)", "var(--atomix-green-6)" ]
|
|
7105
|
-
}, HeatmapChart =
|
|
7549
|
+
}, HeatmapChart = React.memo( React.forwardRef((({data: data = [], config: config = {}, colorScale: colorScale = {
|
|
7106
7550
|
scheme: "viridis",
|
|
7107
7551
|
steps: 9
|
|
7108
7552
|
}, cellConfig: cellConfig = {
|
|
@@ -7300,7 +7744,8 @@ function useLineChart(datasets, options = {}) {
|
|
|
7300
7744
|
}), [hoveredPoint, setHoveredPoint] = React.useState(null), calculateMovingAverage = React.useCallback(((data, period) => {
|
|
7301
7745
|
const result = [];
|
|
7302
7746
|
for (let i = period - 1; i < data.length; i++) {
|
|
7303
|
-
|
|
7747
|
+
var _context;
|
|
7748
|
+
const average = _reduceInstanceProperty(_context = data.slice(i - period + 1, i + 1)).call(_context, ((acc, point) => acc + point.value), 0) / period, dataPoint = data[i];
|
|
7304
7749
|
dataPoint && result.push({
|
|
7305
7750
|
label: dataPoint.label,
|
|
7306
7751
|
value: average,
|
|
@@ -7311,7 +7756,7 @@ function useLineChart(datasets, options = {}) {
|
|
|
7311
7756
|
}), []), calculateTrendLine = React.useCallback((data => {
|
|
7312
7757
|
const n = data.length;
|
|
7313
7758
|
if (n < 2) return data.map((() => null));
|
|
7314
|
-
const xSum = data.
|
|
7759
|
+
const xSum = _reduceInstanceProperty(data).call(data, ((sum, _, i) => sum + i), 0), ySum = _reduceInstanceProperty(data).call(data, ((sum, point) => sum + point.value), 0), slope = (n * _reduceInstanceProperty(data).call(data, ((sum, point, i) => sum + i * point.value), 0) - xSum * ySum) / (n * _reduceInstanceProperty(data).call(data, ((sum, _, i) => sum + i * i), 0) - xSum * xSum), intercept = (ySum - slope * xSum) / n;
|
|
7315
7760
|
return data.map(((point, i) => ({
|
|
7316
7761
|
label: point.label,
|
|
7317
7762
|
value: slope * i + intercept,
|
|
@@ -7418,7 +7863,7 @@ function useLineChart(datasets, options = {}) {
|
|
|
7418
7863
|
|
|
7419
7864
|
HeatmapChart.displayName = "HeatmapChart";
|
|
7420
7865
|
|
|
7421
|
-
const LineChart =
|
|
7866
|
+
const LineChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, lineOptions: lineOptions = {}, onDataPointClick: onDataPointClick, onRealTimeUpdate: onRealTimeUpdate, onZoomChange: onZoomChange, onPanChange: onPanChange, onBrushSelection: onBrushSelection, ...props}, ref) => {
|
|
7422
7867
|
// Merge default options with provided options
|
|
7423
7868
|
const mergedLineOptions = {
|
|
7424
7869
|
showDataPoints: !0,
|
|
@@ -7518,7 +7963,7 @@ const LineChart = React.memo(React.forwardRef((({datasets: datasets = [], config
|
|
|
7518
7963
|
|
|
7519
7964
|
LineChart.displayName = "LineChart";
|
|
7520
7965
|
|
|
7521
|
-
const MultiAxisChart =
|
|
7966
|
+
const MultiAxisChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, yAxes: yAxes = [], xAxes: xAxes = [], multiAxisOptions: multiAxisOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
7522
7967
|
const {showLegend: showLegend = !0, legendPosition: legendPosition = "top", syncAxes: syncAxes = !1, axisPadding: axisPadding = 20, showTooltips: showTooltips = !0, tooltipPosition: tooltipPosition = "nearest", interpolation: interpolation = "linear", showArea: showArea = !1, areaOpacity: areaOpacity = .3, showDataPoints: showDataPoints = !0, pointRadius: pointRadius = 4, spanGaps: spanGaps = !1} = multiAxisOptions;
|
|
7523
7968
|
return jsxRuntime.jsx(BaseChart, {
|
|
7524
7969
|
ref: ref,
|
|
@@ -7666,7 +8111,7 @@ function usePieChart(data, options = {}) {
|
|
|
7666
8111
|
return validData.length ?
|
|
7667
8112
|
// Sort by value if enabled
|
|
7668
8113
|
options.sortByValue ? [ ...validData ].sort(((a, b) => b.value - a.value)) : validData : [];
|
|
7669
|
-
}), [ data, options.sortByValue ]), totalValue = React.useMemo((() => processedData.
|
|
8114
|
+
}), [ data, options.sortByValue ]), totalValue = React.useMemo((() => _reduceInstanceProperty(processedData).call(processedData, ((sum, point) => sum + point.value), 0)), [ processedData ]), slices = React.useMemo((() => {
|
|
7670
8115
|
if (!processedData.length || totalValue <= 0) return [];
|
|
7671
8116
|
const innerRadius = 150 * (options.innerRadius || 0), defaultColors = [ "#7AFFD7", "#1AFFD2", "#00E6C3", "#4DFF9F", "#1AFF85", "#00E66B", "#DD6061", "#FF1A1A", "#E60000", "#FFCC00", "#E6B800", "#B38F00" ];
|
|
7672
8117
|
// Default center
|
|
@@ -7753,7 +8198,7 @@ function usePieChart(data, options = {}) {
|
|
|
7753
8198
|
|
|
7754
8199
|
MultiAxisChart.displayName = "MultiAxisChart";
|
|
7755
8200
|
|
|
7756
|
-
const PieChart =
|
|
8201
|
+
const PieChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, pieOptions: pieOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
7757
8202
|
const data = datasets[0]?.data || [], {slices: slices, handleSliceHover: handleSliceHover, handleSliceLeave: handleSliceLeave, handleSliceClick: handleSliceClick, formatLabel: formatLabel, hoveredSlice: hoveredSlice, selectedSlices: selectedSlices} = usePieChart(data, pieOptions);
|
|
7758
8203
|
return jsxRuntime.jsx(BaseChart, {
|
|
7759
8204
|
ref: ref,
|
|
@@ -7818,7 +8263,7 @@ const PieChart = React.memo(React.forwardRef((({datasets: datasets = [], config:
|
|
|
7818
8263
|
|
|
7819
8264
|
PieChart.displayName = "PieChart";
|
|
7820
8265
|
|
|
7821
|
-
const RadarChart =
|
|
8266
|
+
const RadarChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, radarOptions: radarOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
7822
8267
|
const {gridLevels: gridLevels = 5, showGrid: showGrid = !0, showAxisLabels: showAxisLabels = !0, fillArea: fillArea = !0, fillOpacity: fillOpacity = .3, showDataPoints: showDataPoints = !0, pointRadius: pointRadius = 4, lineWidth: lineWidth = 2, smooth: smooth = !1, scaleType: scaleType = "linear", scaleMin: scaleMin = 0, scaleMax: scaleMax} = radarOptions;
|
|
7823
8268
|
return jsxRuntime.jsx(BaseChart, {
|
|
7824
8269
|
ref: ref,
|
|
@@ -7828,7 +8273,9 @@ const RadarChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
7828
8273
|
renderContent: ({scales: scales, colors: colors, datasets: renderedDatasets, handlers: handlers, hoveredPoint: hoveredPoint, toolbarState: toolbarState, config: renderConfig}) => {
|
|
7829
8274
|
if (!renderedDatasets.length) return null;
|
|
7830
8275
|
// Use toolbar state if available, fallback to config for backward compatibility
|
|
7831
|
-
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? !0, centerX = scales.width / 2, centerY = scales.height / 2, radius = .8 * Math.min(centerX, centerY),
|
|
8276
|
+
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? !0, centerX = scales.width / 2, centerY = scales.height / 2, radius = .8 * Math.min(centerX, centerY), firstDataset = renderedDatasets[0];
|
|
8277
|
+
if (!firstDataset) return null;
|
|
8278
|
+
const dataPoints = firstDataset.data || [], angleStep = 2 * Math.PI / dataPoints.length;
|
|
7832
8279
|
// Calculate value bounds
|
|
7833
8280
|
let minValue = scaleMin, maxValue = scaleMax;
|
|
7834
8281
|
if (void 0 === minValue || void 0 === maxValue) {
|
|
@@ -7891,18 +8338,18 @@ const RadarChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
7891
8338
|
point: dataset.data[i]
|
|
7892
8339
|
});
|
|
7893
8340
|
}
|
|
7894
|
-
if (0 === points.length) return null;
|
|
8341
|
+
if (0 === points.length || !points[0]) return null;
|
|
7895
8342
|
// Generate path
|
|
7896
8343
|
let path = "";
|
|
7897
8344
|
if (smooth && points.length > 2) {
|
|
7898
8345
|
// For smooth curves, we would implement a more complex algorithm
|
|
7899
8346
|
// For now, we'll just connect the points with straight lines
|
|
7900
8347
|
path = `M ${points[0].x},${points[0].y}`;
|
|
7901
|
-
for (let i = 1; i < points.length; i++) path += ` L ${points[i].x},${points[i].y}
|
|
8348
|
+
for (let i = 1; i < points.length; i++) points[i] && (path += ` L ${points[i].x},${points[i].y}`);
|
|
7902
8349
|
path += ` L ${points[0].x},${points[0].y} Z`;
|
|
7903
8350
|
} else {
|
|
7904
8351
|
path = `M ${points[0].x},${points[0].y}`;
|
|
7905
|
-
for (let i = 1; i < points.length; i++) path += ` L ${points[i].x},${points[i].y}
|
|
8352
|
+
for (let i = 1; i < points.length; i++) points[i] && (path += ` L ${points[i].x},${points[i].y}`);
|
|
7906
8353
|
path += ` L ${points[0].x},${points[0].y} Z`;
|
|
7907
8354
|
}
|
|
7908
8355
|
return jsxRuntime.jsxs("g", {
|
|
@@ -7926,7 +8373,9 @@ const RadarChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
7926
8373
|
r: isHovered ? 1.5 * pointRadius : pointRadius,
|
|
7927
8374
|
fill: color,
|
|
7928
8375
|
className: "c-chart__radar-point " + (isHovered ? "c-chart__radar-point--hovered" : ""),
|
|
7929
|
-
onClick: () =>
|
|
8376
|
+
onClick: () => {
|
|
8377
|
+
point.point && handlers.onDataPointClick?.(point.point, datasetIndex, pointIndex);
|
|
8378
|
+
},
|
|
7930
8379
|
onMouseEnter: e => {
|
|
7931
8380
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
7932
8381
|
handlers.onPointHover(datasetIndex, pointIndex, point.x, point.y, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
@@ -7940,8 +8389,8 @@ const RadarChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
7940
8389
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7941
8390
|
children: [ jsxRuntime.jsxs("g", {
|
|
7942
8391
|
children: [ gridLines, dataPaths, axisLabels ]
|
|
7943
|
-
}), showTooltips && hoveredPoint && jsxRuntime.jsx(ChartTooltip, {
|
|
7944
|
-
dataPoint: renderedDatasets[hoveredPoint.datasetIndex]
|
|
8392
|
+
}), showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && jsxRuntime.jsx(ChartTooltip, {
|
|
8393
|
+
dataPoint: renderedDatasets[hoveredPoint.datasetIndex].data[hoveredPoint.pointIndex],
|
|
7945
8394
|
datasetLabel: renderedDatasets[hoveredPoint.datasetIndex]?.label,
|
|
7946
8395
|
datasetColor: renderedDatasets[hoveredPoint.datasetIndex]?.color || colors[hoveredPoint.datasetIndex],
|
|
7947
8396
|
position: {
|
|
@@ -7959,7 +8408,7 @@ const RadarChart = React.memo(React.forwardRef((({datasets: datasets = [], confi
|
|
|
7959
8408
|
|
|
7960
8409
|
RadarChart.displayName = "RadarChart";
|
|
7961
8410
|
|
|
7962
|
-
const ScatterChart =
|
|
8411
|
+
const ScatterChart = React.memo( React.forwardRef((({datasets: datasets = [], config: config = {}, scatterOptions: scatterOptions = {
|
|
7963
8412
|
pointRadius: 4,
|
|
7964
8413
|
showLabels: !1,
|
|
7965
8414
|
enableHoverEffects: !0
|
|
@@ -8015,8 +8464,8 @@ const ScatterChart = React.memo(React.forwardRef((({datasets: datasets = [], con
|
|
|
8015
8464
|
}, `point-${datasetIndex}-${pointIndex}`));
|
|
8016
8465
|
}));
|
|
8017
8466
|
})), jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8018
|
-
children: [ points, showTooltips && hoveredPoint && jsxRuntime.jsx(ChartTooltip, {
|
|
8019
|
-
dataPoint: renderedDatasets[hoveredPoint.datasetIndex]
|
|
8467
|
+
children: [ points, showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && jsxRuntime.jsx(ChartTooltip, {
|
|
8468
|
+
dataPoint: renderedDatasets[hoveredPoint.datasetIndex].data[hoveredPoint.pointIndex],
|
|
8020
8469
|
datasetLabel: renderedDatasets[hoveredPoint.datasetIndex]?.label,
|
|
8021
8470
|
datasetColor: renderedDatasets[hoveredPoint.datasetIndex]?.color || colors[hoveredPoint.datasetIndex],
|
|
8022
8471
|
position: {
|
|
@@ -8033,7 +8482,7 @@ const ScatterChart = React.memo(React.forwardRef((({datasets: datasets = [], con
|
|
|
8033
8482
|
|
|
8034
8483
|
ScatterChart.displayName = "ScatterChart";
|
|
8035
8484
|
|
|
8036
|
-
const TreemapChart =
|
|
8485
|
+
const TreemapChart = React.memo( React.forwardRef((({data: data = [], algorithm: algorithm = "squarified", colorConfig: colorConfig = {
|
|
8037
8486
|
scheme: "category"
|
|
8038
8487
|
}, labelConfig: labelConfig = {
|
|
8039
8488
|
showLabels: !0,
|
|
@@ -8056,9 +8505,11 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8056
8505
|
processedNodes.add(node.id);
|
|
8057
8506
|
// Find children
|
|
8058
8507
|
const children = data.filter((item => item.parent === node.id));
|
|
8508
|
+
var _context;
|
|
8059
8509
|
return children.length > 0 && (node.children = children.map((child => buildTree(child))),
|
|
8060
8510
|
// For parent nodes, value is sum of children
|
|
8061
|
-
node.value = node.children.
|
|
8511
|
+
node.value = _reduceInstanceProperty(_context = node.children).call(_context, ((sum, child) => sum + child.value), 0)),
|
|
8512
|
+
node;
|
|
8062
8513
|
};
|
|
8063
8514
|
// Find root nodes
|
|
8064
8515
|
return data.forEach((item => {
|
|
@@ -8066,7 +8517,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8066
8517
|
})), 1 === rootNodes.length ? rootNodes[0] : {
|
|
8067
8518
|
id: "root",
|
|
8068
8519
|
label: "Root",
|
|
8069
|
-
value: rootNodes.
|
|
8520
|
+
value: _reduceInstanceProperty(rootNodes).call(rootNodes, ((sum, node) => sum + node.value), 0),
|
|
8070
8521
|
children: rootNodes
|
|
8071
8522
|
};
|
|
8072
8523
|
}), [ data ]);
|
|
@@ -8080,8 +8531,10 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8080
8531
|
return colors[index % colors.length];
|
|
8081
8532
|
|
|
8082
8533
|
case "depth":
|
|
8083
|
-
|
|
8084
|
-
|
|
8534
|
+
{
|
|
8535
|
+
const depthColors = [ "var(--atomix-blue-9)", "var(--atomix-blue-6)", "var(--atomix-blue-5)", "var(--atomix-blue-4)", "var(--atomix-blue-2)" ];
|
|
8536
|
+
return depthColors[Math.min(depth, depthColors.length - 1)];
|
|
8537
|
+
}
|
|
8085
8538
|
|
|
8086
8539
|
case "value":
|
|
8087
8540
|
if (data.length > 0) {
|
|
@@ -8092,7 +8545,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8092
8545
|
}
|
|
8093
8546
|
}), [ colorConfig, data ]), squarify = React.useCallback(((nodes, x, y, width, height) => {
|
|
8094
8547
|
if (0 === nodes.length) return;
|
|
8095
|
-
const totalValue = nodes.
|
|
8548
|
+
const totalValue = _reduceInstanceProperty(nodes).call(nodes, ((sum, node) => sum + node.value), 0);
|
|
8096
8549
|
if (1 === nodes.length) {
|
|
8097
8550
|
const node = nodes[0];
|
|
8098
8551
|
return void (node && (node.x = x, node.y = y, node.width = width, node.height = height));
|
|
@@ -8105,7 +8558,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8105
8558
|
if (!node) break;
|
|
8106
8559
|
currentRow.push(node);
|
|
8107
8560
|
// Calculate dimensions for current row
|
|
8108
|
-
const rowValue = currentRow.
|
|
8561
|
+
const rowValue = _reduceInstanceProperty(currentRow).call(currentRow, ((sum, n) => sum + n.value), 0), rowRatio = rowValue / totalValue;
|
|
8109
8562
|
let rowWidth, rowHeight;
|
|
8110
8563
|
remainingWidth >= remainingHeight ? (rowWidth = remainingWidth * rowRatio, rowHeight = remainingHeight) : (rowWidth = remainingWidth,
|
|
8111
8564
|
rowHeight = remainingHeight * rowRatio);
|
|
@@ -8114,7 +8567,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8114
8567
|
if (remainingNodes.length > 0) {
|
|
8115
8568
|
const nextNode = remainingNodes[0];
|
|
8116
8569
|
if (!nextNode) break;
|
|
8117
|
-
const testRow = [ ...currentRow, nextNode ], testRowValue = testRow.
|
|
8570
|
+
const testRow = [ ...currentRow, nextNode ], testRowValue = _reduceInstanceProperty(testRow).call(testRow, ((sum, n) => sum + n.value), 0), testRowRatio = testRowValue / totalValue;
|
|
8118
8571
|
let testRowWidth, testRowHeight;
|
|
8119
8572
|
remainingWidth >= remainingHeight ? (testRowWidth = remainingWidth * testRowRatio,
|
|
8120
8573
|
testRowHeight = remainingHeight) : (testRowWidth = remainingWidth, testRowHeight = remainingHeight * testRowRatio);
|
|
@@ -8163,7 +8616,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8163
8616
|
// Calculate available space with padding
|
|
8164
8617
|
const availableWidth = scales.width - 40, availableHeight = scales.height - 40, leafNodes = data.filter((item => !item.children || 0 === item.children.length));
|
|
8165
8618
|
if (!leafNodes.length) return null;
|
|
8166
|
-
const totalValue = leafNodes.
|
|
8619
|
+
const totalValue = _reduceInstanceProperty(leafNodes).call(leafNodes, ((sum, node) => sum + node.value), 0), treemapNodes = leafNodes.map(((item, index) => ({
|
|
8167
8620
|
id: item.id,
|
|
8168
8621
|
label: item.label,
|
|
8169
8622
|
value: item.value,
|
|
@@ -8237,7 +8690,7 @@ const TreemapChart = React.memo(React.forwardRef((({data: data = [], algorithm:
|
|
|
8237
8690
|
|
|
8238
8691
|
TreemapChart.displayName = "TreemapChart";
|
|
8239
8692
|
|
|
8240
|
-
const WaterfallChart =
|
|
8693
|
+
const WaterfallChart = React.memo( React.forwardRef((({waterfallData: waterfallData = [], config: config = {}, waterfallOptions: waterfallOptions = {}, onDataPointClick: onDataPointClick, ...props}, ref) => {
|
|
8241
8694
|
const {showConnectors: showConnectors = !0, connectorColor: connectorColor = "var(--atomix-gray-1)", connectorStyle: connectorStyle = "dashed", showValues: showValues = !0, valuePosition: valuePosition = "top", colors: waterfallColors = {
|
|
8242
8695
|
positive: "var(--atomix-success)",
|
|
8243
8696
|
negative: "var(--atomix-error)",
|
|
@@ -8492,7 +8945,7 @@ const SIZE_MAP = {
|
|
|
8492
8945
|
|
|
8493
8946
|
ColorModeToggle.displayName = "ColorModeToggle";
|
|
8494
8947
|
|
|
8495
|
-
const Countdown =
|
|
8948
|
+
const Countdown = React.forwardRef((({target: target, show: show = [ "days", "hours", "minutes", "seconds" ], separator: separator = ":", focused: focused = !1, className: className = "", style: style, onComplete: onComplete}, ref) => {
|
|
8496
8949
|
const targetDate = "string" == typeof target ? new Date(target) : target, [now, setNow] = React.useState((() => new Date)), [completed, setCompleted] = React.useState(!1);
|
|
8497
8950
|
React.useEffect((() => {
|
|
8498
8951
|
if (completed) return;
|
|
@@ -8514,16 +8967,16 @@ const Countdown = React.forwardRef((({target: target, show: show = [ "days", "ho
|
|
|
8514
8967
|
diff <= 0 && !completed && (setCompleted(!0), onComplete && onComplete());
|
|
8515
8968
|
}), [ diff, completed, onComplete ]);
|
|
8516
8969
|
const timeParts = [];
|
|
8517
|
-
return show.
|
|
8970
|
+
return _includesInstanceProperty(show).call(show, "days") && timeParts.push({
|
|
8518
8971
|
label: "Days",
|
|
8519
8972
|
value: days
|
|
8520
|
-
}), show.
|
|
8973
|
+
}), _includesInstanceProperty(show).call(show, "hours") && timeParts.push({
|
|
8521
8974
|
label: "Hours",
|
|
8522
8975
|
value: hours
|
|
8523
|
-
}), show.
|
|
8976
|
+
}), _includesInstanceProperty(show).call(show, "minutes") && timeParts.push({
|
|
8524
8977
|
label: "Minutes",
|
|
8525
8978
|
value: minutes
|
|
8526
|
-
}), show.
|
|
8979
|
+
}), _includesInstanceProperty(show).call(show, "seconds") && timeParts.push({
|
|
8527
8980
|
label: "Seconds",
|
|
8528
8981
|
value: seconds
|
|
8529
8982
|
}), jsxRuntime.jsx("div", {
|
|
@@ -8571,8 +9024,9 @@ function useDataTable({data: data = [], columns: columns = [], sortable: sortabl
|
|
|
8571
9024
|
if (!searchQuery) return data;
|
|
8572
9025
|
const lowercaseQuery = searchQuery.toLowerCase();
|
|
8573
9026
|
return data.filter((row => columns.some((column => {
|
|
9027
|
+
var _context;
|
|
8574
9028
|
const value = row[column.key];
|
|
8575
|
-
return null != value && String(value).toLowerCase().
|
|
9029
|
+
return null != value && _includesInstanceProperty(_context = String(value).toLowerCase()).call(_context, lowercaseQuery);
|
|
8576
9030
|
}))));
|
|
8577
9031
|
}), [ data, columns, searchQuery ]), sortedData = React.useMemo((() => sortConfig && sortable ? [ ...filteredData ].sort(((a, b) => {
|
|
8578
9032
|
const aValue = a[sortConfig.key], bValue = b[sortConfig.key];
|
|
@@ -8612,22 +9066,22 @@ const range = (start, end) => {
|
|
|
8612
9066
|
const paginationRange = React.useMemo((() => {
|
|
8613
9067
|
// siblingCount + firstPage + lastPage + currentPage + 2*DOTS
|
|
8614
9068
|
/*
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
9069
|
+
Case 1: If the number of pages is less than the page numbers we want to show in our
|
|
9070
|
+
paginationComponent, we return the range [1..totalPages]
|
|
9071
|
+
*/
|
|
8618
9072
|
if (siblingCount + 5 >= totalPages) return range(1, totalPages);
|
|
8619
9073
|
const leftSiblingIndex = Math.max(currentPage - siblingCount, 1), rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages), shouldShowLeftDots = leftSiblingIndex > 2, shouldShowRightDots = rightSiblingIndex < totalPages - 2, lastPageIndex = totalPages;
|
|
8620
9074
|
/*
|
|
8621
|
-
|
|
8622
|
-
|
|
9075
|
+
Case 2: No left dots to show, but rights dots to be shown
|
|
9076
|
+
*/
|
|
8623
9077
|
return !shouldShowLeftDots && shouldShowRightDots ? [ ...range(1, 3 + 2 * siblingCount), "...", totalPages ] :
|
|
8624
9078
|
/*
|
|
8625
|
-
|
|
8626
|
-
|
|
9079
|
+
Case 3: No right dots to show, but left dots to be shown
|
|
9080
|
+
*/
|
|
8627
9081
|
shouldShowLeftDots && !shouldShowRightDots ? [ 1, "...", ...range(totalPages - (3 + 2 * siblingCount) + 1, totalPages) ] :
|
|
8628
9082
|
/*
|
|
8629
|
-
|
|
8630
|
-
|
|
9083
|
+
Case 4: Both left and right dots to be shown
|
|
9084
|
+
*/
|
|
8631
9085
|
shouldShowLeftDots && shouldShowRightDots ? [ 1, "...", ...range(leftSiblingIndex, rightSiblingIndex), "...", lastPageIndex ] : [];
|
|
8632
9086
|
}), [ totalPages, siblingCount, currentPage ]), goToPage = page => {
|
|
8633
9087
|
page >= 1 && page <= totalPages && page !== currentPage && onPageChange(page);
|
|
@@ -8651,7 +9105,7 @@ const range = (start, end) => {
|
|
|
8651
9105
|
},
|
|
8652
9106
|
DOTS: "..."
|
|
8653
9107
|
};
|
|
8654
|
-
}, PaginationNavButton =
|
|
9108
|
+
}, PaginationNavButton = React.memo((({type: type, onClick: onClick, disabled: disabled, label: label, iconName: iconName}) => jsxRuntime.jsx("li", {
|
|
8655
9109
|
className: `c-pagination__item c-pagination__item--${type} ${disabled ? "is-disabled" : ""}`,
|
|
8656
9110
|
"aria-disabled": disabled,
|
|
8657
9111
|
children: jsxRuntime.jsx("button", {
|
|
@@ -8666,10 +9120,7 @@ const range = (start, end) => {
|
|
|
8666
9120
|
"aria-hidden": "true"
|
|
8667
9121
|
})
|
|
8668
9122
|
})
|
|
8669
|
-
})
|
|
8670
|
-
/**
|
|
8671
|
-
* Pagination component
|
|
8672
|
-
*/ , Pagination = ({currentPage: currentPage = PAGINATION_DEFAULTS.currentPage, totalPages: totalPages = PAGINATION_DEFAULTS.totalPages, onPageChange: onPageChange, siblingCount: siblingCount = PAGINATION_DEFAULTS.siblingCount, showFirstLastButtons: showFirstLastButtons = PAGINATION_DEFAULTS.showFirstLastButtons, showPrevNextButtons: showPrevNextButtons = PAGINATION_DEFAULTS.showPrevNextButtons, size: size = PAGINATION_DEFAULTS.size, className: className = "", style: style, ariaLabel: ariaLabel = "Pagination", glass: glass}) => {
|
|
9123
|
+
}))), Pagination = React.memo((({currentPage: currentPage = PAGINATION_DEFAULTS.currentPage, totalPages: totalPages = PAGINATION_DEFAULTS.totalPages, onPageChange: onPageChange, siblingCount: siblingCount = PAGINATION_DEFAULTS.siblingCount, showFirstLastButtons: showFirstLastButtons = PAGINATION_DEFAULTS.showFirstLastButtons, showPrevNextButtons: showPrevNextButtons = PAGINATION_DEFAULTS.showPrevNextButtons, size: size = PAGINATION_DEFAULTS.size, className: className = "", style: style, ariaLabel: ariaLabel = "Pagination", glass: glass}) => {
|
|
8673
9124
|
const {paginationRange: paginationRange, goToPage: goToPage, nextPage: nextPage, prevPage: prevPage, firstPage: firstPage, lastPage: lastPage} = usePagination({
|
|
8674
9125
|
currentPage: currentPage,
|
|
8675
9126
|
totalPages: totalPages,
|
|
@@ -8749,9 +9200,9 @@ const range = (start, end) => {
|
|
|
8749
9200
|
});
|
|
8750
9201
|
}
|
|
8751
9202
|
return paginationContent;
|
|
8752
|
-
};
|
|
9203
|
+
}));
|
|
8753
9204
|
|
|
8754
|
-
Pagination.displayName = "Pagination";
|
|
9205
|
+
Pagination.displayName = "Pagination", PaginationNavButton.displayName = "PaginationNavButton";
|
|
8755
9206
|
|
|
8756
9207
|
/**
|
|
8757
9208
|
* DataTable - A flexible and accessible data table component
|
|
@@ -8766,7 +9217,7 @@ Pagination.displayName = "Pagination";
|
|
|
8766
9217
|
* />
|
|
8767
9218
|
* ```
|
|
8768
9219
|
*/
|
|
8769
|
-
const DataTable =
|
|
9220
|
+
const DataTable = React.memo((({data: data, columns: columns, className: className, style: style, sortable: sortable = !1, filterable: filterable = !1, paginated: paginated = !1, pageSize: pageSize = 10, striped: striped = !1, bordered: bordered = !1, dense: dense = !1, loading: loading = !1, emptyMessage: emptyMessage = "No data available", onRowClick: onRowClick, onSort: onSort, ...props}) => {
|
|
8770
9221
|
const tableRef = React.useRef(null), {displayData: displayData, sortConfig: sortConfig, currentPage: currentPage, totalPages: totalPages, handleSort: handleSort, handlePageChange: handlePageChange, handleSearch: handleSearch} = useDataTable({
|
|
8771
9222
|
data: data,
|
|
8772
9223
|
columns: columns,
|
|
@@ -8869,7 +9320,7 @@ const DataTable = ({data: data, columns: columns, className: className, style: s
|
|
|
8869
9320
|
})
|
|
8870
9321
|
}) ]
|
|
8871
9322
|
});
|
|
8872
|
-
};
|
|
9323
|
+
}));
|
|
8873
9324
|
|
|
8874
9325
|
/**
|
|
8875
9326
|
* Get the name of a month by its index (0-11)
|
|
@@ -9109,7 +9560,7 @@ function formatDate(date, format) {
|
|
|
9109
9560
|
* Supports various display modes, date ranges, and customization options.
|
|
9110
9561
|
*/ DataTable.displayName = "DataTable";
|
|
9111
9562
|
|
|
9112
|
-
const DatePicker =
|
|
9563
|
+
const DatePicker = React.forwardRef((({value: value, onChange: onChange, selectionMode: selectionMode = "single", startDate: startDate, endDate: endDate, onRangeChange: onRangeChange, format: format = "MM/dd/yyyy", minDate: minDate, maxDate: maxDate, placeholder: placeholder = "Select date...", disabled: disabled = !1, readOnly: readOnly = !1, clearable: clearable = !0, showTodayButton: showTodayButton = !0, showWeekNumbers: showWeekNumbers = !1, inline: inline = !1, id: id, name: name, className: className = "", placement: placement = "bottom-start", inputClassName: inputClassName = "", size: size = "md", style: style, glass: glass, ...props}, ref) => {
|
|
9113
9564
|
const {isOpen:
|
|
9114
9565
|
// State
|
|
9115
9566
|
isOpen, inputValue: inputValue, rangeInputValue: rangeInputValue, viewMode: viewMode, currentMonth: currentMonth, currentYear: currentYear, selectionMode: activeSelectionMode, rangeSelectionState: rangeSelectionState, datePickerRef:
|
|
@@ -9409,12 +9860,63 @@ const DatePicker = React.forwardRef((({value: value, onChange: onChange, selecti
|
|
|
9409
9860
|
DatePicker.displayName = "DatePicker";
|
|
9410
9861
|
|
|
9411
9862
|
// Create context for dropdown state management
|
|
9412
|
-
const DropdownContext =
|
|
9863
|
+
const DropdownContext = React.createContext({
|
|
9413
9864
|
isOpen: !1,
|
|
9414
9865
|
close: () => {},
|
|
9415
9866
|
id: "",
|
|
9416
9867
|
trigger: "click"
|
|
9417
|
-
}),
|
|
9868
|
+
}), DropdownItem = React.memo((({children: children, href: href, active: active = !1, disabled: disabled = !1, icon: icon, onClick: onClick, className: className = "", LinkComponent: LinkComponent, ...props}) => {
|
|
9869
|
+
const {close: close} = React.useContext(DropdownContext), handleClick = e => {
|
|
9870
|
+
disabled ? e.preventDefault() : (onClick && onClick(e),
|
|
9871
|
+
// Always close the dropdown when an item is clicked
|
|
9872
|
+
close());
|
|
9873
|
+
}, itemClasses = [ "c-dropdown__menu-item", active ? "is-active" : "", disabled ? "is-disabled" : "", className ].filter(Boolean).join(" "), linkProps = {
|
|
9874
|
+
href: href,
|
|
9875
|
+
className: itemClasses,
|
|
9876
|
+
onClick: handleClick,
|
|
9877
|
+
role: "menuitem",
|
|
9878
|
+
tabIndex: 0,
|
|
9879
|
+
...props
|
|
9880
|
+
};
|
|
9881
|
+
return href && !disabled ? jsxRuntime.jsx("li", {
|
|
9882
|
+
children: LinkComponent ? (() => {
|
|
9883
|
+
const Component = LinkComponent;
|
|
9884
|
+
return jsxRuntime.jsxs(Component, {
|
|
9885
|
+
...linkProps,
|
|
9886
|
+
children: [ icon && jsxRuntime.jsx("span", {
|
|
9887
|
+
className: "c-dropdown__menu-item-icon",
|
|
9888
|
+
children: icon
|
|
9889
|
+
}), children ]
|
|
9890
|
+
});
|
|
9891
|
+
})() : jsxRuntime.jsxs("a", {
|
|
9892
|
+
...linkProps,
|
|
9893
|
+
children: [ icon && jsxRuntime.jsx("span", {
|
|
9894
|
+
className: "c-dropdown__menu-item-icon",
|
|
9895
|
+
children: icon
|
|
9896
|
+
}), children ]
|
|
9897
|
+
})
|
|
9898
|
+
}) : jsxRuntime.jsx("li", {
|
|
9899
|
+
children: jsxRuntime.jsxs("button", {
|
|
9900
|
+
type: "button",
|
|
9901
|
+
className: itemClasses,
|
|
9902
|
+
onClick: handleClick,
|
|
9903
|
+
disabled: disabled,
|
|
9904
|
+
role: "menuitem",
|
|
9905
|
+
tabIndex: 0,
|
|
9906
|
+
...props,
|
|
9907
|
+
children: [ icon && jsxRuntime.jsx("span", {
|
|
9908
|
+
className: "c-dropdown__menu-item-icon",
|
|
9909
|
+
children: icon
|
|
9910
|
+
}), children ]
|
|
9911
|
+
})
|
|
9912
|
+
});
|
|
9913
|
+
})), DropdownDivider = React.memo((({className: className = ""}) => jsxRuntime.jsx("li", {
|
|
9914
|
+
className: `c-dropdown__divider ${className}`,
|
|
9915
|
+
role: "separator"
|
|
9916
|
+
}))), DropdownHeader = React.memo((({children: children, className: className = ""}) => jsxRuntime.jsx("li", {
|
|
9917
|
+
className: `c-dropdown__header ${className}`,
|
|
9918
|
+
children: children
|
|
9919
|
+
}))), Dropdown = React.memo((({children: children, menu: menu, placement: placement = "bottom-start", trigger: trigger = "click", offset: offset = DROPDOWN.DEFAULTS.OFFSET, isOpen: controlledIsOpen, onOpenChange: onOpenChange, closeOnClickOutside: closeOnClickOutside = !0, closeOnEscape: closeOnEscape = !0, maxHeight: maxHeight, minWidth: minWidth = DROPDOWN.DEFAULTS.MIN_WIDTH, variant: variant, className: className = "", style: style, glass: glass, ...props}) => {
|
|
9418
9920
|
// Set up controlled vs uncontrolled state
|
|
9419
9921
|
const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(!1), isControlled = void 0 !== controlledIsOpen, isOpen = isControlled ? controlledIsOpen : uncontrolledIsOpen, dropdownRef = React.useRef(null), toggleRef = React.useRef(null), menuRef = React.useRef(null), dropdownId = React.useRef(`dropdown-${Math.random().toString(36).substring(2, 9)}`).current, setIsOpen = React.useCallback((nextIsOpen => {
|
|
9420
9922
|
isControlled || setUncontrolledIsOpen(nextIsOpen), onOpenChange && onOpenChange(nextIsOpen);
|
|
@@ -9518,7 +10020,8 @@ const DropdownContext = React.createContext({
|
|
|
9518
10020
|
"aria-orientation": "vertical",
|
|
9519
10021
|
"aria-hidden": !isOpen,
|
|
9520
10022
|
onKeyDown: handleKeyDown,
|
|
9521
|
-
children: glass ?
|
|
10023
|
+
children: glass ?
|
|
10024
|
+
// Default glass settings for dropdowns
|
|
9522
10025
|
(() => {
|
|
9523
10026
|
const defaultGlassProps = {
|
|
9524
10027
|
displacementScale: 20,
|
|
@@ -9534,10 +10037,10 @@ const DropdownContext = React.createContext({
|
|
|
9534
10037
|
})() : menuContent
|
|
9535
10038
|
}) ]
|
|
9536
10039
|
});
|
|
9537
|
-
};
|
|
10040
|
+
}));
|
|
9538
10041
|
|
|
9539
10042
|
/**
|
|
9540
|
-
*
|
|
10043
|
+
* DropdownItem component for menu items
|
|
9541
10044
|
*/
|
|
9542
10045
|
/**
|
|
9543
10046
|
* EdgePanel state and functionality
|
|
@@ -9656,15 +10159,15 @@ function useEdgePanel(initialProps) {
|
|
|
9656
10159
|
defaultProps.closeOnBackdropClick && event.target === event.currentTarget && closePanel();
|
|
9657
10160
|
}), [ closePanel, defaultProps.closeOnBackdropClick ]);
|
|
9658
10161
|
/**
|
|
9659
|
-
|
|
9660
|
-
|
|
10162
|
+
* Set up event listeners for keyboard events
|
|
10163
|
+
*/
|
|
9661
10164
|
return React.useEffect((() => (isOpen && defaultProps.closeOnEscape && document.addEventListener("keydown", handleEscapeKey),
|
|
9662
10165
|
() => {
|
|
9663
10166
|
document.removeEventListener("keydown", handleEscapeKey);
|
|
9664
10167
|
})), [ isOpen, handleEscapeKey, defaultProps.closeOnEscape ]),
|
|
9665
10168
|
/**
|
|
9666
|
-
|
|
9667
|
-
|
|
10169
|
+
* Set initial transform values
|
|
10170
|
+
*/
|
|
9668
10171
|
React.useEffect((() => {
|
|
9669
10172
|
if (containerRef.current) {
|
|
9670
10173
|
const {position: position, mode: mode} = defaultProps;
|
|
@@ -9674,8 +10177,8 @@ function useEdgePanel(initialProps) {
|
|
|
9674
10177
|
}
|
|
9675
10178
|
}), [ defaultProps.mode, defaultProps.position, defaultProps.glass, isOpen ]),
|
|
9676
10179
|
/**
|
|
9677
|
-
|
|
9678
|
-
|
|
10180
|
+
* Sync with prop changes
|
|
10181
|
+
*/
|
|
9679
10182
|
React.useEffect((() => {
|
|
9680
10183
|
void 0 !== defaultProps.isOpen && defaultProps.isOpen !== isOpen && (defaultProps.isOpen ? openPanel(!!defaultProps.glass) : closePanel(!!defaultProps.glass));
|
|
9681
10184
|
}), [ defaultProps.isOpen, closePanel, isOpen, openPanel, defaultProps.glass ]),
|
|
@@ -9737,7 +10240,8 @@ function useEdgePanel(initialProps) {
|
|
|
9737
10240
|
* <p>Panel with custom glass effect</p>
|
|
9738
10241
|
* </EdgePanel>
|
|
9739
10242
|
* ```
|
|
9740
|
-
*/ Dropdown.displayName = "Dropdown"
|
|
10243
|
+
*/ Dropdown.displayName = "Dropdown", DropdownItem.displayName = "DropdownItem",
|
|
10244
|
+
DropdownDivider.displayName = "DropdownDivider", DropdownHeader.displayName = "DropdownHeader";
|
|
9741
10245
|
|
|
9742
10246
|
const EdgePanel = ({title: title, children: children, position: position = "start", mode: mode = "slide", isOpen: isOpen = !1, onOpenChange: onOpenChange, backdrop: backdrop = !0, closeOnBackdropClick: closeOnBackdropClick = !0, closeOnEscape: closeOnEscape = !0, className: className = "", style: style, glass: glass}) => {
|
|
9743
10247
|
const {isOpen: isOpenState, containerRef: containerRef, backdropRef: backdropRef, generateEdgePanelClass: generateEdgePanelClass, closePanel: closePanel, handleBackdropClick: handleBackdropClick} = useEdgePanel({
|
|
@@ -9851,7 +10355,7 @@ function useCheckbox(initialProps) {
|
|
|
9851
10355
|
|
|
9852
10356
|
/**
|
|
9853
10357
|
* Checkbox - A component for checkbox inputs
|
|
9854
|
-
*/ const Checkbox =
|
|
10358
|
+
*/ const Checkbox = React.memo((({label: label, checked: checked = !1, onChange: onChange, className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, value: value, invalid: invalid = !1, valid: valid = !1, indeterminate: indeterminate = !1, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}) => {
|
|
9855
10359
|
const {generateCheckboxClass: generateCheckboxClass, checkboxRef: checkboxRef} = useCheckbox({
|
|
9856
10360
|
indeterminate: indeterminate,
|
|
9857
10361
|
disabled: disabled,
|
|
@@ -9905,7 +10409,7 @@ function useCheckbox(initialProps) {
|
|
|
9905
10409
|
});
|
|
9906
10410
|
}
|
|
9907
10411
|
return checkboxContent;
|
|
9908
|
-
};
|
|
10412
|
+
}));
|
|
9909
10413
|
|
|
9910
10414
|
/**
|
|
9911
10415
|
* Form state and functionality
|
|
@@ -9919,10 +10423,10 @@ function useForm(initialProps) {
|
|
|
9919
10423
|
...initialProps
|
|
9920
10424
|
};
|
|
9921
10425
|
/**
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
10426
|
+
* Generate form class based on properties
|
|
10427
|
+
* @param props - Form properties
|
|
10428
|
+
* @returns Class string
|
|
10429
|
+
*/ return {
|
|
9926
10430
|
defaultProps: defaultProps,
|
|
9927
10431
|
generateFormClass: props => {
|
|
9928
10432
|
const {disabled: disabled = defaultProps.disabled, className: className = ""} = props, disabledClass = disabled ? FORM.CLASSES.DISABLED : "";
|
|
@@ -9977,10 +10481,10 @@ function useFormGroup(initialProps) {
|
|
|
9977
10481
|
...initialProps
|
|
9978
10482
|
};
|
|
9979
10483
|
/**
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
10484
|
+
* Generate form group class based on properties
|
|
10485
|
+
* @param props - Form group properties
|
|
10486
|
+
* @returns Class string
|
|
10487
|
+
*/ return {
|
|
9984
10488
|
defaultProps: defaultProps,
|
|
9985
10489
|
generateFormGroupClass: props => {
|
|
9986
10490
|
const {size: size = defaultProps.size, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props, sizeClass = "md" === size ? "" : "sm" === size ? FORM_GROUP.CLASSES.SMALL : FORM_GROUP.CLASSES.LARGE, validationClass = invalid ? FORM_GROUP.CLASSES.INVALID : valid ? FORM_GROUP.CLASSES.VALID : "", disabledClass = disabled ? FORM_GROUP.CLASSES.DISABLED : "";
|
|
@@ -10041,10 +10545,10 @@ function useInput(initialProps) {
|
|
|
10041
10545
|
...initialProps
|
|
10042
10546
|
};
|
|
10043
10547
|
/**
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10548
|
+
* Generate input class based on properties
|
|
10549
|
+
* @param props - Input properties
|
|
10550
|
+
* @returns Class string
|
|
10551
|
+
*/ return {
|
|
10048
10552
|
defaultProps: defaultProps,
|
|
10049
10553
|
generateInputClass: props => {
|
|
10050
10554
|
const {size: size = defaultProps.size, variant: variant = defaultProps.variant, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = "", type: type} = props, sizeClass = "md" === size ? "" : "sm" === size ? INPUT.CLASSES.SMALL : INPUT.CLASSES.LARGE, variantClass = variant ? `c-input--${variant}` : "", textareaClass = "textarea" === type ? "c-input--textarea" : "";
|
|
@@ -10067,7 +10571,7 @@ function useInput(initialProps) {
|
|
|
10067
10571
|
* Input - A component for text input fields
|
|
10068
10572
|
*/ FormGroup.displayName = "FormGroup";
|
|
10069
10573
|
|
|
10070
|
-
const Input = React.forwardRef((({type: type = "text", value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, className: className = "", style: style, disabled: disabled = !1, required: required = !1, readOnly: readOnly = !1, id: id, name: name, autoComplete: autoComplete, autoFocus: autoFocus = !1, size: size = "md", variant: variant, invalid: invalid = !1, valid: valid = !1, maxLength: maxLength, minLength: minLength, pattern: pattern, min: min, max: max, step: step, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}, ref) => {
|
|
10574
|
+
const Input = React.memo( React.forwardRef((({type: type = "text", value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, className: className = "", style: style, disabled: disabled = !1, required: required = !1, readOnly: readOnly = !1, id: id, name: name, autoComplete: autoComplete, autoFocus: autoFocus = !1, size: size = "md", variant: variant, invalid: invalid = !1, valid: valid = !1, maxLength: maxLength, minLength: minLength, pattern: pattern, min: min, max: max, step: step, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}, ref) => {
|
|
10071
10575
|
const {generateInputClass: generateInputClass} = useInput({
|
|
10072
10576
|
size: size,
|
|
10073
10577
|
variant: variant,
|
|
@@ -10130,7 +10634,7 @@ const Input = React.forwardRef((({type: type = "text", value: value, onChange: o
|
|
|
10130
10634
|
});
|
|
10131
10635
|
}
|
|
10132
10636
|
return inputElement;
|
|
10133
|
-
}));
|
|
10637
|
+
})));
|
|
10134
10638
|
|
|
10135
10639
|
/**
|
|
10136
10640
|
* Hook for Hero component functionality
|
|
@@ -10149,25 +10653,25 @@ function useHero(initialProps) {
|
|
|
10149
10653
|
parallax: !1,
|
|
10150
10654
|
parallaxIntensity: .5,
|
|
10151
10655
|
...initialProps
|
|
10152
|
-
}, hasBackgroundSlider = !!defaultProps.backgroundSlider,
|
|
10656
|
+
}, hasBackgroundSlider = !!defaultProps.backgroundSlider, backgroundSliderResult =
|
|
10153
10657
|
/**
|
|
10154
10658
|
* Hook for Hero background slider functionality
|
|
10155
10659
|
* @param config - Background slider configuration
|
|
10156
10660
|
* @returns Slider state and methods
|
|
10157
10661
|
*/
|
|
10158
10662
|
function(config) {
|
|
10159
|
-
const {slides: slides, autoplay: autoplay, loop: loop = !0, transition: transition = "fade", transitionDuration: transitionDuration = 1e3} = config, [currentIndex, setCurrentIndex] = React.useState(0), [isTransitioning, setIsTransitioning] = React.useState(!1), autoplayRef = React.useRef(null), isPausedRef = React.useRef(!1), slideRefs = React.useMemo((() => slides.map((() =>
|
|
10663
|
+
const {slides: slides, autoplay: autoplay, loop: loop = !0, transition: transition = "fade", transitionDuration: transitionDuration = 1e3} = config, [currentIndex, setCurrentIndex] = React.useState(0), [isTransitioning, setIsTransitioning] = React.useState(!1), autoplayRef = React.useRef(null), isPausedRef = React.useRef(!1), slideRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), videoRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), handleSlideTransition = React.useCallback((nextIndex => {
|
|
10160
10664
|
if (nextIndex === currentIndex || isTransitioning) return;
|
|
10161
10665
|
if (nextIndex < 0 || nextIndex >= slides.length) return;
|
|
10162
10666
|
setIsTransitioning(!0),
|
|
10163
10667
|
// Update current index
|
|
10164
10668
|
setCurrentIndex(nextIndex);
|
|
10165
10669
|
// Play video if it's a video slide
|
|
10166
|
-
const currentVideo = videoRefs[nextIndex]?.current;
|
|
10167
|
-
currentVideo && "video" ===
|
|
10670
|
+
const currentVideo = videoRefs[nextIndex]?.current, nextSlide = slides[nextIndex];
|
|
10671
|
+
currentVideo && nextSlide && "video" === nextSlide.type && !1 !== (nextSlide.videoOptions || {}).autoplay && currentVideo.play().catch((() => {}));
|
|
10168
10672
|
// Pause previous video if it exists
|
|
10169
|
-
const prevVideo = videoRefs[currentIndex]?.current;
|
|
10170
|
-
prevVideo && "video" ===
|
|
10673
|
+
const prevVideo = videoRefs[currentIndex]?.current, currentSlide = slides[currentIndex];
|
|
10674
|
+
prevVideo && currentSlide && "video" === currentSlide.type && prevVideo.pause(),
|
|
10171
10675
|
// Reset transitioning state after transition duration
|
|
10172
10676
|
setTimeout((() => {
|
|
10173
10677
|
setIsTransitioning(!1);
|
|
@@ -10223,7 +10727,13 @@ function useHero(initialProps) {
|
|
|
10223
10727
|
pauseAutoplay: pauseAutoplay,
|
|
10224
10728
|
resumeAutoplay: resumeAutoplay
|
|
10225
10729
|
};
|
|
10226
|
-
}(defaultProps.backgroundSlider
|
|
10730
|
+
}(defaultProps.backgroundSlider || {
|
|
10731
|
+
slides: [],
|
|
10732
|
+
autoplay: {
|
|
10733
|
+
delay: 5e3,
|
|
10734
|
+
pauseOnHover: !0
|
|
10735
|
+
}
|
|
10736
|
+
}), backgroundSlider = hasBackgroundSlider && defaultProps.backgroundSlider ? backgroundSliderResult : void 0, hasBackgroundImage = !!hasBackgroundSlider || !!defaultProps.backgroundImageSrc || !!defaultProps.videoBackground, hasForegroundImage = !!defaultProps.imageSrc, useGridLayout = hasForegroundImage && "center" !== defaultProps.alignment, applyParallaxEffect = (element, intensity = .5) => {
|
|
10227
10737
|
if (!element) return;
|
|
10228
10738
|
// Ensure intensity is between 0 and 1
|
|
10229
10739
|
const safeIntensity = Math.max(0, Math.min(1, intensity));
|
|
@@ -10306,8 +10816,8 @@ function useHero(initialProps) {
|
|
|
10306
10816
|
...initialProps
|
|
10307
10817
|
};
|
|
10308
10818
|
/**
|
|
10309
|
-
|
|
10310
|
-
|
|
10819
|
+
* Check if the river has a background image
|
|
10820
|
+
*/ return {
|
|
10311
10821
|
generateRiverClassNames: (baseClassName = "") => {
|
|
10312
10822
|
const classes = [ RIVER.SELECTORS.RIVER.replace(".", "") ];
|
|
10313
10823
|
// Add layout classes
|
|
@@ -10371,10 +10881,10 @@ function useHero(initialProps) {
|
|
|
10371
10881
|
...initialProps
|
|
10372
10882
|
};
|
|
10373
10883
|
/**
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10884
|
+
* Generate nav class based on properties
|
|
10885
|
+
* @param props - Nav properties
|
|
10886
|
+
* @returns Class string
|
|
10887
|
+
*/ return {
|
|
10378
10888
|
defaultProps: defaultProps,
|
|
10379
10889
|
generateNavClass: props => {
|
|
10380
10890
|
const {alignment: alignment = defaultProps.alignment, variant: variant = defaultProps.variant, className: className = ""} = props;
|
|
@@ -10396,10 +10906,10 @@ function useHero(initialProps) {
|
|
|
10396
10906
|
...initialProps
|
|
10397
10907
|
};
|
|
10398
10908
|
/**
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10909
|
+
* Generate nav item class based on properties
|
|
10910
|
+
* @param props - Nav item properties
|
|
10911
|
+
* @returns Class string
|
|
10912
|
+
*/ return {
|
|
10403
10913
|
defaultProps: defaultProps,
|
|
10404
10914
|
generateNavItemClass: props => {
|
|
10405
10915
|
const {dropdown: dropdown = defaultProps.dropdown, megaMenu: megaMenu = defaultProps.megaMenu, active: active = defaultProps.active, disabled: disabled = defaultProps.disabled, className: className = ""} = props;
|
|
@@ -10425,10 +10935,10 @@ function useHero(initialProps) {
|
|
|
10425
10935
|
...initialProps
|
|
10426
10936
|
}, isInFixedBottomNavbar = () => null !== document.querySelector(".c-navbar--fixed-bottom");
|
|
10427
10937
|
/**
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10938
|
+
* Generate dropdown menu class based on properties
|
|
10939
|
+
* @param props - Dropdown properties
|
|
10940
|
+
* @returns Class string
|
|
10941
|
+
*/ return {
|
|
10432
10942
|
defaultProps: defaultProps,
|
|
10433
10943
|
generateDropdownMenuClass: props => {
|
|
10434
10944
|
const {alignment: alignment = defaultProps.alignment, megaMenu: megaMenu = defaultProps.megaMenu, className: className = ""} = props, baseClass = megaMenu ? NAV.SELECTORS.MEGA_MENU.replace(".", "") : NAV.SELECTORS.DROPDOWN_MENU.replace(".", "");
|
|
@@ -10510,10 +11020,10 @@ function useHero(initialProps) {
|
|
|
10510
11020
|
wrapperRef.current.style.height = "auto");
|
|
10511
11021
|
}), [ defaultProps.isOpen, isOpenState, defaultProps.collapsible, defaultProps.collapsibleDesktop ]);
|
|
10512
11022
|
/**
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
11023
|
+
* Generate side menu class based on properties
|
|
11024
|
+
* @param props - Side menu properties
|
|
11025
|
+
* @returns Class string
|
|
11026
|
+
*/
|
|
10517
11027
|
const handleToggle = () => {
|
|
10518
11028
|
if (defaultProps.disabled) return;
|
|
10519
11029
|
const newState = void 0 !== defaultProps.isOpen ? !defaultProps.isOpen : !isOpenState;
|
|
@@ -10524,9 +11034,9 @@ function useHero(initialProps) {
|
|
|
10524
11034
|
setIsOpenState(newState);
|
|
10525
11035
|
}, getCurrentOpenState = () => void 0 !== defaultProps.isOpen ? defaultProps.isOpen : isOpenState;
|
|
10526
11036
|
/**
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
11037
|
+
* Generate wrapper class
|
|
11038
|
+
* @returns Class string
|
|
11039
|
+
*/ return {
|
|
10530
11040
|
defaultProps: defaultProps,
|
|
10531
11041
|
isOpenState: getCurrentOpenState(),
|
|
10532
11042
|
wrapperRef: wrapperRef,
|
|
@@ -10557,9 +11067,9 @@ function useHero(initialProps) {
|
|
|
10557
11067
|
...initialProps
|
|
10558
11068
|
};
|
|
10559
11069
|
/**
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
11070
|
+
* Generate side menu item class based on properties
|
|
11071
|
+
* @returns Class string
|
|
11072
|
+
*/ return {
|
|
10563
11073
|
defaultProps: defaultProps,
|
|
10564
11074
|
generateSideMenuItemClass: () => {
|
|
10565
11075
|
const {active: active = defaultProps.active, disabled: disabled = defaultProps.disabled, className: className = ""} = defaultProps, activeClass = active ? SIDE_MENU.CLASSES.ACTIVE : "", disabledClass = disabled ? SIDE_MENU.CLASSES.DISABLED : "";
|
|
@@ -10684,7 +11194,8 @@ function useHero(initialProps) {
|
|
|
10684
11194
|
* const style = cssVarsToStyle(vars)
|
|
10685
11195
|
* // Returns: { '--atomix-button-bg': '#000' } as React.CSSProperties
|
|
10686
11196
|
*/ function cssVarsToStyle(vars) {
|
|
10687
|
-
|
|
11197
|
+
var _context;
|
|
11198
|
+
return _reduceInstanceProperty(_context = Object.entries(vars)).call(_context, ((acc, [key, value]) => (acc[key] = "number" == typeof value ? `${value}px` : value,
|
|
10688
11199
|
acc)), {});
|
|
10689
11200
|
}
|
|
10690
11201
|
|
|
@@ -10692,7 +11203,8 @@ function useHero(initialProps) {
|
|
|
10692
11203
|
* Merge multiple CSS variable objects
|
|
10693
11204
|
* Later objects override earlier ones
|
|
10694
11205
|
*/ function mergeCSSVars(...varObjects) {
|
|
10695
|
-
return varObjects.
|
|
11206
|
+
return _reduceInstanceProperty(varObjects).call(varObjects, ((acc, vars) => (vars && Object.assign(acc, vars),
|
|
11207
|
+
acc)), {});
|
|
10696
11208
|
}
|
|
10697
11209
|
|
|
10698
11210
|
/**
|
|
@@ -10725,11 +11237,20 @@ function useHero(initialProps) {
|
|
|
10725
11237
|
|
|
10726
11238
|
/**
|
|
10727
11239
|
* Apply part styles to element props
|
|
10728
|
-
*/
|
|
11240
|
+
*/ function applyPartStyles(baseProps, partStyles) {
|
|
11241
|
+
return partStyles ? {
|
|
11242
|
+
...baseProps,
|
|
11243
|
+
className: mergeClassNames(baseProps.className, partStyles.className),
|
|
11244
|
+
style: {
|
|
11245
|
+
...baseProps.style,
|
|
11246
|
+
...partStyles.style
|
|
11247
|
+
}
|
|
11248
|
+
} : baseProps;
|
|
11249
|
+
}
|
|
11250
|
+
|
|
10729
11251
|
/**
|
|
10730
11252
|
* Create style object from CSS variables
|
|
10731
|
-
*/
|
|
10732
|
-
function createCSSVarStyle(cssVars, baseStyle) {
|
|
11253
|
+
*/ function createCSSVarStyle(cssVars, baseStyle) {
|
|
10733
11254
|
return cssVars ? {
|
|
10734
11255
|
...cssVarsToStyle(cssVars),
|
|
10735
11256
|
...baseStyle
|
|
@@ -10814,31 +11335,121 @@ function mergeComponentProps(baseProps, customization) {
|
|
|
10814
11335
|
}
|
|
10815
11336
|
|
|
10816
11337
|
/**
|
|
10817
|
-
*
|
|
11338
|
+
* Font Preloading Utilities
|
|
11339
|
+
*
|
|
11340
|
+
* Provides utilities for preloading fonts to improve performance
|
|
11341
|
+
* and prevent Flash of Invisible Text (FOIT).
|
|
11342
|
+
*/
|
|
11343
|
+
/**
|
|
11344
|
+
* Creates a preload link element for a font
|
|
11345
|
+
*
|
|
11346
|
+
* @param config - Font preload configuration
|
|
11347
|
+
* @returns HTML link element for preloading
|
|
11348
|
+
*
|
|
11349
|
+
* @example
|
|
11350
|
+
* ```tsx
|
|
11351
|
+
* const preloadLink = createFontPreloadLink({
|
|
11352
|
+
* family: 'Nunito Sans',
|
|
11353
|
+
* path: '/fonts/nunito-sans/nunito-sans-regular.woff2',
|
|
11354
|
+
* weight: 400
|
|
11355
|
+
* });
|
|
11356
|
+
* document.head.appendChild(preloadLink);
|
|
11357
|
+
* ```
|
|
11358
|
+
*/ function createFontPreloadLink(config) {
|
|
11359
|
+
const {path: path, format: format = "woff2", crossorigin: crossorigin = "anonymous"} = config, link = document.createElement("link");
|
|
11360
|
+
return link.rel = "preload", link.as = "font", link.href = path, link.type = `font/${format}`,
|
|
11361
|
+
link.crossOrigin = crossorigin, link;
|
|
11362
|
+
}
|
|
11363
|
+
|
|
11364
|
+
/**
|
|
11365
|
+
* Preloads multiple fonts
|
|
11366
|
+
*
|
|
11367
|
+
* @param fonts - Array of font configurations to preload
|
|
11368
|
+
* @returns Array of created link elements
|
|
11369
|
+
*
|
|
11370
|
+
* @example
|
|
11371
|
+
* ```tsx
|
|
11372
|
+
* const links = preloadFonts([
|
|
11373
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-regular.woff2', weight: 400 },
|
|
11374
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-bold.woff2', weight: 700 },
|
|
11375
|
+
* ]);
|
|
11376
|
+
* links.forEach(link => document.head.appendChild(link));
|
|
11377
|
+
* ```
|
|
11378
|
+
*/ function preloadFonts(fonts) {
|
|
11379
|
+
return fonts.map(createFontPreloadLink);
|
|
11380
|
+
}
|
|
11381
|
+
|
|
11382
|
+
/**
|
|
11383
|
+
* Generates preload link HTML tags as strings
|
|
11384
|
+
* Useful for server-side rendering or static HTML generation
|
|
11385
|
+
*
|
|
11386
|
+
* @param fonts - Array of font configurations
|
|
11387
|
+
* @returns Array of HTML string representations
|
|
11388
|
+
*
|
|
11389
|
+
* @example
|
|
11390
|
+
* ```tsx
|
|
11391
|
+
* const htmlTags = generateFontPreloadTags([
|
|
11392
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-regular.woff2' },
|
|
11393
|
+
* ]);
|
|
11394
|
+
* // Returns: ['<link rel="preload" as="font" href="/fonts/..." type="font/woff2" crossorigin="anonymous">']
|
|
11395
|
+
* ```
|
|
11396
|
+
*/ function generateFontPreloadTags(fonts) {
|
|
11397
|
+
return fonts.map((config => {
|
|
11398
|
+
const {path: path, format: format = "woff2", crossorigin: crossorigin = "anonymous"} = config;
|
|
11399
|
+
return `<link rel="preload" as="font" href="${path}" type="font/${format}" crossorigin="${crossorigin}">`;
|
|
11400
|
+
}));
|
|
11401
|
+
}
|
|
11402
|
+
|
|
11403
|
+
/**
|
|
11404
|
+
* Default font configurations for Atomix Design System
|
|
11405
|
+
* These can be used as a starting point for font preloading
|
|
10818
11406
|
*/ Input.displayName = "Input";
|
|
10819
11407
|
|
|
10820
|
-
|
|
11408
|
+
const DEFAULT_ATOMIX_FONTS = [ {
|
|
11409
|
+
family: "Nunito Sans",
|
|
11410
|
+
path: "/fonts/nunito-sans/nunito-sans-regular.woff2",
|
|
11411
|
+
weight: 400,
|
|
11412
|
+
style: "normal",
|
|
11413
|
+
format: "woff2"
|
|
11414
|
+
}, {
|
|
11415
|
+
family: "Nunito Sans",
|
|
11416
|
+
path: "/fonts/nunito-sans/nunito-sans-bold.woff2",
|
|
11417
|
+
weight: 700,
|
|
11418
|
+
style: "normal",
|
|
11419
|
+
format: "woff2"
|
|
11420
|
+
}, {
|
|
11421
|
+
family: "Nunito Sans",
|
|
11422
|
+
path: "/fonts/nunito-sans/nunito-sans-italic.woff2",
|
|
11423
|
+
weight: 400,
|
|
11424
|
+
style: "italic",
|
|
11425
|
+
format: "woff2"
|
|
11426
|
+
}, {
|
|
11427
|
+
family: "Nunito Sans",
|
|
11428
|
+
path: "/fonts/nunito-sans/nunito-sans-bold-italic.woff2",
|
|
11429
|
+
weight: 700,
|
|
11430
|
+
style: "italic",
|
|
11431
|
+
format: "woff2"
|
|
11432
|
+
} ];
|
|
11433
|
+
|
|
11434
|
+
/**
|
|
11435
|
+
* Utility Functions Exports
|
|
11436
|
+
*/ var utilsImport = Object.freeze({
|
|
10821
11437
|
__proto__: null,
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
...baseProps,
|
|
10825
|
-
className: mergeClassNames(baseProps.className, partStyles.className),
|
|
10826
|
-
style: {
|
|
10827
|
-
...baseProps.style,
|
|
10828
|
-
...partStyles.style
|
|
10829
|
-
}
|
|
10830
|
-
} : baseProps;
|
|
10831
|
-
},
|
|
11438
|
+
DEFAULT_ATOMIX_FONTS: DEFAULT_ATOMIX_FONTS,
|
|
11439
|
+
applyPartStyles: applyPartStyles,
|
|
10832
11440
|
createCSSVarStyle: createCSSVarStyle,
|
|
10833
11441
|
createDebugAttrs: createDebugAttrs,
|
|
11442
|
+
createFontPreloadLink: createFontPreloadLink,
|
|
10834
11443
|
createPartProps: createPartProps,
|
|
10835
11444
|
extractYouTubeId: extractYouTubeId,
|
|
11445
|
+
generateFontPreloadTags: generateFontPreloadTags,
|
|
10836
11446
|
generateUUID: generateUUID,
|
|
10837
11447
|
getPartStyles: getPartStyles,
|
|
10838
11448
|
hasCustomization: hasCustomization,
|
|
10839
11449
|
isYouTubeUrl: isYouTubeUrl,
|
|
10840
11450
|
mergeClassNames: mergeClassNames,
|
|
10841
|
-
mergeComponentProps: mergeComponentProps
|
|
11451
|
+
mergeComponentProps: mergeComponentProps,
|
|
11452
|
+
preloadFonts: preloadFonts
|
|
10842
11453
|
});
|
|
10843
11454
|
|
|
10844
11455
|
/**
|
|
@@ -11000,10 +11611,10 @@ var utilsImport = Object.freeze({
|
|
|
11000
11611
|
...initialProps
|
|
11001
11612
|
};
|
|
11002
11613
|
/**
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11614
|
+
* Generate radio class based on properties
|
|
11615
|
+
* @param props - Radio properties
|
|
11616
|
+
* @returns Class string
|
|
11617
|
+
*/ return {
|
|
11007
11618
|
defaultProps: defaultProps,
|
|
11008
11619
|
generateRadioClass: props => {
|
|
11009
11620
|
const {disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props;
|
|
@@ -11029,10 +11640,10 @@ var utilsImport = Object.freeze({
|
|
|
11029
11640
|
...initialProps
|
|
11030
11641
|
};
|
|
11031
11642
|
/**
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11643
|
+
* Generate select class based on properties
|
|
11644
|
+
* @param props - Select properties
|
|
11645
|
+
* @returns Class string
|
|
11646
|
+
*/ return {
|
|
11036
11647
|
defaultProps: defaultProps,
|
|
11037
11648
|
generateSelectClass: props => {
|
|
11038
11649
|
const {size: size = defaultProps.size, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props, sizeClass = "md" === size ? "" : "sm" === size ? SELECT.CLASSES.SMALL : SELECT.CLASSES.LARGE;
|
|
@@ -11058,10 +11669,10 @@ var utilsImport = Object.freeze({
|
|
|
11058
11669
|
...initialProps
|
|
11059
11670
|
};
|
|
11060
11671
|
/**
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11672
|
+
* Generate textarea class based on properties
|
|
11673
|
+
* @param props - Textarea properties
|
|
11674
|
+
* @returns Class string
|
|
11675
|
+
*/ return {
|
|
11065
11676
|
defaultProps: defaultProps,
|
|
11066
11677
|
generateTextareaClass: props => {
|
|
11067
11678
|
const {size: size = defaultProps.size, variant: variant = defaultProps.variant, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props, sizeClass = "md" === size ? "" : "sm" === size ? TEXTAREA.CLASSES.SMALL : TEXTAREA.CLASSES.LARGE, variantClass = variant ? `c-input--${variant}` : "";
|
|
@@ -11357,7 +11968,7 @@ function useSlider(options) {
|
|
|
11357
11968
|
total: 0,
|
|
11358
11969
|
average: 0
|
|
11359
11970
|
};
|
|
11360
|
-
const values = processedData.map((d => d.value)), min = Math.min(...values), max = Math.max(...values), total = values.
|
|
11971
|
+
const values = processedData.map((d => d.value)), min = Math.min(...values), max = Math.max(...values), total = _reduceInstanceProperty(values).call(values, ((sum, val) => sum + val), 0);
|
|
11361
11972
|
return {
|
|
11362
11973
|
min: min,
|
|
11363
11974
|
max: max,
|
|
@@ -11385,14 +11996,24 @@ function useSlider(options) {
|
|
|
11385
11996
|
if (!data.length) return {
|
|
11386
11997
|
xScale: () => padding.left,
|
|
11387
11998
|
yScale: () => padding.top + innerHeight,
|
|
11999
|
+
minValue: 0,
|
|
12000
|
+
maxValue: 0,
|
|
12001
|
+
valueRange: 0,
|
|
12002
|
+
innerWidth: innerWidth,
|
|
12003
|
+
innerHeight: innerHeight,
|
|
11388
12004
|
width: width,
|
|
11389
12005
|
height: height,
|
|
11390
12006
|
padding: padding
|
|
11391
12007
|
};
|
|
11392
|
-
const values = data.map((d => d.value)), minValue = Math.min(0, ...values),
|
|
12008
|
+
const values = data.map((d => d.value)), minValue = Math.min(0, ...values), maxValue = Math.max(...values), valueRange = maxValue - minValue || 1;
|
|
11393
12009
|
return {
|
|
11394
12010
|
xScale: index => padding.left + index / Math.max(data.length - 1, 1) * innerWidth,
|
|
11395
12011
|
yScale: value => padding.top + innerHeight - (value - minValue) / valueRange * innerHeight,
|
|
12012
|
+
minValue: minValue,
|
|
12013
|
+
maxValue: maxValue,
|
|
12014
|
+
valueRange: valueRange,
|
|
12015
|
+
innerWidth: innerWidth,
|
|
12016
|
+
innerHeight: innerHeight,
|
|
11396
12017
|
width: width,
|
|
11397
12018
|
height: height,
|
|
11398
12019
|
padding: padding
|
|
@@ -11474,7 +12095,7 @@ var composablesImport = Object.freeze({
|
|
|
11474
12095
|
|
|
11475
12096
|
/**
|
|
11476
12097
|
* Select - A component for dropdown selection
|
|
11477
|
-
*/ const Select =
|
|
12098
|
+
*/ const Select = React.memo((({options: options = [], value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder = "Select an option", className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, size: size = "md", invalid: invalid = !1, valid: valid = !1, multiple: multiple = !1, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}) => {
|
|
11478
12099
|
const {generateSelectClass: generateSelectClass} = useSelect({
|
|
11479
12100
|
size: size,
|
|
11480
12101
|
disabled: disabled,
|
|
@@ -11613,14 +12234,14 @@ var composablesImport = Object.freeze({
|
|
|
11613
12234
|
});
|
|
11614
12235
|
}
|
|
11615
12236
|
return selectContent;
|
|
11616
|
-
};
|
|
12237
|
+
}));
|
|
11617
12238
|
|
|
11618
12239
|
Select.displayName = "Select";
|
|
11619
12240
|
|
|
11620
12241
|
/**
|
|
11621
12242
|
* Radio - A component for radio button inputs
|
|
11622
12243
|
*/
|
|
11623
|
-
const Radio =
|
|
12244
|
+
const Radio = React.memo((({label: label, checked: checked = !1, onChange: onChange, className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, value: value, invalid: invalid = !1, valid: valid = !1, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}) => {
|
|
11624
12245
|
const {generateRadioClass: generateRadioClass} = useRadio({
|
|
11625
12246
|
disabled: disabled,
|
|
11626
12247
|
invalid: invalid,
|
|
@@ -11671,14 +12292,14 @@ const Radio = ({label: label, checked: checked = !1, onChange: onChange, classNa
|
|
|
11671
12292
|
});
|
|
11672
12293
|
}
|
|
11673
12294
|
return radioContent;
|
|
11674
|
-
};
|
|
12295
|
+
}));
|
|
11675
12296
|
|
|
11676
12297
|
Radio.displayName = "Radio";
|
|
11677
12298
|
|
|
11678
12299
|
/**
|
|
11679
12300
|
* Textarea - A component for multiline text input
|
|
11680
12301
|
*/
|
|
11681
|
-
const Textarea = React.forwardRef((({value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, className: className = "", style: style, disabled: disabled = !1, required: required = !1, readOnly: readOnly = !1, id: id, name: name, rows: rows = 4, cols: cols, maxLength: maxLength, minLength: minLength, size: size = "md", variant: variant, invalid: invalid = !1, valid: valid = !1, autoFocus: autoFocus = !1, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}, ref) => {
|
|
12302
|
+
const Textarea = React.memo( React.forwardRef((({value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, className: className = "", style: style, disabled: disabled = !1, required: required = !1, readOnly: readOnly = !1, id: id, name: name, rows: rows = 4, cols: cols, maxLength: maxLength, minLength: minLength, size: size = "md", variant: variant, invalid: invalid = !1, valid: valid = !1, autoFocus: autoFocus = !1, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy, glass: glass}, ref) => {
|
|
11682
12303
|
const {generateTextareaClass: generateTextareaClass} = useTextarea({
|
|
11683
12304
|
size: size,
|
|
11684
12305
|
variant: variant,
|
|
@@ -11736,7 +12357,7 @@ const Textarea = React.forwardRef((({value: value, onChange: onChange, onBlur: o
|
|
|
11736
12357
|
});
|
|
11737
12358
|
}
|
|
11738
12359
|
return textareaElement;
|
|
11739
|
-
}));
|
|
12360
|
+
})));
|
|
11740
12361
|
|
|
11741
12362
|
Textarea.displayName = "Textarea";
|
|
11742
12363
|
|
|
@@ -11749,7 +12370,7 @@ Textarea.displayName = "Textarea";
|
|
|
11749
12370
|
* <FooterSocialLink platform="custom" url="https://example.com" icon={<CustomIcon />} label="Custom Platform" />
|
|
11750
12371
|
* ```
|
|
11751
12372
|
*/
|
|
11752
|
-
const FooterSocialLink =
|
|
12373
|
+
const FooterSocialLink = React.forwardRef((({platform: platform, url: url, icon: icon, label: label, size: size = "md", variant: variant = "default", disabled: disabled = !1, className: className = "", ...props}, ref) => {
|
|
11753
12374
|
const linkClass = [ "c-footer__social-link", `c-footer__social-link--${platform}`, `c-footer__social-link--${size}`, `c-footer__social-link--${variant}`, disabled && "c-footer__social-link--disabled", className ].filter(Boolean).join(" "), ariaLabel = label || `Follow us on ${(platform => ({
|
|
11754
12375
|
facebook: "Facebook",
|
|
11755
12376
|
twitter: "Twitter",
|
|
@@ -11834,7 +12455,7 @@ FooterSocialLink.displayName = "FooterSocialLink";
|
|
|
11834
12455
|
* </Grid>
|
|
11835
12456
|
* ```
|
|
11836
12457
|
*/
|
|
11837
|
-
const Grid =
|
|
12458
|
+
const Grid = React.forwardRef((({children: children, className: className = "", justifyContent: justifyContent, alignItems: alignItems, noGutters: noGutters, direction: direction, wrap: wrap, ...props}, ref) => {
|
|
11838
12459
|
const classes = [ "o-grid" ];
|
|
11839
12460
|
return justifyContent && classes.push(`u-justify-content-${justifyContent}`), alignItems && classes.push(`u-align-items-${alignItems}`),
|
|
11840
12461
|
noGutters && classes.push("o-grid--no-gutters"), direction && classes.push(`u-flex-direction-${direction}`),
|
|
@@ -11853,7 +12474,7 @@ Grid.displayName = "Grid";
|
|
|
11853
12474
|
* GridCol component for creating columns within a Grid.
|
|
11854
12475
|
* Uses the CSS grid column classes defined in _objects.grid.scss.
|
|
11855
12476
|
*/
|
|
11856
|
-
const GridCol =
|
|
12477
|
+
const GridCol = React.forwardRef((({children: children, className: className = "", xs: xs, sm: sm, md: md, lg: lg, xl: xl, xxl: xxl, offsetXs: offsetXs, offsetSm: offsetSm, offsetMd: offsetMd, offsetLg: offsetLg, offsetXl: offsetXl, offsetXxl: offsetXxl, grow: grow, shrink: shrink, basis: basis, align: align, ...props}, ref) => {
|
|
11857
12478
|
// If no specific size is provided, use auto class
|
|
11858
12479
|
const classes = xs || sm || md || lg || xl || xxl ? [ "o-grid__col" ] : [ "o-grid__col", "o-grid__col--auto" ], processResponsiveProp = (value, breakpoint) => {
|
|
11859
12480
|
void 0 !== value && (
|
|
@@ -11896,7 +12517,7 @@ GridCol.displayName = "GridCol";
|
|
|
11896
12517
|
* </Container>
|
|
11897
12518
|
* ```
|
|
11898
12519
|
*/
|
|
11899
|
-
const Row =
|
|
12520
|
+
const Row = React.forwardRef((({children: children, className: className = "", justifyContent: justifyContent, alignItems: alignItems, noGutters: noGutters, ...props}, ref) => {
|
|
11900
12521
|
const classes = [ "o-grid" ];
|
|
11901
12522
|
return justifyContent && classes.push(`u-justify-content-${justifyContent}`), alignItems && classes.push(`u-align-items-${alignItems}`),
|
|
11902
12523
|
noGutters && classes.push("o-grid--no-gutters"), className && classes.push(className),
|
|
@@ -11933,7 +12554,7 @@ Row.displayName = "Row";
|
|
|
11933
12554
|
* </Footer>
|
|
11934
12555
|
* ```
|
|
11935
12556
|
*/
|
|
11936
|
-
const Footer =
|
|
12557
|
+
const Footer = React.forwardRef((({brand: brand, brandLogo: brandLogo, brandDescription: brandDescription, copyright: copyright, layout: layout = "columns", variant: variant = "primary", size: size = "md", showNewsletter: showNewsletter = !1, newsletterTitle: newsletterTitle = "Stay Updated", newsletterDescription: newsletterDescription = "Subscribe to our newsletter for the latest updates.", newsletterPlaceholder: newsletterPlaceholder = "Enter your email", newsletterButtonText: newsletterButtonText = "Subscribe", onNewsletterSubmit: onNewsletterSubmit, socialLinks: socialLinks = [], showBackToTop: showBackToTop = !1, backToTopText: backToTopText = "Back to Top", onBackToTop: onBackToTop, showDivider: showDivider = !0, sticky: sticky = !1, children: children, className: className = "", disabled: disabled = !1, glass: glass, ...props}, ref) => {
|
|
11937
12558
|
const {footerClass: footerClass, containerClass: containerClass, brandClass: brandClass, sectionsClass: sectionsClass, bottomClass: bottomClass, handleNewsletterSubmit: handleNewsletterSubmit, handleBackToTop: handleBackToTop, socialLinks: footerSocialLinks} = function(options = {}) {
|
|
11938
12559
|
const {layout: layout = FOOTER.DEFAULTS.LAYOUT, variant: variant = FOOTER.DEFAULTS.VARIANT, size: size = FOOTER.DEFAULTS.SIZE, sticky: sticky = FOOTER.DEFAULTS.STICKY, showNewsletter: showNewsletter = FOOTER.DEFAULTS.SHOW_NEWSLETTER, showBackToTop: showBackToTop = FOOTER.DEFAULTS.SHOW_BACK_TO_TOP, socialLinks: socialLinks = [], onNewsletterSubmit: onNewsletterSubmit, onBackToTop: onBackToTop, className: className = ""} = options;
|
|
11939
12560
|
// Generate footer classes
|
|
@@ -12064,7 +12685,7 @@ const Footer = React.forwardRef((({brand: brand, brandLogo: brandLogo, brandDesc
|
|
|
12064
12685
|
alignItems: "centered" === layout || "stacked" === layout ? "center" : void 0,
|
|
12065
12686
|
children: React__default.default.Children.map(children, (child =>
|
|
12066
12687
|
// Check if the child is a valid React element
|
|
12067
|
-
|
|
12688
|
+
React__default.default.isValidElement(child) ? React__default.default.cloneElement(child, {
|
|
12068
12689
|
showNewsletter: showNewsletter
|
|
12069
12690
|
}) : child))
|
|
12070
12691
|
})
|
|
@@ -12153,7 +12774,7 @@ Footer.displayName = "Footer";
|
|
|
12153
12774
|
* </MasonryGrid>
|
|
12154
12775
|
* ```
|
|
12155
12776
|
*/
|
|
12156
|
-
const MasonryGrid =
|
|
12777
|
+
const MasonryGrid = React.forwardRef((({children: children, className: className = "", xs: xs = 1, sm: sm, md: md, lg: lg, xl: xl, xxl: xxl, gap: gap = 16, animate: animate = !0, imagesLoaded: imagesLoaded = !0, onLayoutComplete: onLayoutComplete, onImageLoad: onImageLoad, ...props}, ref) => {
|
|
12157
12778
|
// === REFS & STATE ===
|
|
12158
12779
|
const [columns, setColumns] = React.useState(xs), [positions, setPositions] = React.useState([]), [layoutComplete, setLayoutComplete] = React.useState(!1), [loadingImages, setLoadingImages] = React.useState(!1), containerRef = React.useRef(null), columnHeights = React.useRef([]), imagesLoadedCount = React.useRef(0), totalImagesCount = React.useRef(0), imageElements = React.useRef(new Map);
|
|
12159
12780
|
React.useEffect((() => {
|
|
@@ -12176,11 +12797,11 @@ const MasonryGrid = React.forwardRef((({children: children, className: className
|
|
|
12176
12797
|
React.useEffect((() => {
|
|
12177
12798
|
const newItems = [];
|
|
12178
12799
|
React.Children.forEach(children, ((child, index) => {
|
|
12179
|
-
|
|
12800
|
+
React.isValidElement(child) && newItems.push({
|
|
12180
12801
|
id: child.key?.toString() || `masonry-item-${index}`,
|
|
12181
12802
|
element: child,
|
|
12182
12803
|
position: null,
|
|
12183
|
-
ref:
|
|
12804
|
+
ref: React__default.default.createRef()
|
|
12184
12805
|
});
|
|
12185
12806
|
})), setItems(newItems);
|
|
12186
12807
|
}), [ children ]);
|
|
@@ -12338,7 +12959,7 @@ MasonryGrid.displayName = "MasonryGrid";
|
|
|
12338
12959
|
* </MasonryGrid>
|
|
12339
12960
|
* ```
|
|
12340
12961
|
*/
|
|
12341
|
-
const MasonryGridItem =
|
|
12962
|
+
const MasonryGridItem = React.forwardRef((({children: children, className: className = "", ...props}, ref) => {
|
|
12342
12963
|
const classes = [ "o-masonry-grid__item-inner" ];
|
|
12343
12964
|
return className && classes.push(className), jsxRuntime.jsx("div", {
|
|
12344
12965
|
ref: ref,
|
|
@@ -12371,7 +12992,7 @@ var layouts = Object.freeze({
|
|
|
12371
12992
|
* <FooterLink href="/product2">Product 2</FooterLink>
|
|
12372
12993
|
* </FooterSection>
|
|
12373
12994
|
* ```
|
|
12374
|
-
*/ const FooterSection =
|
|
12995
|
+
*/ const FooterSection = React.forwardRef((({title: title, icon: icon, collapsible: collapsible = !1, defaultCollapsed: defaultCollapsed = !1, showNewsletter: showNewsletter = !1, children: children, className: className = "", ...props}, ref) => {
|
|
12375
12996
|
const [isCollapsed, setIsCollapsed] = React__default.default.useState(defaultCollapsed), sectionClass = [ "c-footer__section", collapsible && "c-footer__section--collapsible", isCollapsed && "c-footer__section--collapsed", className ].filter(Boolean).join(" ");
|
|
12376
12997
|
return jsxRuntime.jsx(GridCol, {
|
|
12377
12998
|
xs: 12,
|
|
@@ -12435,7 +13056,7 @@ FooterSection.displayName = "FooterSection";
|
|
|
12435
13056
|
* </FooterLink>
|
|
12436
13057
|
* ```
|
|
12437
13058
|
*/
|
|
12438
|
-
const FooterLink =
|
|
13059
|
+
const FooterLink = React.forwardRef((({href: href, icon: icon, external: external = !1, active: active = !1, disabled: disabled = !1, onClick: onClick, children: children, className: className = "", LinkComponent: LinkComponent, ...props}, ref) => {
|
|
12439
13060
|
const linkProps = {
|
|
12440
13061
|
className: [ "c-footer__link", active && "c-footer__link--active", disabled && "c-footer__link--disabled", className ].filter(Boolean).join(" "),
|
|
12441
13062
|
onClick: disabled ? void 0 : onClick,
|
|
@@ -12701,33 +13322,34 @@ const Hero = ({title: title, subtitle: subtitle, text: text, imageSrc: imageSrc,
|
|
|
12701
13322
|
|
|
12702
13323
|
Hero.displayName = "Hero";
|
|
12703
13324
|
|
|
12704
|
-
const List =
|
|
13325
|
+
const List = React.memo((({children: children, variant: variant = "default", className: className = "", style: style, ...props}) => {
|
|
13326
|
+
var _context;
|
|
12705
13327
|
// Generate CSS classes
|
|
12706
|
-
|
|
13328
|
+
const listClasses = [ LIST.BASE_CLASS, "default" !== variant && `c-list--${variant}`, className ].filter(Boolean).join(" "), ListElement = _includesInstanceProperty(_context = [ "number", "text" ]).call(_context, variant) ? "ol" : "ul";
|
|
12707
13329
|
// Determine the HTML element based on variant
|
|
12708
13330
|
return jsxRuntime.jsx(ListElement, {
|
|
12709
13331
|
className: listClasses,
|
|
12710
13332
|
style: style,
|
|
12711
13333
|
...props,
|
|
12712
|
-
children: React__default.default.Children.map(children, (child =>
|
|
12713
|
-
jsxRuntime.jsx("li", {
|
|
13334
|
+
children: React__default.default.Children.map(children, (child => jsxRuntime.jsx("li", {
|
|
12714
13335
|
className: "c-list__item",
|
|
12715
13336
|
children: child
|
|
12716
|
-
})))
|
|
13337
|
+
})))
|
|
12717
13338
|
});
|
|
12718
|
-
};
|
|
13339
|
+
}));
|
|
12719
13340
|
|
|
12720
13341
|
List.displayName = "List";
|
|
12721
13342
|
|
|
12722
13343
|
const ListGroup = ({children: children, className: className = "", style: style, variant: variant = "default"}) => {
|
|
12723
13344
|
// Generate CSS classes
|
|
12724
|
-
const listGroupClasses = [ LIST_GROUP.BASE_CLASS, className ].filter(Boolean).join(" "), validLists = React__default.default.Children.toArray(children).filter((child =>
|
|
13345
|
+
const listGroupClasses = [ LIST_GROUP.BASE_CLASS, className ].filter(Boolean).join(" "), validLists = React__default.default.Children.toArray(children).filter((child => React__default.default.isValidElement(child) && child.type === List));
|
|
12725
13346
|
// Get valid List children
|
|
12726
13347
|
return jsxRuntime.jsx("div", {
|
|
12727
13348
|
className: listGroupClasses,
|
|
12728
13349
|
style: style,
|
|
12729
13350
|
children: validLists.map(((child, index) => {
|
|
12730
13351
|
const childProps = child.props;
|
|
13352
|
+
|
|
12731
13353
|
return React__default.default.cloneElement(child, {
|
|
12732
13354
|
key: index,
|
|
12733
13355
|
variant: childProps?.variant ?? variant
|
|
@@ -12936,7 +13558,7 @@ const Messages = ({messages: messages = [], otherAvatar: otherAvatar, selfAvatar
|
|
|
12936
13558
|
/**
|
|
12937
13559
|
* Modal component for displaying overlay content
|
|
12938
13560
|
*/
|
|
12939
|
-
const Modal =
|
|
13561
|
+
const Modal = React.memo((({children: children, isOpen: isOpen = !1, onOpenChange: onOpenChange, onClose: onClose, onOpen: onOpen, title: title, subtitle: subtitle, size: size = "md", backdrop: backdrop = !0, keyboard: keyboard = !0, className: className = "", style: style, closeButton: closeButton = !0, footer: footer, glass: glass, ...props}) => {
|
|
12940
13562
|
const modalRef = React.useRef(null), dialogRef = React.useRef(null), backdropRef = React.useRef(null), {isOpen: isOpenState, open: open, close: close} =
|
|
12941
13563
|
/**
|
|
12942
13564
|
* Hook for managing modal state
|
|
@@ -13045,7 +13667,8 @@ const Modal = ({children: children, isOpen: isOpen = !1, onOpenChange: onOpenCha
|
|
|
13045
13667
|
}), jsxRuntime.jsx("div", {
|
|
13046
13668
|
ref: dialogRef,
|
|
13047
13669
|
className: "c-modal__dialog",
|
|
13048
|
-
children: glass ?
|
|
13670
|
+
children: glass ?
|
|
13671
|
+
// Default glass settings for modals
|
|
13049
13672
|
(() => {
|
|
13050
13673
|
const defaultGlassProps = {
|
|
13051
13674
|
displacementScale: document.querySelector(".c-modal---glass .c-modal__content")?.clientHeight,
|
|
@@ -13064,7 +13687,7 @@ const Modal = ({children: children, isOpen: isOpen = !1, onOpenChange: onOpenCha
|
|
|
13064
13687
|
})() : modalContent
|
|
13065
13688
|
}) ]
|
|
13066
13689
|
});
|
|
13067
|
-
};
|
|
13690
|
+
}));
|
|
13068
13691
|
|
|
13069
13692
|
Modal.displayName = "Modal";
|
|
13070
13693
|
|
|
@@ -13083,7 +13706,7 @@ Modal.displayName = "Modal";
|
|
|
13083
13706
|
* </Nav>
|
|
13084
13707
|
* ```
|
|
13085
13708
|
*/
|
|
13086
|
-
const Nav =
|
|
13709
|
+
const Nav = React.forwardRef((({children: children, alignment: alignment = "start", variant: variant = "default", className: className = "", disabled: disabled = !1, glass: glass}, ref) => {
|
|
13087
13710
|
const {generateNavClass: generateNavClass} = useNav({
|
|
13088
13711
|
alignment: alignment,
|
|
13089
13712
|
variant: variant
|
|
@@ -13097,8 +13720,9 @@ const Nav = React.forwardRef((({children: children, alignment: alignment = "star
|
|
|
13097
13720
|
role: "menubar",
|
|
13098
13721
|
"aria-orientation": "horizontal",
|
|
13099
13722
|
children: React__default.default.Children.map(children, (child => {
|
|
13100
|
-
if (React__default.default.isValidElement(child)) {
|
|
13723
|
+
if ( React__default.default.isValidElement(child)) {
|
|
13101
13724
|
const childProps = child.props;
|
|
13725
|
+
|
|
13102
13726
|
return React__default.default.cloneElement(child, {
|
|
13103
13727
|
...childProps,
|
|
13104
13728
|
disabled: !!disabled || childProps?.disabled
|
|
@@ -13155,7 +13779,7 @@ Nav.displayName = "Nav";
|
|
|
13155
13779
|
* </NavItem>
|
|
13156
13780
|
* ```
|
|
13157
13781
|
*/
|
|
13158
|
-
const NavItem =
|
|
13782
|
+
const NavItem = React.forwardRef((({children: children, dropdown: dropdown = !1, megaMenu: megaMenu = !1, active: active = !1, href: href, onClick: onClick, className: className = "", disabled: disabled = !1, "aria-expanded": ariaExpanded, LinkComponent: LinkComponent}, ref) => {
|
|
13159
13783
|
const {generateNavItemClass: generateNavItemClass, generateNavLinkClass: generateNavLinkClass, handleClick: handleClick} = useNavItem({
|
|
13160
13784
|
dropdown: dropdown,
|
|
13161
13785
|
megaMenu: megaMenu,
|
|
@@ -13236,7 +13860,7 @@ NavItem.displayName = "NavItem";
|
|
|
13236
13860
|
* </Navbar>
|
|
13237
13861
|
* ```
|
|
13238
13862
|
*/
|
|
13239
|
-
const Navbar =
|
|
13863
|
+
const Navbar = React.forwardRef((({brand: brand, children: children, variant: variant, position: position = "static", containerWidth: containerWidth, collapsible: collapsible = !0, expanded: expanded, onToggle: onToggle, className: className = "", style: style, disabled: disabled = !1, backdrop: backdrop = !1, closeOnOutsideClick: closeOnOutsideClick = !0, closeOnEscape: closeOnEscape = !0, ariaLabel: ariaLabel = "Main navigation", id: id, glass: glass}, ref) => {
|
|
13240
13864
|
const {generateNavbarClass: generateNavbarClass, generateContainerStyle: generateContainerStyle, generateCollapseClass: generateCollapseClass} = useNavbar({
|
|
13241
13865
|
position: position,
|
|
13242
13866
|
collapsible: collapsible,
|
|
@@ -13379,13 +14003,13 @@ function setRef(ref, value) {
|
|
|
13379
14003
|
* ```
|
|
13380
14004
|
*/ Navbar.displayName = "Navbar";
|
|
13381
14005
|
|
|
13382
|
-
const SideMenuList =
|
|
14006
|
+
const SideMenuList = React.forwardRef((({children: children, className: className = ""}, ref) => {
|
|
13383
14007
|
const listClass = `c-side-menu__list ${className}`.trim();
|
|
13384
14008
|
return jsxRuntime.jsx("ul", {
|
|
13385
14009
|
ref: ref,
|
|
13386
14010
|
className: listClass,
|
|
13387
14011
|
role: "list",
|
|
13388
|
-
children: React__default.default.Children.map(children, ((child, index) =>
|
|
14012
|
+
children: React__default.default.Children.map(children, ((child, index) => React__default.default.isValidElement(child) ? jsxRuntime.jsx("li", {
|
|
13389
14013
|
className: "c-side-menu__item",
|
|
13390
14014
|
role: "listitem",
|
|
13391
14015
|
children: child
|
|
@@ -13420,7 +14044,7 @@ SideMenuList.displayName = "SideMenuList";
|
|
|
13420
14044
|
* </SideMenuItem>
|
|
13421
14045
|
* ```
|
|
13422
14046
|
*/
|
|
13423
|
-
const SideMenuItem =
|
|
14047
|
+
const SideMenuItem = React.forwardRef((({children: children, href: href, onClick: onClick, active: active = !1, disabled: disabled = !1, icon: icon, className: className = "", target: target, rel: rel, LinkComponent: LinkComponentProp}, ref) => {
|
|
13424
14048
|
const {LinkComponent: LinkComponentFromContext} = useSideMenuContext(), LinkComponent = LinkComponentProp ?? LinkComponentFromContext, {generateSideMenuItemClass: generateSideMenuItemClass, handleClick: handleClick} = useSideMenuItem({
|
|
13425
14049
|
active: active,
|
|
13426
14050
|
disabled: disabled,
|
|
@@ -13507,7 +14131,7 @@ const SideMenuItem = React.forwardRef((({children: children, href: href, onClick
|
|
|
13507
14131
|
SideMenuItem.displayName = "SideMenuItem";
|
|
13508
14132
|
|
|
13509
14133
|
// Context for passing LinkComponent to SideMenuItem children
|
|
13510
|
-
const SideMenuContext =
|
|
14134
|
+
const SideMenuContext = React.createContext({}), useSideMenuContext = () => React.useContext(SideMenuContext)
|
|
13511
14135
|
/**
|
|
13512
14136
|
* SideMenu component provides a collapsible navigation menu with title and menu items.
|
|
13513
14137
|
* Automatically collapses on mobile devices and can be toggled via a header button.
|
|
@@ -13522,7 +14146,7 @@ const SideMenuContext = React.createContext({}), useSideMenuContext = () => Reac
|
|
|
13522
14146
|
* </SideMenuList>
|
|
13523
14147
|
* </SideMenu>
|
|
13524
14148
|
* ```
|
|
13525
|
-
*/ , SideMenu =
|
|
14149
|
+
*/ , SideMenu = React.forwardRef((({title: title, children: children, menuItems: menuItems = [], isOpen: isOpen, onToggle: onToggle, collapsible: collapsible = !0, collapsibleDesktop: collapsibleDesktop = !1, defaultCollapsedDesktop: defaultCollapsedDesktop = !1, className: className = "", style: style, disabled: disabled = !1, toggleIcon: toggleIcon, id: id, glass: glass, LinkComponent: LinkComponent}, ref) => {
|
|
13526
14150
|
const {isOpenState: isOpenState, wrapperRef: wrapperRef, innerRef: innerRef, sideMenuRef: sideMenuRef, generateSideMenuClass: generateSideMenuClass, generateWrapperClass: generateWrapperClass, handleToggle: handleToggle} = useSideMenu({
|
|
13527
14151
|
isOpen: isOpen,
|
|
13528
14152
|
onToggle: onToggle,
|
|
@@ -13725,7 +14349,7 @@ const SideMenuContext = React.createContext({}), useSideMenuContext = () => Reac
|
|
|
13725
14349
|
// Hook to use SideMenu context
|
|
13726
14350
|
SideMenu.displayName = "SideMenu";
|
|
13727
14351
|
|
|
13728
|
-
const Menu =
|
|
14352
|
+
const Menu = React.forwardRef((({children: children, className: className = "", style: style, disabled: disabled = !1}, ref) => jsxRuntime.jsx("div", {
|
|
13729
14353
|
ref: ref,
|
|
13730
14354
|
className: `c-menu ${className}`,
|
|
13731
14355
|
style: style,
|
|
@@ -13733,9 +14357,10 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13733
14357
|
className: "c-menu__list",
|
|
13734
14358
|
role: "menu",
|
|
13735
14359
|
children: React__default.default.Children.map(children, (child => {
|
|
13736
|
-
if (React__default.default.isValidElement(child)) {
|
|
14360
|
+
if ( React__default.default.isValidElement(child)) {
|
|
13737
14361
|
// Pass disabled prop down to all children if Menu is disabled
|
|
13738
14362
|
const childProps = child.props;
|
|
14363
|
+
|
|
13739
14364
|
return React__default.default.cloneElement(child, {
|
|
13740
14365
|
...childProps,
|
|
13741
14366
|
disabled: !!disabled || childProps?.disabled
|
|
@@ -13744,7 +14369,11 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13744
14369
|
return child;
|
|
13745
14370
|
}))
|
|
13746
14371
|
})
|
|
13747
|
-
})))
|
|
14372
|
+
})));
|
|
14373
|
+
|
|
14374
|
+
Menu.displayName = "Menu";
|
|
14375
|
+
|
|
14376
|
+
const MenuItem = React.forwardRef((({children: children, href: href = "#", icon: icon, active: active = !1, disabled: disabled = !1, onClick: onClick, className: className = ""}, ref) => {
|
|
13748
14377
|
const itemClass = `c-menu__item ${active ? "is-active" : ""} ${disabled ? "is-disabled" : ""} ${className}`;
|
|
13749
14378
|
return jsxRuntime.jsx("li", {
|
|
13750
14379
|
ref: ref,
|
|
@@ -13771,7 +14400,12 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13771
14400
|
})), children ]
|
|
13772
14401
|
})
|
|
13773
14402
|
});
|
|
13774
|
-
}))
|
|
14403
|
+
}));
|
|
14404
|
+
|
|
14405
|
+
MenuItem.displayName = "MenuItem";
|
|
14406
|
+
|
|
14407
|
+
// Map icon-lux names to Phosphor icon names
|
|
14408
|
+
const mapIconName = luxIconName => ({
|
|
13775
14409
|
circle: "Circle",
|
|
13776
14410
|
"caret-down": "CaretDown",
|
|
13777
14411
|
"caret-up": "CaretUp",
|
|
@@ -13785,11 +14419,15 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13785
14419
|
bell: "Bell",
|
|
13786
14420
|
search: "MagnifyingGlass"
|
|
13787
14421
|
}[luxIconName] || "Circle") // Default to Circle if no mapping found
|
|
13788
|
-
, MenuDivider =
|
|
14422
|
+
, MenuDivider = React.forwardRef((({className: className = ""}, ref) => jsxRuntime.jsx("li", {
|
|
13789
14423
|
ref: ref,
|
|
13790
14424
|
className: `c-menu__divider ${className}`,
|
|
13791
14425
|
role: "separator"
|
|
13792
|
-
})))
|
|
14426
|
+
})));
|
|
14427
|
+
|
|
14428
|
+
MenuDivider.displayName = "MenuDivider";
|
|
14429
|
+
|
|
14430
|
+
const MegaMenu = React.forwardRef((({children: children, className: className = "", style: style, disabled: disabled = !1}, ref) => jsxRuntime.jsx("div", {
|
|
13793
14431
|
ref: ref,
|
|
13794
14432
|
className: `c-menu c-menu--mega ${className}`,
|
|
13795
14433
|
style: style,
|
|
@@ -13798,9 +14436,10 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13798
14436
|
children: jsxRuntime.jsx("div", {
|
|
13799
14437
|
className: "c-menu__grid o-grid",
|
|
13800
14438
|
children: React__default.default.Children.map(children, (child => {
|
|
13801
|
-
if (React__default.default.isValidElement(child)) {
|
|
14439
|
+
if ( React__default.default.isValidElement(child)) {
|
|
13802
14440
|
// Pass disabled prop down to all children if MegaMenu is disabled
|
|
13803
14441
|
const childProps = child.props;
|
|
14442
|
+
|
|
13804
14443
|
return React__default.default.cloneElement(child, {
|
|
13805
14444
|
...childProps,
|
|
13806
14445
|
disabled: !!disabled || childProps?.disabled
|
|
@@ -13810,7 +14449,11 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13810
14449
|
}))
|
|
13811
14450
|
})
|
|
13812
14451
|
})
|
|
13813
|
-
})))
|
|
14452
|
+
})));
|
|
14453
|
+
|
|
14454
|
+
MegaMenu.displayName = "MegaMenu";
|
|
14455
|
+
|
|
14456
|
+
const MegaMenuColumn = React.forwardRef((({title: title, icon: icon, children: children, width: width = "auto", className: className = "", disabled: disabled = !1}, ref) => {
|
|
13814
14457
|
const columnClass = `o-grid__col o-grid__col--${width} ${className}`;
|
|
13815
14458
|
return jsxRuntime.jsxs("div", {
|
|
13816
14459
|
ref: ref,
|
|
@@ -13835,13 +14478,13 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13835
14478
|
className: "c-menu__subitems-list",
|
|
13836
14479
|
role: "menu",
|
|
13837
14480
|
children: React__default.default.Children.map(children, (child => {
|
|
13838
|
-
if (React__default.default.isValidElement(child)) {
|
|
14481
|
+
if ( React__default.default.isValidElement(child)) {
|
|
13839
14482
|
// Pass disabled prop down to all children if column is disabled
|
|
13840
14483
|
const childProps = child.props;
|
|
13841
14484
|
return jsxRuntime.jsx("li", {
|
|
13842
14485
|
className: "c-menu__subitem",
|
|
13843
14486
|
role: "menuitem",
|
|
13844
|
-
children:
|
|
14487
|
+
children: React__default.default.cloneElement(child, {
|
|
13845
14488
|
...childProps,
|
|
13846
14489
|
disabled: !!disabled || childProps?.disabled
|
|
13847
14490
|
})
|
|
@@ -13851,7 +14494,11 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13851
14494
|
}))
|
|
13852
14495
|
}) ]
|
|
13853
14496
|
});
|
|
13854
|
-
}))
|
|
14497
|
+
}));
|
|
14498
|
+
|
|
14499
|
+
MegaMenuColumn.displayName = "MegaMenuColumn";
|
|
14500
|
+
|
|
14501
|
+
const MegaMenuLink = React.forwardRef((({href: href, children: children, className: className = "", disabled: disabled = !1, onClick: onClick}, ref) => jsxRuntime.jsx("a", {
|
|
13855
14502
|
ref: ref,
|
|
13856
14503
|
href: href,
|
|
13857
14504
|
className: `c-menu__subitem-link ${disabled ? "is-disabled" : ""} ${className}`,
|
|
@@ -13860,7 +14507,11 @@ const Menu = React.forwardRef((({children: children, className: className = "",
|
|
|
13860
14507
|
},
|
|
13861
14508
|
"aria-disabled": disabled,
|
|
13862
14509
|
children: children
|
|
13863
|
-
})))
|
|
14510
|
+
})));
|
|
14511
|
+
|
|
14512
|
+
MegaMenuLink.displayName = "MegaMenuLink";
|
|
14513
|
+
|
|
14514
|
+
const NavDropdown = React.forwardRef((({title: title, children: children, alignment: alignment = "start", megaMenu: megaMenu = !1, className: className = "", style: style, disabled: disabled = !1}, ref) => {
|
|
13864
14515
|
const {generateDropdownMenuClass: generateDropdownMenuClass, getIconName: getIconName} = useNavDropdown({
|
|
13865
14516
|
alignment: alignment,
|
|
13866
14517
|
megaMenu: megaMenu
|
|
@@ -14500,12 +15151,13 @@ React.useEffect((() => {
|
|
|
14500
15151
|
};
|
|
14501
15152
|
}));
|
|
14502
15153
|
}), [ isMounted, currentIndex, calculateBounds, constrainPosition ]), handleWheel = React.useCallback((event => {
|
|
15154
|
+
var _context;
|
|
14503
15155
|
if (!isMounted || !event || !event.currentTarget) return;
|
|
14504
15156
|
// Additional safety check for the target element
|
|
14505
15157
|
const target = event.currentTarget;
|
|
14506
15158
|
if (target && "function" == typeof target.getBoundingClientRect) {
|
|
14507
15159
|
// Storybook-specific safety check - ensure DOM is ready
|
|
14508
|
-
if ("undefined" != typeof window && window.location?.href?.
|
|
15160
|
+
if ("undefined" != typeof window && (null == (_context = window.location?.href) ? void 0 : Function.call.bind(_includesInstanceProperty(_context), _context))?.("storybook")) try {
|
|
14509
15161
|
// Test if getBoundingClientRect works before proceeding
|
|
14510
15162
|
const testRect = target.getBoundingClientRect();
|
|
14511
15163
|
if (!testRect || 0 === testRect.width || 0 === testRect.height) return;
|
|
@@ -15049,7 +15701,7 @@ React.useEffect((() => {
|
|
|
15049
15701
|
/**
|
|
15050
15702
|
* Hook for managing popover state and positioning logic
|
|
15051
15703
|
*/
|
|
15052
|
-
const PopoverContext =
|
|
15704
|
+
const PopoverContext = React.createContext({
|
|
15053
15705
|
isOpen: !1,
|
|
15054
15706
|
setIsOpen: () => {},
|
|
15055
15707
|
triggerRef: {
|
|
@@ -15234,7 +15886,7 @@ const PopoverContext = React.createContext({
|
|
|
15234
15886
|
popoverId: popoverId,
|
|
15235
15887
|
triggerType: trigger
|
|
15236
15888
|
},
|
|
15237
|
-
children: [ children, "undefined" != typeof document &&
|
|
15889
|
+
children: [ children, "undefined" != typeof document && reactDom.createPortal(jsxRuntime.jsxs("div", {
|
|
15238
15890
|
ref: popoverRef,
|
|
15239
15891
|
className: `c-popover c-popover--${currentPosition} ${isOpen ? POPOVER.CLASSES.IS_OPEN : ""} ${glass ? "c-popover--glass" : ""} ${className}`,
|
|
15240
15892
|
style: style,
|
|
@@ -15281,10 +15933,7 @@ const PopoverContext = React.createContext({
|
|
|
15281
15933
|
};
|
|
15282
15934
|
|
|
15283
15935
|
// Context to share popover state between components
|
|
15284
|
-
|
|
15285
|
-
* PopoverTrigger component to wrap the element that triggers the popover
|
|
15286
|
-
*/
|
|
15287
|
-
React.forwardRef((({children: children, trigger: triggerProp}, ref) => {
|
|
15936
|
+
React.forwardRef((({children: children, trigger: triggerProp}, ref) => {
|
|
15288
15937
|
const {isOpen: isOpen, setIsOpen: setIsOpen, triggerRef: triggerRef, popoverId: popoverId, triggerType: triggerType} = React__default.default.useContext(PopoverContext), effectiveTrigger = triggerProp || triggerType, child = React__default.default.Children.only(children), triggerProps = {
|
|
15289
15938
|
ref: ref || triggerRef,
|
|
15290
15939
|
"aria-describedby": popoverId,
|
|
@@ -15297,13 +15946,13 @@ React.forwardRef((({children: children, trigger: triggerProp}, ref) => {
|
|
|
15297
15946
|
setIsOpen(!0);
|
|
15298
15947
|
}, triggerProps.onMouseLeave = () => {
|
|
15299
15948
|
setIsOpen(!1);
|
|
15300
|
-
}),
|
|
15301
|
-
})), Popover.displayName = "Popover";
|
|
15949
|
+
}), React__default.default.cloneElement(child, triggerProps);
|
|
15950
|
+
})).displayName = "PopoverTrigger", Popover.displayName = "Popover";
|
|
15302
15951
|
|
|
15303
15952
|
/**
|
|
15304
15953
|
* Hook for managing rating component state and interactions
|
|
15305
15954
|
*/
|
|
15306
|
-
const Rating =
|
|
15955
|
+
const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultValue, maxValue: maxValue = 5, allowHalf: allowHalf = !1, readOnly: readOnly = !1, size: size = "md", color: color, onChange: onChange, className: className = "", style: style, label: label, id: id, useVanillaJS: useVanillaJS = !1, glass: glass, ...restProps}, ref) => {
|
|
15307
15956
|
const internalRef = React.useRef(null), ratingInstance = React.useRef(null), {currentValue: currentValue, hoverValue: hoverValue, focusedIndex: focusedIndex, setHoverValue: setHoverValue, setFocused: setFocused, handleKeyDown: handleKeyDown} = (({value: value = 0, maxValue: maxValue = 5, allowHalf: allowHalf = !1, readOnly: readOnly = !1, onChange: onChange}) => {
|
|
15308
15957
|
// Determine if component is in controlled mode
|
|
15309
15958
|
const isControlled = void 0 !== onChange, [internalValue, setInternalValue] = React.useState(value), [hoverValue, setHoverValue] = React.useState(null), [focusedIndex, setFocusedIndex] = React.useState(null), currentValue = isControlled ? value : internalValue, handleMouseEnter = React.useCallback((starValue => {
|
|
@@ -15364,7 +16013,7 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultVa
|
|
|
15364
16013
|
allowHalf: allowHalf,
|
|
15365
16014
|
readOnly: readOnly,
|
|
15366
16015
|
onChange: onChange
|
|
15367
|
-
}), handleMouseEnter = React.useCallback(((e, starValue) => {
|
|
16016
|
+
}), forkedRef = useForkRef(internalRef, ref), handleMouseEnter = React.useCallback(((e, starValue) => {
|
|
15368
16017
|
if (!readOnly) if (allowHalf) {
|
|
15369
16018
|
// Get the star element's bounding rectangle
|
|
15370
16019
|
const starRect = e.currentTarget.getBoundingClientRect(), starCenterX = starRect.left + starRect.width / 2, adjustedValue = e.clientX < starCenterX ? starValue - .5 : starValue;
|
|
@@ -15415,7 +16064,7 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultVa
|
|
|
15415
16064
|
// If using vanilla JS, just render the container
|
|
15416
16065
|
if (useVanillaJS) return jsxRuntime.jsx("div", {
|
|
15417
16066
|
className: ratingClasses,
|
|
15418
|
-
ref:
|
|
16067
|
+
ref: forkedRef,
|
|
15419
16068
|
id: id,
|
|
15420
16069
|
...restProps
|
|
15421
16070
|
});
|
|
@@ -15423,7 +16072,7 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultVa
|
|
|
15423
16072
|
// Determine the effective value (either hovered or actual)
|
|
15424
16073
|
const effectiveValue = null !== hoverValue ? hoverValue : currentValue, ratingContent = jsxRuntime.jsx("div", {
|
|
15425
16074
|
className: ratingClasses,
|
|
15426
|
-
ref:
|
|
16075
|
+
ref: forkedRef,
|
|
15427
16076
|
id: id,
|
|
15428
16077
|
style: style,
|
|
15429
16078
|
"data-readonly": readOnly ? "true" : "false",
|
|
@@ -15628,7 +16277,7 @@ ProductReview.displayName = "ProductReview";
|
|
|
15628
16277
|
/**
|
|
15629
16278
|
* Hook for managing Progress component state and behavior
|
|
15630
16279
|
*/
|
|
15631
|
-
const Progress = React.forwardRef((({value: value, variant: variant = "primary", size: size = "md", className: className = "", style: style, disabled: disabled = !1, ariaLabel: ariaLabel = PROGRESS.DEFAULTS.ARIA_LABEL, glass: glass}, ref) => {
|
|
16280
|
+
const Progress = React.memo( React.forwardRef((({value: value, variant: variant = "primary", size: size = "md", className: className = "", style: style, disabled: disabled = !1, ariaLabel: ariaLabel = PROGRESS.DEFAULTS.ARIA_LABEL, glass: glass}, ref) => {
|
|
15632
16281
|
const {progressValue: progressValue, progressStyle: progressStyle, progressClasses: progressClasses} = (({value: value, variant: variant = "primary", size: size = "md", className: className = ""}) => {
|
|
15633
16282
|
// Clamp value between 0 and 100
|
|
15634
16283
|
const progressValue = Math.min(Math.max(value, 0), 100), baseClass = "c-progress";
|
|
@@ -15678,7 +16327,14 @@ const Progress = React.forwardRef((({value: value, variant: variant = "primary",
|
|
|
15678
16327
|
});
|
|
15679
16328
|
}
|
|
15680
16329
|
return progressContent;
|
|
15681
|
-
}))
|
|
16330
|
+
})));
|
|
16331
|
+
|
|
16332
|
+
Progress.displayName = "Progress";
|
|
16333
|
+
|
|
16334
|
+
/**
|
|
16335
|
+
* River component for displaying content with image sections
|
|
16336
|
+
*/
|
|
16337
|
+
const River = ({title: title, text: text, actions: actions, imageSrc: imageSrc, imageAlt: imageAlt = "Image", center: center = !1, breakout: breakout = !1, reverse: reverse = !1, contentColumns: contentColumns, backgroundImageSrc: backgroundImageSrc, showOverlay: showOverlay = !0, contentWidth: contentWidth, className: className = "", style: style}) => {
|
|
15682
16338
|
const {generateRiverClassNames: generateRiverClassNames, generateContentClass: generateContentClass, generateVisualClass: generateVisualClass, hasBackgroundImage: hasBackgroundImage, hasForegroundImage: hasForegroundImage, textContent: textContent} = useRiver({
|
|
15683
16339
|
title: title,
|
|
15684
16340
|
text: text,
|
|
@@ -15856,9 +16512,22 @@ const SectionIntro = ({title: title, label: label, text: text, actions: actions,
|
|
|
15856
16512
|
|
|
15857
16513
|
SectionIntro.displayName = "SectionIntro";
|
|
15858
16514
|
|
|
15859
|
-
const Slider =
|
|
15860
|
-
const {slides: slides = [], height: height = 300, width: width = "100%", slidesToShow: slidesToShow = 1, spaceBetween: spaceBetween = 0, loop: loop = !1, initialSlide: initialSlide = 0, direction: direction = "horizontal", speed: speed = 300, allowTouchMove: allowTouchMove = !0, threshold: threshold = 50, grabCursor: grabCursor = !0, autoplay: autoplay, navigation: navigation, pagination: pagination, className: className, style: style, onSlideChange: onSlideChange, ...rest} = props
|
|
15861
|
-
|
|
16515
|
+
const Slider = React.forwardRef(((props, ref) => {
|
|
16516
|
+
const {slides: slides = [], height: height = 300, width: width = "100%", slidesToShow: slidesToShow = 1, spaceBetween: spaceBetween = 0, loop: loop = !1, initialSlide: initialSlide = 0, direction: direction = "horizontal", speed: speed = 300, allowTouchMove: allowTouchMove = !0, threshold: threshold = 50, grabCursor: grabCursor = !0, autoplay: autoplay, navigation: navigation, pagination: pagination, className: className, style: style, onSlideChange: onSlideChange, ...rest} = props, slider = useSlider({
|
|
16517
|
+
slides: slides || [],
|
|
16518
|
+
slidesToShow: slidesToShow,
|
|
16519
|
+
spaceBetween: spaceBetween,
|
|
16520
|
+
loop: loop,
|
|
16521
|
+
initialSlide: initialSlide,
|
|
16522
|
+
direction: direction,
|
|
16523
|
+
speed: speed,
|
|
16524
|
+
allowTouchMove: allowTouchMove,
|
|
16525
|
+
threshold: threshold,
|
|
16526
|
+
autoplay: autoplay,
|
|
16527
|
+
onSlideChange: onSlideChange
|
|
16528
|
+
}), {containerRef: containerRef, wrapperRef: wrapperRef, allSlides: allSlides, realIndex: realIndex, translateValue: translateValue, slideWidth: slideWidth, transitioning: transitioning, touching: touching, slideNext: slideNext, slidePrev: slidePrev, goToSlide: goToSlide, canSlideNext: canSlideNext, canSlidePrev: canSlidePrev, handleTouchStart: handleTouchStart, handleTouchMove: handleTouchMove, handleTouchEnd: handleTouchEnd, loopedSlides: loopedSlides} = slider, totalWrapperWidth = React.useMemo((() => 0 === slideWidth ? 0 : allSlides.length * (slideWidth + spaceBetween) - spaceBetween), [ allSlides.length, slideWidth, spaceBetween ]);
|
|
16529
|
+
// Hooks must be called unconditionally - before early return
|
|
16530
|
+
if (!slides || 0 === slides.length) return jsxRuntime.jsx("div", {
|
|
15862
16531
|
className: "c-slider c-slider--empty",
|
|
15863
16532
|
style: {
|
|
15864
16533
|
height: height,
|
|
@@ -15870,19 +16539,7 @@ const Slider = React.forwardRef(((props, ref) => {
|
|
|
15870
16539
|
children: "No slides available"
|
|
15871
16540
|
})
|
|
15872
16541
|
});
|
|
15873
|
-
const
|
|
15874
|
-
slides: slides,
|
|
15875
|
-
slidesToShow: slidesToShow,
|
|
15876
|
-
spaceBetween: spaceBetween,
|
|
15877
|
-
loop: loop,
|
|
15878
|
-
initialSlide: initialSlide,
|
|
15879
|
-
direction: direction,
|
|
15880
|
-
speed: speed,
|
|
15881
|
-
allowTouchMove: allowTouchMove,
|
|
15882
|
-
threshold: threshold,
|
|
15883
|
-
autoplay: autoplay,
|
|
15884
|
-
onSlideChange: onSlideChange
|
|
15885
|
-
}), {containerRef: containerRef, wrapperRef: wrapperRef, allSlides: allSlides, realIndex: realIndex, translateValue: translateValue, slideWidth: slideWidth, transitioning: transitioning, touching: touching, slideNext: slideNext, slidePrev: slidePrev, goToSlide: goToSlide, canSlideNext: canSlideNext, canSlidePrev: canSlidePrev, handleTouchStart: handleTouchStart, handleTouchMove: handleTouchMove, handleTouchEnd: handleTouchEnd, loopedSlides: loopedSlides} = slider, totalWrapperWidth = React.useMemo((() => 0 === slideWidth ? 0 : allSlides.length * (slideWidth + spaceBetween) - spaceBetween), [ allSlides.length, slideWidth, spaceBetween ]), containerClasses = [ "c-slider", "vertical" === direction && "c-slider--vertical", grabCursor && "c-slider--grab-cursor", touching && "c-slider--grabbing", loop && "c-slider--loop", className ].filter(Boolean).join(" ");
|
|
16542
|
+
const containerClasses = [ "c-slider", "vertical" === direction && "c-slider--vertical", grabCursor && "c-slider--grab-cursor", touching && "c-slider--grabbing", loop && "c-slider--loop", className ].filter(Boolean).join(" ");
|
|
15886
16543
|
return jsxRuntime.jsxs("div", {
|
|
15887
16544
|
ref: ref || containerRef,
|
|
15888
16545
|
className: containerClasses,
|
|
@@ -16048,7 +16705,7 @@ Steps.displayName = "Steps";
|
|
|
16048
16705
|
/**
|
|
16049
16706
|
* Tabs component for switching between different content panels
|
|
16050
16707
|
*/
|
|
16051
|
-
const Tabs =
|
|
16708
|
+
const Tabs = React.memo((({items: items, activeIndex: activeIndex = TAB.DEFAULTS.ACTIVE_INDEX, onTabChange: onTabChange, className: className = "", style: style, glass: glass}) => {
|
|
16052
16709
|
const [currentTab, setCurrentTab] = React.useState(activeIndex), tabContent = jsxRuntime.jsxs("div", {
|
|
16053
16710
|
className: `c-tabs js-atomix-tab ${className}`,
|
|
16054
16711
|
style: style,
|
|
@@ -16109,7 +16766,7 @@ const Tabs = ({items: items, activeIndex: activeIndex = TAB.DEFAULTS.ACTIVE_INDE
|
|
|
16109
16766
|
});
|
|
16110
16767
|
}
|
|
16111
16768
|
return tabContent;
|
|
16112
|
-
};
|
|
16769
|
+
}));
|
|
16113
16770
|
|
|
16114
16771
|
Tabs.displayName = "Tabs";
|
|
16115
16772
|
|
|
@@ -16273,13 +16930,12 @@ const Todo = ({items: items = [], title: title = "Todo List", onAddTodo: onAddTo
|
|
|
16273
16930
|
type: "checkbox",
|
|
16274
16931
|
className: "c-todo__checkbox c-checkbox",
|
|
16275
16932
|
checked: item.completed,
|
|
16276
|
-
onChange: () => {
|
|
16277
|
-
|
|
16933
|
+
onChange: () => (id => {
|
|
16934
|
+
disabled || (setLocalItems((prevItems => prevItems.map((item => item.id === id ? {
|
|
16278
16935
|
...item,
|
|
16279
16936
|
completed: !item.completed
|
|
16280
|
-
} : item)))), onToggleTodo && onToggleTodo(id))
|
|
16281
|
-
|
|
16282
|
-
},
|
|
16937
|
+
} : item)))), onToggleTodo && onToggleTodo(id));
|
|
16938
|
+
})(item.id),
|
|
16283
16939
|
disabled: disabled,
|
|
16284
16940
|
"aria-label": `Mark "${item.text}" as ${item.completed ? "incomplete" : "complete"}`
|
|
16285
16941
|
}), jsxRuntime.jsx("span", {
|
|
@@ -16289,11 +16945,10 @@ const Todo = ({items: items = [], title: title = "Todo List", onAddTodo: onAddTo
|
|
|
16289
16945
|
}), jsxRuntime.jsx("button", {
|
|
16290
16946
|
type: "button",
|
|
16291
16947
|
className: "c-todo__delete-btn c-btn c-btn--error c-btn--sm",
|
|
16292
|
-
onClick: () => {
|
|
16293
|
-
|
|
16294
|
-
onDeleteTodo && onDeleteTodo(id))
|
|
16295
|
-
|
|
16296
|
-
},
|
|
16948
|
+
onClick: () => (id => {
|
|
16949
|
+
disabled || (setLocalItems((prevItems => prevItems.filter((item => item.id !== id)))),
|
|
16950
|
+
onDeleteTodo && onDeleteTodo(id));
|
|
16951
|
+
})(item.id),
|
|
16297
16952
|
disabled: disabled,
|
|
16298
16953
|
"aria-label": `Delete "${item.text}"`,
|
|
16299
16954
|
children: jsxRuntime.jsx(Icon, {
|
|
@@ -16359,7 +17014,7 @@ Toggle.displayName = "Toggle";
|
|
|
16359
17014
|
/**
|
|
16360
17015
|
* Calculate tooltip and arrow positions based on trigger and tooltip dimensions
|
|
16361
17016
|
*/
|
|
16362
|
-
const Tooltip =
|
|
17017
|
+
const Tooltip = React.memo((({content: content, children: children, position: position = TOOLTIP.DEFAULTS.POSITION, trigger: trigger = TOOLTIP.DEFAULTS.TRIGGER, className: className = "", style: style, delay: delay = TOOLTIP.DEFAULTS.DELAY, offset: offset = TOOLTIP.DEFAULTS.OFFSET, glass: glass}) => {
|
|
16363
17018
|
const {isVisible: isVisible, isPositioned: isPositioned, tooltipId: tooltipId, triggerRef: triggerRef, tooltipRef: tooltipRef, tooltipStyle: tooltipStyle, arrowStyle: arrowStyle, triggerProps: triggerProps, wrapperProps: wrapperProps} = (({position: position = "top", trigger: trigger = "hover", offset: offset = 10, delay: delay = 200}) => {
|
|
16364
17019
|
const [isVisible, setIsVisible] = React.useState(!1), [isPositioned, setIsPositioned] = React.useState(!1), [tooltipStyle, setTooltipStyle] = React.useState({}), [arrowStyle, setArrowStyle] = React.useState({}), timeoutRef = React.useRef(null), triggerRef = React.useRef(null), tooltipRef = React.useRef(null), tooltipId = `tooltip-${Math.random().toString(36).slice(2, 11)}`, showTooltip = React.useCallback((() => {
|
|
16365
17020
|
timeoutRef.current && clearTimeout(timeoutRef.current), delay > 0 ? timeoutRef.current = setTimeout((() => {
|
|
@@ -16536,7 +17191,7 @@ const Tooltip = ({content: content, children: children, position: position = TOO
|
|
|
16536
17191
|
})()
|
|
16537
17192
|
}) ]
|
|
16538
17193
|
});
|
|
16539
|
-
};
|
|
17194
|
+
}));
|
|
16540
17195
|
|
|
16541
17196
|
/**
|
|
16542
17197
|
* Get arrow size from CSS custom property
|
|
@@ -16699,13 +17354,14 @@ Upload.displayName = "Upload";
|
|
|
16699
17354
|
/**
|
|
16700
17355
|
* Advanced Video Player Component
|
|
16701
17356
|
*/
|
|
16702
|
-
const VideoPlayer =
|
|
17357
|
+
const VideoPlayer = React.forwardRef((({src: src, type: type = "video", youtubeId: youtubeId, poster: poster, autoplay: autoplay = !1, loop: loop = !1, muted: muted = !1, controls: controls = !0, preload: preload = "metadata", width: width, height: height, aspectRatio: aspectRatio = "16:9", className: className = "", onPlay: onPlay, onPause: onPause, onEnded: onEnded, onTimeUpdate: onTimeUpdate, onVolumeChange: onVolumeChange, onFullscreenChange: onFullscreenChange, onError: onError, showDownload: showDownload = !1, showShare: showShare = !1, showSettings: showSettings = !0, playbackRates: playbackRates = [ .5, .75, 1, 1.25, 1.5, 2 ], subtitles: subtitles, quality: quality, ambientMode: ambientMode = !1, glass: glass = !1, glassOpacity: glassOpacity = 1, glassContent: glassContent, style: style, ...props}, ref) => {
|
|
16703
17358
|
const videoRef = React.useRef(null), containerRef = React.useRef(null), canvasRef = React.useRef(null), iframeRef = React.useRef(null), [containerBorderRadius, setContainerBorderRadius] = React.useState(8), isYouTube = "youtube" === type || youtubeId || src && isYouTubeUrl(src), videoId = youtubeId || (isYouTube && src ? extractYouTubeId(src) : null), {isPlaying: isPlaying, currentTime: currentTime, duration: duration, volume: volume, isMuted: isMuted, isFullscreen: isFullscreen, isLoading: isLoading, playbackRate: playbackRate, currentQuality: currentQuality, showControls: showControls, play: play, pause: pause, togglePlay: togglePlay, seek: seek, setVolume: setVolume, toggleMute: toggleMute, toggleFullscreen: toggleFullscreen, togglePictureInPicture: togglePictureInPicture, setPlaybackRate: setPlaybackRate, setQuality: setQuality, formatTime: formatTime, getProgressPercentage: getProgressPercentage, getBufferedPercentage: getBufferedPercentage} = function({videoRef: videoRef, containerRef: containerRef, onPlay: onPlay, onPause: onPause, onEnded: onEnded, onTimeUpdate: onTimeUpdate, onVolumeChange: onVolumeChange, onFullscreenChange: onFullscreenChange, onError: onError, playbackRates: playbackRates = [ .5, .75, 1, 1.25, 1.5, 2 ], quality: quality}) {
|
|
16704
17359
|
const [isPlaying, setIsPlaying] = React.useState(!1), [currentTime, setCurrentTime] = React.useState(0), [duration, setDuration] = React.useState(0), [volume, setVolumeState] = React.useState(1), [isMuted, setIsMuted] = React.useState(!1), [isFullscreen, setIsFullscreen] = React.useState(!1), [isPictureInPicture, setIsPictureInPicture] = React.useState(!1), [isLoading, setIsLoading] = React.useState(!1), [buffered, setBuffered] = React.useState(0), [playbackRate, setPlaybackRateState] = React.useState(1), [currentQuality, setCurrentQuality] = React.useState(quality?.[0] || null), [showControls, setShowControls] = React.useState(!0), controlsTimeoutRef = React.useRef(null), resetControlsTimeout = React.useCallback((() => {
|
|
16705
|
-
controlsTimeoutRef.current && clearTimeout(controlsTimeoutRef.current), setShowControls(!0)
|
|
16706
|
-
|
|
17360
|
+
controlsTimeoutRef.current && clearTimeout(controlsTimeoutRef.current), setShowControls(!0);
|
|
17361
|
+
const timeout = setTimeout((() => {
|
|
16707
17362
|
isPlaying && setShowControls(!1);
|
|
16708
17363
|
}), 3e3);
|
|
17364
|
+
controlsTimeoutRef.current = timeout;
|
|
16709
17365
|
}), [ isPlaying ]), play = React.useCallback((async () => {
|
|
16710
17366
|
if (videoRef.current) try {
|
|
16711
17367
|
await videoRef.current.play(), setIsPlaying(!0), onPlay?.();
|
|
@@ -16740,7 +17396,7 @@ const VideoPlayer = React.forwardRef((({src: src, type: type = "video", youtubeI
|
|
|
16740
17396
|
console.error("Picture-in-picture error:", error);
|
|
16741
17397
|
}
|
|
16742
17398
|
}), [ videoRef, isPictureInPicture ]), setPlaybackRate = React.useCallback((rate => {
|
|
16743
|
-
videoRef.current && playbackRates.
|
|
17399
|
+
videoRef.current && _includesInstanceProperty(playbackRates).call(playbackRates, rate) && (videoRef.current.playbackRate = rate,
|
|
16744
17400
|
setPlaybackRateState(rate));
|
|
16745
17401
|
}), [ videoRef, playbackRates ]), setQuality = React.useCallback((newQuality => {
|
|
16746
17402
|
if (videoRef.current && quality) {
|
|
@@ -17584,41 +18240,37 @@ function validateConfig(config) {
|
|
|
17584
18240
|
function(themes) {
|
|
17585
18241
|
const errors = [], warnings = [];
|
|
17586
18242
|
0 === Object.keys(themes).length && warnings.push("No themes defined in configuration");
|
|
17587
|
-
for (const [themeId, theme] of Object.entries(themes))
|
|
17588
|
-
|
|
17589
|
-
|
|
17590
|
-
|
|
17591
|
-
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
var version;
|
|
17619
|
-
/**
|
|
17620
|
-
* Check if string is valid color
|
|
17621
|
-
*/ return {
|
|
18243
|
+
for (const [themeId, theme] of Object.entries(themes)) {
|
|
18244
|
+
var _context;
|
|
18245
|
+
// Validate theme ID
|
|
18246
|
+
if (themeId && "string" == typeof themeId)
|
|
18247
|
+
// Validate theme object
|
|
18248
|
+
if (theme && "object" == typeof theme)
|
|
18249
|
+
// Validate theme type
|
|
18250
|
+
if (!theme.type || "css" !== theme.type && "js" !== theme.type) errors.push(`Theme "${themeId}" must have type "css" or "js"`); else {
|
|
18251
|
+
// Validate CSS theme
|
|
18252
|
+
if (
|
|
18253
|
+
// Validate required fields
|
|
18254
|
+
theme.name && "string" == typeof theme.name || errors.push(`Theme "${themeId}" must have a "name" string`),
|
|
18255
|
+
"css" === theme.type) {
|
|
18256
|
+
const cssErrors = validateCSSTheme();
|
|
18257
|
+
errors.push(...cssErrors.errors), warnings.push(...cssErrors.warnings);
|
|
18258
|
+
}
|
|
18259
|
+
// Validate JS theme
|
|
18260
|
+
if ("js" === theme.type) {
|
|
18261
|
+
const jsErrors = validateJSTheme(themeId, theme);
|
|
18262
|
+
errors.push(...jsErrors.errors), warnings.push(...jsErrors.warnings);
|
|
18263
|
+
}
|
|
18264
|
+
// Validate metadata
|
|
18265
|
+
theme.version && !isValidSemver(theme.version) && warnings.push(`Theme "${themeId}" has invalid version format: ${theme.version}`),
|
|
18266
|
+
theme.status && !_includesInstanceProperty(_context = [ "stable", "beta", "experimental", "deprecated" ]).call(_context, theme.status) && warnings.push(`Theme "${themeId}" has invalid status: ${theme.status}`),
|
|
18267
|
+
// Validate color format
|
|
18268
|
+
theme.color && !isValidColor(theme.color) && warnings.push(`Theme "${themeId}" has invalid color format: ${theme.color}`),
|
|
18269
|
+
// Validate accessibility
|
|
18270
|
+
theme.a11y && theme.a11y.contrastTarget && (theme.a11y.contrastTarget < 1 || theme.a11y.contrastTarget > 21) && warnings.push(`Theme "${themeId}" has invalid contrast target: ${theme.a11y.contrastTarget}`);
|
|
18271
|
+
} else errors.push(`Theme "${themeId}" must be an object`); else errors.push(`Invalid theme ID: ${themeId}`);
|
|
18272
|
+
}
|
|
18273
|
+
return {
|
|
17622
18274
|
valid: 0 === errors.length,
|
|
17623
18275
|
errors: errors,
|
|
17624
18276
|
warnings: warnings
|
|
@@ -17638,9 +18290,10 @@ function validateConfig(config) {
|
|
|
17638
18290
|
*/
|
|
17639
18291
|
function(build) {
|
|
17640
18292
|
const errors = [], warnings = [];
|
|
18293
|
+
var _context2;
|
|
17641
18294
|
return build.output && "object" == typeof build.output ? (build.output.directory && "string" == typeof build.output.directory || errors.push('Build output must have a "directory" string'),
|
|
17642
18295
|
build.output.formats && "object" == typeof build.output.formats || errors.push('Build output must have a "formats" object')) : errors.push('Build config must have an "output" object'),
|
|
17643
|
-
build.sass && "object" == typeof build.sass ? build.sass.style && ![ "expanded", "compressed", "compact", "nested" ].
|
|
18296
|
+
build.sass && "object" == typeof build.sass ? build.sass.style && !_includesInstanceProperty(_context2 = [ "expanded", "compressed", "compact", "nested" ]).call(_context2, build.sass.style) && warnings.push(`Invalid Sass style: ${build.sass.style}`) : errors.push('Build config must have a "sass" object'),
|
|
17644
18297
|
{
|
|
17645
18298
|
valid: 0 === errors.length,
|
|
17646
18299
|
errors: errors,
|
|
@@ -17704,7 +18357,10 @@ function validateConfig(config) {
|
|
|
17704
18357
|
errors: errors,
|
|
17705
18358
|
warnings: warnings
|
|
17706
18359
|
};
|
|
17707
|
-
}
|
|
18360
|
+
}
|
|
18361
|
+
/**
|
|
18362
|
+
* Check if string is valid semver
|
|
18363
|
+
*/ (config.dependencies, config.themes || {});
|
|
17708
18364
|
errors.push(...depErrors.errors), warnings.push(...depErrors.warnings);
|
|
17709
18365
|
}
|
|
17710
18366
|
return {
|
|
@@ -17738,13 +18394,22 @@ function validateCSSTheme(themeId, theme) {
|
|
|
17738
18394
|
};
|
|
17739
18395
|
}
|
|
17740
18396
|
|
|
17741
|
-
function
|
|
18397
|
+
function isValidSemver(version) {
|
|
18398
|
+
return /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/.test(version);
|
|
18399
|
+
}
|
|
18400
|
+
|
|
18401
|
+
/**
|
|
18402
|
+
* Check if string is valid color
|
|
18403
|
+
*/ function isValidColor(color) {
|
|
17742
18404
|
// Hex color
|
|
17743
|
-
|
|
18405
|
+
if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color)) return !0;
|
|
17744
18406
|
// RGB/RGBA
|
|
17745
|
-
|
|
18407
|
+
if (/^rgba?\(/.test(color)) return !0;
|
|
17746
18408
|
// HSL/HSLA
|
|
17747
|
-
|
|
18409
|
+
if (/^hsla?\(/.test(color)) return !0;
|
|
18410
|
+
// Named colors (basic check)
|
|
18411
|
+
const namedColors = [ "black", "white", "red", "green", "blue", "yellow", "cyan", "magenta", "transparent", "currentColor" ];
|
|
18412
|
+
return !!_includesInstanceProperty(namedColors).call(namedColors, color.toLowerCase());
|
|
17748
18413
|
}
|
|
17749
18414
|
|
|
17750
18415
|
/**
|
|
@@ -17793,8 +18458,8 @@ class ThemeError extends Error {
|
|
|
17793
18458
|
Error.captureStackTrace && Error.captureStackTrace(this, ThemeError);
|
|
17794
18459
|
}
|
|
17795
18460
|
/**
|
|
17796
|
-
|
|
17797
|
-
|
|
18461
|
+
* Convert error to JSON for logging
|
|
18462
|
+
*/ toJSON() {
|
|
17798
18463
|
return {
|
|
17799
18464
|
name: this.name,
|
|
17800
18465
|
message: this.message,
|
|
@@ -17831,8 +18496,8 @@ class ThemeLogger {
|
|
|
17831
18496
|
};
|
|
17832
18497
|
}
|
|
17833
18498
|
/**
|
|
17834
|
-
|
|
17835
|
-
|
|
18499
|
+
* Log an error
|
|
18500
|
+
*/ error(message, error, context) {
|
|
17836
18501
|
if (this.config.level < LogLevel.ERROR) return;
|
|
17837
18502
|
const errorObj = error instanceof Error ? error : new Error(message), themeError = error instanceof ThemeError ? error : new ThemeError(message, ThemeErrorCode.UNKNOWN_ERROR, context);
|
|
17838
18503
|
this.config.enableConsole && console.error(`[ThemeError] ${message}`, {
|
|
@@ -17845,20 +18510,20 @@ class ThemeLogger {
|
|
|
17845
18510
|
}), this.config.onError?.(themeError, context);
|
|
17846
18511
|
}
|
|
17847
18512
|
/**
|
|
17848
|
-
|
|
17849
|
-
|
|
18513
|
+
* Log a warning
|
|
18514
|
+
*/ warn(message, context) {
|
|
17850
18515
|
this.config.level < LogLevel.WARN || (this.config.enableConsole && console.warn(`[ThemeWarning] ${message}`, context || {}),
|
|
17851
18516
|
this.config.onWarn?.(message, context));
|
|
17852
18517
|
}
|
|
17853
18518
|
/**
|
|
17854
|
-
|
|
17855
|
-
|
|
18519
|
+
* Log an info message
|
|
18520
|
+
*/ info(message, context) {
|
|
17856
18521
|
this.config.level < LogLevel.INFO || (this.config.enableConsole && console.info(`[ThemeInfo] ${message}`, context || {}),
|
|
17857
18522
|
this.config.onInfo?.(message, context));
|
|
17858
18523
|
}
|
|
17859
18524
|
/**
|
|
17860
|
-
|
|
17861
|
-
|
|
18525
|
+
* Log a debug message
|
|
18526
|
+
*/ debug(message, context) {
|
|
17862
18527
|
this.config.level < LogLevel.DEBUG || (this.config.enableConsole, this.config.onDebug?.(message, context));
|
|
17863
18528
|
}
|
|
17864
18529
|
}
|
|
@@ -18001,11 +18666,6 @@ class ThemeLogger {
|
|
|
18001
18666
|
/**
|
|
18002
18667
|
* Theme Registry
|
|
18003
18668
|
*
|
|
18004
|
-
* Central registry for all themes with discovery and dependency management
|
|
18005
|
-
*/
|
|
18006
|
-
/**
|
|
18007
|
-
* Theme Registry
|
|
18008
|
-
*
|
|
18009
18669
|
* Manages theme registration, discovery, and dependency resolution
|
|
18010
18670
|
*/ (processedConfig, env);
|
|
18011
18671
|
// Validate if requested
|
|
@@ -18068,8 +18728,8 @@ class ThemeRegistry {
|
|
|
18068
18728
|
this.entries = new Map, this.config = null, this.initialized = !1;
|
|
18069
18729
|
}
|
|
18070
18730
|
/**
|
|
18071
|
-
|
|
18072
|
-
|
|
18731
|
+
* Initialize registry from config
|
|
18732
|
+
*/ async initialize(config) {
|
|
18073
18733
|
if (!this.initialized) {
|
|
18074
18734
|
// Load config if not provided
|
|
18075
18735
|
if (config) this.config = config; else try {
|
|
@@ -18119,8 +18779,8 @@ class ThemeRegistry {
|
|
|
18119
18779
|
}
|
|
18120
18780
|
}
|
|
18121
18781
|
/**
|
|
18122
|
-
|
|
18123
|
-
|
|
18782
|
+
* Register a theme
|
|
18783
|
+
*/ register(themeId, definition) {
|
|
18124
18784
|
// Get dependencies from config or definition
|
|
18125
18785
|
const entry = {
|
|
18126
18786
|
id: themeId,
|
|
@@ -18132,23 +18792,23 @@ class ThemeRegistry {
|
|
|
18132
18792
|
this.entries.set(themeId, entry);
|
|
18133
18793
|
}
|
|
18134
18794
|
/**
|
|
18135
|
-
|
|
18136
|
-
|
|
18795
|
+
* Get theme entry
|
|
18796
|
+
*/ get(themeId) {
|
|
18137
18797
|
return this.entries.get(themeId);
|
|
18138
18798
|
}
|
|
18139
18799
|
/**
|
|
18140
|
-
|
|
18141
|
-
|
|
18800
|
+
* Check if theme exists
|
|
18801
|
+
*/ has(themeId) {
|
|
18142
18802
|
return this.entries.has(themeId);
|
|
18143
18803
|
}
|
|
18144
18804
|
/**
|
|
18145
|
-
|
|
18146
|
-
|
|
18805
|
+
* Get all theme IDs
|
|
18806
|
+
*/ getAllIds() {
|
|
18147
18807
|
return Array.from(this.entries.keys());
|
|
18148
18808
|
}
|
|
18149
18809
|
/**
|
|
18150
|
-
|
|
18151
|
-
|
|
18810
|
+
* Get all theme metadata
|
|
18811
|
+
*/ getAllMetadata() {
|
|
18152
18812
|
return Array.from(this.entries.values()).map((entry => ({
|
|
18153
18813
|
id: entry.id,
|
|
18154
18814
|
name: entry.definition.name,
|
|
@@ -18167,34 +18827,34 @@ class ThemeRegistry {
|
|
|
18167
18827
|
})));
|
|
18168
18828
|
}
|
|
18169
18829
|
/**
|
|
18170
|
-
|
|
18171
|
-
|
|
18830
|
+
* Get theme definition
|
|
18831
|
+
*/ getDefinition(themeId) {
|
|
18172
18832
|
return this.entries.get(themeId)?.definition;
|
|
18173
18833
|
}
|
|
18174
18834
|
/**
|
|
18175
|
-
|
|
18176
|
-
|
|
18835
|
+
* Get theme object (for JS themes)
|
|
18836
|
+
*/ getTheme(themeId) {
|
|
18177
18837
|
return this.entries.get(themeId)?.theme;
|
|
18178
18838
|
}
|
|
18179
18839
|
/**
|
|
18180
|
-
|
|
18181
|
-
|
|
18840
|
+
* Set theme object (for JS themes)
|
|
18841
|
+
*/ setTheme(themeId, theme) {
|
|
18182
18842
|
const entry = this.entries.get(themeId);
|
|
18183
18843
|
entry && (entry.theme = theme, entry.loaded = !0);
|
|
18184
18844
|
}
|
|
18185
18845
|
/**
|
|
18186
|
-
|
|
18187
|
-
|
|
18846
|
+
* Get dependencies for a theme
|
|
18847
|
+
*/ getDependencies(themeId) {
|
|
18188
18848
|
return this.entries.get(themeId)?.dependencies || [];
|
|
18189
18849
|
}
|
|
18190
18850
|
/**
|
|
18191
|
-
|
|
18192
|
-
|
|
18851
|
+
* Get dependents for a theme (themes that depend on this one)
|
|
18852
|
+
*/ getDependents(themeId) {
|
|
18193
18853
|
return this.entries.get(themeId)?.dependents || [];
|
|
18194
18854
|
}
|
|
18195
18855
|
/**
|
|
18196
|
-
|
|
18197
|
-
|
|
18856
|
+
* Resolve all dependencies in correct order
|
|
18857
|
+
*/ resolveDependencyOrder(themeId) {
|
|
18198
18858
|
const resolved = [], visited = new Set, visiting = new Set, visit = id => {
|
|
18199
18859
|
if (visiting.has(id)) throw new Error(`Circular dependency detected involving theme: ${id}`);
|
|
18200
18860
|
if (visited.has(id)) return;
|
|
@@ -18209,17 +18869,18 @@ class ThemeRegistry {
|
|
|
18209
18869
|
return visit(themeId), resolved;
|
|
18210
18870
|
}
|
|
18211
18871
|
/**
|
|
18212
|
-
|
|
18213
|
-
|
|
18872
|
+
* Resolve dependencies and build dependency graph
|
|
18873
|
+
*/ resolveDependencies() {
|
|
18214
18874
|
// Build dependents map
|
|
18215
18875
|
for (const entry of this.entries.values()) for (const dep of entry.dependencies) {
|
|
18216
18876
|
const depEntry = this.entries.get(dep);
|
|
18217
|
-
|
|
18877
|
+
var _context;
|
|
18878
|
+
depEntry && (_includesInstanceProperty(_context = depEntry.dependents).call(_context, entry.id) || depEntry.dependents.push(entry.id));
|
|
18218
18879
|
}
|
|
18219
18880
|
}
|
|
18220
18881
|
/**
|
|
18221
|
-
|
|
18222
|
-
|
|
18882
|
+
* Validate all themes
|
|
18883
|
+
*/ validate() {
|
|
18223
18884
|
const errors = [];
|
|
18224
18885
|
// Check for circular dependencies
|
|
18225
18886
|
for (const themeId of this.entries.keys()) try {
|
|
@@ -18235,8 +18896,8 @@ class ThemeRegistry {
|
|
|
18235
18896
|
};
|
|
18236
18897
|
}
|
|
18237
18898
|
/**
|
|
18238
|
-
|
|
18239
|
-
|
|
18899
|
+
* Clear registry
|
|
18900
|
+
*/ clear() {
|
|
18240
18901
|
this.entries.clear(), this.config = null, this.initialized = !1;
|
|
18241
18902
|
}
|
|
18242
18903
|
}
|
|
@@ -18267,8 +18928,8 @@ class ThemeRegistry {
|
|
|
18267
18928
|
};
|
|
18268
18929
|
}
|
|
18269
18930
|
/**
|
|
18270
|
-
|
|
18271
|
-
|
|
18931
|
+
* Get cached CSS theme
|
|
18932
|
+
*/ getCSS(themeId) {
|
|
18272
18933
|
if (!this.config.enabled) return null;
|
|
18273
18934
|
const entry = this.cache.get(themeId);
|
|
18274
18935
|
return entry && "css" === entry.type ?
|
|
@@ -18279,8 +18940,8 @@ class ThemeRegistry {
|
|
|
18279
18940
|
this.updateAccessOrder(themeId), entry) : null;
|
|
18280
18941
|
}
|
|
18281
18942
|
/**
|
|
18282
|
-
|
|
18283
|
-
|
|
18943
|
+
* Get cached JS theme
|
|
18944
|
+
*/ getJS(themeId) {
|
|
18284
18945
|
if (!this.config.enabled) return null;
|
|
18285
18946
|
const entry = this.cache.get(themeId);
|
|
18286
18947
|
return entry && "js" === entry.type ?
|
|
@@ -18291,8 +18952,8 @@ class ThemeRegistry {
|
|
|
18291
18952
|
this.updateAccessOrder(themeId), entry) : null;
|
|
18292
18953
|
}
|
|
18293
18954
|
/**
|
|
18294
|
-
|
|
18295
|
-
|
|
18955
|
+
* Set CSS theme cache entry
|
|
18956
|
+
*/ setCSS(themeId, entry) {
|
|
18296
18957
|
if (!this.config.enabled) return;
|
|
18297
18958
|
// Evict if needed
|
|
18298
18959
|
this.evictIfNeeded();
|
|
@@ -18308,8 +18969,8 @@ class ThemeRegistry {
|
|
|
18308
18969
|
this.cache.set(themeId, cacheEntry), this.updateAccessOrder(themeId);
|
|
18309
18970
|
}
|
|
18310
18971
|
/**
|
|
18311
|
-
|
|
18312
|
-
|
|
18972
|
+
* Set JS theme cache entry
|
|
18973
|
+
*/ setJS(themeId, theme) {
|
|
18313
18974
|
if (!this.config.enabled) return;
|
|
18314
18975
|
// Evict if needed
|
|
18315
18976
|
this.evictIfNeeded();
|
|
@@ -18323,8 +18984,8 @@ class ThemeRegistry {
|
|
|
18323
18984
|
this.cache.set(themeId, cacheEntry), this.updateAccessOrder(themeId);
|
|
18324
18985
|
}
|
|
18325
18986
|
/**
|
|
18326
|
-
|
|
18327
|
-
|
|
18987
|
+
* Check if theme is cached
|
|
18988
|
+
*/ has(themeId) {
|
|
18328
18989
|
if (!this.config.enabled) return !1;
|
|
18329
18990
|
const entry = this.cache.get(themeId);
|
|
18330
18991
|
return !!entry && (
|
|
@@ -18333,19 +18994,19 @@ class ThemeRegistry {
|
|
|
18333
18994
|
this.removeFromAccessOrder(themeId), !1));
|
|
18334
18995
|
}
|
|
18335
18996
|
/**
|
|
18336
|
-
|
|
18337
|
-
|
|
18997
|
+
* Remove theme from cache
|
|
18998
|
+
*/ delete(themeId) {
|
|
18338
18999
|
const deleted = this.cache.delete(themeId);
|
|
18339
19000
|
return deleted && this.removeFromAccessOrder(themeId), deleted;
|
|
18340
19001
|
}
|
|
18341
19002
|
/**
|
|
18342
|
-
|
|
18343
|
-
|
|
19003
|
+
* Clear all cache
|
|
19004
|
+
*/ clear() {
|
|
18344
19005
|
this.cache.clear(), this.accessOrder = [];
|
|
18345
19006
|
}
|
|
18346
19007
|
/**
|
|
18347
|
-
|
|
18348
|
-
|
|
19008
|
+
* Get cache statistics
|
|
19009
|
+
*/ getStats() {
|
|
18349
19010
|
let cssThemes = 0, jsThemes = 0;
|
|
18350
19011
|
for (const entry of this.cache.values()) "css" === entry.type ? cssThemes++ : jsThemes++;
|
|
18351
19012
|
return {
|
|
@@ -18356,19 +19017,19 @@ class ThemeRegistry {
|
|
|
18356
19017
|
};
|
|
18357
19018
|
}
|
|
18358
19019
|
/**
|
|
18359
|
-
|
|
18360
|
-
|
|
19020
|
+
* Update access order for LRU
|
|
19021
|
+
*/ updateAccessOrder(themeId) {
|
|
18361
19022
|
this.removeFromAccessOrder(themeId), this.accessOrder.push(themeId);
|
|
18362
19023
|
}
|
|
18363
19024
|
/**
|
|
18364
|
-
|
|
18365
|
-
|
|
19025
|
+
* Remove from access order
|
|
19026
|
+
*/ removeFromAccessOrder(themeId) {
|
|
18366
19027
|
const index = this.accessOrder.indexOf(themeId);
|
|
18367
19028
|
index > -1 && this.accessOrder.splice(index, 1);
|
|
18368
19029
|
}
|
|
18369
19030
|
/**
|
|
18370
|
-
|
|
18371
|
-
|
|
19031
|
+
* Evict least recently used entries if cache is full
|
|
19032
|
+
*/ evictIfNeeded() {
|
|
18372
19033
|
if (!(this.cache.size < this.config.maxSize))
|
|
18373
19034
|
// Evict least recently used (first in access order)
|
|
18374
19035
|
for (;this.cache.size >= this.config.maxSize && this.accessOrder.length > 0; ) {
|
|
@@ -18496,8 +19157,8 @@ function isJSTheme(theme) {
|
|
|
18496
19157
|
* Validates themes for correctness and accessibility
|
|
18497
19158
|
*/ class ThemeValidator {
|
|
18498
19159
|
/**
|
|
18499
|
-
|
|
18500
|
-
|
|
19160
|
+
* Validate theme
|
|
19161
|
+
*/
|
|
18501
19162
|
validate(theme, metadata) {
|
|
18502
19163
|
const errors = [], warnings = [], a11yIssues = [], paletteResult = this.validatePalette(theme.palette, metadata);
|
|
18503
19164
|
errors.push(...paletteResult.errors), warnings.push(...paletteResult.warnings),
|
|
@@ -18531,8 +19192,8 @@ function isJSTheme(theme) {
|
|
|
18531
19192
|
};
|
|
18532
19193
|
}
|
|
18533
19194
|
/**
|
|
18534
|
-
|
|
18535
|
-
|
|
19195
|
+
* Validate palette
|
|
19196
|
+
*/ validatePalette(palette, metadata) {
|
|
18536
19197
|
const errors = [], warnings = [], a11yIssues = [], contrastTarget = metadata?.a11y?.contrastTarget || 4.5;
|
|
18537
19198
|
// Validate primary color contrast
|
|
18538
19199
|
if (palette.primary) {
|
|
@@ -18576,8 +19237,8 @@ function isJSTheme(theme) {
|
|
|
18576
19237
|
};
|
|
18577
19238
|
}
|
|
18578
19239
|
/**
|
|
18579
|
-
|
|
18580
|
-
|
|
19240
|
+
* Validate typography
|
|
19241
|
+
*/ validateTypography(typography) {
|
|
18581
19242
|
const errors = [], warnings = [];
|
|
18582
19243
|
return typography.fontFamily && "string" == typeof typography.fontFamily || errors.push("Typography must have a fontFamily"),
|
|
18583
19244
|
(!typography.fontSize || "number" != typeof typography.fontSize || typography.fontSize <= 0) && errors.push("Typography must have a valid fontSize"),
|
|
@@ -18591,8 +19252,8 @@ function isJSTheme(theme) {
|
|
|
18591
19252
|
};
|
|
18592
19253
|
}
|
|
18593
19254
|
/**
|
|
18594
|
-
|
|
18595
|
-
|
|
19255
|
+
* Validate spacing
|
|
19256
|
+
*/ validateSpacing(spacing) {
|
|
18596
19257
|
const errors = [];
|
|
18597
19258
|
if ("function" != typeof spacing) errors.push("Spacing must be a function"); else
|
|
18598
19259
|
// Test spacing function
|
|
@@ -18609,8 +19270,8 @@ function isJSTheme(theme) {
|
|
|
18609
19270
|
};
|
|
18610
19271
|
}
|
|
18611
19272
|
/**
|
|
18612
|
-
|
|
18613
|
-
|
|
19273
|
+
* Validate breakpoints
|
|
19274
|
+
*/ validateBreakpoints(breakpoints) {
|
|
18614
19275
|
const errors = [], warnings = [];
|
|
18615
19276
|
if (breakpoints.values) {
|
|
18616
19277
|
const required = [ "xs", "sm", "md", "lg", "xl" ];
|
|
@@ -18633,8 +19294,8 @@ function isJSTheme(theme) {
|
|
|
18633
19294
|
};
|
|
18634
19295
|
}
|
|
18635
19296
|
/**
|
|
18636
|
-
|
|
18637
|
-
|
|
19297
|
+
* Check color contrast ratio
|
|
19298
|
+
*/ checkContrast(foreground, background) {
|
|
18638
19299
|
try {
|
|
18639
19300
|
return getContrastRatio(foreground, background);
|
|
18640
19301
|
} catch {
|
|
@@ -18642,15 +19303,15 @@ function isJSTheme(theme) {
|
|
|
18642
19303
|
}
|
|
18643
19304
|
}
|
|
18644
19305
|
/**
|
|
18645
|
-
|
|
18646
|
-
|
|
19306
|
+
* Check if color is valid
|
|
19307
|
+
*/ isValidColor(color) {
|
|
18647
19308
|
// Hex
|
|
18648
19309
|
return !!/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color) || !!/^rgba?\(/.test(color) || !!/^hsla?\(/.test(color);
|
|
18649
19310
|
// RGB/RGBA
|
|
18650
19311
|
}
|
|
18651
19312
|
/**
|
|
18652
|
-
|
|
18653
|
-
|
|
19313
|
+
* Validate transitions
|
|
19314
|
+
*/ validateTransitions(transitions) {
|
|
18654
19315
|
const errors = [], warnings = [], a11yIssues = [];
|
|
18655
19316
|
if (!transitions) return errors.push("Transitions configuration is required"), {
|
|
18656
19317
|
valid: !1,
|
|
@@ -18682,8 +19343,8 @@ function isJSTheme(theme) {
|
|
|
18682
19343
|
};
|
|
18683
19344
|
}
|
|
18684
19345
|
/**
|
|
18685
|
-
|
|
18686
|
-
|
|
19346
|
+
* Validate z-index
|
|
19347
|
+
*/ validateZIndex(zIndex) {
|
|
18687
19348
|
const errors = [], warnings = [], a11yIssues = [];
|
|
18688
19349
|
if (!zIndex) return errors.push("Z-index configuration is required"), {
|
|
18689
19350
|
valid: !1,
|
|
@@ -18694,7 +19355,9 @@ function isJSTheme(theme) {
|
|
|
18694
19355
|
const numericEntries = Object.entries(zIndex).filter((([, value]) => "number" == typeof value));
|
|
18695
19356
|
for (const [key, value] of Object.entries(zIndex)) void 0 !== value && ("number" != typeof value ? errors.push(`Z-index ${key} must be a number, got ${typeof value}`) : value < 0 ? errors.push(`Z-index ${key} must be non-negative, got ${value}`) : value > 1e4 && warnings.push(`Z-index ${key} (${value}) exceeds recommended maximum (10000)`));
|
|
18696
19357
|
for (let i = 0; i < numericEntries.length; i++) for (let j = i + 1; j < numericEntries.length; j++) {
|
|
18697
|
-
const
|
|
19358
|
+
const entryA = numericEntries[i], entryB = numericEntries[j];
|
|
19359
|
+
if (!entryA || !entryB) continue;
|
|
19360
|
+
const [keyA, valueA] = entryA, [keyB, valueB] = entryB, diff = Math.abs(valueA - valueB);
|
|
18698
19361
|
diff < 10 && diff > 0 && warnings.push(`Z-index values ${keyA} (${valueA}) and ${keyB} (${valueB}) are very close, potential layering conflicts`);
|
|
18699
19362
|
}
|
|
18700
19363
|
return {
|
|
@@ -18705,8 +19368,8 @@ function isJSTheme(theme) {
|
|
|
18705
19368
|
};
|
|
18706
19369
|
}
|
|
18707
19370
|
/**
|
|
18708
|
-
|
|
18709
|
-
|
|
19371
|
+
* Validate border radius
|
|
19372
|
+
*/ validateBorderRadius(borderRadius) {
|
|
18710
19373
|
const errors = [], warnings = [], a11yIssues = [];
|
|
18711
19374
|
if (!borderRadius) return errors.push("Border radius configuration is required"),
|
|
18712
19375
|
{
|
|
@@ -18752,8 +19415,8 @@ function isJSTheme(theme) {
|
|
|
18752
19415
|
};
|
|
18753
19416
|
}
|
|
18754
19417
|
/**
|
|
18755
|
-
|
|
18756
|
-
|
|
19418
|
+
* Validate custom properties
|
|
19419
|
+
*/ validateCustom(custom) {
|
|
18757
19420
|
const errors = [], warnings = [], a11yIssues = [];
|
|
18758
19421
|
if (!custom || "object" != typeof custom) return {
|
|
18759
19422
|
valid: !0,
|
|
@@ -18810,7 +19473,7 @@ function isJSTheme(theme) {
|
|
|
18810
19473
|
* Convert a nested object to flat CSS variable declarations
|
|
18811
19474
|
*/ function flattenObject(obj, prefix = "", result = {}) {
|
|
18812
19475
|
for (const key in obj) {
|
|
18813
|
-
if (!
|
|
19476
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
18814
19477
|
const value = obj[key], newKey = prefix ? `${prefix}-${key}` : key;
|
|
18815
19478
|
if (value && "object" == typeof value && !Array.isArray(value)) {
|
|
18816
19479
|
// Skip special objects like functions
|
|
@@ -19310,28 +19973,28 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19310
19973
|
};
|
|
19311
19974
|
}
|
|
19312
19975
|
/**
|
|
19313
|
-
|
|
19314
|
-
|
|
19976
|
+
* Initialize engine with theme registry
|
|
19977
|
+
*/ async initialize() {
|
|
19315
19978
|
await this.registry.initialize();
|
|
19316
19979
|
}
|
|
19317
19980
|
/**
|
|
19318
|
-
|
|
19319
|
-
|
|
19981
|
+
* Get current theme ID
|
|
19982
|
+
*/ getCurrentTheme() {
|
|
19320
19983
|
return this.currentTheme;
|
|
19321
19984
|
}
|
|
19322
19985
|
/**
|
|
19323
|
-
|
|
19324
|
-
|
|
19986
|
+
* Get active theme object
|
|
19987
|
+
*/ getActiveTheme() {
|
|
19325
19988
|
return this.activeTheme;
|
|
19326
19989
|
}
|
|
19327
19990
|
/**
|
|
19328
|
-
|
|
19329
|
-
|
|
19991
|
+
* Check if theme is loaded
|
|
19992
|
+
*/ isThemeLoaded(themeId) {
|
|
19330
19993
|
return this.loadedThemes.has(themeId);
|
|
19331
19994
|
}
|
|
19332
19995
|
/**
|
|
19333
|
-
|
|
19334
|
-
|
|
19996
|
+
* Load and apply theme
|
|
19997
|
+
*/ async setTheme(themeId, options = {}) {
|
|
19335
19998
|
const {force: force = !1, preload: preload = !1, removePrevious: removePrevious = !0, fallbackOnError: fallbackOnError = !0} = options;
|
|
19336
19999
|
// Handle Theme object directly
|
|
19337
20000
|
if ("string" != typeof themeId) {
|
|
@@ -19396,16 +20059,16 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19396
20059
|
}
|
|
19397
20060
|
}
|
|
19398
20061
|
/**
|
|
19399
|
-
|
|
19400
|
-
|
|
20062
|
+
* Load theme (CSS or JS)
|
|
20063
|
+
*/ async loadTheme(themeId, options) {
|
|
19401
20064
|
const definition = this.registry.getDefinition(themeId);
|
|
19402
20065
|
if (!definition) throw new Error(`Theme definition not found: ${themeId}`);
|
|
19403
20066
|
"css" === definition.type ? await this.loadCSSTheme(themeId, definition, options) : await this.loadJSTheme(themeId, definition),
|
|
19404
20067
|
this.loadedThemes.add(themeId), this.emitLoad(themeId);
|
|
19405
20068
|
}
|
|
19406
20069
|
/**
|
|
19407
|
-
|
|
19408
|
-
|
|
20070
|
+
* Load CSS theme
|
|
20071
|
+
*/ async loadCSSTheme(themeId, definition, options) {
|
|
19409
20072
|
// Check cache
|
|
19410
20073
|
if (this.config.enableCache) {
|
|
19411
20074
|
const cached = this.cache.getCSS(themeId);
|
|
@@ -19447,8 +20110,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19447
20110
|
}
|
|
19448
20111
|
}
|
|
19449
20112
|
/**
|
|
19450
|
-
|
|
19451
|
-
|
|
20113
|
+
* Load JS theme
|
|
20114
|
+
*/ async loadJSTheme(themeId, definition) {
|
|
19452
20115
|
if ("js" !== definition.type) return;
|
|
19453
20116
|
// Check cache
|
|
19454
20117
|
if (this.config.enableCache) {
|
|
@@ -19472,8 +20135,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19472
20135
|
this.config.enableCache && this.cache.setJS(themeId, theme), this.registry.setTheme(themeId, theme);
|
|
19473
20136
|
}
|
|
19474
20137
|
/**
|
|
19475
|
-
|
|
19476
|
-
|
|
20138
|
+
* Apply theme (set as active)
|
|
20139
|
+
*/ async applyTheme(themeId, removePrevious) {
|
|
19477
20140
|
const previousTheme = this.currentTheme;
|
|
19478
20141
|
// Remove previous theme if requested
|
|
19479
20142
|
removePrevious && previousTheme && previousTheme !== themeId && await this.removeTheme(previousTheme);
|
|
@@ -19492,15 +20155,15 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19492
20155
|
});
|
|
19493
20156
|
}
|
|
19494
20157
|
/**
|
|
19495
|
-
|
|
19496
|
-
|
|
20158
|
+
* Apply CSS theme
|
|
20159
|
+
*/ async applyCSSTheme(themeId) {
|
|
19497
20160
|
if (isServer()) return;
|
|
19498
20161
|
const definition = this.registry.getDefinition(themeId), className = definition?.class || themeId;
|
|
19499
20162
|
applyThemeAttributes(this.config.dataAttribute, className), this.activeTheme = null;
|
|
19500
20163
|
}
|
|
19501
20164
|
/**
|
|
19502
|
-
|
|
19503
|
-
|
|
20165
|
+
* Apply JS theme
|
|
20166
|
+
*/ async applyJSTheme(theme, removePrevious) {
|
|
19504
20167
|
if (isServer()) return;
|
|
19505
20168
|
// Remove previous JS theme CSS
|
|
19506
20169
|
removePrevious && removeInjectedCSS(this.config.styleId), injectCSS(generateCSSVariables(theme, {
|
|
@@ -19514,8 +20177,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19514
20177
|
this.currentTheme = themeId;
|
|
19515
20178
|
}
|
|
19516
20179
|
/**
|
|
19517
|
-
|
|
19518
|
-
|
|
20180
|
+
* Remove theme
|
|
20181
|
+
*/ async removeTheme(themeId) {
|
|
19519
20182
|
const definition = this.registry.getDefinition(themeId);
|
|
19520
20183
|
definition && ("css" === definition.type ? isBrowser() && (themeNameOrLinkId => {
|
|
19521
20184
|
if (isServer()) return;
|
|
@@ -19529,35 +20192,35 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19529
20192
|
})(getThemeLinkId(themeId)) : isBrowser() && removeInjectedCSS(this.config.styleId));
|
|
19530
20193
|
}
|
|
19531
20194
|
/**
|
|
19532
|
-
|
|
19533
|
-
|
|
20195
|
+
* Preload theme
|
|
20196
|
+
*/ async preloadTheme(themeId) {
|
|
19534
20197
|
await this.setTheme(themeId, {
|
|
19535
20198
|
preload: !0
|
|
19536
20199
|
});
|
|
19537
20200
|
}
|
|
19538
20201
|
/**
|
|
19539
|
-
|
|
19540
|
-
|
|
20202
|
+
* Get registry
|
|
20203
|
+
*/ getRegistry() {
|
|
19541
20204
|
return this.registry;
|
|
19542
20205
|
}
|
|
19543
20206
|
/**
|
|
19544
|
-
|
|
19545
|
-
|
|
20207
|
+
* Get cache
|
|
20208
|
+
*/ getCache() {
|
|
19546
20209
|
return this.cache;
|
|
19547
20210
|
}
|
|
19548
20211
|
/**
|
|
19549
|
-
|
|
19550
|
-
|
|
20212
|
+
* Clear failed theme tracking (allows retry of previously failed themes)
|
|
20213
|
+
*/ clearFailedThemes() {
|
|
19551
20214
|
this.failedThemes.clear();
|
|
19552
20215
|
}
|
|
19553
20216
|
/**
|
|
19554
|
-
|
|
19555
|
-
|
|
20217
|
+
* Clear specific failed theme (allows retry of a specific theme)
|
|
20218
|
+
*/ clearFailedTheme(themeId) {
|
|
19556
20219
|
this.failedThemes.delete(themeId);
|
|
19557
20220
|
}
|
|
19558
20221
|
/**
|
|
19559
|
-
|
|
19560
|
-
|
|
20222
|
+
* Check if theme has failed to load
|
|
20223
|
+
*/ hasFailedTheme(themeId) {
|
|
19561
20224
|
return this.failedThemes.has(themeId);
|
|
19562
20225
|
}
|
|
19563
20226
|
on(event, listener) {
|
|
@@ -19567,8 +20230,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19567
20230
|
"change" === event ? this.changeListeners = this.changeListeners.filter((l => l !== listener)) : "load" === event ? this.loadListeners = this.loadListeners.filter((l => l !== listener)) : "error" === event ? this.errorListeners = this.errorListeners.filter((l => l !== listener)) : "revert" === event && (this.revertListeners = this.revertListeners.filter((l => l !== listener)));
|
|
19568
20231
|
}
|
|
19569
20232
|
/**
|
|
19570
|
-
|
|
19571
|
-
|
|
20233
|
+
* Emit change event
|
|
20234
|
+
*/ emitChange(event) {
|
|
19572
20235
|
for (const listener of this.changeListeners) try {
|
|
19573
20236
|
listener(event);
|
|
19574
20237
|
} catch (error) {
|
|
@@ -19578,8 +20241,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19578
20241
|
}
|
|
19579
20242
|
}
|
|
19580
20243
|
/**
|
|
19581
|
-
|
|
19582
|
-
|
|
20244
|
+
* Emit load event
|
|
20245
|
+
*/ emitLoad(themeId) {
|
|
19583
20246
|
for (const listener of this.loadListeners) try {
|
|
19584
20247
|
listener(themeId);
|
|
19585
20248
|
} catch (error) {
|
|
@@ -19589,9 +20252,9 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19589
20252
|
}
|
|
19590
20253
|
}
|
|
19591
20254
|
/**
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
20255
|
+
* Emit error event
|
|
20256
|
+
* Emits error to listeners (error emission is controlled at call site)
|
|
20257
|
+
*/ emitError(error, themeId) {
|
|
19595
20258
|
for (const listener of this.errorListeners) try {
|
|
19596
20259
|
listener(error, themeId);
|
|
19597
20260
|
} catch (err) {
|
|
@@ -19602,8 +20265,8 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19602
20265
|
}
|
|
19603
20266
|
}
|
|
19604
20267
|
/**
|
|
19605
|
-
|
|
19606
|
-
|
|
20268
|
+
* Emit revert event
|
|
20269
|
+
*/ emitRevert(event) {
|
|
19607
20270
|
for (const listener of this.revertListeners) try {
|
|
19608
20271
|
listener(event);
|
|
19609
20272
|
} catch (error) {
|
|
@@ -19627,15 +20290,24 @@ function generateCSSVariables(theme, options = {}) {
|
|
|
19627
20290
|
*/
|
|
19628
20291
|
/**
|
|
19629
20292
|
* RTL-aware locales (languages that use RTL)
|
|
19630
|
-
*/ const RTL_LOCALES = new Set([ "ar",
|
|
19631
|
-
|
|
19632
|
-
"
|
|
19633
|
-
|
|
19634
|
-
"
|
|
19635
|
-
|
|
19636
|
-
"
|
|
19637
|
-
|
|
19638
|
-
"
|
|
20293
|
+
*/ const RTL_LOCALES = new Set([ "ar",
|
|
20294
|
+
// Arabic
|
|
20295
|
+
"he",
|
|
20296
|
+
// Hebrew
|
|
20297
|
+
"fa",
|
|
20298
|
+
// Persian/Farsi
|
|
20299
|
+
"ur",
|
|
20300
|
+
// Urdu
|
|
20301
|
+
"yi",
|
|
20302
|
+
// Yiddish
|
|
20303
|
+
"ji",
|
|
20304
|
+
// Yiddish (alternative)
|
|
20305
|
+
"iw",
|
|
20306
|
+
// Hebrew (old code)
|
|
20307
|
+
"ku",
|
|
20308
|
+
// Kurdish
|
|
20309
|
+
"ps",
|
|
20310
|
+
// Pashto
|
|
19639
20311
|
"sd" ]), DEFAULT_RTL_CONFIG = {
|
|
19640
20312
|
enabled: !1,
|
|
19641
20313
|
direction: "ltr",
|
|
@@ -19667,66 +20339,66 @@ class RTLManager {
|
|
|
19667
20339
|
this.config.enabled && "undefined" != typeof document && this.applyDirection(this.config.direction);
|
|
19668
20340
|
}
|
|
19669
20341
|
/**
|
|
19670
|
-
|
|
19671
|
-
|
|
20342
|
+
* Detect locale from browser
|
|
20343
|
+
*/ detectLocale() {
|
|
19672
20344
|
if ("undefined" == typeof navigator) return "en";
|
|
19673
20345
|
// Try navigator.language first
|
|
19674
|
-
const lang = navigator.language || navigator.languages && navigator.languages[0] || "en";
|
|
19675
|
-
return
|
|
20346
|
+
const lang = navigator.language || navigator.languages && navigator.languages[0] || "en", langParts = String(lang).split("-");
|
|
20347
|
+
return langParts[0] ? langParts[0].toLowerCase() : "en";
|
|
19676
20348
|
}
|
|
19677
20349
|
/**
|
|
19678
|
-
|
|
19679
|
-
|
|
20350
|
+
* Check if locale is RTL
|
|
20351
|
+
*/ isRTLLocale(locale) {
|
|
19680
20352
|
return RTL_LOCALES.has(locale.toLowerCase());
|
|
19681
20353
|
}
|
|
19682
20354
|
/**
|
|
19683
|
-
|
|
19684
|
-
|
|
20355
|
+
* Get current direction
|
|
20356
|
+
*/ getDirection() {
|
|
19685
20357
|
return this.config.direction;
|
|
19686
20358
|
}
|
|
19687
20359
|
/**
|
|
19688
|
-
|
|
19689
|
-
|
|
20360
|
+
* Check if RTL is enabled
|
|
20361
|
+
*/ isEnabled() {
|
|
19690
20362
|
return this.config.enabled;
|
|
19691
20363
|
}
|
|
19692
20364
|
/**
|
|
19693
|
-
|
|
19694
|
-
|
|
20365
|
+
* Set direction
|
|
20366
|
+
*/ setDirection(direction) {
|
|
19695
20367
|
this.config.direction !== direction && (this.config.direction = direction, this.applyDirection(direction),
|
|
19696
20368
|
this.notifyListeners(direction));
|
|
19697
20369
|
}
|
|
19698
20370
|
/**
|
|
19699
|
-
|
|
19700
|
-
|
|
20371
|
+
* Toggle direction
|
|
20372
|
+
*/ toggleDirection() {
|
|
19701
20373
|
const newDirection = "ltr" === this.config.direction ? "rtl" : "ltr";
|
|
19702
20374
|
return this.setDirection(newDirection), newDirection;
|
|
19703
20375
|
}
|
|
19704
20376
|
/**
|
|
19705
|
-
|
|
19706
|
-
|
|
20377
|
+
* Enable RTL
|
|
20378
|
+
*/ enable() {
|
|
19707
20379
|
this.config.enabled || (this.config.enabled = !0, this.applyDirection(this.config.direction));
|
|
19708
20380
|
}
|
|
19709
20381
|
/**
|
|
19710
|
-
|
|
19711
|
-
|
|
20382
|
+
* Disable RTL
|
|
20383
|
+
*/ disable() {
|
|
19712
20384
|
this.config.enabled && (this.config.enabled = !1, this.applyDirection("ltr"));
|
|
19713
20385
|
}
|
|
19714
20386
|
/**
|
|
19715
|
-
|
|
19716
|
-
|
|
20387
|
+
* Set locale and auto-adjust direction
|
|
20388
|
+
*/ setLocale(locale) {
|
|
19717
20389
|
if (this.config.locale = locale.toLowerCase(), this.config.autoDetect) {
|
|
19718
20390
|
const isRTL = this.isRTLLocale(locale);
|
|
19719
20391
|
this.setDirection(isRTL ? "rtl" : "ltr");
|
|
19720
20392
|
}
|
|
19721
20393
|
}
|
|
19722
20394
|
/**
|
|
19723
|
-
|
|
19724
|
-
|
|
20395
|
+
* Get current locale
|
|
20396
|
+
*/ getLocale() {
|
|
19725
20397
|
return this.config.locale;
|
|
19726
20398
|
}
|
|
19727
20399
|
/**
|
|
19728
|
-
|
|
19729
|
-
|
|
20400
|
+
* Apply direction to DOM
|
|
20401
|
+
*/ applyDirection(direction) {
|
|
19730
20402
|
if ("undefined" == typeof document) return;
|
|
19731
20403
|
const html = document.documentElement, body = document.body;
|
|
19732
20404
|
// Set dir attribute
|
|
@@ -19738,16 +20410,16 @@ class RTLManager {
|
|
|
19738
20410
|
html.style.setProperty("--atomix-direction", direction), html.style.setProperty("--atomix-text-direction", direction);
|
|
19739
20411
|
}
|
|
19740
20412
|
/**
|
|
19741
|
-
|
|
19742
|
-
|
|
20413
|
+
* Add direction change listener
|
|
20414
|
+
*/ onDirectionChange(callback) {
|
|
19743
20415
|
// Return unsubscribe function
|
|
19744
20416
|
return this.listeners.add(callback), () => {
|
|
19745
20417
|
this.listeners.delete(callback);
|
|
19746
20418
|
};
|
|
19747
20419
|
}
|
|
19748
20420
|
/**
|
|
19749
|
-
|
|
19750
|
-
|
|
20421
|
+
* Notify listeners of direction change
|
|
20422
|
+
*/ notifyListeners(direction) {
|
|
19751
20423
|
this.listeners.forEach((callback => {
|
|
19752
20424
|
try {
|
|
19753
20425
|
callback(direction);
|
|
@@ -19759,17 +20431,17 @@ class RTLManager {
|
|
|
19759
20431
|
}));
|
|
19760
20432
|
}
|
|
19761
20433
|
/**
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
20434
|
+
* Get RTL-aware value
|
|
20435
|
+
*
|
|
20436
|
+
* Returns different values based on direction
|
|
20437
|
+
*/ getValue(ltrValue, rtlValue) {
|
|
19766
20438
|
return "rtl" === this.config.direction ? rtlValue : ltrValue;
|
|
19767
20439
|
}
|
|
19768
20440
|
/**
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
20441
|
+
* Get RTL-aware CSS property
|
|
20442
|
+
*
|
|
20443
|
+
* Returns appropriate CSS property based on direction
|
|
20444
|
+
*/ getCSSProperty(property) {
|
|
19773
20445
|
return "rtl" === this.config.direction && {
|
|
19774
20446
|
left: "right",
|
|
19775
20447
|
right: "left",
|
|
@@ -19786,8 +20458,8 @@ class RTLManager {
|
|
|
19786
20458
|
}[property] || property;
|
|
19787
20459
|
}
|
|
19788
20460
|
/**
|
|
19789
|
-
|
|
19790
|
-
|
|
20461
|
+
* Destroy RTL manager
|
|
20462
|
+
*/ destroy() {
|
|
19791
20463
|
if (this.listeners.clear(), "undefined" != typeof document) {
|
|
19792
20464
|
const html = document.documentElement, body = document.body;
|
|
19793
20465
|
html.removeAttribute("dir"), html.removeAttribute(this.config.dataAttribute), body?.removeAttribute("dir"),
|
|
@@ -19796,14 +20468,6 @@ class RTLManager {
|
|
|
19796
20468
|
}
|
|
19797
20469
|
}
|
|
19798
20470
|
|
|
19799
|
-
/**
|
|
19800
|
-
* Theme Manager
|
|
19801
|
-
*
|
|
19802
|
-
* Core theme management class for the Atomix Design System.
|
|
19803
|
-
* Rewritten to use the new ThemeEngine architecture.
|
|
19804
|
-
* Handles theme loading, switching, persistence, and events.
|
|
19805
|
-
* Supports both CSS-based themes and JavaScript-based themes.
|
|
19806
|
-
*/
|
|
19807
20471
|
/**
|
|
19808
20472
|
* Default configuration values
|
|
19809
20473
|
*/ const DEFAULT_CONFIG = {
|
|
@@ -19833,10 +20497,10 @@ class RTLManager {
|
|
|
19833
20497
|
* ```
|
|
19834
20498
|
*/ class ThemeManager {
|
|
19835
20499
|
/**
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
20500
|
+
* Create a new ThemeManager instance
|
|
20501
|
+
*
|
|
20502
|
+
* @param config - Theme manager configuration
|
|
20503
|
+
*/
|
|
19840
20504
|
constructor(config) {
|
|
19841
20505
|
this.currentTheme = null, this.activeTheme = null, this.eventListeners = {
|
|
19842
20506
|
themeChange: [],
|
|
@@ -19908,8 +20572,8 @@ class RTLManager {
|
|
|
19908
20572
|
this.initialize();
|
|
19909
20573
|
}
|
|
19910
20574
|
/**
|
|
19911
|
-
|
|
19912
|
-
|
|
20575
|
+
* Initialize the theme manager
|
|
20576
|
+
*/ initialize() {
|
|
19913
20577
|
this.initialized || isServer() || (
|
|
19914
20578
|
// Initialize engine
|
|
19915
20579
|
this.engine.initialize().then((() => {
|
|
@@ -19947,8 +20611,9 @@ class RTLManager {
|
|
|
19947
20611
|
removePrevious: !1,
|
|
19948
20612
|
fallbackOnError: !0
|
|
19949
20613
|
}).catch((error => {
|
|
20614
|
+
var _context;
|
|
19950
20615
|
// Only log error once, don't spam console
|
|
19951
|
-
|
|
20616
|
+
error instanceof Error && !_includesInstanceProperty(_context = error.message).call(_context, "previously failed") && this.logger.warn(`Failed to load default theme "${themeId}"`, {
|
|
19952
20617
|
themeId: themeId,
|
|
19953
20618
|
error: error.message
|
|
19954
20619
|
});
|
|
@@ -19962,8 +20627,8 @@ class RTLManager {
|
|
|
19962
20627
|
})), this.initialized = !0);
|
|
19963
20628
|
}
|
|
19964
20629
|
/**
|
|
19965
|
-
|
|
19966
|
-
|
|
20630
|
+
* Get default theme
|
|
20631
|
+
*/ getDefaultTheme() {
|
|
19967
20632
|
// Check storage first
|
|
19968
20633
|
if (this.config.enablePersistence && this.storageAdapter.isAvailable()) {
|
|
19969
20634
|
const stored = this.storageAdapter.getItem(this.config.storageKey);
|
|
@@ -19978,8 +20643,8 @@ class RTLManager {
|
|
|
19978
20643
|
return this.config.defaultTheme || null;
|
|
19979
20644
|
}
|
|
19980
20645
|
/**
|
|
19981
|
-
|
|
19982
|
-
|
|
20646
|
+
* Set theme
|
|
20647
|
+
*/ async setTheme(theme, options) {
|
|
19983
20648
|
// Persist to storage
|
|
19984
20649
|
if (await this.engine.setTheme(theme, options), this.config.enablePersistence && this.storageAdapter.isAvailable()) {
|
|
19985
20650
|
const themeId = "string" == typeof theme ? theme : theme.name || "js-theme";
|
|
@@ -19989,39 +20654,39 @@ class RTLManager {
|
|
|
19989
20654
|
this.config.onThemeChange && this.config.onThemeChange(theme);
|
|
19990
20655
|
}
|
|
19991
20656
|
/**
|
|
19992
|
-
|
|
19993
|
-
|
|
20657
|
+
* Get current theme
|
|
20658
|
+
*/ getTheme() {
|
|
19994
20659
|
return this.currentTheme || ("string" == typeof this.config.defaultTheme ? this.config.defaultTheme : "");
|
|
19995
20660
|
}
|
|
19996
20661
|
/**
|
|
19997
|
-
|
|
19998
|
-
|
|
20662
|
+
* Get active theme object (for JS themes)
|
|
20663
|
+
*/ getActiveTheme() {
|
|
19999
20664
|
return this.activeTheme || this.engine.getActiveTheme();
|
|
20000
20665
|
}
|
|
20001
20666
|
/**
|
|
20002
|
-
|
|
20003
|
-
|
|
20667
|
+
* Get available themes
|
|
20668
|
+
*/ getAvailableThemes() {
|
|
20004
20669
|
return this.engine.getRegistry().getAllMetadata();
|
|
20005
20670
|
}
|
|
20006
20671
|
/**
|
|
20007
|
-
|
|
20008
|
-
|
|
20672
|
+
* Check if theme is loaded
|
|
20673
|
+
*/ isThemeLoaded(themeName) {
|
|
20009
20674
|
return this.engine.isThemeLoaded(themeName);
|
|
20010
20675
|
}
|
|
20011
20676
|
/**
|
|
20012
|
-
|
|
20013
|
-
|
|
20677
|
+
* Preload theme
|
|
20678
|
+
*/ async preloadTheme(themeName) {
|
|
20014
20679
|
await this.engine.preloadTheme(themeName);
|
|
20015
20680
|
}
|
|
20016
|
-
on(event, callback) {
|
|
20681
|
+
/* eslint-enable no-dupe-class-members */ on(event, callback) {
|
|
20017
20682
|
"themeChange" === event ? this.eventListeners.themeChange.push(callback) : "themeLoad" === event ? this.eventListeners.themeLoad.push(callback) : "themeError" === event && this.eventListeners.themeError.push(callback);
|
|
20018
20683
|
}
|
|
20019
|
-
off(event, callback) {
|
|
20684
|
+
/* eslint-enable no-dupe-class-members */ off(event, callback) {
|
|
20020
20685
|
"themeChange" === event ? this.eventListeners.themeChange = this.eventListeners.themeChange.filter((cb => cb !== callback)) : "themeLoad" === event ? this.eventListeners.themeLoad = this.eventListeners.themeLoad.filter((cb => cb !== callback)) : "themeError" === event && (this.eventListeners.themeError = this.eventListeners.themeError.filter((cb => cb !== callback)));
|
|
20021
20686
|
}
|
|
20022
20687
|
/**
|
|
20023
|
-
|
|
20024
|
-
|
|
20688
|
+
* Emit theme change event
|
|
20689
|
+
*/ emitThemeChange(event) {
|
|
20025
20690
|
for (const callback of this.eventListeners.themeChange) try {
|
|
20026
20691
|
callback(event);
|
|
20027
20692
|
} catch (error) {
|
|
@@ -20031,8 +20696,8 @@ class RTLManager {
|
|
|
20031
20696
|
}
|
|
20032
20697
|
}
|
|
20033
20698
|
/**
|
|
20034
|
-
|
|
20035
|
-
|
|
20699
|
+
* Emit theme load event
|
|
20700
|
+
*/ emitThemeLoad(themeName) {
|
|
20036
20701
|
for (const callback of this.eventListeners.themeLoad) try {
|
|
20037
20702
|
callback(themeName);
|
|
20038
20703
|
} catch (error) {
|
|
@@ -20042,8 +20707,8 @@ class RTLManager {
|
|
|
20042
20707
|
}
|
|
20043
20708
|
}
|
|
20044
20709
|
/**
|
|
20045
|
-
|
|
20046
|
-
|
|
20710
|
+
* Emit theme error event
|
|
20711
|
+
*/ emitThemeError(error, themeName) {
|
|
20047
20712
|
if (error instanceof ThemeError || new ThemeError(error.message, ThemeErrorCode.THEME_LOAD_FAILED, {
|
|
20048
20713
|
themeName: themeName,
|
|
20049
20714
|
originalError: error.message
|
|
@@ -20063,28 +20728,28 @@ class RTLManager {
|
|
|
20063
20728
|
}
|
|
20064
20729
|
}
|
|
20065
20730
|
/**
|
|
20066
|
-
|
|
20067
|
-
|
|
20731
|
+
* Get engine instance (for advanced usage)
|
|
20732
|
+
*/ getEngine() {
|
|
20068
20733
|
return this.engine;
|
|
20069
20734
|
}
|
|
20070
20735
|
/**
|
|
20071
|
-
|
|
20072
|
-
|
|
20736
|
+
* Get RTL manager
|
|
20737
|
+
*/ getRTLManager() {
|
|
20073
20738
|
return this.rtlManager;
|
|
20074
20739
|
}
|
|
20075
20740
|
/**
|
|
20076
|
-
|
|
20077
|
-
|
|
20741
|
+
* Set RTL direction
|
|
20742
|
+
*/ setDirection(direction) {
|
|
20078
20743
|
this.rtlManager?.setDirection(direction);
|
|
20079
20744
|
}
|
|
20080
20745
|
/**
|
|
20081
|
-
|
|
20082
|
-
|
|
20746
|
+
* Get current direction
|
|
20747
|
+
*/ getDirection() {
|
|
20083
20748
|
return this.rtlManager?.getDirection() || "ltr";
|
|
20084
20749
|
}
|
|
20085
20750
|
/**
|
|
20086
|
-
|
|
20087
|
-
|
|
20751
|
+
* Destroy theme manager
|
|
20752
|
+
*/ destroy() {
|
|
20088
20753
|
// Remove all listeners
|
|
20089
20754
|
this.eventListeners = {
|
|
20090
20755
|
themeChange: [],
|
|
@@ -20105,7 +20770,7 @@ class RTLManager {
|
|
|
20105
20770
|
*/
|
|
20106
20771
|
/**
|
|
20107
20772
|
* Theme context with default values
|
|
20108
|
-
*/ const ThemeContext =
|
|
20773
|
+
*/ const ThemeContext = React.createContext(null);
|
|
20109
20774
|
|
|
20110
20775
|
ThemeContext.displayName = "ThemeContext";
|
|
20111
20776
|
|
|
@@ -20481,7 +21146,7 @@ const ThemeProvider = ({children: children, defaultTheme: defaultTheme, themes:
|
|
|
20481
21146
|
...target
|
|
20482
21147
|
};
|
|
20483
21148
|
for (const source of sources) if (source) for (const key in source) {
|
|
20484
|
-
if (!
|
|
21149
|
+
if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
|
|
20485
21150
|
const targetValue = result[key], sourceValue = source[key];
|
|
20486
21151
|
isObject(targetValue) && isObject(sourceValue) ?
|
|
20487
21152
|
// Recursively merge objects
|
|
@@ -20578,25 +21243,6 @@ const ThemeProvider = ({children: children, defaultTheme: defaultTheme, themes:
|
|
|
20578
21243
|
custom: theme.custom
|
|
20579
21244
|
};
|
|
20580
21245
|
}
|
|
20581
|
-
/**
|
|
20582
|
-
* createTheme - Create a theme object with computed values
|
|
20583
|
-
*
|
|
20584
|
-
* Similar to Material-UI's createTheme, this function accepts theme configuration
|
|
20585
|
-
* options and returns a complete theme object with computed values.
|
|
20586
|
-
*
|
|
20587
|
-
* @example
|
|
20588
|
-
* ```typescript
|
|
20589
|
-
* const theme = createTheme({
|
|
20590
|
-
* palette: {
|
|
20591
|
-
* primary: { main: '#7AFFD7' },
|
|
20592
|
-
* secondary: { main: '#FF5733' },
|
|
20593
|
-
* },
|
|
20594
|
-
* typography: {
|
|
20595
|
-
* fontFamily: 'Inter, sans-serif',
|
|
20596
|
-
* },
|
|
20597
|
-
* });
|
|
20598
|
-
* ```
|
|
20599
|
-
*/
|
|
20600
21246
|
// ============================================================================
|
|
20601
21247
|
// Default Theme Values
|
|
20602
21248
|
// ============================================================================
|
|
@@ -20823,7 +21469,7 @@ function createPaletteColor(color) {
|
|
|
20823
21469
|
*/
|
|
20824
21470
|
function createTheme(...options) {
|
|
20825
21471
|
// Merge all options
|
|
20826
|
-
const mergedOptions = options.
|
|
21472
|
+
const mergedOptions = _reduceInstanceProperty(options).call(options, ((acc, option) => deepMerge(acc, option)), {}), palette = {
|
|
20827
21473
|
primary: createPaletteColor(mergedOptions.palette?.primary || DEFAULT_PALETTE.primary),
|
|
20828
21474
|
secondary: createPaletteColor(mergedOptions.palette?.secondary || DEFAULT_PALETTE.secondary),
|
|
20829
21475
|
error: createPaletteColor(mergedOptions.palette?.error || DEFAULT_PALETTE.error),
|
|
@@ -20999,11 +21645,6 @@ function createThemeFromConfig(config) {
|
|
|
20999
21645
|
return config.prefix && config.prefix, theme;
|
|
21000
21646
|
}
|
|
21001
21647
|
|
|
21002
|
-
/**
|
|
21003
|
-
* Theme Tools for Library Users
|
|
21004
|
-
*
|
|
21005
|
-
* Developer-friendly utilities for working with Atomix themes
|
|
21006
|
-
*/
|
|
21007
21648
|
/**
|
|
21008
21649
|
* Quick theme creator with sensible defaults
|
|
21009
21650
|
*/ function quickTheme(name, primaryColor, secondaryColor) {
|
|
@@ -21029,7 +21670,7 @@ function createThemeFromConfig(config) {
|
|
|
21029
21670
|
mode: "dark",
|
|
21030
21671
|
background: {
|
|
21031
21672
|
default: "#121212",
|
|
21032
|
-
|
|
21673
|
+
subtle: "#1e1e1e"
|
|
21033
21674
|
},
|
|
21034
21675
|
text: {
|
|
21035
21676
|
primary: "#ffffff",
|
|
@@ -21094,8 +21735,8 @@ function exportTheme(theme) {
|
|
|
21094
21735
|
this.commands = new Map, this.registerDefaultCommands();
|
|
21095
21736
|
}
|
|
21096
21737
|
/**
|
|
21097
|
-
|
|
21098
|
-
|
|
21738
|
+
* Register default commands
|
|
21739
|
+
*/ registerDefaultCommands() {
|
|
21099
21740
|
this.register({
|
|
21100
21741
|
name: "validate",
|
|
21101
21742
|
description: "Validate theme configuration",
|
|
@@ -21139,13 +21780,13 @@ function exportTheme(theme) {
|
|
|
21139
21780
|
});
|
|
21140
21781
|
}
|
|
21141
21782
|
/**
|
|
21142
|
-
|
|
21143
|
-
|
|
21783
|
+
* Register a command
|
|
21784
|
+
*/ register(command) {
|
|
21144
21785
|
this.commands.set(command.name, command);
|
|
21145
21786
|
}
|
|
21146
21787
|
/**
|
|
21147
|
-
|
|
21148
|
-
|
|
21788
|
+
* Run CLI with arguments
|
|
21789
|
+
*/ async run(args) {
|
|
21149
21790
|
const [commandName, ...commandArgs] = args;
|
|
21150
21791
|
if (!commandName) return void this.handleHelp([], {});
|
|
21151
21792
|
const command = this.commands.get(commandName);
|
|
@@ -21159,8 +21800,8 @@ function exportTheme(theme) {
|
|
|
21159
21800
|
}
|
|
21160
21801
|
}
|
|
21161
21802
|
/**
|
|
21162
|
-
|
|
21163
|
-
|
|
21803
|
+
* Parse command arguments
|
|
21804
|
+
*/ parseArgs(args) {
|
|
21164
21805
|
const parsedArgs = [], options = {};
|
|
21165
21806
|
for (let i = 0; i < args.length; i++) {
|
|
21166
21807
|
const arg = args[i];
|
|
@@ -21175,8 +21816,8 @@ function exportTheme(theme) {
|
|
|
21175
21816
|
};
|
|
21176
21817
|
}
|
|
21177
21818
|
/**
|
|
21178
|
-
|
|
21179
|
-
|
|
21819
|
+
* Handle validate command
|
|
21820
|
+
*/ handleValidate(args, options) {
|
|
21180
21821
|
try {
|
|
21181
21822
|
const result = validateConfig(loadThemeConfig());
|
|
21182
21823
|
result.valid ? result.warnings.length > 0 && result.warnings.forEach((warning => {})) : (result.errors.forEach((error => {})),
|
|
@@ -21186,8 +21827,8 @@ function exportTheme(theme) {
|
|
|
21186
21827
|
}
|
|
21187
21828
|
}
|
|
21188
21829
|
/**
|
|
21189
|
-
|
|
21190
|
-
|
|
21830
|
+
* Handle list command
|
|
21831
|
+
*/ handleList(args, options) {
|
|
21191
21832
|
try {
|
|
21192
21833
|
const themes = loadThemeConfig().themes || {};
|
|
21193
21834
|
if (0 === Object.keys(themes).length) return;
|
|
@@ -21198,8 +21839,8 @@ function exportTheme(theme) {
|
|
|
21198
21839
|
}
|
|
21199
21840
|
}
|
|
21200
21841
|
/**
|
|
21201
|
-
|
|
21202
|
-
|
|
21842
|
+
* Handle inspect command
|
|
21843
|
+
*/ handleInspect(args, options) {
|
|
21203
21844
|
const themeName = options.theme || args[0];
|
|
21204
21845
|
themeName || (console.error("Error: Theme name is required"), console.error("Usage: atomix-theme inspect --theme <theme-name>"),
|
|
21205
21846
|
process.exit(1));
|
|
@@ -21212,8 +21853,8 @@ function exportTheme(theme) {
|
|
|
21212
21853
|
}
|
|
21213
21854
|
}
|
|
21214
21855
|
/**
|
|
21215
|
-
|
|
21216
|
-
|
|
21856
|
+
* Handle compare command
|
|
21857
|
+
*/ handleCompare(args, options) {
|
|
21217
21858
|
const theme1 = options.theme1 || args[0], theme2 = options.theme2 || args[1];
|
|
21218
21859
|
theme1 && theme2 || (console.error("Error: Two theme names are required"), console.error("Usage: atomix-theme compare --theme1 <name1> --theme2 <name2>"),
|
|
21219
21860
|
process.exit(1));
|
|
@@ -21232,8 +21873,8 @@ function exportTheme(theme) {
|
|
|
21232
21873
|
}
|
|
21233
21874
|
}
|
|
21234
21875
|
/**
|
|
21235
|
-
|
|
21236
|
-
|
|
21876
|
+
* Handle export command
|
|
21877
|
+
*/ handleExport(args, options) {
|
|
21237
21878
|
const themeName = options.theme || args[0], outputPath = options.output || `${themeName}.json`;
|
|
21238
21879
|
themeName || (console.error("Error: Theme name is required"), console.error("Usage: atomix-theme export --theme <theme-name> [--output <path>]"),
|
|
21239
21880
|
process.exit(1));
|
|
@@ -21246,8 +21887,8 @@ function exportTheme(theme) {
|
|
|
21246
21887
|
}
|
|
21247
21888
|
}
|
|
21248
21889
|
/**
|
|
21249
|
-
|
|
21250
|
-
|
|
21890
|
+
* Handle help command
|
|
21891
|
+
*/ handleHelp(args, options) {
|
|
21251
21892
|
for (const [name, command] of this.commands.entries()) if (command.options) for (const [option, description] of Object.entries(command.options)) ;
|
|
21252
21893
|
}
|
|
21253
21894
|
}
|
|
@@ -22017,9 +22658,12 @@ function exportTheme(theme) {
|
|
|
22017
22658
|
...theme
|
|
22018
22659
|
}, keys = path.split(".");
|
|
22019
22660
|
let current = newTheme;
|
|
22020
|
-
for (let i = 0; i < keys.length - 1; i++)
|
|
22021
|
-
|
|
22022
|
-
|
|
22661
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
22662
|
+
const key = keys[i];
|
|
22663
|
+
key && !current[key] && (current[key] = {}), key && (current = current[key]);
|
|
22664
|
+
}
|
|
22665
|
+
const lastKey = keys[keys.length - 1];
|
|
22666
|
+
lastKey && (current[lastKey] = value), updateTheme(createTheme(newTheme));
|
|
22023
22667
|
}), [ theme, updateTheme ]), exportTheme = React.useCallback((() => {
|
|
22024
22668
|
const dataStr = JSON.stringify(theme, null, 2), dataUri = "data:application/json;charset=utf-8," + encodeURIComponent(dataStr), exportFileDefaultName = `${theme.name.toLowerCase().replace(/\s+/g, "-")}-theme.json`, linkElement = document.createElement("a");
|
|
22025
22669
|
linkElement.setAttribute("href", dataUri), linkElement.setAttribute("download", exportFileDefaultName),
|
|
@@ -22185,8 +22829,8 @@ class ThemeApplicator {
|
|
|
22185
22829
|
this.appliedVars = new Set, this.root = root;
|
|
22186
22830
|
}
|
|
22187
22831
|
/**
|
|
22188
|
-
|
|
22189
|
-
|
|
22832
|
+
* Apply a complete theme configuration
|
|
22833
|
+
*/ applyTheme(theme) {
|
|
22190
22834
|
// Clear previously applied variables
|
|
22191
22835
|
this.clearAppliedVars(),
|
|
22192
22836
|
// Apply global CSS variables
|
|
@@ -22201,55 +22845,56 @@ class ThemeApplicator {
|
|
|
22201
22845
|
theme.components && this.applyComponentOverrides(theme.components);
|
|
22202
22846
|
}
|
|
22203
22847
|
/**
|
|
22204
|
-
|
|
22205
|
-
|
|
22848
|
+
* Apply global CSS variables
|
|
22849
|
+
*/ applyGlobalCSSVars(vars) {
|
|
22206
22850
|
Object.entries(vars).forEach((([key, value]) => {
|
|
22207
22851
|
this.root.style.setProperty(key, String(value)), this.appliedVars.add(key);
|
|
22208
22852
|
}));
|
|
22209
22853
|
}
|
|
22210
22854
|
/**
|
|
22211
|
-
|
|
22212
|
-
|
|
22855
|
+
* Apply typography system
|
|
22856
|
+
*/ applyTypography(typography) {
|
|
22213
22857
|
if (!typography) return;
|
|
22214
22858
|
const vars = {};
|
|
22215
22859
|
typography.fontFamily && (vars["--atomix-font-family"] = typography.fontFamily),
|
|
22216
22860
|
typography.fontSize && Object.entries(typography.fontSize).forEach((([key, value]) => {
|
|
22217
|
-
vars[`--atomix-font-size-${key}`] = value;
|
|
22861
|
+
"string" != typeof value && "number" != typeof value || (vars[`--atomix-font-size-${key}`] = value);
|
|
22218
22862
|
})), typography.fontWeight && Object.entries(typography.fontWeight).forEach((([key, value]) => {
|
|
22219
|
-
vars[`--atomix-font-weight-${key}`] = value;
|
|
22863
|
+
"string" != typeof value && "number" != typeof value || (vars[`--atomix-font-weight-${key}`] = value);
|
|
22220
22864
|
})), typography.lineHeight && Object.entries(typography.lineHeight).forEach((([key, value]) => {
|
|
22221
|
-
vars[`--atomix-line-height-${key}`] = value;
|
|
22865
|
+
"string" != typeof value && "number" != typeof value || (vars[`--atomix-line-height-${key}`] = value);
|
|
22222
22866
|
})), this.applyGlobalCSSVars(vars);
|
|
22223
22867
|
}
|
|
22224
22868
|
/**
|
|
22225
|
-
|
|
22226
|
-
|
|
22869
|
+
* Apply spacing system
|
|
22870
|
+
*/ applySpacing(spacing) {
|
|
22227
22871
|
const vars = {};
|
|
22228
|
-
|
|
22229
|
-
|
|
22230
|
-
|
|
22872
|
+
// Handle spacing function or object
|
|
22873
|
+
"function" != typeof spacing && ("object" == typeof spacing && null !== spacing && Object.entries(spacing).forEach((([key, value]) => {
|
|
22874
|
+
"string" != typeof value && "number" != typeof value || (vars[`--atomix-space-${key}`] = value);
|
|
22875
|
+
})), this.applyGlobalCSSVars(vars));
|
|
22231
22876
|
}
|
|
22232
22877
|
/**
|
|
22233
|
-
|
|
22234
|
-
|
|
22878
|
+
* Apply color palette
|
|
22879
|
+
*/ applyPalette(palette) {
|
|
22235
22880
|
if (!palette) return;
|
|
22236
22881
|
const vars = {};
|
|
22237
22882
|
Object.entries(palette).forEach((([colorName, colorScale]) => {
|
|
22238
|
-
colorScale && Object.entries(colorScale).forEach((([shade, value]) => {
|
|
22239
|
-
value && (vars[`--atomix-color-${colorName}-${shade}`] = value);
|
|
22883
|
+
colorScale && "object" == typeof colorScale && Object.entries(colorScale).forEach((([shade, value]) => {
|
|
22884
|
+
!value || "string" != typeof value && "number" != typeof value || (vars[`--atomix-color-${colorName}-${shade}`] = value);
|
|
22240
22885
|
}));
|
|
22241
22886
|
})), this.applyGlobalCSSVars(vars);
|
|
22242
22887
|
}
|
|
22243
22888
|
/**
|
|
22244
|
-
|
|
22245
|
-
|
|
22889
|
+
* Apply component-level overrides
|
|
22890
|
+
*/ applyComponentOverrides(overrides) {
|
|
22246
22891
|
Object.entries(overrides).forEach((([componentName, override]) => {
|
|
22247
22892
|
override && this.applyComponentOverride(componentName, override);
|
|
22248
22893
|
}));
|
|
22249
22894
|
}
|
|
22250
22895
|
/**
|
|
22251
|
-
|
|
22252
|
-
|
|
22896
|
+
* Apply override for a specific component
|
|
22897
|
+
*/ applyComponentOverride(componentName, override) {
|
|
22253
22898
|
const vars = {}, componentKey = componentName.toLowerCase();
|
|
22254
22899
|
// Apply component-level CSS variables
|
|
22255
22900
|
override.cssVars && Object.entries(override.cssVars).forEach((([key, value]) => {
|
|
@@ -22273,23 +22918,23 @@ class ThemeApplicator {
|
|
|
22273
22918
|
})), this.applyGlobalCSSVars(vars);
|
|
22274
22919
|
}
|
|
22275
22920
|
/**
|
|
22276
|
-
|
|
22277
|
-
|
|
22921
|
+
* Clear all applied CSS variables
|
|
22922
|
+
*/ clearAppliedVars() {
|
|
22278
22923
|
removeCSSVariables(Array.from(this.appliedVars), this.root), this.appliedVars.clear();
|
|
22279
22924
|
}
|
|
22280
22925
|
/**
|
|
22281
|
-
|
|
22282
|
-
|
|
22926
|
+
* Get all currently applied variables
|
|
22927
|
+
*/ getAppliedVars() {
|
|
22283
22928
|
return Array.from(this.appliedVars);
|
|
22284
22929
|
}
|
|
22285
22930
|
/**
|
|
22286
|
-
|
|
22287
|
-
|
|
22931
|
+
* Remove theme application
|
|
22932
|
+
*/ removeTheme() {
|
|
22288
22933
|
this.clearAppliedVars();
|
|
22289
22934
|
}
|
|
22290
22935
|
/**
|
|
22291
|
-
|
|
22292
|
-
|
|
22936
|
+
* Update specific CSS variables without clearing all
|
|
22937
|
+
*/ updateCSSVars(vars) {
|
|
22293
22938
|
this.applyGlobalCSSVars(vars);
|
|
22294
22939
|
}
|
|
22295
22940
|
}
|
|
@@ -22629,7 +23274,7 @@ function mergePartStyles(base, override) {
|
|
|
22629
23274
|
// No slot provided, use fallback
|
|
22630
23275
|
if (!slot) return fallback;
|
|
22631
23276
|
// Slot is a plain React node
|
|
22632
|
-
if (React__default.default.isValidElement(slot) || "string" == typeof slot || "number" == typeof slot) return slot;
|
|
23277
|
+
if ( React__default.default.isValidElement(slot) || "string" == typeof slot || "number" == typeof slot) return slot;
|
|
22633
23278
|
// Slot is an object with rendering options
|
|
22634
23279
|
if ("object" == typeof slot && null !== slot) {
|
|
22635
23280
|
const slotObj = slot;
|
|
@@ -22717,11 +23362,11 @@ exports.Card = Card, exports.Chart = Chart, exports.ChartRenderer = ChartRendere
|
|
|
22717
23362
|
exports.Checkbox = Checkbox, exports.ColorModeToggle = ColorModeToggle, exports.Container = Container,
|
|
22718
23363
|
exports.Countdown = Countdown, exports.DATA_TABLE_CLASSES = DATA_TABLE_CLASSES,
|
|
22719
23364
|
exports.DATA_TABLE_SELECTORS = DATA_TABLE_SELECTORS, exports.DATEPICKER = DATEPICKER,
|
|
22720
|
-
exports.
|
|
22721
|
-
exports.
|
|
22722
|
-
exports.
|
|
22723
|
-
exports.
|
|
22724
|
-
exports.FORM_GROUP = FORM_GROUP, exports.Footer = Footer, exports.FooterLink = FooterLink,
|
|
23365
|
+
exports.DEFAULT_ATOMIX_FONTS = DEFAULT_ATOMIX_FONTS, exports.DOTS = "...", exports.DROPDOWN = DROPDOWN,
|
|
23366
|
+
exports.DROPDOWN_CSS_VARS = DROPDOWN_CSS_VARS, exports.DataTable = DataTable, exports.DatePicker = DatePicker,
|
|
23367
|
+
exports.DonutChart = DonutChart, exports.Dropdown = Dropdown, exports.EDGE_PANEL = EDGE_PANEL,
|
|
23368
|
+
exports.EdgePanel = EdgePanel, exports.ElevationCard = ElevationCard, exports.FOOTER = FOOTER,
|
|
23369
|
+
exports.FORM = FORM, exports.FORM_GROUP = FORM_GROUP, exports.Footer = Footer, exports.FooterLink = FooterLink,
|
|
22725
23370
|
exports.FooterSection = FooterSection, exports.FooterSocialLink = FooterSocialLink,
|
|
22726
23371
|
exports.Form = Form, exports.FormGroup = FormGroup, exports.FunnelChart = FunnelChart,
|
|
22727
23372
|
exports.GLASS_CONTAINER = GLASS_CONTAINER, exports.GaugeChart = GaugeChart, exports.Grid = Grid,
|
|
@@ -22763,8 +23408,9 @@ exports.applyCSSVarsToStyle =
|
|
|
22763
23408
|
* Utility to apply CSS variables to style object
|
|
22764
23409
|
*/
|
|
22765
23410
|
function(cssVars, baseStyle) {
|
|
23411
|
+
var _context2;
|
|
22766
23412
|
return {
|
|
22767
|
-
...Object.entries(cssVars).
|
|
23413
|
+
..._reduceInstanceProperty(_context2 = Object.entries(cssVars)).call(_context2, ((acc, [key, value]) => (acc[key] = "number" == typeof value ? `${value}px` : value,
|
|
22768
23414
|
acc)), {}),
|
|
22769
23415
|
...baseStyle
|
|
22770
23416
|
};
|
|
@@ -22791,10 +23437,11 @@ function(cssVars, baseStyle) {
|
|
|
22791
23437
|
* const config = loadAtomixConfig();
|
|
22792
23438
|
* const theme = createThemeFromConfig(config);
|
|
22793
23439
|
* ```
|
|
22794
|
-
*/ , exports.
|
|
22795
|
-
exports.
|
|
22796
|
-
exports.
|
|
22797
|
-
exports.
|
|
23440
|
+
*/ , exports.applyPartStyles = applyPartStyles, exports.applyTheme = applyTheme,
|
|
23441
|
+
exports.composables = composables, exports.constants = constants, exports.createCLI = createCLI,
|
|
23442
|
+
exports.createCSSVarStyle = createCSSVarStyle, exports.createDarkVariant = createDarkVariant,
|
|
23443
|
+
exports.createDebugAttrs = createDebugAttrs, exports.createFontPreloadLink = createFontPreloadLink,
|
|
23444
|
+
exports.createPartProps = createPartProps, exports.createSlotComponent =
|
|
22798
23445
|
/**
|
|
22799
23446
|
* Create a slot wrapper component
|
|
22800
23447
|
*
|
|
@@ -22892,7 +23539,8 @@ function(config) {
|
|
|
22892
23539
|
}, exports.exportTheme = exportTheme, exports.extendTheme = extendTheme, exports.extractComponentName = extractComponentName,
|
|
22893
23540
|
exports.extractYouTubeId = extractYouTubeId, exports.generateCSSVariableName = generateCSSVariableName,
|
|
22894
23541
|
exports.generateCSSVariables = generateCSSVariables, exports.generateComponentCSSVars = generateComponentCSSVars,
|
|
22895
|
-
exports.
|
|
23542
|
+
exports.generateFontPreloadTags = generateFontPreloadTags, exports.generateUUID = generateUUID,
|
|
23543
|
+
exports.getCSSVariable = getCSSVariable, exports.getComponentCSSVars =
|
|
22896
23544
|
/**
|
|
22897
23545
|
* Get CSS variables for a component
|
|
22898
23546
|
*/
|
|
@@ -22951,34 +23599,66 @@ exports.loadAtomixConfig = function(options = {}) {
|
|
|
22951
23599
|
* Resolve config path
|
|
22952
23600
|
*
|
|
22953
23601
|
* Finds atomix.config.ts in the project, checking common locations.
|
|
23602
|
+
* Returns null in browser environments where file system access is not available.
|
|
23603
|
+
*
|
|
23604
|
+
* This function is designed to work in Node.js environments only.
|
|
23605
|
+
* In browser builds, it will always return null without attempting to access Node.js modules.
|
|
23606
|
+
*
|
|
23607
|
+
* @internal This function uses Node.js modules and should not be called in browser environments.
|
|
22954
23608
|
*/ , exports.mapSCSSTokensToCSSVars = mapSCSSTokensToCSSVars, exports.mergeCSSVars = mergeCSSVars,
|
|
22955
|
-
exports.
|
|
22956
|
-
exports.mergeSlots = function(...slots) {
|
|
23609
|
+
exports.mergeClassNames = mergeClassNames, exports.mergeComponentProps = mergeComponentProps,
|
|
23610
|
+
exports.mergePartStyles = mergePartStyles, exports.mergeSlots = function(...slots) {
|
|
22957
23611
|
const filtered = slots.filter((s => void 0 !== s));
|
|
22958
|
-
if (0 !== filtered.length) return 1 === filtered.length ? filtered[0] : filtered.
|
|
23612
|
+
if (0 !== filtered.length) return 1 === filtered.length ? filtered[0] : _reduceInstanceProperty(filtered).call(filtered, ((acc, slot) => ({
|
|
22959
23613
|
...acc,
|
|
22960
23614
|
...slot
|
|
22961
23615
|
})));
|
|
22962
|
-
}, exports.mergeTheme = mergeTheme, exports.
|
|
22963
|
-
exports.
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
23616
|
+
}, exports.mergeTheme = mergeTheme, exports.preloadFonts = preloadFonts, exports.quickTheme = quickTheme,
|
|
23617
|
+
exports.removeCSSVariables = removeCSSVariables, exports.removeTheme = removeTheme,
|
|
23618
|
+
exports.renderSlot = renderSlot, exports.resolveConfigPath = function() {
|
|
23619
|
+
// Early return for browser environments - prevents any Node.js module access
|
|
23620
|
+
// This check happens before any require() calls, preventing bundlers from analyzing them
|
|
23621
|
+
if ("undefined" != typeof window || "undefined" == typeof process || !process.cwd) return null;
|
|
23622
|
+
// Only attempt to load Node.js modules in Node.js runtime
|
|
23623
|
+
// Use a lazy-loading pattern that prevents static analysis by bundlers
|
|
23624
|
+
try {
|
|
23625
|
+
// Create a function that only executes in Node.js runtime
|
|
23626
|
+
// Use string-based module names to prevent static analysis by bundlers
|
|
23627
|
+
const modules = (() => {
|
|
23628
|
+
// These requires are only executed at runtime in Node.js environments
|
|
23629
|
+
// They are marked as external in Rollup config and should not be bundled
|
|
23630
|
+
// Using string concatenation and computed property access to prevent static analysis
|
|
23631
|
+
if ("undefined" == typeof require) return null;
|
|
23632
|
+
// Use a try-catch wrapper to safely access require
|
|
23633
|
+
try {
|
|
23634
|
+
// Build module names dynamically to prevent static analysis
|
|
23635
|
+
const moduleNames = [ "fs", "path" ];
|
|
23636
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
23637
|
+
return {
|
|
23638
|
+
fs: require(moduleNames[0]),
|
|
23639
|
+
path: require(moduleNames[1])
|
|
23640
|
+
};
|
|
23641
|
+
} catch {
|
|
23642
|
+
return null;
|
|
23643
|
+
}
|
|
23644
|
+
})();
|
|
23645
|
+
if (!modules) return null;
|
|
23646
|
+
const {fs: fs, path: path} = modules, cwd = process.cwd(), possiblePaths = [ path.join(cwd, "atomix.config.ts"), path.join(cwd, "atomix.config.js"), path.join(cwd, "atomix.config.mjs") ];
|
|
23647
|
+
for (const configPath of possiblePaths) if (fs.existsSync(configPath)) return configPath;
|
|
23648
|
+
} catch (error) {
|
|
23649
|
+
// Silently fail in browser environments or when modules are unavailable
|
|
23650
|
+
return null;
|
|
23651
|
+
}
|
|
22967
23652
|
return null;
|
|
22968
23653
|
}, exports.runCLI = runCLI, exports.sliderConstants = sliderConstants, exports.supportsDarkMode = function(theme) {
|
|
22969
|
-
|
|
23654
|
+
var _context;
|
|
23655
|
+
return "dark" === theme.palette?.mode || !0 === theme.supportsDarkMode || Boolean((null == (_context = theme.a11y?.modes) ? void 0 : Function.call.bind(_includesInstanceProperty(_context), _context))?.("dark"));
|
|
22970
23656
|
}, exports.theme = theme, exports.themeToCSS = themeToCSS, exports.types = types,
|
|
22971
23657
|
exports.useAccordion = useAccordion, exports.useAtomixGlass = useAtomixGlass, exports.useBadge = useBadge,
|
|
22972
23658
|
exports.useBarChart = useBarChart, exports.useBlock = useBlock, exports.useBreadcrumb = useBreadcrumb,
|
|
22973
23659
|
exports.useButton = useButton, exports.useCard = useCard, exports.useChartData = useChartData,
|
|
22974
23660
|
exports.useChartInteraction = useChartInteraction, exports.useChartScale = useChartScale,
|
|
22975
23661
|
exports.useCheckbox = useCheckbox, exports.useComponentCustomization =
|
|
22976
|
-
/**
|
|
22977
|
-
* Component Customization Hook
|
|
22978
|
-
*
|
|
22979
|
-
* Merges theme-level component overrides with component-level props
|
|
22980
|
-
* for comprehensive customization support.
|
|
22981
|
-
*/
|
|
22982
23662
|
/**
|
|
22983
23663
|
* Hook to merge theme overrides with component props
|
|
22984
23664
|
*
|
|
@@ -23004,8 +23684,11 @@ function(component, props) {
|
|
|
23004
23684
|
})), merged;
|
|
23005
23685
|
}), [ theme, component, props.parts ]), className = React.useMemo((() => [ theme?.components?.[component]?.className || "", props.className || "" ].filter(Boolean).join(" ")), [ theme, component, props.className ]), style = React.useMemo((() => ({
|
|
23006
23686
|
...props.style
|
|
23007
|
-
})), [ props.style ]), cssVarStyle = React.useMemo((() =>
|
|
23008
|
-
|
|
23687
|
+
})), [ props.style ]), cssVarStyle = React.useMemo((() => {
|
|
23688
|
+
var _context;
|
|
23689
|
+
return _reduceInstanceProperty(_context = Object.entries(cssVars)).call(_context, ((acc, [key, value]) => (acc[key] = "number" == typeof value ? `${value}px` : value,
|
|
23690
|
+
acc)), {});
|
|
23691
|
+
}), [ cssVars ]);
|
|
23009
23692
|
// Merge CSS variables
|
|
23010
23693
|
return {
|
|
23011
23694
|
cssVars: cssVars,
|