@wonderflow/react-components 3.0.0-beta.1 → 3.0.0-beta.10

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.
Files changed (45) hide show
  1. package/button/button.module.css +1 -1
  2. package/card/card.module.css +1 -1
  3. package/core/utils/media.css +19 -1
  4. package/core/utils/vibrancy.css +0 -24
  5. package/drawer/drawer.d.ts +81 -0
  6. package/drawer/drawer.js +34 -0
  7. package/drawer/drawer.module.css +1 -0
  8. package/drawer/index.d.ts +2 -0
  9. package/drawer/index.js +1 -0
  10. package/dropdown/dropdown.js +11 -11
  11. package/index.d.ts +4 -2
  12. package/index.js +3 -2
  13. package/modal/content/modal-content.js +4 -3
  14. package/modal/content/modal-content.module.css +1 -1
  15. package/modal/index.d.ts +0 -1
  16. package/modal/index.js +0 -1
  17. package/modal/modal.d.ts +0 -10
  18. package/modal/modal.js +24 -7
  19. package/modal/modal.module.css +1 -1
  20. package/overlay-container/index.d.ts +1 -0
  21. package/overlay-container/index.js +1 -0
  22. package/overlay-container/overlay-container.d.ts +14 -0
  23. package/overlay-container/overlay-container.js +8 -4
  24. package/overlay-container/overlay-container.module.css +1 -0
  25. package/overlay-container/overlay-context.d.ts +9 -0
  26. package/overlay-container/overlay-context.js +23 -0
  27. package/package.json +52 -14
  28. package/select/select.module.css +1 -1
  29. package/selection-controls/selection-controls.module.css +1 -1
  30. package/snackbar/snackbar.d.ts +1 -1
  31. package/snackbar/snackbar.js +2 -2
  32. package/snackbar/snackbar.module.css +1 -1
  33. package/spinner/spinner.d.ts +12 -0
  34. package/split-button/split-button.module.css +1 -1
  35. package/stack/stack.module.css +1 -1
  36. package/textfield/base-field/base-field.module.css +1 -1
  37. package/themes/dark.css +1 -1
  38. package/themes/light.css +1 -1
  39. package/title/title.d.ts +20 -0
  40. package/title/title.module.css +1 -1
  41. package/toggle-button/toggle-button.d.ts +10 -0
  42. package/tooltip/tooltip.d.ts +32 -1
  43. package/tooltip/tooltip.js +11 -12
  44. package/modal/modal-context.d.ts +0 -9
  45. package/modal/modal-context.js +0 -23
@@ -1 +1 @@
1
- .Button{-webkit-touch-callout:none;grid-gap:.44rem;align-items:center;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:.22rem;box-sizing:border-box;cursor:pointer;display:inline-flex;font-family:inherit;font-weight:600;justify-content:center;margin:0;min-inline-size:min-content;overflow:hidden;position:relative;text-decoration:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.Button[data-button-dimension=big]{block-size:2.67rem;font-size:1rem;padding:.55rem 1.33rem .66rem}.Button[data-button-dimension=regular]{block-size:2.22rem;font-size:.89rem;padding:.33rem .89rem .44rem}.Button[data-button-dimension=small]{grid-gap:.22rem;block-size:1.33rem;font-size:.78rem;padding:0 .22rem .11rem}.Button[data-button-kind=primary]{background:var(--cta-default);color:var(--cta-foreground)}.Button[data-button-kind=primary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:var(--cta-dark)}.Button[data-button-kind=primary]:where([aria-pressed=true]),.Button[data-button-kind=primary]:where([aria-pressed=true]:active){background:#9e0018;color:#fff}.Button[data-button-kind=secondary]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:linear-gradient(to bottom,var(--global-vibrancy-background-hover),var(--global-vibrancy-background-hover));color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:where([aria-pressed=true]),.Button[data-button-kind=secondary]:where([aria-pressed=true]:active){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-kind=flat]{color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:linear-gradient(to bottom,var(--global-vibrancy-background-hover),var(--global-vibrancy-background-hover))}.Button[data-button-kind=flat]:is(:hover,:focus){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:where([aria-pressed=true]),.Button[data-button-kind=flat]:where([aria-pressed=true]:is(:active,:focus)){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-fullwidth=true]{inline-size:100%}.Button[data-button-icon-position=right]{flex-direction:row-reverse}.Button[aria-disabled=true],.Button[aria-disabled=true]:is(:hover,:focus,:active){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Button[aria-busy=true]>:not(.SpinnerIndicator){visibility:hidden}.SpinnerIndicator{align-content:center;bottom:0;display:grid;justify-content:center;left:0;place-content:center;position:absolute;right:0;top:0}.ButtonsGroup{display:inline-flex}.ButtonsGroup>:not(:first-child,:last-child,:only-of-type){border-radius:0}.ButtonsGroup>:first-child:not(:only-of-type){border-bottom-right-radius:0;border-top-right-radius:0;box-shadow:inset -1px 0 0 #6666661a}.ButtonsGroup>:last-child:not(:only-of-type){border-bottom-left-radius:0;border-top-left-radius:0;box-shadow:inset 1px 0 0 #6666661a}
1
+ .Button{-webkit-touch-callout:none;grid-gap:.44rem;align-items:center;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:.22rem;box-sizing:border-box;cursor:pointer;display:inline-flex;font-family:inherit;font-weight:600;justify-content:center;margin:0;min-inline-size:min-content;overflow:hidden;position:relative;text-decoration:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.Button[data-button-dimension=big]{block-size:2.67rem;font-size:1rem;padding:.55rem 1.33rem .66rem}.Button[data-button-dimension=regular]{block-size:2.22rem;font-size:.89rem;padding:.33rem .89rem .44rem}.Button[data-button-dimension=small]{grid-gap:.22rem;block-size:1.33rem;font-size:.78rem;padding:0 .22rem .11rem}.Button[data-button-kind=primary]{background:var(--cta-default);color:var(--cta-foreground)}.Button[data-button-kind=primary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background:var(--cta-dark)}.Button[data-button-kind=primary]:where([aria-pressed=true]),.Button[data-button-kind=primary]:where([aria-pressed=true]:active){background:#9e0018;color:#fff}.Button[data-button-kind=secondary]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hover);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=secondary]:where([aria-pressed=true]),.Button[data-button-kind=secondary]:where([aria-pressed=true]:active){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-kind=flat]{color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:not([aria-pressed=true],[aria-disabled=true]):is(:active){background-color:var(--global-vibrancy-background-hover)}.Button[data-button-kind=flat]:is(:hover,:focus){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);color:var(--global-vibrancy-foreground)}.Button[data-button-kind=flat]:where([aria-pressed=true]),.Button[data-button-kind=flat]:where([aria-pressed=true]:is(:active,:focus)){background:var(--dimmed-7);color:var(--dimmed-0)}.Button[data-button-fullwidth=true]{inline-size:100%}.Button[data-button-icon-position=right]{flex-direction:row-reverse}.Button[aria-disabled=true],.Button[aria-disabled=true]:is(:hover,:focus,:active){background-color:var(--global-global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.Button[aria-busy=true]>:not(.SpinnerIndicator){visibility:hidden}.SpinnerIndicator{align-content:center;bottom:0;display:grid;justify-content:center;left:0;place-content:center;position:absolute;right:0;top:0}.ButtonsGroup{display:inline-flex}.ButtonsGroup>:not(:first-child,:last-child,:only-of-type){border-radius:0}.ButtonsGroup>:first-child:not(:only-of-type){border-bottom-right-radius:0;border-top-right-radius:0;box-shadow:inset -1px 0 0 #6666661a}.ButtonsGroup>:last-child:not(:only-of-type){border-bottom-left-radius:0;border-top-left-radius:0;box-shadow:inset 1px 0 0 #6666661a}
@@ -1 +1 @@
1
- :where(.Card){background:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}:where(.Card)[data-card-dimmed="1"]{background:var(--dimmed-0)}:where(.Card)[data-card-dimmed="2"]{background:var(--dimmed-1)}:where(.Card)[data-card-dimmed="3"]{background:var(--dimmed-2)}:where(.Card)[data-card-vibrant=true]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background))}:where(.Card)[data-card-highlight-hover=true][data-card-vibrant=true].focus-visible,:where(.Card)[data-card-highlight-hover=true][data-card-vibrant=true]:hover{background:linear-gradient(to bottom,var(--global-vibrancy-background-hover),var(--global-vibrancy-background-hover))}:where(.Card)[data-card-highlight-hover=true][data-card-vibrant=true]:focus-visible,:where(.Card)[data-card-highlight-hover=true][data-card-vibrant=true]:hover{background:linear-gradient(to bottom,var(--global-vibrancy-background-hover),var(--global-vibrancy-background-hover))}:where(.Card)[data-card-bordered=true]{border:1px solid var(--dimmed-1)}:where(.Card)[data-card-vibrant=true][data-card-bordered=true]{border:1px solid var(--dimmed-2)}.Left{flex-shrink:0}.Content{flex-grow:1}.Right{flex-shrink:0}
1
+ :where(.Card){background:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}[data-card-dimmed="1"]:where(.Card){background:var(--dimmed-0)}[data-card-dimmed="2"]:where(.Card){background:var(--dimmed-1)}[data-card-dimmed="3"]:where(.Card){background:var(--dimmed-2)}[data-card-vibrant=true]:where(.Card){-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background)}[data-card-highlight-hover=true][data-card-vibrant=true]:where(.Card).focus-visible,[data-card-highlight-hover=true][data-card-vibrant=true]:where(.Card):hover{background-color:var(--global-vibrancy-background-hover)}[data-card-highlight-hover=true][data-card-vibrant=true]:where(.Card):focus-visible,[data-card-highlight-hover=true][data-card-vibrant=true]:where(.Card):hover{background-color:var(--global-vibrancy-background-hover)}[data-card-bordered=true]:where(.Card){border:1px solid var(--dimmed-1)}[data-card-vibrant=true][data-card-bordered=true]:where(.Card){border:1px solid var(--dimmed-2)}.Left{flex-shrink:0}.Content{flex-grow:1}.Right{flex-shrink:0}
@@ -27,4 +27,22 @@
27
27
 
