@shohojdhara/atomix 0.4.2 → 0.4.4
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 +14 -13
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +2 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +2 -10
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +5 -1
- package/dist/core.js +22 -16
- package/dist/core.js.map +1 -1
- package/dist/forms.js +2 -10
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +3 -10
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +73 -47
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +71 -45
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +2 -14
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -4
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/Card/Card.tsx +31 -11
- package/src/components/Dropdown/Dropdown.tsx +276 -273
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Navigation/Nav/NavItem.tsx +6 -3
- package/src/lib/types/components.ts +5 -0
- package/src/styles/02-tools/_tools.utility-api.scss +4 -4
- package/src/styles/06-components/_components.atomix-glass.scss +2 -1
package/dist/index.js
CHANGED
|
@@ -3355,17 +3355,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
3355
3355
|
}) ]
|
|
3356
3356
|
}), withBorder && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3357
3357
|
children: [ jsxRuntime.jsx("span", {
|
|
3358
|
-
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
3359
|
-
style: {
|
|
3360
|
-
width: glassSize.width,
|
|
3361
|
-
height: glassSize.height
|
|
3362
|
-
}
|
|
3358
|
+
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
3363
3359
|
}), jsxRuntime.jsx("span", {
|
|
3364
|
-
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
3365
|
-
style: {
|
|
3366
|
-
width: glassSize.width,
|
|
3367
|
-
height: glassSize.height
|
|
3368
|
-
}
|
|
3360
|
+
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
3369
3361
|
}) ]
|
|
3370
3362
|
}) ]
|
|
3371
3363
|
});
|
|
@@ -4114,10 +4106,9 @@ const BreadcrumbItem = React.forwardRef((({children: children, href: href, acti
|
|
|
4114
4106
|
className: itemClasses,
|
|
4115
4107
|
style: style,
|
|
4116
4108
|
...props,
|
|
4117
|
-
children: href && !active ? LinkComponent ?
|
|
4118
|
-
// @ts-ignore - Dynamic components are tricky in TS without stricter types
|
|
4119
|
-
jsxRuntime.jsx(LinkComponent, {
|
|
4109
|
+
children: href && !active ? linkAs && LinkComponent ? jsxRuntime.jsx(LinkComponent, {
|
|
4120
4110
|
href: href,
|
|
4111
|
+
to: href,
|
|
4121
4112
|
...commonLinkProps,
|
|
4122
4113
|
children: linkContent
|
|
4123
4114
|
}) : jsxRuntime.jsx("a", {
|
|
@@ -4391,6 +4382,7 @@ const Button = React__default.default.memo( React.forwardRef((({label: label, c
|
|
|
4391
4382
|
ref: ref,
|
|
4392
4383
|
// LinkComponent usually forwards ref to anchor
|
|
4393
4384
|
href: href,
|
|
4385
|
+
to: href,
|
|
4394
4386
|
target: target,
|
|
4395
4387
|
rel: "_blank" === target ? "noopener noreferrer" : void 0
|
|
4396
4388
|
};
|
|
@@ -4685,6 +4677,8 @@ active: active = !1, disabled: disabled = !1, loading: loading = !1, selected: s
|
|
|
4685
4677
|
header: header, image: image, imageAlt: imageAlt = "", title: title, text: text, actions: actions, icon: icon, footer: footer, children: children,
|
|
4686
4678
|
// Interaction
|
|
4687
4679
|
onClick: onClick, onHover: onHover, onFocus: onFocus, href: href, target: target,
|
|
4680
|
+
// Custom Link
|
|
4681
|
+
LinkComponent: LinkComponent,
|
|
4688
4682
|
// Glass
|
|
4689
4683
|
glass: glass,
|
|
4690
4684
|
// Accessibility
|
|
@@ -4768,7 +4762,19 @@ className: className = "", style: style, ...rest}, ref) => {
|
|
|
4768
4762
|
};
|
|
4769
4763
|
// Render as anchor if href is provided
|
|
4770
4764
|
if (href && !isDisabled) {
|
|
4771
|
-
|
|
4765
|
+
let anchorElement;
|
|
4766
|
+
if (LinkComponent) {
|
|
4767
|
+
const LinkComp = LinkComponent;
|
|
4768
|
+
anchorElement = jsxRuntime.jsx(LinkComp, {
|
|
4769
|
+
...commonProps,
|
|
4770
|
+
ref: ref,
|
|
4771
|
+
href: href,
|
|
4772
|
+
to: href,
|
|
4773
|
+
target: target,
|
|
4774
|
+
rel: "_blank" === target ? "noopener noreferrer" : void 0,
|
|
4775
|
+
children: cardContent
|
|
4776
|
+
});
|
|
4777
|
+
} else anchorElement = jsxRuntime.jsx("a", {
|
|
4772
4778
|
...commonProps,
|
|
4773
4779
|
ref: ref,
|
|
4774
4780
|
href: href,
|
|
@@ -9870,6 +9876,7 @@ const DropdownItem = React.memo((({children: children, href: href, active: acti
|
|
|
9870
9876
|
close());
|
|
9871
9877
|
}, itemClasses = [ "c-dropdown__menu-item", active ? "is-active" : "", disabled ? "is-disabled" : "", className ].filter(Boolean).join(" "), linkProps = {
|
|
9872
9878
|
href: href,
|
|
9879
|
+
to: href,
|
|
9873
9880
|
className: itemClasses,
|
|
9874
9881
|
onClick: handleClick,
|
|
9875
9882
|
role: "menuitem",
|
|
@@ -9908,13 +9915,32 @@ const DropdownItem = React.memo((({children: children, href: href, active: acti
|
|
|
9908
9915
|
}), children ]
|
|
9909
9916
|
})
|
|
9910
9917
|
});
|
|
9911
|
-
}))
|
|
9918
|
+
}));
|
|
9919
|
+
|
|
9920
|
+
DropdownItem.displayName = "DropdownItem";
|
|
9921
|
+
|
|
9922
|
+
/**
|
|
9923
|
+
* DropdownDivider component for separating groups of items
|
|
9924
|
+
*/
|
|
9925
|
+
const DropdownDivider = React.memo((({className: className = ""}) => jsxRuntime.jsx("li", {
|
|
9912
9926
|
className: `c-dropdown__divider ${className}`,
|
|
9913
9927
|
role: "separator"
|
|
9914
|
-
})))
|
|
9928
|
+
})));
|
|
9929
|
+
|
|
9930
|
+
DropdownDivider.displayName = "DropdownDivider";
|
|
9931
|
+
|
|
9932
|
+
/**
|
|
9933
|
+
* DropdownHeader component for section headers
|
|
9934
|
+
*/
|
|
9935
|
+
const DropdownHeader = React.memo((({children: children, className: className = ""}) => jsxRuntime.jsx("li", {
|
|
9915
9936
|
className: `c-dropdown__header ${className}`,
|
|
9916
9937
|
children: children
|
|
9917
|
-
})))
|
|
9938
|
+
})));
|
|
9939
|
+
|
|
9940
|
+
DropdownHeader.displayName = "DropdownHeader";
|
|
9941
|
+
|
|
9942
|
+
// Helper context to pass glass prop to DropdownMenu
|
|
9943
|
+
const DropdownStyleContext = React.createContext({}), Dropdown = React.memo((function({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}) {
|
|
9918
9944
|
// Set up controlled vs uncontrolled state
|
|
9919
9945
|
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 => {
|
|
9920
9946
|
isControlled || setUncontrolledIsOpen(nextIsOpen), onOpenChange && onOpenChange(nextIsOpen);
|
|
@@ -10066,9 +10092,7 @@ const DropdownItem = React.memo((({children: children, href: href, active: acti
|
|
|
10066
10092
|
});
|
|
10067
10093
|
}));
|
|
10068
10094
|
|
|
10069
|
-
|
|
10070
|
-
* DropdownDivider component for separating groups of items
|
|
10071
|
-
*/ Dropdown.displayName = "Dropdown", Dropdown.Trigger = DropdownTrigger, Dropdown.Menu = DropdownMenu,
|
|
10095
|
+
Dropdown.displayName = "Dropdown", Dropdown.Trigger = DropdownTrigger, Dropdown.Menu = DropdownMenu,
|
|
10072
10096
|
Dropdown.Item = DropdownItem, Dropdown.Divider = DropdownDivider, Dropdown.Header = DropdownHeader;
|
|
10073
10097
|
|
|
10074
10098
|
/**
|
|
@@ -14000,11 +14024,12 @@ const FooterLink = React.forwardRef((({href: href, icon: icon, external: extern
|
|
|
14000
14024
|
const Component = LinkComponent, componentProps = {
|
|
14001
14025
|
ref: ref,
|
|
14002
14026
|
...href && !disabled ? {
|
|
14027
|
+
href: href,
|
|
14003
14028
|
to: href
|
|
14004
14029
|
} : {},
|
|
14005
14030
|
...linkProps
|
|
14006
14031
|
};
|
|
14007
|
-
// Only pass href if the link is not disabled and href exists
|
|
14032
|
+
// Only pass href/to if the link is not disabled and href exists
|
|
14008
14033
|
return jsxRuntime.jsxs(Component, {
|
|
14009
14034
|
...componentProps,
|
|
14010
14035
|
children: [ icon && jsxRuntime.jsx("span", {
|
|
@@ -14839,7 +14864,24 @@ const Modal = ModalWithSubcomponents, Nav = React.forwardRef((({children: child
|
|
|
14839
14864
|
* </NavDropdown>
|
|
14840
14865
|
* </Nav>
|
|
14841
14866
|
* ```
|
|
14842
|
-
*/
|
|
14867
|
+
*/
|
|
14868
|
+
/**
|
|
14869
|
+
* Utility to merge multiple React refs into one
|
|
14870
|
+
*/
|
|
14871
|
+
function setRef(ref, value) {
|
|
14872
|
+
"function" == typeof ref ? ref(value) : ref && (
|
|
14873
|
+
// This is safe because we're checking that ref exists first
|
|
14874
|
+
ref.current = value);
|
|
14875
|
+
}
|
|
14876
|
+
|
|
14877
|
+
/**
|
|
14878
|
+
* Combines two React refs into a single ref function
|
|
14879
|
+
* This is used when you need to use and forward a ref at the same time
|
|
14880
|
+
*/ function useForkRef(refA, refB) {
|
|
14881
|
+
return React__default.default.useMemo((() => null == refA && null == refB ? null : refValue => {
|
|
14882
|
+
setRef(refA, refValue), setRef(refB, refValue);
|
|
14883
|
+
}), [ refA, refB ]);
|
|
14884
|
+
}
|
|
14843
14885
|
|
|
14844
14886
|
/**
|
|
14845
14887
|
* NavItem component represents a single navigation item that can be a link, dropdown trigger, or mega menu trigger.
|
|
@@ -14868,14 +14910,15 @@ const Modal = ModalWithSubcomponents, Nav = React.forwardRef((({children: child
|
|
|
14868
14910
|
* </MegaMenu>
|
|
14869
14911
|
* </NavItem>
|
|
14870
14912
|
* ```
|
|
14871
|
-
*/
|
|
14913
|
+
*/ Nav.displayName = "Nav";
|
|
14914
|
+
|
|
14872
14915
|
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) => {
|
|
14873
14916
|
const {generateNavItemClass: generateNavItemClass, generateNavLinkClass: generateNavLinkClass, handleClick: handleClick} = useNavItem({
|
|
14874
14917
|
dropdown: dropdown,
|
|
14875
14918
|
megaMenu: megaMenu,
|
|
14876
14919
|
active: active,
|
|
14877
14920
|
disabled: disabled
|
|
14878
|
-
}), [isActive, setIsActive] = React.useState(!1), itemRef = React.useRef(null);
|
|
14921
|
+
}), [isActive, setIsActive] = React.useState(!1), itemRef = React.useRef(null), combinedRef = useForkRef(ref, itemRef);
|
|
14879
14922
|
// State for tracking dropdown open state
|
|
14880
14923
|
// Close dropdown on outside click (desktop only)
|
|
14881
14924
|
React.useEffect((() => {
|
|
@@ -14906,8 +14949,9 @@ const NavItem = React.forwardRef((({children: children, dropdown: dropdown = !1
|
|
|
14906
14949
|
disabled: disabled,
|
|
14907
14950
|
className: className
|
|
14908
14951
|
}) + (isActive ? " is-active" : ""), navLinkClass = generateNavLinkClass(active, disabled, dropdown || megaMenu ? "c-nav__dropdown-toggle" : ""), childContent = React__default.default.Children.toArray(children), expanded = void 0 !== ariaExpanded ? ariaExpanded : isActive, linkProps = {
|
|
14909
|
-
ref:
|
|
14952
|
+
ref: combinedRef,
|
|
14910
14953
|
href: href || "#",
|
|
14954
|
+
to: href || "#",
|
|
14911
14955
|
className: navLinkClass,
|
|
14912
14956
|
onClick: dropdown || megaMenu ? e => {
|
|
14913
14957
|
(dropdown || megaMenu) && (e.preventDefault(), setIsActive(!isActive));
|
|
@@ -14917,7 +14961,6 @@ const NavItem = React.forwardRef((({children: children, dropdown: dropdown = !1
|
|
|
14917
14961
|
"aria-current": !active || dropdown || megaMenu ? void 0 : "page"
|
|
14918
14962
|
};
|
|
14919
14963
|
return jsxRuntime.jsxs("li", {
|
|
14920
|
-
ref: ref,
|
|
14921
14964
|
className: navItemClass,
|
|
14922
14965
|
role: "menuitem",
|
|
14923
14966
|
"aria-haspopup": dropdown || megaMenu,
|
|
@@ -15062,23 +15105,7 @@ const Navbar = React.forwardRef((({brand: brand, children: children, variant: v
|
|
|
15062
15105
|
});
|
|
15063
15106
|
}));
|
|
15064
15107
|
|
|
15065
|
-
|
|
15066
|
-
* Utility to merge multiple React refs into one
|
|
15067
|
-
*/
|
|
15068
|
-
function setRef(ref, value) {
|
|
15069
|
-
"function" == typeof ref ? ref(value) : ref && (
|
|
15070
|
-
// This is safe because we're checking that ref exists first
|
|
15071
|
-
ref.current = value);
|
|
15072
|
-
}
|
|
15073
|
-
|
|
15074
|
-
/**
|
|
15075
|
-
* Combines two React refs into a single ref function
|
|
15076
|
-
* This is used when you need to use and forward a ref at the same time
|
|
15077
|
-
*/ function useForkRef(refA, refB) {
|
|
15078
|
-
return React__default.default.useMemo((() => null == refA && null == refB ? null : refValue => {
|
|
15079
|
-
setRef(refA, refValue), setRef(refB, refValue);
|
|
15080
|
-
}), [ refA, refB ]);
|
|
15081
|
-
}
|
|
15108
|
+
Navbar.displayName = "Navbar";
|
|
15082
15109
|
|
|
15083
15110
|
/**
|
|
15084
15111
|
* SideMenuList component provides a container for side menu items.
|
|
@@ -15091,8 +15118,7 @@ function setRef(ref, value) {
|
|
|
15091
15118
|
* <SideMenuItem href="/contact">Contact</SideMenuItem>
|
|
15092
15119
|
* </SideMenuList>
|
|
15093
15120
|
* ```
|
|
15094
|
-
*/
|
|
15095
|
-
|
|
15121
|
+
*/
|
|
15096
15122
|
const SideMenuList = React.forwardRef((({children: children, className: className = ""}, ref) => {
|
|
15097
15123
|
const listClass = `c-side-menu__list ${className}`.trim();
|
|
15098
15124
|
return jsxRuntime.jsx("ul", {
|