@telia/teddy 0.0.21 → 0.0.23
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/accordion/accordion-content.d.ts +5 -0
- package/dist/components/accordion/accordion-content.js +15 -0
- package/dist/components/accordion/accordion-header.d.ts +6 -0
- package/dist/components/accordion/accordion-header.js +16 -0
- package/dist/components/accordion/accordion-indicator.d.ts +5 -0
- package/dist/components/accordion/accordion-indicator.js +16 -0
- package/dist/components/accordion/accordion-item.d.ts +8 -0
- package/dist/components/accordion/accordion-item.js +15 -0
- package/dist/components/accordion/accordion-root.d.ts +15 -0
- package/dist/components/accordion/accordion-root.js +39 -0
- package/dist/components/accordion/accordion-title.d.ts +7 -0
- package/dist/components/accordion/accordion-title.js +15 -0
- package/dist/components/accordion/accordion-trigger.d.ts +12 -0
- package/dist/components/accordion/accordion-trigger.js +20 -0
- package/dist/components/accordion/index.d.ts +29 -2
- package/dist/components/accordion/index.js +15 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/card/card.d.ts +4 -4
- package/dist/components/chip/chip-indicator.d.ts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/drawer/drawer-close.d.ts +15 -0
- package/dist/components/drawer/drawer-close.js +22 -0
- package/dist/components/drawer/drawer-content.d.ts +22 -0
- package/dist/components/drawer/drawer-content.js +25 -0
- package/dist/components/drawer/drawer-description.d.ts +9 -0
- package/dist/components/drawer/drawer-description.js +19 -0
- package/dist/components/drawer/drawer-footer.d.ts +8 -0
- package/dist/components/drawer/drawer-footer.js +16 -0
- package/dist/components/drawer/drawer-overlay.d.ts +13 -0
- package/dist/components/drawer/drawer-overlay.js +26 -0
- package/dist/components/drawer/drawer-root.d.ts +26 -0
- package/dist/components/drawer/drawer-root.js +11 -0
- package/dist/components/drawer/drawer-title.d.ts +9 -0
- package/dist/components/drawer/drawer-title.js +17 -0
- package/dist/components/drawer/drawer-trigger.d.ts +12 -0
- package/dist/components/drawer/drawer-trigger.js +10 -0
- package/dist/components/drawer/index.js +20 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +7 -1
- package/dist/components/modal/modal.js +12 -9
- package/dist/components/navigation-menu/navigation-menu.d.ts +1 -1
- package/dist/components/notification/notification.d.ts +2 -2
- package/dist/components/scroll-area/index.d.ts +38 -0
- package/dist/components/scroll-area/index.js +9 -0
- package/dist/components/scroll-area/scroll-area-bar.d.ts +5 -0
- package/dist/components/scroll-area/scroll-area-bar.js +158 -0
- package/dist/components/scroll-area/scroll-area-button.d.ts +36 -0
- package/dist/components/scroll-area/scroll-area-button.js +11 -0
- package/dist/components/scroll-area/scroll-area-corner.d.ts +5 -0
- package/dist/components/scroll-area/scroll-area-corner.js +8 -0
- package/dist/components/scroll-area/scroll-area-item.d.ts +8 -0
- package/dist/components/scroll-area/scroll-area-item.js +41 -0
- package/dist/components/scroll-area/scroll-area-root.d.ts +21 -0
- package/dist/components/scroll-area/scroll-area-root.js +11 -0
- package/dist/components/scroll-area/scroll-area-thumb.d.ts +5 -0
- package/dist/components/scroll-area/scroll-area-thumb.js +8 -0
- package/dist/components/tabs/index.d.ts +59 -0
- package/dist/components/tabs/index.js +16 -0
- package/dist/components/tabs/tabs-content.d.ts +10 -0
- package/dist/components/tabs/tabs-content.js +15 -0
- package/dist/components/tabs/tabs-list.d.ts +16 -0
- package/dist/components/tabs/tabs-list.js +20 -0
- package/dist/components/tabs/tabs-root.d.ts +46 -0
- package/dist/components/tabs/tabs-root.js +41 -0
- package/dist/components/tabs/tabs-scroll-button.d.ts +27 -0
- package/dist/components/tabs/tabs-scroll-button.js +15 -0
- package/dist/components/tabs/tabs-scroll.d.ts +9 -0
- package/dist/components/tabs/tabs-scroll.js +22 -0
- package/dist/components/tabs/tabs-trigger.d.ts +16 -0
- package/dist/components/tabs/tabs-trigger.js +28 -0
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/toggle/toggle.d.ts +2 -2
- package/dist/drawer.module-B3QhrxH1.js +14 -0
- package/dist/main.js +7 -1
- package/dist/style.css +510 -244
- package/dist/utils/generate-styling/grid.d.ts +24 -24
- package/dist/utils/generate-styling/index.d.ts +16 -16
- package/dist/utils/generate-styling/util.d.ts +2 -2
- package/package.json +16 -13
- package/dist/components/accordion/accordion.d.ts +0 -61
- package/dist/components/accordion/accordion.js +0 -93
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as DrawerPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
export declare const rootClassName = "teddy-drawer";
|
|
5
|
+
export type RootProps = Omit<React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Root>, 'open' | 'defaultOpen' | 'onOpenChange' | 'modal'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The controlled open state of the dialog. Must be used in conjunction with onOpenChange.
|
|
8
|
+
*/
|
|
9
|
+
open?: DrawerPrimitive.DialogProps['open'];
|
|
10
|
+
/**
|
|
11
|
+
* Event handler called when the open state of the dialog changes.
|
|
12
|
+
*/
|
|
13
|
+
onOpenChange?: DrawerPrimitive.DialogProps['onOpenChange'];
|
|
14
|
+
/**
|
|
15
|
+
* The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
|
|
16
|
+
*/
|
|
17
|
+
defaultOpen?: DrawerPrimitive.DialogProps['defaultOpen'];
|
|
18
|
+
/**
|
|
19
|
+
* The modality of the dialog. When set to true, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.
|
|
20
|
+
*/
|
|
21
|
+
modal?: DrawerPrimitive.DialogProps['modal'];
|
|
22
|
+
};
|
|
23
|
+
export declare function Root(props: RootProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare namespace Root {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as DrawerPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
const rootClassName = "teddy-drawer";
|
|
4
|
+
function Root(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Root, { ...props });
|
|
6
|
+
}
|
|
7
|
+
Root.displayName = "Root";
|
|
8
|
+
export {
|
|
9
|
+
Root,
|
|
10
|
+
rootClassName
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Heading } from '../heading';
|
|
3
|
+
|
|
4
|
+
import * as DrawerPrimitive from '@radix-ui/react-dialog';
|
|
5
|
+
/** -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Title
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
export type TitleProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title> & React.ComponentPropsWithoutRef<typeof Heading>;
|
|
9
|
+
export declare const Title: React.ForwardRefExoticComponent<TitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import * as DrawerPrimitive from "@radix-ui/react-dialog";
|
|
5
|
+
import { s as styles } from "../../drawer.module-B3QhrxH1.js";
|
|
6
|
+
import { rootClassName } from "./drawer-root.js";
|
|
7
|
+
import { Heading } from "../heading/heading.js";
|
|
8
|
+
const Title = React__default.forwardRef(
|
|
9
|
+
({ className, asChild, children, variant, ...rest }, forwardedRef) => {
|
|
10
|
+
const classes = clsx([styles[`${rootClassName}__title`]], className);
|
|
11
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Title, { className: classes, ref: forwardedRef, ...rest, asChild: true, children: /* @__PURE__ */ jsx(Heading, { variant: variant ?? "title-300", ...asChild ? { asChild: true } : { as: "h2" }, children }) });
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
Title.displayName = "Title";
|
|
15
|
+
export {
|
|
16
|
+
Title
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as DrawerPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
/** -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Trigger
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
export type TriggerProps = Omit<React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>, 'asChild' | 'children'> & {
|
|
8
|
+
children: React.ReactElement;
|
|
9
|
+
};
|
|
10
|
+
export declare const Trigger: React.ForwardRefExoticComponent<Omit<Omit<DrawerPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref">, "children" | "asChild"> & {
|
|
11
|
+
children: React.ReactElement;
|
|
12
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import * as DrawerPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
const Trigger = React__default.forwardRef(
|
|
5
|
+
({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsx(DrawerPrimitive.Trigger, { ...props, ref: forwardedRef, asChild: true, children })
|
|
6
|
+
);
|
|
7
|
+
Trigger.displayName = "Trigger";
|
|
8
|
+
export {
|
|
9
|
+
Trigger
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Close } from "./drawer-close.js";
|
|
2
|
+
import { Content } from "./drawer-content.js";
|
|
3
|
+
import { Description } from "./drawer-description.js";
|
|
4
|
+
import { Footer } from "./drawer-footer.js";
|
|
5
|
+
import { Overlay } from "./drawer-overlay.js";
|
|
6
|
+
import { Root } from "./drawer-root.js";
|
|
7
|
+
import { Title } from "./drawer-title.js";
|
|
8
|
+
import { Trigger } from "./drawer-trigger.js";
|
|
9
|
+
const Drawer = Object.assign(Root, {
|
|
10
|
+
Title,
|
|
11
|
+
Description,
|
|
12
|
+
Trigger,
|
|
13
|
+
Overlay,
|
|
14
|
+
Content,
|
|
15
|
+
Footer,
|
|
16
|
+
Close
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
Drawer
|
|
20
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ScrollArea } from "./scroll-area/index.js";
|
|
2
|
+
import { Tabs } from "./tabs/index.js";
|
|
3
|
+
import { Drawer } from "./drawer/index.js";
|
|
1
4
|
import { Image } from "./image/image.js";
|
|
2
5
|
import { Chip } from "./chip/index.js";
|
|
3
6
|
import { Modal } from "./modal/modal.js";
|
|
@@ -9,7 +12,7 @@ import { Card } from "./card/card.js";
|
|
|
9
12
|
import { Grid } from "./grid/grid.js";
|
|
10
13
|
import { NavigationMenu } from "./navigation-menu/navigation-menu.js";
|
|
11
14
|
import { Toggle } from "./toggle/toggle.js";
|
|
12
|
-
import { Accordion } from "./accordion/
|
|
15
|
+
import { Accordion } from "./accordion/index.js";
|
|
13
16
|
import { Link } from "./link/link.js";
|
|
14
17
|
import { Badge } from "./badge/badge.js";
|
|
15
18
|
import { Button } from "./button/button.js";
|
|
@@ -32,6 +35,7 @@ export {
|
|
|
32
35
|
Button,
|
|
33
36
|
Card,
|
|
34
37
|
Chip,
|
|
38
|
+
Drawer,
|
|
35
39
|
FieldErrorText,
|
|
36
40
|
Flex,
|
|
37
41
|
Grid,
|
|
@@ -47,7 +51,9 @@ export {
|
|
|
47
51
|
NavigationMenu,
|
|
48
52
|
Notification,
|
|
49
53
|
RadioGroup,
|
|
54
|
+
ScrollArea,
|
|
50
55
|
Spinner,
|
|
56
|
+
Tabs,
|
|
51
57
|
Text,
|
|
52
58
|
TextField,
|
|
53
59
|
TextSpacing,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useEffect } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as DrawerPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import "../scroll-area/index.js";
|
|
5
|
+
import "../tabs/index.js";
|
|
6
|
+
import "../drawer/index.js";
|
|
4
7
|
import "../image/image.js";
|
|
5
8
|
import "../chip/index.js";
|
|
6
9
|
import "../notification/notification.js";
|
|
@@ -11,7 +14,7 @@ import "../card/card.js";
|
|
|
11
14
|
import "../grid/grid.js";
|
|
12
15
|
import "../navigation-menu/navigation-menu.js";
|
|
13
16
|
import "../toggle/toggle.js";
|
|
14
|
-
import "../accordion/
|
|
17
|
+
import "../accordion/index.js";
|
|
15
18
|
import "../link/link.js";
|
|
16
19
|
import "../badge/badge.js";
|
|
17
20
|
import { Button } from "../button/button.js";
|
|
@@ -56,18 +59,18 @@ const Root = (props) => {
|
|
|
56
59
|
const imageRef = React__default.useRef(null);
|
|
57
60
|
const actionGroupRef = React__default.useRef(null);
|
|
58
61
|
const scrollRef = React__default.useRef(null);
|
|
59
|
-
return /* @__PURE__ */ jsx(RootContext.Provider, { value: { imageRef, actionGroupRef, scrollRef }, children: /* @__PURE__ */ jsx(
|
|
62
|
+
return /* @__PURE__ */ jsx(RootContext.Provider, { value: { imageRef, actionGroupRef, scrollRef }, children: /* @__PURE__ */ jsx(DrawerPrimitive.Root, { ...props, modal: true }) });
|
|
60
63
|
};
|
|
61
64
|
Root.displayName = "Dialog.Root";
|
|
62
65
|
const Trigger = React__default.forwardRef(
|
|
63
|
-
({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsx(
|
|
66
|
+
({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsx(DrawerPrimitive.Trigger, { ...props, ref: forwardedRef, asChild: true, children })
|
|
64
67
|
);
|
|
65
68
|
Trigger.displayName = "Dialog.Trigger";
|
|
66
69
|
const OverlayContext = React__default.createContext(false);
|
|
67
70
|
const Overlay = React__default.forwardRef(
|
|
68
71
|
({ className, forceMount, container, ...rest }, forwardedRef) => {
|
|
69
72
|
const classes = clsx([styles[`${rootClassName}__overlay`]], className);
|
|
70
|
-
return /* @__PURE__ */ jsx(OverlayContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
73
|
+
return /* @__PURE__ */ jsx(OverlayContext.Provider, { value: true, children: /* @__PURE__ */ jsx(DrawerPrimitive.Portal, { container, forceMount, children: /* @__PURE__ */ jsx(DrawerPrimitive.Overlay, { className: classes, ref: forwardedRef, ...rest }) }) });
|
|
71
74
|
}
|
|
72
75
|
);
|
|
73
76
|
Overlay.displayName = "Dialog.Content";
|
|
@@ -76,7 +79,7 @@ const InnerContent = React__default.forwardRef(
|
|
|
76
79
|
const classes = clsx([styles[`${rootClassName}__scroll`]], className);
|
|
77
80
|
const context = React__default.useContext(RootContext);
|
|
78
81
|
return /* @__PURE__ */ jsx(
|
|
79
|
-
|
|
82
|
+
DrawerPrimitive.Content,
|
|
80
83
|
{
|
|
81
84
|
...props,
|
|
82
85
|
ref: forwardedRef,
|
|
@@ -146,7 +149,7 @@ const Group = React__default.forwardRef(
|
|
|
146
149
|
Group.displayName = "Dialog.Group";
|
|
147
150
|
const TitleInner = React__default.forwardRef(
|
|
148
151
|
function TitleInner2(props, forwardedRef) {
|
|
149
|
-
return /* @__PURE__ */ jsx(
|
|
152
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { variant: "title-200", as: "h2", ...props, asChild: false, ref: forwardedRef }) });
|
|
150
153
|
}
|
|
151
154
|
);
|
|
152
155
|
const Title = React__default.forwardRef((props, forwardedRef) => {
|
|
@@ -157,7 +160,7 @@ const Title = React__default.forwardRef((props, forwardedRef) => {
|
|
|
157
160
|
return /* @__PURE__ */ jsx(TitleInner, { ...props, ref: forwardedRef });
|
|
158
161
|
});
|
|
159
162
|
Title.displayName = "Dialog.Title";
|
|
160
|
-
const Description = React__default.forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
163
|
+
const Description = React__default.forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(DrawerPrimitive.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { as: "p", variant: "paragraph-100", ...props, asChild: false, ref: forwardedRef }) }));
|
|
161
164
|
Description.displayName = "Dialog.Description";
|
|
162
165
|
const Image = React__default.forwardRef(({ asChild, ...props }, forwardedRef) => {
|
|
163
166
|
const classes = clsx([styles[`${rootClassName}__image`]], props.className);
|
|
@@ -179,7 +182,7 @@ const Close = React__default.forwardRef(
|
|
|
179
182
|
setHasImage(true);
|
|
180
183
|
}
|
|
181
184
|
}, [imageRef]);
|
|
182
|
-
return /* @__PURE__ */ jsx(
|
|
185
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsx(Button, { variant: hasImage ? "primary-negative" : "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"], children: /* @__PURE__ */ jsx(Icon, { name: "close" }) }) });
|
|
183
186
|
}
|
|
184
187
|
);
|
|
185
188
|
Close.displayName = "Dialog.Close";
|
|
@@ -100,7 +100,7 @@ declare const NavigationMenu: React.ForwardRefExoticComponent<Omit<NavigationMen
|
|
|
100
100
|
variant?: "default" | "float" | undefined;
|
|
101
101
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
102
102
|
Link: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>, "ref"> & {
|
|
103
|
-
variant?: "
|
|
103
|
+
variant?: "button" | "small" | "default" | undefined;
|
|
104
104
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
105
105
|
Indicator: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuIndicatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
106
106
|
Viewport: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -80,8 +80,8 @@ declare const Notification: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<
|
|
|
80
80
|
Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
81
81
|
Heading: React.ForwardRefExoticComponent<HeadingProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
82
82
|
Icon: React.ForwardRefExoticComponent<Partial<Omit<React.SVGProps<SVGSVGElement> & {
|
|
83
|
-
name: "
|
|
84
|
-
size?: ("
|
|
83
|
+
name: "link" | "map" | "menu" | "search" | "summary" | "time" | "video" | "filter" | "image" | "stop" | "key" | "x" | "download" | "split" | "alert" | "radio" | "email" | "copy" | "add" | "reverse" | "infinite" | "visible" | "help" | "zoom-out" | "zoom" | "alarm-off" | "alarm-on" | "attachment" | "bookmark-filled" | "bookmark" | "copy-filled" | "dislike" | "edit" | "heart-filled" | "heart" | "invisible" | "like" | "lock-open" | "lock" | "login" | "logout" | "maximize" | "minimize" | "mute" | "password-invisible" | "password-visible" | "play-filled" | "play" | "remove-filled" | "remove" | "save" | "send" | "settings" | "share" | "shuffle" | "sync" | "skip-back-10sec" | "skip-back-30sec" | "skip-forward-10sec" | "skip-forward-30sec" | "star-filled" | "star" | "switch-arrows" | "tv-next" | "tv-pause" | "tv-previous" | "tv-stop" | "upload" | "volume" | "connected-building" | "home" | "hospital" | "industry" | "premises-datacenter" | "premises-large" | "premises-medium" | "premises-small" | "premises" | "store" | "address-book" | "b2b-customer" | "care" | "chat-robot" | "chat" | "child-1" | "child-2" | "conversation" | "customer-dialogue" | "dsl-hub" | "end-user" | "handshake" | "headphones" | "letter" | "mms" | "new-contact" | "new-group" | "news" | "parental-guide" | "people-hub" | "people" | "portal" | "signature" | "smiley-happy" | "smiley-sad" | "sms" | "support" | "user-admin" | "vcard" | "voicemail" | "battery" | "bluetooth" | "broadband" | "broken-phone" | "cast" | "cloud-connect" | "connected" | "core-router" | "daas-device" | "data-transfer" | "desktop" | "devices" | "esim-simcard" | "esim" | "face-id" | "fiber" | "fingerprint" | "fiveg" | "fourg" | "home-installation" | "industrial-iot" | "internet" | "it-service" | "laptop" | "mobile-broadband" | "network" | "phone-recycling" | "phone-ringing" | "phone" | "rack" | "refill-card" | "remote-control" | "repair" | "roaming" | "router" | "secure-device" | "sense-car" | "server" | "service-device" | "service-supervision" | "slow-wifi" | "smart-wifi" | "smartphone" | "smartwatch" | "tablet" | "trade-phone" | "tv" | "usb" | "voice-switch" | "wallplug" | "wireless-off" | "wireless-weak" | "wireless" | "world-alert" | "world-off" | "world-question" | "bar-chart" | "doc" | "document-doc" | "document-edit" | "document-pdf" | "document-ppt" | "excel" | "folder-copy" | "folder-new" | "folder" | "gif" | "graph" | "media-content" | "org-chart" | "pie-chart" | "print" | "register" | "report" | "simcard" | "spell-check" | "credit-card" | "euro" | "invoice" | "kontantkort" | "kr" | "late-payment" | "money-back-euro" | "money-back-kr" | "money-euro" | "money-kr" | "pay-monthly-euro" | "pay-monthly-kr" | "pay-once-euro" | "pay-once-kr" | "payment-success" | "savings" | "wallet" | "airplay" | "camera" | "entertainment" | "external" | "film" | "games" | "megaphone" | "microphone" | "music" | "player-settings" | "record" | "stream" | "trailer" | "video-conference" | "activity-level" | "ai-robot" | "bag" | "basketball" | "blood-pressure" | "bulb" | "business-continuity" | "business-intelligence" | "calendar" | "cart" | "close-circle" | "cloud" | "coffee" | "compass" | "construction" | "cookie" | "delivery" | "drone" | "education" | "efficiency" | "environment" | "facemask" | "flag" | "focus" | "food" | "fraud" | "getting-started" | "home-care" | "job-search" | "layers" | "measuring-health" | "moisture" | "offering" | "offshore" | "optimization" | "pebble" | "pet-dog" | "pin" | "plane" | "plus-minus" | "police" | "power-grid" | "present" | "press-button" | "price" | "pulse" | "recycle" | "reservation" | "route" | "ruler" | "satellite" | "secured-1" | "secured-2" | "security-camera" | "shopping" | "snowflake" | "speedometer" | "spyware" | "suitcase" | "sustainability" | "tag" | "temperature" | "thinking" | "train" | "transfer" | "undo" | "wavelength" | "weather" | "world" | "android" | "apple" | "bankid-norway" | "bankid" | "facebook" | "instagram" | "youtube" | "linkedin" | "snapchat" | "telia-logo" | "whatsapp" | "windows" | "alert-filled" | "check-circle-filled" | "check-circle" | "error-filled" | "error" | "info-filled" | "info" | "question-filled" | "question" | "warning" | "arrow-down" | "arrow-left" | "arrow-right" | "arrow-subdirectory" | "arrow-up" | "card-view" | "checkmark-bold" | "checkmark" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "close" | "grid-view" | "list-view" | "minus-bold" | "minus" | "more-horizontal" | "more-vertical" | "plus" | "services" | "sorter" | "table-view";
|
|
84
|
+
size?: ("xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "font") | undefined;
|
|
85
85
|
children?: React.ReactNode;
|
|
86
86
|
}, "ref">> & React.RefAttributes<SVGSVGElement>>;
|
|
87
87
|
Dismiss: React.ForwardRefExoticComponent<DismissProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { RootProps } from './scroll-area-root';
|
|
2
|
+
import { ItemProps } from './scroll-area-item';
|
|
3
|
+
import { ButtonProps } from './scroll-area-button';
|
|
4
|
+
|
|
5
|
+
export declare const ScrollArea: import('react').ForwardRefExoticComponent<Omit<import('@radix-ui/react-scroll-area').ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
6
|
+
variant?: ("button" | "scrollbar") | undefined;
|
|
7
|
+
} & import('react').RefAttributes<HTMLDivElement>> & {
|
|
8
|
+
Item: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
asChild?: boolean | undefined;
|
|
10
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
11
|
+
Button: import('react').ForwardRefExoticComponent<Omit<Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
12
|
+
asChild?: boolean | undefined;
|
|
13
|
+
loading?: boolean | undefined;
|
|
14
|
+
fullWidth?: boolean | undefined;
|
|
15
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
16
|
+
variant?: "text" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
iconOnly: true;
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
} & import('react').RefAttributes<HTMLButtonElement>, "ref"> | Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
21
|
+
asChild?: boolean | undefined;
|
|
22
|
+
loading?: boolean | undefined;
|
|
23
|
+
fullWidth?: boolean | undefined;
|
|
24
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
25
|
+
variant?: "text" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
iconOnly?: false | undefined;
|
|
28
|
+
"aria-label"?: string | undefined;
|
|
29
|
+
} & import('react').RefAttributes<HTMLButtonElement>, "ref">, "hidden"> & {
|
|
30
|
+
direction?: "left" | "right" | "up" | "down" | undefined;
|
|
31
|
+
hidden?: boolean | undefined;
|
|
32
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
33
|
+
};
|
|
34
|
+
export type ScrollAreaProps = {
|
|
35
|
+
Root: RootProps;
|
|
36
|
+
Item: ItemProps;
|
|
37
|
+
Button: ButtonProps;
|
|
38
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
4
|
+
export type ScrollbarProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>;
|
|
5
|
+
export declare const Scrollbar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
5
|
+
import { Button as Button$1 } from "../button/button.js";
|
|
6
|
+
import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
|
|
7
|
+
import "../../assets/sprite.5636ec8e-teddy.svg";
|
|
8
|
+
import { Icon } from "../icon/icon.js";
|
|
9
|
+
import { Slottable } from "@radix-ui/react-slot";
|
|
10
|
+
const styles = {
|
|
11
|
+
"teddy-scroll-area": "_teddy-scroll-area_1swny_3",
|
|
12
|
+
"teddy-scroll-area__viewport": "_teddy-scroll-area__viewport_1swny_7",
|
|
13
|
+
"teddy-scroll-area__scrollbar": "_teddy-scroll-area__scrollbar_1swny_12",
|
|
14
|
+
"teddy-scroll-area__scrollbar--hidden": "_teddy-scroll-area__scrollbar--hidden_1swny_33",
|
|
15
|
+
"teddy-scroll-area__thumb": "_teddy-scroll-area__thumb_1swny_46",
|
|
16
|
+
"teddy-scroll-area__corner": "_teddy-scroll-area__corner_1swny_63",
|
|
17
|
+
"teddy-scroll-area__button": "_teddy-scroll-area__button_1swny_66",
|
|
18
|
+
"teddy-scroll-area__button--hidden": "_teddy-scroll-area__button--hidden_1swny_90"
|
|
19
|
+
};
|
|
20
|
+
const Scrollbar = React__default.forwardRef(
|
|
21
|
+
({ className, ...props }, forwardRef) => {
|
|
22
|
+
const context = React__default.useContext(RootContext);
|
|
23
|
+
const classes = clsx(
|
|
24
|
+
[styles[`${rootClassName}__scrollbar`]],
|
|
25
|
+
{
|
|
26
|
+
[styles[`${rootClassName}__scrollbar--hidden`]]: (context == null ? void 0 : context.variant) !== "scrollbar"
|
|
27
|
+
},
|
|
28
|
+
className
|
|
29
|
+
);
|
|
30
|
+
return /* @__PURE__ */ jsx(ScrollAreaPrimitive.Scrollbar, { ...props, ref: forwardRef, className: classes });
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
Scrollbar.displayName = "Scrollbar";
|
|
34
|
+
const Thumb = React__default.forwardRef(
|
|
35
|
+
({ className, ...props }, forwardRef) => {
|
|
36
|
+
const classes = clsx([styles[`${rootClassName}__thumb`]], className);
|
|
37
|
+
return /* @__PURE__ */ jsx(ScrollAreaPrimitive.Thumb, { ...props, ref: forwardRef, className: classes });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
Thumb.displayName = "Thumb";
|
|
41
|
+
const Corner = React__default.forwardRef(
|
|
42
|
+
({ className, ...props }, forwardRef) => {
|
|
43
|
+
const classes = clsx([styles[`${rootClassName}__corner`]], className);
|
|
44
|
+
return /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, { ...props, ref: forwardRef, className: classes });
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
Corner.displayName = "Corner";
|
|
48
|
+
const Button = React__default.forwardRef(
|
|
49
|
+
({ className, hidden, direction, children, ...props }, forwardRef) => {
|
|
50
|
+
const context = React__default.useContext(RootContext);
|
|
51
|
+
const internalHidden = hidden ?? (direction === "up" && !(context == null ? void 0 : context.hasScrollTop) || direction === "down" && !(context == null ? void 0 : context.hasScrollBottom) || direction === "left" && !(context == null ? void 0 : context.hasScrollLeft) || direction === "right" && !(context == null ? void 0 : context.hasScrollRight));
|
|
52
|
+
const classes = clsx(
|
|
53
|
+
[styles[`${rootClassName}__button`]],
|
|
54
|
+
{
|
|
55
|
+
[styles[`${rootClassName}__button--hidden`]]: internalHidden
|
|
56
|
+
},
|
|
57
|
+
className
|
|
58
|
+
);
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Button$1,
|
|
61
|
+
{
|
|
62
|
+
iconOnly: true,
|
|
63
|
+
variant: "primary",
|
|
64
|
+
"aria-label": direction === "down" ? "Scroll ned" : direction === "up" ? "Scroll opp" : direction === "left" ? "Scroll venstre" : "Scroll høyre",
|
|
65
|
+
"data-direction": direction,
|
|
66
|
+
tabIndex: internalHidden ? -1 : void 0,
|
|
67
|
+
...props,
|
|
68
|
+
onClick: composeEventHandlers(props.onClick, (e) => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
if (e.defaultPrevented)
|
|
71
|
+
return;
|
|
72
|
+
const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
|
|
73
|
+
const scrollDirection = direction === "up" || direction === "left" ? -1 : 1;
|
|
74
|
+
const scrollAxis = direction === "up" || direction === "down" ? "top" : "left";
|
|
75
|
+
const scrollAmount = ((direction === "up" || direction === "down" ? scroll == null ? void 0 : scroll.height : scroll == null ? void 0 : scroll.width) || 0) * 0.7;
|
|
76
|
+
(_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
|
|
77
|
+
[scrollAxis]: scrollAmount * scrollDirection,
|
|
78
|
+
behavior: "smooth"
|
|
79
|
+
});
|
|
80
|
+
}),
|
|
81
|
+
ref: forwardRef,
|
|
82
|
+
className: classes,
|
|
83
|
+
children: children || /* @__PURE__ */ jsx(
|
|
84
|
+
Icon,
|
|
85
|
+
{
|
|
86
|
+
name: direction === "down" ? "chevron-down" : direction === "up" ? "chevron-up" : direction === "left" ? "chevron-left" : "chevron-right"
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
Button$1.displayName = "Button";
|
|
94
|
+
const rootClassName = "teddy-scroll-area";
|
|
95
|
+
const RootContext = React__default.createContext(void 0);
|
|
96
|
+
const Root = React__default.forwardRef(
|
|
97
|
+
({ className, variant, children, ...props }, forwardRef) => {
|
|
98
|
+
const [scrollRef, setScrollRef] = React__default.useState(null);
|
|
99
|
+
const [hasScroll, setHasScroll] = React__default.useState(null);
|
|
100
|
+
const initialHasScrollLeft = scrollRef ? scrollRef.scrollLeft > 0 : null;
|
|
101
|
+
const initialHasScrollRight = scrollRef ? scrollRef.scrollLeft < scrollRef.scrollWidth - scrollRef.clientWidth : null;
|
|
102
|
+
const initialHasScrollTop = scrollRef ? scrollRef.scrollTop > 0 : null;
|
|
103
|
+
const initialHasScrollBottom = scrollRef ? scrollRef.scrollTop < scrollRef.scrollHeight - scrollRef.clientHeight : null;
|
|
104
|
+
const hasScrollLeft = hasScroll ? hasScroll.left : initialHasScrollLeft;
|
|
105
|
+
const hasScrollRight = hasScroll ? hasScroll.right : initialHasScrollRight;
|
|
106
|
+
const hasScrollTop = hasScroll ? hasScroll.top : initialHasScrollTop;
|
|
107
|
+
const hasScrollBottom = hasScroll ? hasScroll.bottom : initialHasScrollBottom;
|
|
108
|
+
const hasScrollHorizontal = hasScrollLeft || hasScrollRight;
|
|
109
|
+
const hasScrollVertical = hasScrollTop || hasScrollBottom;
|
|
110
|
+
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
111
|
+
function handleScroll(e) {
|
|
112
|
+
const target = e.currentTarget;
|
|
113
|
+
setHasScroll({
|
|
114
|
+
left: target.scrollLeft > 0,
|
|
115
|
+
right: target.scrollLeft < target.scrollWidth - target.clientWidth,
|
|
116
|
+
top: target.scrollTop > 0,
|
|
117
|
+
bottom: target.scrollTop < target.scrollHeight - target.clientHeight
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return /* @__PURE__ */ jsx(
|
|
121
|
+
RootContext.Provider,
|
|
122
|
+
{
|
|
123
|
+
value: { scrollRef, variant, hasScrollTop, hasScrollBottom, hasScrollLeft, hasScrollRight },
|
|
124
|
+
children: /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, { ...props, ref: forwardRef, className: classes, children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
ScrollAreaPrimitive.Viewport,
|
|
127
|
+
{
|
|
128
|
+
onScroll: handleScroll,
|
|
129
|
+
ref: setScrollRef,
|
|
130
|
+
className: clsx([styles[`${rootClassName}__viewport`]]),
|
|
131
|
+
children: /* @__PURE__ */ jsx(Slottable, { children })
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx(Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsx(Thumb, {}) }),
|
|
135
|
+
/* @__PURE__ */ jsx(Scrollbar, { orientation: "horizontal", children: /* @__PURE__ */ jsx(Thumb, {}) }),
|
|
136
|
+
/* @__PURE__ */ jsx(Corner, {}),
|
|
137
|
+
variant === "button" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
+
hasScrollVertical && /* @__PURE__ */ jsx(Button, { direction: "up", hidden: !hasScrollTop }),
|
|
139
|
+
hasScrollVertical && /* @__PURE__ */ jsx(Button, { direction: "down", hidden: !hasScrollBottom }),
|
|
140
|
+
hasScrollHorizontal && /* @__PURE__ */ jsx(Button, { direction: "left", hidden: !hasScrollLeft }),
|
|
141
|
+
hasScrollHorizontal && /* @__PURE__ */ jsx(Button, { direction: "right", hidden: !hasScrollRight })
|
|
142
|
+
] })
|
|
143
|
+
] })
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
Root.displayName = "Root";
|
|
149
|
+
export {
|
|
150
|
+
Button as B,
|
|
151
|
+
Corner as C,
|
|
152
|
+
Root as R,
|
|
153
|
+
Scrollbar,
|
|
154
|
+
Thumb as T,
|
|
155
|
+
RootContext as a,
|
|
156
|
+
rootClassName as r,
|
|
157
|
+
styles as s
|
|
158
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Button as PrimitiveButton } from '../button';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Props for the ScrollAreaButton component.
|
|
6
|
+
*/
|
|
7
|
+
export type ButtonProps = Omit<React.ComponentPropsWithoutRef<typeof PrimitiveButton>, 'hidden'> & {
|
|
8
|
+
/** In which direction the button should point and scroll to */
|
|
9
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
10
|
+
/** Hidden will fade the button out. Used when the scrollbar is at the end */
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
14
|
+
asChild?: boolean | undefined;
|
|
15
|
+
loading?: boolean | undefined;
|
|
16
|
+
fullWidth?: boolean | undefined;
|
|
17
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
18
|
+
variant?: "text" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
iconOnly: true;
|
|
21
|
+
"aria-label": string;
|
|
22
|
+
} & React.RefAttributes<HTMLButtonElement>, "ref"> | Omit<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
23
|
+
asChild?: boolean | undefined;
|
|
24
|
+
loading?: boolean | undefined;
|
|
25
|
+
fullWidth?: boolean | undefined;
|
|
26
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
27
|
+
variant?: "text" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
iconOnly?: false | undefined;
|
|
30
|
+
"aria-label"?: string | undefined;
|
|
31
|
+
} & React.RefAttributes<HTMLButtonElement>, "ref">, "hidden"> & {
|
|
32
|
+
/** In which direction the button should point and scroll to */
|
|
33
|
+
direction?: "left" | "right" | "up" | "down" | undefined;
|
|
34
|
+
/** Hidden will fade the button out. Used when the scrollbar is at the end */
|
|
35
|
+
hidden?: boolean | undefined;
|
|
36
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "clsx";
|
|
4
|
+
import { B } from "./scroll-area-bar.js";
|
|
5
|
+
import "../button/button.js";
|
|
6
|
+
import "../../utils/composeEventHandlers.js";
|
|
7
|
+
import "../../assets/sprite.5636ec8e-teddy.svg";
|
|
8
|
+
import "../icon/icon.js";
|
|
9
|
+
export {
|
|
10
|
+
B as Button
|
|
11
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
4
|
+
export type CornerProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Corner>;
|
|
5
|
+
export declare const Corner: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaCornerProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ItemProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
|
+
asChild?: boolean | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { s as styles, r as rootClassName, a as RootContext } from "./scroll-area-bar.js";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
|
|
7
|
+
const Item = React__default.forwardRef(
|
|
8
|
+
({ className, asChild, ...props }, forwardRef) => {
|
|
9
|
+
const classes = clsx([styles[`${rootClassName}__item`]], className);
|
|
10
|
+
const Comp = asChild ? Slot : "div";
|
|
11
|
+
const context = React__default.useContext(RootContext);
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Comp,
|
|
14
|
+
{
|
|
15
|
+
...props,
|
|
16
|
+
onClick: composeEventHandlers(props.onClick, (e) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
if (e.defaultPrevented)
|
|
19
|
+
return;
|
|
20
|
+
const scroll = (_a = context == null ? void 0 : context.scrollRef) == null ? void 0 : _a.getBoundingClientRect();
|
|
21
|
+
const item = e.currentTarget.getBoundingClientRect();
|
|
22
|
+
const scrollViewVerticalCenter = ((scroll == null ? void 0 : scroll.top) || 0) + ((scroll == null ? void 0 : scroll.height) || 0) / 2;
|
|
23
|
+
const itemVerticalCenter = ((item == null ? void 0 : item.top) || 0) + ((item == null ? void 0 : item.height) || 0) / 2;
|
|
24
|
+
const scrollViewHorizontalCenter = ((scroll == null ? void 0 : scroll.left) || 0) + ((scroll == null ? void 0 : scroll.width) || 0) / 2;
|
|
25
|
+
const itemHorizontalCenter = ((item == null ? void 0 : item.left) || 0) + ((item == null ? void 0 : item.width) || 0) / 2;
|
|
26
|
+
(_b = context == null ? void 0 : context.scrollRef) == null ? void 0 : _b.scrollBy({
|
|
27
|
+
top: itemVerticalCenter - scrollViewVerticalCenter,
|
|
28
|
+
left: itemHorizontalCenter - scrollViewHorizontalCenter,
|
|
29
|
+
behavior: "smooth"
|
|
30
|
+
});
|
|
31
|
+
}),
|
|
32
|
+
ref: forwardRef,
|
|
33
|
+
className: classes
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
Item.displayName = "Item";
|
|
39
|
+
export {
|
|
40
|
+
Item
|
|
41
|
+
};
|