28
28
  /* Motion Media Queries */
29
29
 
30
- @custom-media --allow-motion (prefers-reduced-motion: no-preference);
30
+ @custom-media --motion (prefers-reduced-motion: no-preference);
31
+ @custom-media --reduced-motion (prefers-reduced-motion: reduce);
32
+
33
+ /* Opacity Media Queries */
34
+
35
+ @custom-media --opacity (prefers-reduced-transparency: no-preference);
36
+ @custom-media --reduce-opacity (prefers-reduced-transparency: reduce);
37
+
38
+ /* Contrast Media Queries */
39
+
40
+ @custom-media --high-contrast (prefers-contrast: high);
41
+ @custom-media --low-contrast (prefers-contrast: low);
42
+
43
+ /* Pointer Media Queries */
44
+
45
+ @custom-media --touch (hover: none) and (pointer: coarse);
46
+ @custom-media --stylus (hover: none) and (pointer: fine);
47
+ @custom-media --pointer (hover) and (pointer: coarse);
48
+ @custom-media --mouse (hover) and (pointer: fine);
@@ -1,27 +1,3 @@
1
1
  @define-mixin vibrancy {
2
2
  backdrop-filter: saturate(180%) blur(62px);
3
- background:
4
- linear-gradient(
5
- to bottom,
6
- var(--global-vibrancy-background),
7
- var(--global-vibrancy-background)
8
- );
9
- }
10
- @define-mixin vibrancy-hover {
11
- background:
12
- linear-gradient(
13
- to bottom,
14
- var(--global-vibrancy-background-hover),
15
- var(--global-vibrancy-background-hover)
16
- );
17
- }
18
- @define-mixin vibrancy-disabled {
19
- color: var(--global-disabled-foreground);
20
- backdrop-filter: saturate(180%) blur(62px);
21
- background:
22
- linear-gradient(
23
- to bottom,
24
- var(--global-disabled-background),
25
- var(--global-disabled-background)
26
- );
27
3
  }
@@ -0,0 +1,81 @@
1
+ import { PropsWithChildren, ReactNode } from 'react';
2
+ export declare type DrawerProps = PropsWithChildren<PropsWithClass> & {
3
+ /**
4
+ * This enable the drawer to be closed by clicking on the overlay.
5
+ * Even if this can be set to `false` we strongly recommend to leave
6
+ * it to `true` as it ensures the accessibility of the drawer.
7
+ *
8
+ * @important This property is considered only when `isModal` is `true`.
9
+ */
10
+ closeOnClickOutside?: boolean;
11
+ /**
12
+ * Set the accessible title of the drawer. This is used by screen readers to
13
+ * announce the title of the drawer when opened.
14
+ */
15
+ title?: ReactNode;
16
+ /**
17
+ * Hide or show the drawer header which includes the title and the close button.
18
+ * If you hide the title, make sure to add yuor own title element in order
19
+ * to provide an accessible label to the drawer.
20
+ */
21
+ showHeader?: boolean;
22
+ /**
23
+ * Set the maximum width of the drawer, on mobile the drawer will be
24
+ * automatically collapsed when the width is reached.
25
+ */
26
+ maxWidth?: string;
27
+ /**
28
+ * Set the theme of the content card. To ensure contrast with the default overlay color (dark),
29
+ * this is set to `light` by default.
30
+ */
31
+ theme?: 'dark' | 'light' | 'auto';
32
+ /**
33
+ * Set the side on which the drawer will be positioned.
34
+ */
35
+ side?: 'left' | 'right';
36
+ /**
37
+ * Disable the modal behavior of the drawer.
38
+ */
39
+ isModal?: boolean;
40
+ };
41
+ export declare const Drawer: import("react").ForwardRefExoticComponent<PropsWithClass & {
42
+ children?: ReactNode;
43
+ } & {
44
+ /**
45
+ * This enable the drawer to be closed by clicking on the overlay.
46
+ * Even if this can be set to `false` we strongly recommend to leave
47
+ * it to `true` as it ensures the accessibility of the drawer.
48
+ *
49
+ * @important This property is considered only when `isModal` is `true`.
50
+ */
51
+ closeOnClickOutside?: boolean | undefined;
52
+ /**
53
+ * Set the accessible title of the drawer. This is used by screen readers to
54
+ * announce the title of the drawer when opened.
55
+ */
56
+ title?: ReactNode;
57
+ /**
58
+ * Hide or show the drawer header which includes the title and the close button.
59
+ * If you hide the title, make sure to add yuor own title element in order
60
+ * to provide an accessible label to the drawer.
61
+ */
62
+ showHeader?: boolean | undefined;
63
+ /**
64
+ * Set the maximum width of the drawer, on mobile the drawer will be
65
+ * automatically collapsed when the width is reached.
66
+ */
67
+ maxWidth?: string | undefined;
68
+ /**
69
+ * Set the theme of the content card. To ensure contrast with the default overlay color (dark),
70
+ * this is set to `light` by default.
71
+ */
72
+ theme?: "auto" | "light" | "dark" | undefined;
73
+ /**
74
+ * Set the side on which the drawer will be positioned.
75
+ */
76
+ side?: "left" | "right" | undefined;
77
+ /**
78
+ * Disable the modal behavior of the drawer.
79
+ */
80
+ isModal?: boolean | undefined;
81
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { motion } from 'framer-motion';
4
+ import clsx from 'clsx';
5
+ import { FocusOn, AutoFocusInside } from 'react-focus-on';
6
+ import { useKeyPress } from 'ahooks';
7
+ import { Drawer as DrawerClass, Container, Content, Header, CloseButton } from './drawer.module.css';
8
+ import { useOverlayContext } from '../overlay-container';
9
+ import { Elevator, IconButton, Stack, Title } from '../';
10
+ export const Drawer = forwardRef(({ children, className, closeOnClickOutside = true, showHeader = true, maxWidth = '400px', side = 'right', theme = 'light', isModal = true, title, ...otherProps }, forwardedRef) => {
11
+ const { titleId, onClose } = useOverlayContext();
12
+ useKeyPress('esc', () => (!isModal && onClose) && onClose());
13
+ const dynamicStyle = {
14
+ '--max-w': maxWidth
15
+ };
16
+ const DrawerAnimation = {
17
+ visible: {
18
+ x: 0,
19
+ transition: {
20
+ ease: [0, 0, 0.34, 1],
21
+ duration: 0.35
22
+ }
23
+ },
24
+ hidden: {
25
+ x: side === 'right' ? '100%' : '-100%',
26
+ transition: {
27
+ ease: [0.3, 0.07, 1, 1],
28
+ duration: 0.2
29
+ }
30
+ }
31
+ };
32
+ return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(DrawerClass, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, { verticalAlign: "center", fill: false, horizontalAlign: "space-between", direction: "row", className: Header, children: [_jsx(Title, { responsive: false, level: "6", id: titleId, children: title }, void 0), onClose && _jsx(IconButton, { dimension: "small", onClick: onClose, className: CloseButton, icon: "xmark", kind: "flat" }, void 0)] }, void 0)), _jsx(AutoFocusInside, { children: children }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
33
+ });
34
+ Drawer.displayName = 'Drawer';
@@ -0,0 +1 @@
1
+ .Drawer{display:contents}.Container{align-items:stretch;bottom:0;display:grid;left:0;pointer-events:none;position:absolute;right:0;top:0}.Container[data-drawer-side=right]{justify-content:flex-end}.Container[data-drawer-side=left]{justify-content:flex-start}@media (min-width:30em){.Container{overflow:auto}}.Container>*{pointer-events:auto}.Content{-webkit-overflow-scrolling:touch;background-color:var(--global-background);inline-size:100%;max-inline-size:var(--max-w);overflow:auto;overscroll-behavior:contain}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:.89rem 4.44rem .89rem 1.33rem;position:sticky;top:0}.CloseButton.CloseButton{position:absolute;right:.44rem;top:50%;transform:translateY(-50%)}
@@ -0,0 +1,2 @@
1
+ export { Drawer } from './drawer';
2
+ export type { DrawerProps } from './drawer';
@@ -0,0 +1 @@
1
+ export { Drawer } from './drawer';
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { useState, Children, cloneElement, useRef, forwardRef } from 'react';
4
- import { useKey, useClickAway } from 'react-use';
4
+ import { useKeyPress, useClickAway, useFocusWithin } from 'ahooks';
5
5
  import { Dropdown as DropdownClass, PopUp } from './dropdown.module.css';
