@atom-learning/components 10.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/action-icon/ActionIcon.d.ts +4 -3
- package/dist/components/action-icon/ActionIcon.js +4 -2
- package/dist/components/action-icon/ActionIcon.js.map +1 -1
- package/dist/components/banner/banner-regular/BannerRegular.d.ts +1 -0
- package/dist/components/banner/banner-regular/BannerRegularDismiss.d.ts +5 -3
- package/dist/components/banner/banner-slim/BannerSlim.d.ts +9 -2
- package/dist/components/banner/banner-slim/BannerSlimDismiss.d.ts +5 -3
- package/dist/components/button/Button.d.ts +2 -2
- package/dist/components/button/Button.js +21 -17
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +2 -1
- package/dist/components/dropdown-menu/DropdownMenuLinkItem.d.ts +2 -1
- package/dist/components/dropdown-menu/DropdownMenuLinkItem.js +18 -13
- package/dist/components/dropdown-menu/DropdownMenuLinkItem.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/link/Link.d.ts +2 -2
- package/dist/components/link/Link.js +13 -9
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/navigation/NavigationMenu.d.ts +2 -1
- package/dist/components/navigation/NavigationMenuLink.d.ts +2 -1
- package/dist/components/navigation/NavigationMenuLink.js +28 -13
- package/dist/components/navigation/NavigationMenuLink.js.map +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVertical.d.ts +4 -2
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.d.ts +4 -2
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.js +5 -3
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.js.map +1 -1
- package/dist/components/number-input/NumberInputStepper.d.ts +5 -3
- package/dist/components/pagination/PaginationNextButton.d.ts +5 -3
- package/dist/components/pagination/PaginationPreviousButton.d.ts +5 -3
- package/dist/components/router-provider/Router.d.ts +9 -0
- package/dist/components/router-provider/Router.js +7 -0
- package/dist/components/router-provider/Router.js.map +1 -0
- package/dist/components/router-provider/RouterProvider.d.ts +16 -0
- package/dist/components/router-provider/RouterProvider.js +23 -0
- package/dist/components/router-provider/RouterProvider.js.map +1 -0
- package/dist/components/sortable/Handle.d.ts +5 -3
- package/dist/components/tile-interactive/TileInteractive.d.ts +5 -3
- package/dist/components/tile-interactive/TileInteractive.js +4 -2
- package/dist/components/tile-interactive/TileInteractive.js.map +1 -1
- package/dist/components/tile-toggle-group/TileToggleGroupItem.d.ts +5 -2
- package/dist/components/top-bar/TopBar.d.ts +4 -2
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +108 -59
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/dist/types/navigatorActions.types.d.ts +0 -5
package/dist/index.cjs.js
CHANGED
|
@@ -510,6 +510,24 @@ var getExternalAnchorProps = (url) => isExternalUrl(url) ? {
|
|
|
510
510
|
rel: "noopener noreferrer"
|
|
511
511
|
} : {};
|
|
512
512
|
//#endregion
|
|
513
|
+
//#region src/components/router-provider/RouterProvider.tsx
|
|
514
|
+
var RouterContext = react.createContext({});
|
|
515
|
+
var RouterProvider = ({ link, children }) => {
|
|
516
|
+
const value = react.useMemo(() => ({ link }), [link]);
|
|
517
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RouterContext.Provider, {
|
|
518
|
+
value,
|
|
519
|
+
children
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
var isAbsoluteUrl = (url) => /^https?:\/\//.test(url || "");
|
|
523
|
+
var EMPTY = {};
|
|
524
|
+
var useRouterLinkProps = (href, { reloadDocument } = {}) => {
|
|
525
|
+
const { link } = react.useContext(RouterContext);
|
|
526
|
+
if (!link || !href || isAbsoluteUrl(href) || reloadDocument) return EMPTY;
|
|
527
|
+
return { as: link };
|
|
528
|
+
};
|
|
529
|
+
RouterProvider.displayName = "Router.Provider";
|
|
530
|
+
//#endregion
|
|
513
531
|
//#region src/components/action-icon/ActionIcon.constants.ts
|
|
514
532
|
var ActionIconSizeMap = {
|
|
515
533
|
xs: "sm",
|
|
@@ -614,16 +632,17 @@ var StyledButton$5 = styled("button", {
|
|
|
614
632
|
isRounded: { true: ["rounded-full"] }
|
|
615
633
|
}
|
|
616
634
|
}, { enableResponsiveVariants: true });
|
|
617
|
-
var ActionIcon = ({ ref, children, theme = "primary", appearance = "simple", size = "sm", label, href, disabled, hasTooltip = true, tooltipSide, ...rest }) => {
|
|
635
|
+
var ActionIcon = ({ ref, children, theme = "primary", appearance = "simple", size = "sm", label, href, disabled, hasTooltip = true, tooltipSide, reloadDocument, ...rest }) => {
|
|
618
636
|
const INVALID_CHILDREN_MESSAGE = `A single ${Icon.name} component is permitted as a child of ActionIcon`;
|
|
619
637
|
(0, tiny_invariant.default)(react.Children.count(children) === 1, INVALID_CHILDREN_MESSAGE);
|
|
638
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
620
639
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionalTooltipWrapper, {
|
|
621
640
|
hasTooltip,
|
|
622
641
|
label,
|
|
623
642
|
tooltipSide,
|
|
624
643
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledButton$5, {
|
|
625
644
|
...href ? {
|
|
626
|
-
as: "a",
|
|
645
|
+
as: routerLinkProps.as || "a",
|
|
627
646
|
href: disabled ? void 0 : href,
|
|
628
647
|
onClick: void 0,
|
|
629
648
|
"aria-disabled": !!disabled
|
|
@@ -889,23 +908,26 @@ var WithLoader = ({ size, children }) => /* @__PURE__ */ (0, react_jsx_runtime.j
|
|
|
889
908
|
size,
|
|
890
909
|
children
|
|
891
910
|
})] });
|
|
892
|
-
var Button = (({ ref, children, as, href, isLoading = false, onClick, disabled, ...rest }) =>
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
href,
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
children
|
|
907
|
-
|
|
908
|
-
|
|
911
|
+
var Button = (({ ref, children, as, href, isLoading = false, onClick, disabled, reloadDocument, ...rest }) => {
|
|
912
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
913
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledButton, {
|
|
914
|
+
as: as || routerLinkProps.as || (href ? "a" : void 0),
|
|
915
|
+
...!disabled && !isLoading && {
|
|
916
|
+
href,
|
|
917
|
+
onClick
|
|
918
|
+
},
|
|
919
|
+
isLoading,
|
|
920
|
+
type: !href ? "button" : void 0,
|
|
921
|
+
disabled,
|
|
922
|
+
...rest,
|
|
923
|
+
...getExternalAnchorProps(href),
|
|
924
|
+
ref,
|
|
925
|
+
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WithLoader, {
|
|
926
|
+
size: rest.size,
|
|
927
|
+
children
|
|
928
|
+
}) : children
|
|
929
|
+
});
|
|
930
|
+
});
|
|
909
931
|
//#endregion
|
|
910
932
|
//#region src/components/heading/Heading.tsx
|
|
911
933
|
var Heading = styled("h2", {
|
|
@@ -1233,15 +1255,18 @@ var StyledLink = styled("a", {
|
|
|
1233
1255
|
},
|
|
1234
1256
|
defaultVariants: { size: "md" }
|
|
1235
1257
|
}, { enableResponsiveVariants: true });
|
|
1236
|
-
var Link = (({ ref, as, disabled, href, ...rest }) =>
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1258
|
+
var Link = (({ ref, as, disabled, href, reloadDocument, ...rest }) => {
|
|
1259
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
1260
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledLink, {
|
|
1261
|
+
as: as || routerLinkProps.as || (!href ? "button" : void 0),
|
|
1262
|
+
noCapsize: !href ? true : void 0,
|
|
1263
|
+
href,
|
|
1264
|
+
...disabled && { disabled: true },
|
|
1265
|
+
...rest,
|
|
1266
|
+
...getExternalAnchorProps(href),
|
|
1267
|
+
ref
|
|
1268
|
+
});
|
|
1269
|
+
});
|
|
1245
1270
|
//#endregion
|
|
1246
1271
|
//#region src/components/image/ImageCredit.tsx
|
|
1247
1272
|
var overlayControlClasses = [
|
|
@@ -6787,19 +6812,23 @@ DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
|
6787
6812
|
//#endregion
|
|
6788
6813
|
//#region src/components/dropdown-menu/DropdownMenuLinkItem.tsx
|
|
6789
6814
|
var StyledLink$2 = styled("a", { base: ["no-underline"] });
|
|
6790
|
-
var DropdownMenuLinkItem = ({ children, href, target, rel, download, ...rest }) =>
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6815
|
+
var DropdownMenuLinkItem = ({ children, href, reloadDocument, target, rel, download, ...rest }) => {
|
|
6816
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
6817
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuItem, {
|
|
6818
|
+
...rest,
|
|
6819
|
+
asChild: true,
|
|
6820
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledLink$2, {
|
|
6821
|
+
as: routerLinkProps.as,
|
|
6822
|
+
href,
|
|
6823
|
+
target,
|
|
6824
|
+
rel,
|
|
6825
|
+
download,
|
|
6826
|
+
role: "menuitem",
|
|
6827
|
+
...getExternalAnchorProps(href),
|
|
6828
|
+
children
|
|
6829
|
+
})
|
|
6830
|
+
});
|
|
6831
|
+
};
|
|
6803
6832
|
//#endregion
|
|
6804
6833
|
//#region src/components/dropdown-menu/DropdownMenuSeparator.tsx
|
|
6805
6834
|
var DropdownMenuSeparator = styled(_radix_ui_react_dropdown_menu.Separator, { base: [
|
|
@@ -7309,19 +7338,33 @@ var StyledLink$1 = styled(_radix_ui_react_navigation_menu.Link, {
|
|
|
7309
7338
|
]
|
|
7310
7339
|
} }
|
|
7311
7340
|
});
|
|
7312
|
-
var NavigationMenuLink = ({ ref, children, href, disabled, className, variant = "link", ...rest }) =>
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7341
|
+
var NavigationMenuLink = ({ ref, children, href, disabled, className, variant = "link", reloadDocument, ...rest }) => {
|
|
7342
|
+
const RouterLink = useRouterLinkProps(href, { reloadDocument }).as;
|
|
7343
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListItem, { children: disabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DisabledButton, {
|
|
7344
|
+
disabled: true,
|
|
7345
|
+
className,
|
|
7346
|
+
children
|
|
7347
|
+
}) : RouterLink ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledLink$1, {
|
|
7348
|
+
href,
|
|
7349
|
+
ref,
|
|
7350
|
+
elementType: variant,
|
|
7351
|
+
className,
|
|
7352
|
+
asChild: true,
|
|
7353
|
+
...rest,
|
|
7354
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RouterLink, {
|
|
7355
|
+
href,
|
|
7356
|
+
children
|
|
7357
|
+
})
|
|
7358
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledLink$1, {
|
|
7359
|
+
href,
|
|
7360
|
+
ref,
|
|
7361
|
+
elementType: variant,
|
|
7362
|
+
className,
|
|
7363
|
+
...getExternalAnchorProps(href),
|
|
7364
|
+
...rest,
|
|
7365
|
+
children
|
|
7366
|
+
}) });
|
|
7367
|
+
};
|
|
7325
7368
|
//#endregion
|
|
7326
7369
|
//#region src/components/navigation/NavigationMenuDropdownItem.tsx
|
|
7327
7370
|
var NavigationMenuDropdownItem = ({ ref, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuLink, {
|
|
@@ -7589,9 +7632,10 @@ var StyledNavigationMenuVerticalLink = styled(_radix_ui_react_navigation_menu.Li
|
|
|
7589
7632
|
lg: ["min-h-12"]
|
|
7590
7633
|
} }
|
|
7591
7634
|
});
|
|
7592
|
-
var NavigationMenuVerticalLink = ({ as, href, children, ...rest }) => {
|
|
7593
|
-
const
|
|
7594
|
-
const
|
|
7635
|
+
var NavigationMenuVerticalLink = ({ as, href, children, reloadDocument, ...rest }) => {
|
|
7636
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
7637
|
+
const Component = as || routerLinkProps.as || (href ? "a" : "button");
|
|
7638
|
+
const componentProps = as || routerLinkProps.as ? {} : href ? getExternalAnchorProps(href) : { type: "button" };
|
|
7595
7639
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuVerticalItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledNavigationMenuVerticalLink, {
|
|
7596
7640
|
size: "lg",
|
|
7597
7641
|
href,
|
|
@@ -8157,6 +8201,9 @@ var RadioCard = ({ children, isFullWidth = false, size = "md", align = "left", .
|
|
|
8157
8201
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children })]
|
|
8158
8202
|
});
|
|
8159
8203
|
//#endregion
|
|
8204
|
+
//#region src/components/router-provider/Router.ts
|
|
8205
|
+
var Router = { Provider: RouterProvider };
|
|
8206
|
+
//#endregion
|
|
8160
8207
|
//#region src/components/radio-card/RadioCardGroup.tsx
|
|
8161
8208
|
var RadioCardGroup = ({ className, children, size, isFullWidth, align, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Root, {
|
|
8162
8209
|
...rest,
|
|
@@ -10011,9 +10058,10 @@ var StyledTileInteractive = styled(Tile, { base: [
|
|
|
10011
10058
|
"not-disabled:transition-transform",
|
|
10012
10059
|
"not-disabled:translate-y-0"
|
|
10013
10060
|
] });
|
|
10014
|
-
var TileInteractive = ({ ref, onClick, href, type = "button", as, ...rest }) => {
|
|
10061
|
+
var TileInteractive = ({ ref, onClick, href, type = "button", as, reloadDocument, ...rest }) => {
|
|
10062
|
+
const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
|
|
10015
10063
|
const elementSpecificProps = !!href ? {
|
|
10016
|
-
as: as || "a",
|
|
10064
|
+
as: as || routerLinkProps.as || "a",
|
|
10017
10065
|
href,
|
|
10018
10066
|
onClick: void 0
|
|
10019
10067
|
} : {
|
|
@@ -11119,6 +11167,7 @@ exports.RadioButtonField = RadioButtonField;
|
|
|
11119
11167
|
exports.RadioButtonGroup = RadioButtonGroup;
|
|
11120
11168
|
exports.RadioCard = RadioCard;
|
|
11121
11169
|
exports.RadioCardGroup = RadioCardGroup;
|
|
11170
|
+
exports.Router = Router;
|
|
11122
11171
|
exports.SearchField = SearchField;
|
|
11123
11172
|
exports.SearchInput = SearchInput;
|
|
11124
11173
|
exports.SectionMessage = SectionMessage;
|