6
6
  import { useUIDSeed } from 'react-uid';
7
- import { useFocusWithin } from '@react-aria/interactions';
8
7
  import { DropdownMenu } from './menu/dropdown-menu';
9
8
  import { DropdownItem } from './item/dropdown-item';
10
9
  import { DropdownItemCheckbox } from './item-checkbox/dropdown-item-checkbox';
@@ -26,16 +25,17 @@ export const Dropdown = forwardRef(({ className, children, trigger, offset = 8,
26
25
  offset: [0, offset],
27
26
  closeOnOutsideClick: false
28
27
  });
29
- useClickAway(popupRef, () => {
30
- setIsOpen(false);
31
- });
32
- const { focusWithinProps } = useFocusWithin({
33
- onFocusWithin: () => null,
34
- onBlurWithin: (e) => e.relatedTarget && setIsOpen(false),
35
- onFocusWithinChange: () => null
28
+ const isFocusWithin = useFocusWithin(popupRef, {
29
+ onBlur: (e) => e.relatedTarget && setIsOpen(false),
30
+ onChange: (isFocusWithin) => {
31
+ !isFocusWithin && setIsOpen(false);
32
+ }
36
33
  });
37
- useKey('Escape', () => setIsOpen(false));
38
- return (_jsxs("div", { ref: popupRef, className: clsx(DropdownClass, className), ...focusWithinProps, children: [Children.map(trigger, (child) => cloneElement(child, {
34
+ useClickAway(() => {
35
+ setIsOpen(false);
36
+ }, popupRef);
37
+ useKeyPress('esc', () => setIsOpen(false));
38
+ return (_jsxs("div", { ref: popupRef, "data-dropdown-has-focus-within": isFocusWithin, className: clsx(DropdownClass, className), children: [Children.map(trigger, (child) => cloneElement(child, {
39
39
  ref: setTriggerRef,
40
40
  id: seedID('dropdown-trigger'),
41
41
  'aria-haspopup': 'true',
package/index.d.ts CHANGED
@@ -16,6 +16,8 @@ export { ClampText } from './clamp-text';
16
16
  export type { ClampTextProps } from './clamp-text';
17
17
  export { Container } from './container';
18
18
  export type { ContainerProps } from './container';
19
+ export { Drawer } from './drawer';
20
+ export type { DrawerProps } from './drawer';
19
21
  export { Table } from './table';
20
22
  export type { TableProps } from './table';
21
23
  export { Disclosure } from './disclosure';
@@ -36,11 +38,11 @@ export { List } from './list';
36
38
  export type { ListProps } from './list';
37
39
  export { SplitButton } from './split-button';
38
40
  export type { SplitButtonProps } from './split-button';
39
- export { Modal, useModalContext, ModalProvider } from './modal';
41
+ export { Modal } from './modal';
40
42
  export type { ModalProps } from './modal';
41
43
  export { LinearProgress } from './linear-progress';
42
44
  export type { LinearProgressProps } from './linear-progress';
43
- export { OverlayContainer } from './overlay-container';
45
+ export { OverlayContainer, useOverlayContext, OverlayProvider } from './overlay-container';
44
46
  export type { OverlayContainerProps } from './overlay-container';
45
47
  export { Prose } from './prose';
46
48
  export type { ProseProps } from './prose';
package/index.js CHANGED
@@ -8,6 +8,7 @@ export { Chip } from './chip';
8
8
  export { CircularProgress } from './circular-progress';
9
9
  export { ClampText } from './clamp-text';
10
10
  export { Container } from './container';
11
+ export { Drawer } from './drawer';
11
12
  export { Table } from './table';
12
13
  export { Disclosure } from './disclosure';
13
14
  export { Dropdown } from './dropdown';
@@ -18,9 +19,9 @@ export { InfoState } from './info-state';
18
19
  export { InputGroup } from './input-group';
19
20
  export { List } from './list';
20
21
  export { SplitButton } from './split-button';
21
- export { Modal, useModalContext, ModalProvider } from './modal';
22
+ export { Modal } from './modal';
22
23
  export { LinearProgress } from './linear-progress';
23
- export { OverlayContainer } from './overlay-container';
24
+ export { OverlayContainer, useOverlayContext, OverlayProvider } from './overlay-container';
24
25
  export { Prose } from './prose';
25
26
  export { Pagination } from './pagination';
26
27
  export { Select } from './select';
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { forwardRef } from 'react';
4
+ import { AutoFocusInside } from 'react-focus-on';
4
5
  import { Content, Header, CloseButton } from './modal-content.module.css';
5
6
  import { Title, Elevator, IconButton, Stack } from '../../';
6
- import { useModalContext } from '../modal-context';
7
+ import { useOverlayContext } from '../../overlay-container';
7
8
  export const ModalContent = forwardRef(({ children, className, title, theme = 'light', ...otherProps }, forwardedRef) => {
8
- const { onClose, titleId } = useModalContext();
9
- return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, { verticalAlign: "center", fill: false, horizontalAlign: "space-between", direction: "row", className: Header, children: [_jsx(Title, { level: "5", id: titleId, children: title }, void 0), onClose && _jsx(IconButton, { onClick: onClose, className: CloseButton, icon: "xmark", kind: "flat" }, void 0)] }, void 0), children] }, void 0) }, void 0));
9
+ const { onClose, titleId } = useOverlayContext();
10
+ return (_jsx(Elevator, { resting: 4, children: _jsxs("div", { className: clsx(Content, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: [_jsxs(Stack, { verticalAlign: "center", fill: false, horizontalAlign: "space-between", direction: "row", className: Header, children: [_jsx(Title, { responsive: false, level: "5", id: titleId, children: title }, void 0), onClose && _jsx(IconButton, { onClick: onClose, className: CloseButton, icon: "xmark", kind: "flat" }, void 0)] }, void 0), _jsx(AutoFocusInside, { children: children }, void 0)] }, void 0) }, void 0));
10
11
  });
11
12
  ModalContent.displayName = 'Modal.Content';
@@ -1 +1 @@
1
- .Content{-webkit-overflow-scrolling:touch;align-self:end;background-color:var(--global-background);border-radius:.89rem .89rem 0 0;color:var(--global-foreground);inline-size:100%;justify-self:center;max-block-size:95vh;overflow:auto;overscroll-behavior:contain}@media (min-width:30em){.Content{align-self:center;border-radius:.44rem;justify-self:center;max-block-size:80vh;max-inline-size:600px}}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:.89rem 4.44rem .89rem 1.33rem;position:sticky;top:0}.CloseButton.CloseButton{position:absolute;right:.44rem;top:.44rem}
1
+ .Content{-webkit-overflow-scrolling:touch;align-self:end;background-color:var(--global-background);border-radius:.89rem .89rem 0 0;inline-size:100%;justify-self:center;max-block-size:95vh;overflow:auto;overscroll-behavior:contain}@media (min-width:30em){.Content{align-self:center;border-radius:.44rem;justify-self:center;max-block-size:80vh;max-inline-size:600px}}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:.89rem 4.44rem .89rem 1.33rem;position:sticky;top:0}.CloseButton.CloseButton{position:absolute;right:.44rem;top:.44rem}
package/modal/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { Modal } from './modal';
2
- export { useModalContext, ModalProvider } from './modal-context';
3
2
  export type { ModalProps } from './modal';
package/modal/index.js CHANGED
@@ -1,2 +1 @@
1
1
  export { Modal } from './modal';
2
- export { useModalContext, ModalProvider } from './modal-context';
package/modal/modal.d.ts CHANGED
@@ -1,22 +1,12 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ModalContentProps } from './content/modal-content';
3
3
  export declare type ModalProps = PropsWithChildren<PropsWithClass> & {
4
- /**
5
- * Set the overlay style. This is used to obscure the page content
6
- * behind the modal while it is open. If set to `auto`, the overlay
7
- * color is determined by the global active theme (light or dark).
8
- */
9
- overlayColor?: 'light' | 'dark' | 'auto';
10
4
  /**
11
5
  * This enable the modal to be closed by clicking on the overlay.
12
6
  * Even if this can be set to `false` we strongly recommend to leave
13
7
  * it to `true` as it ensures the accessibility of the modal.
14
8
  */
15
9
  closeOnClickOutside?: boolean;
16
- /**
17
- * The callback function that is called when the modal is closed.
18
- */
19
- onClose(): void;
20
10
  };
21
11
  declare type ModalComponent = React.ForwardRefExoticComponent<ModalProps> & {
22
12
  Content: React.ForwardRefExoticComponent<ModalContentProps>;
package/modal/modal.js CHANGED
@@ -1,15 +1,32 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import { useUIDSeed } from 'react-uid';
4
3
  import { motion } from 'framer-motion';
5
4
  import clsx from 'clsx';
6
5
  import { FocusOn } from 'react-focus-on';
7
6
  import { ModalContent } from './content/modal-content';
8
- import { Modal as ModalClass, Backdrop, Container } from './modal.module.css';
9
- import { ModalContext, ModalProvider } from './modal-context';
10
- export const Modal = forwardRef(({ children, className, overlayColor = 'dark', closeOnClickOutside = true, onClose, ...otherProps }, forwardedRef) => {
11
- const seedID = useUIDSeed();
12
- return (_jsx(ModalProvider, { onClose: onClose, children: _jsx(ModalContext.Consumer, { children: (ctx) => (_jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": ctx.titleId, className: clsx(ModalClass, className), ref: forwardedRef, ...otherProps, children: [_jsx(motion.span, { className: Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 } }, seedID('modal-backdrop')), _jsx(FocusOn, { onClickOutside: ctx.onClose, onEscapeKey: ctx.onClose, children: _jsx(motion.div, { className: Container, initial: { y: 20, scale: 0.98, opacity: 0 }, animate: { y: 0, scale: 1, opacity: 1 }, transition: { ease: 'easeOut', duration: 0.1 }, children: children }, seedID('modal-container')) }, void 0)] }, void 0)) }, void 0) }, void 0));
7
+ import { Modal as ModalClass, Container } from './modal.module.css';
8
+ import { useOverlayContext } from '../overlay-container';
9
+ const ModalAnimation = {
10
+ visible: {
11
+ scale: 1,
12
+ opacity: 1,
13
+ transition: {
14
+ ease: [0, 0, 0.34, 1],
15
+ duration: 0.35
16
+ }
17
+ },
18
+ hidden: {
19
+ scale: 0.98,
20
+ opacity: 0,
21
+ transition: {
22
+ ease: [0.3, 0.07, 1, 1],
23
+ duration: 0.2
24
+ }
25
+ }
26
+ };
27
+ export const Modal = forwardRef(({ children, className, closeOnClickOutside = true, ...otherProps }, forwardedRef) => {
28
+ const { titleId, onClose } = useOverlayContext();
29
+ return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(ModalClass, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: Container, children: children }, void 0) }, void 0) }, void 0));
13
30
  });
14
31
  Modal.displayName = 'Modal';
15
32
  Modal.Content = ModalContent;
@@ -1 +1 @@
1
- .Modal{position:fixed;z-index:20}.Backdrop,.Modal{bottom:0;left:0;right:0;top:0}.Backdrop{background-color:var(--dimmed-0);display:block;position:absolute;z-index:1}.Backdrop[data-overlay-color=light]{background-color:#f9fafb}.Backdrop[data-overlay-color=dark]{background-color:#202328}.Container{align-items:center;bottom:0;display:grid;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:1}@media (min-width:30em){.Container{overflow:auto;padding:0 1.33rem}}.Container>*{pointer-events:auto}
1
+ .Modal{display:contents}.Container{align-items:center;bottom:0;display:grid;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:1}@media (min-width:30em){.Container{overflow:auto;padding:0 1.33rem}}.Container>*{pointer-events:auto}
@@ -1,2 +1,3 @@
1
1
  export { OverlayContainer } from './overlay-container';
2
+ export { useOverlayContext, OverlayProvider, OverlayContext } from './overlay-context';
2
3
  export type { OverlayContainerProps } from './overlay-container';
@@ -1 +1,2 @@
1
1
  export { OverlayContainer } from './overlay-container';
2
+ export { useOverlayContext, OverlayProvider, OverlayContext } from './overlay-context';
@@ -15,5 +15,19 @@ export declare type OverlayContainerProps = {
15
15
  * if necessary.
16
16
  */
17
17
  index?: number;
18
+ /**
19
+ * Set the overlay style. This is used to obscure the content
20
+ * behind the overlay if `obfuscate` is `true`. If set to `auto`, the overlay
21
+ * color is determined by the global active theme (light or dark).
22
+ */
23
+ overlayColor?: 'light' | 'dark' | 'auto';
24
+ /**
25
+ * The callback function that is called when the overlay is closed.
26
+ */
27
+ onClose?(): void;
28
+ /**
29
+ * Set the overlay to be obscuring the page content behind it.
30
+ */
31
+ obfuscate?: boolean;
18
32
  };
19
33
  export declare const OverlayContainer: React.FC<OverlayContainerProps>;
@@ -1,13 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AnimatePresence, motion } from 'framer-motion';
2
3
  import { useEffect } from 'react';
3
- import { ModalProvider } from '../modal';
4
4
  import { createPortal } from 'react-dom';
5
- export const OverlayContainer = ({ children, root = document.body, index = 4 }) => {
5
+ import { useUIDSeed } from 'react-uid';
6
+ import { OverlayProvider } from './overlay-context';
7
+ import { OverlayContainer as OverlayContainerClass, Backdrop } from './overlay-container.module.css';
8
+ export const OverlayContainer = ({ children, root = document.body, overlayColor = 'dark', index = 4, obfuscate = true, onClose }) => {
9
+ const seedID = useUIDSeed();
6
10
  useEffect(() => {
7
11
  if (root.closest('[data-overlay-container]')) {
8
12
  throw new Error('An OverlayContainer must not be inside another container. Please change the root prop.');
9
13
  }
10
14
  }, [root]);
11
- const content = (_jsx(ModalProvider, { children: _jsx("div", { "data-overlay-container": true, style: { position: 'relative', zIndex: index }, children: children }, void 0) }, void 0));
15
+ const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (_jsxs("div", { "data-overlay-container": true, "data-overlay-container-obfuscate": obfuscate, className: OverlayContainerClass, style: { zIndex: index }, children: [obfuscate && (_jsx(motion.span, { className: Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 }, exit: { opacity: 0 } }, seedID('modal-backdrop'))), children] }, void 0)) }, void 0) }, void 0));
12
16
  return createPortal(content, root);
13
17
  };
@@ -0,0 +1 @@
1
+ .OverlayContainer{bottom:0;display:block;left:0;position:fixed;right:0;top:0}.OverlayContainer[data-overlay-container-obfuscate=false]{pointer-events:none}.Backdrop{background-color:var(--dimmed-0);bottom:0;left:0;position:fixed;right:0;top:0;z-index:-1}.Backdrop[data-overlay-color=light]{background-color:#f9fafb}.Backdrop[data-overlay-color=dark]{background-color:#202328}
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { OverlayContainerProps } from './overlay-container';
3
+ declare type OverlayContextProps = Partial<OverlayContainerProps> & {
4
+ titleId?: string;
5
+ };
6
+ export declare const OverlayContext: import("react").Context<OverlayContextProps>;
7
+ export declare const OverlayProvider: (props: PropsWithChildren<OverlayContextProps>) => JSX.Element;
8
+ export declare const useOverlayContext: () => OverlayContextProps;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ import { useUIDSeed } from 'react-uid';
4
+ export const OverlayContext = createContext({
5
+ titleId: '',
6
+ onClose: () => { }
7
+ });
8
+ OverlayContext.displayName = 'OverlayContext';
9
+ export const OverlayProvider = (props) => {
10
+ const seedID = useUIDSeed();
11
+ const { children, titleId = seedID('overlay-title'), onClose } = props;
12
+ return (_jsx(OverlayContext.Provider, { value: {
13
+ titleId,
14
+ onClose
15
+ }, children: children }, void 0));
16
+ };
17
+ export const useOverlayContext = () => {
18
+ const context = useContext(OverlayContext);
19
+ if (!context) {
20
+ throw new Error('OverlayContainer component must be used inside OverlayContext to access context data.');
21
+ }
22
+ return context;
23
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
3
  "description": "UI components from Wonderflow's Wanda design system",
4
- "version": "3.0.0-beta.1",
4
+ "version": "3.0.0-beta.10",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "engines": {
12
12
  "node": ">=14.x",
13
- "npm": ">=8.x.x"
13
+ "npm": ">=8.x"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -35,6 +35,7 @@
35
35
  "scripts": {
36
36
  "start": "run-s build:themes build:icons storybook",
37
37
  "storybook": "start-storybook --quiet -p 6006",
38
+ "commit": "cz",
38
39
  "lint": "run-s lint:scripts && run-s lint:styles",
39
40
  "lint:scripts": "eslint \"src/**/*.{tsx,ts}\"",
40
41
  "lint:styles": "stylelint src/**/*.css",
@@ -63,13 +64,13 @@
63
64
  "postbuild": "run-s prepare:package"
64
65
  },
65
66
  "dependencies": {
66
- "@react-aria/interactions": "3.7.0",
67
67
  "@wonderflow/tokens": "1.3.7",
68
+ "ahooks": "3.1.1",
68
69
  "clsx": "1.1.1",
69
70
  "framer-motion": "4.1.17",
70
71
  "postcss": "^8.4.5",
71
72
  "react": "^17.0",
72
- "react-data-table-component": "7.4.5",
73
+ "react-data-table-component": "7.4.6",
73
74
  "react-dom": "^17.0",
74
75
  "react-focus-on": "3.5.4",
75
76
  "react-loading-skeleton": "3.0.1",
@@ -78,7 +79,6 @@
78
79
  "react-popper-tooltip": "4.3.1",
79
80
  "react-roving-tabindex": "3.1.1",
80
81
  "react-uid": "2.3.1",
81
- "react-use": "17.3.1",
82
82
  "storybook-addon-turbo-build": "1.0.1",
83
83
  "type-fest": "2.8.0"
84
84
  },
@@ -96,16 +96,18 @@
96
96
  "@semantic-release/github": "8.0.2",
97
97
  "@semantic-release/npm": "8.0.3",
98
98
  "@semantic-release/release-notes-generator": "10.0.3",
99
- "@storybook/addon-actions": "6.4.9",
100
- "@storybook/addon-essentials": "6.4.9",
101
- "@storybook/addon-links": "6.4.9",
99
+ "@storybook/addon-actions": "6.5.0-alpha.4",
100
+ "@storybook/addon-essentials": "6.5.0-alpha.4",
101
+ "@storybook/addon-links": "6.5.0-alpha.4",
102
102
  "@storybook/addon-postcss": "2.0.0",
103
- "@storybook/addons": "6.4.9",
104
- "@storybook/react": "6.4.9",
105
- "@storybook/theming": "6.4.9",
103
+ "@storybook/addons": "6.5.0-alpha.4",
104
+ "@storybook/builder-webpack5": "6.5.0-alpha.4",
105
+ "@storybook/manager-webpack5": "6.5.0-alpha.4",
106
+ "@storybook/react": "6.5.0-alpha.4",
107
+ "@storybook/theming": "6.5.0-alpha.4",
106
108
  "@types/react-dom": "17.0.11",
107
- "@typescript-eslint/eslint-plugin": "5.7.0",
108
- "@typescript-eslint/parser": "5.7.0",
109
+ "@typescript-eslint/eslint-plugin": "5.8.0",
110
+ "@typescript-eslint/parser": "5.8.0",
109
111
  "@wonderflow/config": "3.0.3",
110
112
  "@wonderflow/eslint-config": "1.1.8",
111
113
  "@wonderflow/stylelint-config": "1.1.3",
@@ -116,7 +118,8 @@
116
118
  "cz-conventional-changelog": "3.3.0",
117
119
  "directory-tree": "3.0.1",
118
120
  "eslint": "7.32.0",
119
- "eslint-plugin-react": "7.27.1",
121
+ "eslint-plugin-react": "7.28.0",
122
+ "eslint-plugin-storybook": "0.5.5",
120
123
  "fs-extra": "10.0.0",
121
124
  "husky": "7.0.4",
122
125
  "is-ci": "3.0.1",
@@ -130,14 +133,49 @@
130
133
  "storybook-addon-themes": "6.1.0",
131
134
  "storybook-css-modules-preset": "1.1.1",
132
135
  "style-dictionary": "3.0.3",
136
+ "styled-components": "5.3.3",
133
137
  "stylelint": "14.1.0",
134
138
  "svgo": "2.8.0",
135
139
  "svgstore": "3.0.1",
136
140
  "typescript": "4.5.4",
137
141
  "typescript-plugin-css-modules": "3.4.0",
142
+ "webpack": "5.65.0",
138
143
  "yargs": "17.3.0"
139
144
  },
140
145
  "resolutions": {
141
146
  "rc": "1.2.8"
147
+ },
148
+ "config": {
149
+ "commitizen": {
150
+ "path": "cz-conventional-changelog"
151
+ }
152
+ },
153
+ "release": {
154
+ "branches": [
155
+ "main",
156
+ {
157
+ "name": "beta",
158
+ "channel": "beta",
159
+ "prerelease": true
160
+ }
161
+ ],
162
+ "plugins": [
163
+ "commit-analyzer-fail-on-no-release",
164
+ "@semantic-release/release-notes-generator",
165
+ "@semantic-release/github",
166
+ [
167
+ "@semantic-release/npm",
168
+ {
169
+ "pkgRoot": "dist"
170
+ }
171
+ ],
172
+ [
173
+ "@semantic-release/exec",
174
+ {
175
+ "prepareCmd": "npx replace-json-property package.json version ${nextRelease.version}"
176
+ }
177
+ ],
178
+ "@semantic-release/git"
179
+ ]
142
180
  }
143
181
  }
@@ -1 +1 @@
1
- .Select{-webkit-appearance:none;appearance:none;padding:0;position:relative}.Select[data-select-dimension=small]{--field-height:1.33rem;--field-padding:0.33rem;--font-size:0.78rem}.Select[data-select-dimension=regular]{--field-height:2.22rem;--field-padding:0.89rem;--font-size:0.89rem}.Select[data-select-dimension=big]{--field-height:2.67rem;--field-padding:0.89rem;--font-size:1.00rem}.FieldContainer{color:var(--global-vibrancy-foreground);inline-size:100%;position:relative}.Select[aria-disabled=true] .FieldContainer{color:var(--global-disabled-foreground)}.Field{-webkit-appearance:none;appearance:none;background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));block-size:var(--field-height);border:0;border-radius:.22rem;box-sizing:border-box;color:inherit;display:block;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;overflow:hidden;padding:0 calc(var(--field-padding)*3.5) 3px var(--field-padding);text-overflow:ellipsis}.Field,.Field:disabled{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px)}.Field:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Field option{color:#000}.Field optgroup{color:initial}.Field[multiple]{block-size:auto;overflow:auto;padding:.44rem .89rem}.Field[multiple] option{color:currentColor;padding:calc(var(--field-padding)/2) var(--field-padding)}.Field[multiple] option:checked{background:var(--dimmed-4) linear-gradient(to bottom,var(--dimmed-4) 0,var(--dimmed-4) 100%);background-color:var(--dimmed-4);color:var(--dimmed-0)}.Field[multiple] optgroup{color:currentColor;font-family:inherit;font-size:inherit;line-height:inherit;margin:0 0 1rem}.Icon{border-radius:.22rem;pointer-events:none;position:absolute;right:calc(var(--field-padding) - var(--field-padding)/3);top:calc(var(--field-padding) - var(--field-padding)/4)}
1
+ .Select{-webkit-appearance:none;appearance:none;padding:0;position:relative}.Select[data-select-dimension=small]{--field-height:1.33rem;--field-padding:0.33rem;--font-size:0.78rem}.Select[data-select-dimension=regular]{--field-height:2.22rem;--field-padding:0.89rem;--font-size:0.89rem}.Select[data-select-dimension=big]{--field-height:2.67rem;--field-padding:0.89rem;--font-size:1.00rem}.FieldContainer{color:var(--global-vibrancy-foreground);inline-size:100%;position:relative}.Select[aria-disabled=true] .FieldContainer{color:var(--global-disabled-foreground)}.Field{-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));block-size:var(--field-height);border:0;border-radius:.22rem;box-sizing:border-box;color:inherit;display:block;font-family:inherit;font-size:var(--font-size);inline-size:100%;margin:0;overflow:hidden;padding:0 calc(var(--field-padding)*3.5) 0 var(--field-padding);text-overflow:ellipsis}.Field:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Field option{color:#000}.Field optgroup{color:initial}.Field[multiple]{block-size:auto;overflow:auto;padding:.44rem .89rem}.Field[multiple] option{color:currentColor;padding:calc(var(--field-padding)/2) var(--field-padding)}.Field[multiple] option:checked{background:var(--dimmed-4) linear-gradient(to bottom,var(--dimmed-4) 0,var(--dimmed-4) 100%);background-color:var(--dimmed-4);color:var(--dimmed-0)}.Field[multiple] optgroup{color:currentColor;font-family:inherit;font-size:inherit;line-height:inherit;margin:0 0 1rem}.Icon{border-radius:.22rem;pointer-events:none;position:absolute;right:calc(var(--field-padding) - var(--field-padding)/3);top:calc(var(--field-padding) - var(--field-padding)/4)}
@@ -1 +1 @@
1
- .Checkbox{--w:24px;--h:24px;-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-vibrancy-background),var(--global-vibrancy-background));block-size:var(--h);border-radius:.22rem;color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.Checkbox:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.Checkbox:active{background-color:var(--global-vibrancy-background-hover)}.Checkbox:checked,.Checkbox[data-control-indeterminate=true]{background:var(--dimmed-7)}:is(.Checkbox:checked,.Checkbox[data-control-indeterminate=true]):after{display:block}.Checkbox:disabled{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));color:var(--global-disabled-foreground);cursor:not-allowed}.Checkbox[data-control-dimension=small]{--w:16px;--h:16px}.Checkbox[data-control-indeterminate=true]:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.Radio{composes:Checkbox;border-radius:100%}.Radio:after{background-color:currentColor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.Toggle{--w:44px;--h:24px;--p:2px;composes:Radio;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}
1
+ .Checkbox{--w:24px;--h:24px;-webkit-appearance:none;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);block-size:var(--h);border-radius:.22rem;color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.Checkbox:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.Checkbox:active{background-color:var(--global-vibrancy-background-hover)}.Checkbox:checked,.Checkbox[data-control-indeterminate=true]{background:var(--dimmed-7)}.Checkbox:checked:after,.Checkbox[data-control-indeterminate=true]:after{display:block}.Checkbox:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.Checkbox[data-control-dimension=small]{--w:16px;--h:16px}.Checkbox[data-control-indeterminate=true]:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.Radio{composes:Checkbox;border-radius:100%}.Radio:after{background-color:currentColor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.Toggle{--w:44px;--h:24px;--p:2px;composes:Radio;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}
@@ -36,6 +36,6 @@ export declare type SnackbarProps = {
36
36
  */
37
37
  onDismiss?(): void;
38
38
  };
39
- declare type PolymorphicSnackbar = Polymorphic.ForwardRefComponent<'div', SnackbarProps>;
39
+ declare type PolymorphicSnackbar = Polymorphic.ForwardRefComponent<'output', SnackbarProps>;
40
40
  export declare const Snackbar: PolymorphicSnackbar;
41
41
  export {};
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
3
3
  import { Snackbar as SnackbarClass, Icon as IconClass, Action } from './snackbar.module.css';
4
4
  import clsx from 'clsx';
5
5
  import { Title, Stack, Icon, Button } from '../';
6
- export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'div', dismissable, dismissLabel = 'Dismiss', onDismiss, ...otherProps }, forwardedRef) => {
6
+ export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'output', dismissable, dismissLabel = 'Dismiss', onDismiss, ...otherProps }, forwardedRef) => {
7
7
  const defaultIcons = {
8
8
  info: 'circle-info',
9
9
  warning: 'triangle-exclamation',
@@ -11,5 +11,5 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
11
11
  positive: 'check',
12
12
  danger: 'circle-x'
13
13
  };
14
- return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "alert", ...otherProps, children: _jsxs(Stack, { verticalAlign: "start", horizontalAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Icon, { className: IconClass, name: icon || defaultIcons[kind], dimension: 24 }, void 0), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "5", children: title }, void 0), _jsx("p", { children: children }, void 0)] }, void 0), dismissable && (_jsx(Stack, { horizontalAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: Action, children: dismissLabel }, void 0) }, void 0))] }, void 0)] }, void 0) }, void 0));
14
+ return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { verticalAlign: "start", horizontalAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Icon, { className: IconClass, name: icon || defaultIcons[kind], dimension: 24 }, void 0), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "5", children: title }, void 0), _jsx("p", { children: children }, void 0)] }, void 0), dismissable && (_jsx(Stack, { horizontalAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: Action, children: dismissLabel }, void 0) }, void 0))] }, void 0)] }, void 0) }, void 0));
15
15
  });
@@ -1 +1 @@
1
- .Snackbar{background:linear-gradient(to right,var(--snackbar-fg) 4px,var(--snackbar-bg) 4px);border-radius:.22rem;color:var(--snackbar-fg);overflow:hidden;padding:.89rem 1.33rem}.Snackbar p{font-size:.89rem}.Snackbar[data-snackbar-kind=neutral]{--snackbar-bg:var(--highlight-gray-background);--snackbar-fg:var(--highlight-gray-foreground)}.Snackbar[data-snackbar-kind=positive]{--snackbar-bg:var(--highlight-green-background);--snackbar-fg:var(--highlight-green-foreground)}.Snackbar[data-snackbar-kind=warning]{--snackbar-bg:var(--highlight-yellow-background);--snackbar-fg:var(--highlight-yellow-foreground)}.Snackbar[data-snackbar-kind=info]{--snackbar-bg:var(--highlight-blue-background);--snackbar-fg:var(--highlight-blue-foreground)}.Snackbar[data-snackbar-kind=danger]{--snackbar-bg:var(--highlight-red-background);--snackbar-fg:var(--highlight-red-foreground)}.Icon{flex-shrink:0}.Action:is(.Action.Action){background-color:var(--snackbar-fg);color:var(--snackbar-bg)}
1
+ .Snackbar{background:linear-gradient(to right,var(--snackbar-fg) 4px,var(--snackbar-bg) 4px);border-radius:.22rem;color:var(--snackbar-fg);display:block;overflow:hidden;padding:.89rem 1.33rem}.Snackbar p{font-size:.89rem}.Snackbar[data-snackbar-kind=neutral]{--snackbar-bg:var(--highlight-gray-background);--snackbar-fg:var(--highlight-gray-foreground)}.Snackbar[data-snackbar-kind=positive]{--snackbar-bg:var(--highlight-green-background);--snackbar-fg:var(--highlight-green-foreground)}.Snackbar[data-snackbar-kind=warning]{--snackbar-bg:var(--highlight-yellow-background);--snackbar-fg:var(--highlight-yellow-foreground)}.Snackbar[data-snackbar-kind=info]{--snackbar-bg:var(--highlight-blue-background);--snackbar-fg:var(--highlight-blue-foreground)}.Snackbar[data-snackbar-kind=danger]{--snackbar-bg:var(--highlight-red-background);--snackbar-fg:var(--highlight-red-foreground)}.Icon{flex-shrink:0}.Action:is(.Action.Action){background-color:var(--snackbar-fg);color:var(--snackbar-bg)}
@@ -1,9 +1,21 @@
1
1
  import { SVGAttributes } from 'react';
2
2
  export declare type SpinnerProps = SVGAttributes<SVGElement> & {
3
+ /**
4
+ * Set the size of the spinner
5
+ */
3
6
  dimension?: 'small' | 'regular' | 'big';
7
+ /**
8
+ * Override the color of the spinner
9
+ */
4
10
  color?: string;
5
11
  };
6
12
  export declare const Spinner: import("react").ForwardRefExoticComponent<SVGAttributes<SVGElement> & {
13
+ /**
14
+ * Set the size of the spinner
15
+ */
7
16
  dimension?: "big" | "small" | "regular" | undefined;
17
+ /**
18
+ * Override the color of the spinner
19
+ */
8
20
  color?: string | undefined;
9
21
  } & import("react").RefAttributes<SVGSVGElement>>;
@@ -1 +1 @@
1
- .SplitButton>:first-child{border-bottom-right-radius:0;border-top-right-radius:0}.SplitButton>:first-child[data-button-dimension=big]{padding-left:.89rem;padding-right:.89rem}.SplitButton>*>button{--separator-color:#6666;border-bottom-left-radius:0;border-top-left-radius:0;box-shadow:inset 1px 0 0 0 var(--separator-color)}.SplitButton>*>button[data-button-kind=primary]{--separator-color:#ffffff4d}.SplitButton>*>button:is([data-button-dimension=big],[data-button-dimension=regular]){padding-left:.44rem;padding-right:.44rem}
1
+ .SplitButton>:first-child{border-bottom-right-radius:0;border-top-right-radius:0}.SplitButton>[data-button-dimension=big]:first-child{padding-left:.89rem;padding-right:.89rem}.SplitButton>*>button{--separator-color:#6666;border-bottom-left-radius:0;border-top-left-radius:0;box-shadow:inset 1px 0 0 0 var(--separator-color)}.SplitButton>*>button[data-button-kind=primary]{--separator-color:#ffffff4d}.SplitButton>*>button:is([data-button-dimension=big],[data-button-dimension=regular]){padding-left:.44rem;padding-right:.44rem}
@@ -1 +1 @@
1
- :where(.Stack){grid-gap:var(--rGap,0) var(--cGap,0);align-items:var(--hAlign);display:flex;flex-direction:column;justify-content:var(--vAlign);padding:var(--vPadding,0) var(--hPadding,0)}:where(.Stack)[data-stack-fill=true]>*{flex-grow:1}:where(.Stack)[data-stack-direction=row]{align-items:var(--vAlign);flex-direction:row;justify-content:var(--hAlign)}:where(.Stack)[data-stack-inline=true]{display:inline-flex;flex-grow:0}:where(.Stack)[data-stack-wrap=true]{flex-wrap:wrap}
1
+ :where(.Stack){grid-gap:var(--rGap,0) var(--cGap,0);align-items:var(--hAlign);display:flex;flex-direction:column;justify-content:var(--vAlign);padding:var(--vPadding,0) var(--hPadding,0)}[data-stack-fill=true]:where(.Stack)>*{flex-grow:1}[data-stack-direction=row]:where(.Stack){align-items:var(--vAlign);flex-direction:row;justify-content:var(--hAlign)}[data-stack-inline=true]:where(.Stack){display:inline-flex;flex-grow:0}[data-stack-wrap=true]:where(.Stack){flex-wrap:wrap}
@@ -1 +1 @@
1
- .BaseField{-webkit-appearance:none;appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.22rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;outline-offset:2px;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField.focus-visible{border-color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:#0000;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--dimmed-6)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:autofill,.BaseField:autofill:active,.BaseField:autofill:focus,.BaseField:autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range).focus-visible{border-color:var(--highlight-red-foreground)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{-webkit-appearance:textfield;appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{-webkit-appearance:none;appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}textarea.BaseField{block-size:auto;line-height:1.5;min-block-size:1.78rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + .89rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:30%}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField::-webkit-calendar-picker-indicator:hover{background-color:initial}
1
+ .BaseField{-webkit-appearance:none;appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.22rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1;margin:0;outline-offset:2px;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField.focus-visible{border-color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:#0000;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--dimmed-6)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:autofill,.BaseField:autofill:active,.BaseField:autofill:focus,.BaseField:autofill:hover{border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range).focus-visible{border-color:var(--highlight-red-foreground)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{-webkit-appearance:textfield;appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{-webkit-appearance:none;appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}textarea.BaseField{block-size:auto;line-height:1.5;min-block-size:1.78rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + .89rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:30%}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField::-webkit-calendar-picker-indicator:hover{background-color:initial}
package/themes/dark.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 21 Dec 2021 12:49:44 GMT
3
+ * Generated on Fri, 24 Dec 2021 14:26:38 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes/light.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 21 Dec 2021 12:49:44 GMT
3
+ * Generated on Fri, 24 Dec 2021 14:26:38 GMT
4
4
  */
5
5
 
6
6
  :root {
package/title/title.d.ts CHANGED
@@ -1,9 +1,29 @@
1
1
  import { Polymorphic } from '../';
2
2
  export declare type TitleProps = {
3
+ /**
4
+ * Set the level of the title. This property only
5
+ * affects the visual appearance of the title and not the
6
+ * semantic meaning of the title, which you can define
7
+ * by using the `as` property.
8
+ */
3
9
  level?: '1' | '2' | '3' | '4' | '5' | '6' | 'display';
10
+ /**
11
+ * Set the text line-height of the title. This uses
12
+ * the predefined tokens from the typography system.
13
+ */
4
14
  lineHeight?: 'none' | 'small' | 'large';
15
+ /**
16
+ * Set the text alignment of the title based on the text direction.
17
+ */
5
18
  textAlign?: 'start' | 'center' | 'end';
19
+ /**
20
+ * Set the maximum width of the text after which it will wrap.
21
+ */
6
22
  maxWidth?: string;
23
+ /**
24
+ * Enable or disable the responsiveness of the text. If disabled,
25
+ * the text will be always the same size across all breakpoints.
26
+ */
7
27
  responsive?: boolean;
8
28
  };
9
29
  declare type PolymorphicTitle = Polymorphic.ForwardRefComponent<'span', TitleProps>;
@@ -1 +1 @@
1
- .Title:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:0.3;color:var(--heading-foreground);display:block;font-size:var(--fs-max);line-height:1.2;max-inline-size:var(--maxW,initial);min-block-size:.01vh;overflow-wrap:break-word;text-align:var(--tAlign)}.Title:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display)[data-title-line-height=small]{--lh:1.33}.Title:is(.H6){--fs-min:0.78rem;--fs-max:1.00rem;font-weight:700}.Title:is(.H5){--fs-min:1rem;--fs-max:1.33rem;font-weight:700}.Title:is(.H4){--fs-min:1.33rem;--fs-max:1.77rem;font-weight:700}.Title:is(.H3){--fs-min:1.77rem;--fs-max:2.37rem;font-weight:800}.Title:is(.H3):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H2){--fs-min:2.37rem;--fs-max:3.16rem;font-weight:800}.Title:is(.H2):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H1){--fs-min:3.16rem;--fs-max:4.2rem;font-weight:800}.Title:is(.H1):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title.Display{--fs-min:4.2rem;--fs-max:5.6rem;font-weight:800}.Title.Display:before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title[data-title-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Title[data-title-responsive=true]{font-size:var(--fs-max)}}
1
+ .Title:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:0.3;color:var(--heading-foreground);display:block;font-size:var(--fs-max);line-height:1.2;max-inline-size:var(--maxW,initial);min-block-size:.01vh;overflow-wrap:break-word;text-align:var(--tAlign)}.Title[data-title-line-height=small]:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:1.33}.Title:is(.H6){--fs-min:0.78rem;--fs-max:1.00rem;font-weight:700}.Title:is(.H5){--fs-min:1rem;--fs-max:1.33rem;font-weight:700}.Title:is(.H4){--fs-min:1.33rem;--fs-max:1.77rem;font-weight:700}.Title:is(.H3){--fs-min:1.77rem;--fs-max:2.37rem;font-weight:800}.Title:is(.H3):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H2){--fs-min:2.37rem;--fs-max:3.16rem;font-weight:800}.Title:is(.H2):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H1){--fs-min:3.16rem;--fs-max:4.2rem;font-weight:800}.Title:is(.H1):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title.Display{--fs-min:4.2rem;--fs-max:5.6rem;font-weight:800}.Title.Display:before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title[data-title-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Title[data-title-responsive=true]{font-size:var(--fs-max)}}
@@ -1,8 +1,18 @@
1
1
  import { IconButton, IconButtonProps, Polymorphic } from '../';
2
2
  import { Except } from 'type-fest';
3
3
  export declare type ToggleButtonProps = Except<IconButtonProps, 'icon'> & {
4
+ /**
5
+ * Set the icon to show when the button is resting.
6
+ */
4
7
  restingIcon: IconButtonProps['icon'];
8
+ /**
9
+ * Set the icon to show when the button is pressed/active.
10
+ */
5
11
  pressedIcon?: IconButtonProps['icon'];
12
+ /**
13
+ * Set the pressed state of the button. If `pressedIcon` is set,
14
+ * the icon will be shown instead of the resting icon.
15
+ */
6
16
  pressed?: boolean;
7
17
  };
8
18
  declare type PolymorphicToggleButton = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof IconButton>, Polymorphic.OwnProps<typeof IconButton> & ToggleButtonProps>;
@@ -1,13 +1,44 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import { AutoPlacement, BasePlacement, VariationPlacement } from '@popperjs/core/lib';
3
3
  export declare type TooltipProps = PropsWithClass & {
4
+ /**
5
+ * Pass the content of the tooltip. It can be any valid React node.
6
+ */
4
7
  children: ReactNode;
8
+ /**
9
+ * Set the element that will be used as the trigger of the tooltip.
10
+ */
5
11
  trigger: ReactNode;
12
+ /**
13
+ * The placement of the tooltip. This is automatically handled based on
14
+ * scroll and viewport edges.
15
+ *
16
+ * The first key refers to the X axis, the second key refers to the Y axis.
17
+ * Eg: `auto-start` means the dropdown will be placed automatically on left or right
18
+ * based on the available space, and anchored at the top (start) of the trigger.
19
+ */
6
20
  placement?: AutoPlacement | BasePlacement | VariationPlacement;
21
+ /**
22
+ * Set if the tooltip should be shown or hidden.
23
+ */
7
24
  show?: boolean;
25
+ /**
26
+ * Define a delay time before the tooltip is shown.
27
+ */
8
28
  delay?: number;
29
+ /**
30
+ * Set the max width of the tooltip. This prevents the tooltip content
31
+ * from filling the whole screen.
32
+ */
9
33
  maxWidth?: string;
10
- fill?: boolean;
34
+ /**
35
+ * Make the tooltip interactive.
36
+ * This will allow the user to interact with the tooltip content.
37
+ */
11
38
  interactive?: boolean;
39
+ /**
40
+ * Set the trigger container to behave like inline or block element
41
+ */
42
+ fill?: boolean;
12
43
  };
13
44
  export declare const Tooltip: FC<TooltipProps>;
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, cloneElement, useState } from 'react';
2
+ import { Children, cloneElement, useState, useRef } from 'react';
3
3
  import { useUIDSeed } from 'react-uid';
4
- import { useKey } from 'react-use';
4
+ import { useKeyPress, useFocusWithin } from 'ahooks';
5
5
  import { Elevator } from '../';
6
- import { useFocusWithin } from '@react-aria/interactions';
7
6
  import { Tooltip as TooltipClass, Arrow, Trigger } from './tooltip.module.css';
8
7
  import { usePopperTooltip } from 'react-popper-tooltip';
9
8
  export const Tooltip = ({ children, trigger, placement = 'bottom-start', show, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500 }) => {
10
9
  const seedID = useUIDSeed();
11
10
  const [controlledVisible, setControlledVisible] = useState(false);
12
- useKey('Escape', () => setControlledVisible(false));
11
+ const tooltipContainerRef = useRef(null);
12
+ useKeyPress('esc', () => setControlledVisible(false));
13
13
  const { getArrowProps, getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
14
14
  delayShow: delay,
15
15
  delayHide: 300,
16
- trigger: ['hover', 'focus'],
16
+ trigger: ['hover'],
17
17
  visible: show || controlledVisible,
18
18
  closeOnTriggerHidden: true,
19
19
  interactive: interactive,
@@ -23,19 +23,18 @@ export const Tooltip = ({ children, trigger, placement = 'bottom-start', show, s
23
23
  }, {
24
24
  strategy: 'fixed'
25
25
  });
26
- const { focusWithinProps } = useFocusWithin({
27
- onFocusWithin: () => {
26
+ const isFocusWithin = useFocusWithin(tooltipContainerRef, {
27
+ onFocus: () => {
28
28
  setControlledVisible(true);
29
29
  },
30
- onBlurWithin: () => {
31
- setControlledVisible(false);
32
- },
33
- onFocusWithinChange: () => null
30
+ onBlur: (e) => {
31
+ (e.target?.parentElement !== tooltipContainerRef.current) && setControlledVisible(false);
32
+ }
34
33
  });
35
34
  const dynamycStyle = {
36
35
  '--maxW': maxWidth
37
36
  };
38
- return (_jsxs("div", { "data-tooltip-fill": fill, className: Trigger, ...focusWithinProps, style: { ...style }, children: [Children.map(trigger, (child) => cloneElement(child, {
37
+ return (_jsxs("div", { "data-tooltip-fill": fill, className: Trigger, ref: tooltipContainerRef, "data-tooltip-has-focus-within": isFocusWithin, style: { ...style }, children: [Children.map(trigger, (child) => cloneElement(child, {
39
38
  ref: setTriggerRef,
40
39
  'aria-describedby': seedID('tooltip-content')
41
40
  })), visible && (_jsx(Elevator, { resting: 2, children: _jsxs("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), "data-theme": "dark", ...getTooltipProps({ className: TooltipClass, style: dynamycStyle }), children: [children, _jsx("div", { ...getArrowProps({ className: Arrow }) }, void 0)] }, void 0) }, void 0))] }, void 0));
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { ModalProps } from '../modal';
3
- declare type ModalContextProps = Partial<ModalProps> & {
4
- titleId?: string;
5
- };
6
- export declare const ModalContext: import("react").Context<ModalContextProps>;
7
- export declare const ModalProvider: (props: PropsWithChildren<ModalContextProps>) => JSX.Element;
8
- export declare const useModalContext: () => ModalContextProps;
9
- export {};
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from 'react';
3
- import { useUIDSeed } from 'react-uid';
4
- export const ModalContext = createContext({
5
- titleId: '',
6
- onClose: () => { }
7
- });
8
- ModalContext.displayName = 'ModalContext';
9
- export const ModalProvider = (props) => {
10
- const seedID = useUIDSeed();
11
- const { children, titleId = seedID('modal-title'), onClose } = props;
12
- return (_jsx(ModalContext.Provider, { value: {
13
- titleId,
14
- onClose
15
- }, children: children }, void 0));
16
- };
17
- export const useModalContext = () => {
18
- const context = useContext(ModalContext);
19
- if (!context) {
20
- throw new Error('Modal component must be used inside ModalContext to access context data.');
21
- }
22
- return context;
23
- };