@wonderflow/react-components 10.0.0-next.2 → 10.0.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/core/basic.css +1 -1
  2. package/core.css +1 -1
  3. package/dist/components/drawer/drawer.d.ts.map +1 -1
  4. package/dist/components/drawer/drawer.js +4 -6
  5. package/dist/components/drawer/drawer.module.css +1 -1
  6. package/dist/components/info-state/info-state.d.ts +34 -3
  7. package/dist/components/info-state/info-state.d.ts.map +1 -1
  8. package/dist/components/modal/content/modal-content.d.ts +17 -4
  9. package/dist/components/modal/content/modal-content.d.ts.map +1 -1
  10. package/dist/components/modal/modal.d.ts +3 -3
  11. package/dist/components/modal/modal.d.ts.map +1 -1
  12. package/dist/components/modal/modal.js +7 -11
  13. package/dist/components/overlay-container/index.d.ts +0 -1
  14. package/dist/components/overlay-container/index.d.ts.map +1 -1
  15. package/dist/components/overlay-container/index.js +0 -1
  16. package/dist/components/overlay-container/overlay-container.d.ts.map +1 -1
  17. package/dist/components/overlay-container/overlay-container.js +1 -1
  18. package/dist/components/selection-controls/checkbox.d.ts.map +1 -1
  19. package/dist/components/selection-controls/checkbox.js +2 -2
  20. package/dist/components/selection-controls/radio.d.ts.map +1 -1
  21. package/dist/components/selection-controls/radio.js +1 -1
  22. package/dist/components/selection-controls/selection-controls.module.css +1 -1
  23. package/dist/components/snackbar/snackbar.d.ts.map +1 -1
  24. package/dist/components/snackbar/snackbar.js +4 -4
  25. package/dist/components/snackbar/snackbar.module.css +1 -1
  26. package/dist/components/textfield/base-field/base-field.module.css +1 -1
  27. package/dist/components/title/title.d.ts.map +1 -1
  28. package/dist/components/title/title.js +11 -4
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/providers/index.d.ts +4 -0
  33. package/dist/providers/index.d.ts.map +1 -0
  34. package/dist/providers/index.js +3 -0
  35. package/dist/{components/overlay-container/overlay-context.d.ts → providers/overlay.d.ts} +2 -2
  36. package/dist/providers/overlay.d.ts.map +1 -0
  37. package/dist/{components/overlay-container/overlay-context.js → providers/overlay.js} +0 -0
  38. package/dist/providers/responsive.d.ts +25 -0
  39. package/dist/providers/responsive.d.ts.map +1 -0
  40. package/dist/providers/responsive.js +43 -0
  41. package/package.json +4 -4
  42. package/dist/components/overlay-container/overlay-context.d.ts.map +0 -1
package/core/basic.css CHANGED
@@ -1 +1 @@
1
- html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;background-color:var(--global-background);box-sizing:border-box;font-size:100%;line-height:1.5}*,:after,:before{-webkit-tap-highlight-color:hsl(0 100% 47%/20%);box-sizing:inherit;margin:0}:focus-visible{outline:5px auto Highlight;outline:5px auto -webkit-focus-ring-color}body{font-feature-settings:"calt" off;color:var(--global-foreground);font-family:system-ui,sans-serif;font-size:1.125rem;margin:0;scroll-padding:5rem}::selection{background-color:var(--dimmed-7);color:var(--dimmed-0);text-shadow:none}img{display:block;inline-size:100%;max-inline-size:100%}svg:not([fill]){fill:currentcolor}fieldset{border:0;padding:0}
1
+ html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;background-color:var(--global-background);box-sizing:border-box;font-size:100%;line-height:1.5}*,:after,:before{-webkit-tap-highlight-color:hsl(0 100% 47%/20%);box-sizing:inherit;margin:0;outline-offset:5px;transition:outline-offset .2s ease-out}:focus-visible{outline:5px auto Highlight;outline:5px auto -webkit-focus-ring-color;outline-offset:2px}body{font-feature-settings:"calt" off;color:var(--global-foreground);font-family:system-ui,sans-serif;font-size:1.125rem;margin:0;scroll-padding:5rem}::selection{background-color:var(--dimmed-7);color:var(--dimmed-0);text-shadow:none}img{display:block;inline-size:100%;max-inline-size:100%}svg:not([fill]){fill:currentcolor}fieldset{border:0;padding:0}
package/core.css CHANGED
@@ -1 +1 @@
1
- html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;background-color:var(--global-background);box-sizing:border-box;font-size:100%;line-height:1.5}*,:after,:before{-webkit-tap-highlight-color:hsl(0 100% 47%/20%);box-sizing:inherit;margin:0}:focus-visible{outline:5px auto Highlight;outline:5px auto -webkit-focus-ring-color}body{font-feature-settings:"calt" off;color:var(--global-foreground);font-family:system-ui,sans-serif;font-size:1.125rem;margin:0;scroll-padding:5rem}::selection{background-color:var(--dimmed-7);color:var(--dimmed-0);text-shadow:none}img{display:block;inline-size:100%;max-inline-size:100%}svg:not([fill]){fill:currentcolor}fieldset{border:0;padding:0}[data-elevation]{--shadow-color:0deg 0% 0%}[data-elevation-hover="0"]:hover,[data-elevation="0"]{box-shadow:none;transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="1"]:hover,[data-elevation="1"]{box-shadow:0 3px 13px hsl(var(--shadow-color)/6%),0 2.5px 4.59px hsl(var(--shadow-color)/4.06%),0 1.34px 2.45px hsl(var(--shadow-color)/2.35%),0 .75px 1.37px hsl(var(--shadow-color)/4%),0 .39px .73px hsl(var(--shadow-color)/1.65%),0 .16px .3px hsl(var(--shadow-color)/.94%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="2"]:hover,[data-elevation="2"]{box-shadow:0 9px 25px hsl(var(--shadow-color)/8%),0 3.75px 10.44px hsl(var(--shadow-color)/6.35%),0 2.01px 5.58px hsl(var(--shadow-color)/4.75%),0 1.12px 3.13px hsl(var(--shadow-color)/4.5%),0 .6px 1.66px hsl(var(--shadow-color)/4.25%),0 .25px .69px hsl(var(--shadow-color)/3.65%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="3"]:hover,[data-elevation="3"]{box-shadow:0 18px 40px hsl(var(--shadow-color)/9%),0 7.51px 16.71px hsl(var(--shadow-color)/5.63%),0 4.02px 8.93px hsl(var(--shadow-color)/4.15%),0 2.25px 5px hsl(var(--shadow-color)/4%),0 1.19px 2.66px hsl(var(--shadow-color)/3.85%),0 .49px 1.1px hsl(var(--shadow-color)/3.37%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="4"]:hover,[data-elevation="4"]{box-shadow:0 33px 78px hsl(var(--shadow-color)/11%),0 12.04px 28.47px hsl(var(--shadow-color)/7.59%),0 5.84px 13.82px hsl(var(--shadow-color)/6.12%),0 2.86px 6.77px hsl(var(--shadow-color)/4.88%),0 1.13px 2.67px hsl(var(--shadow-color)/5.41%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}:where(p){font-size:1rem;line-height:1.5;min-block-size:.01vh}small{font-size:.7em}b,strong{font-weight:600}:where(a:any-link){color:var(--global-interactive-text);text-decoration:none;word-break:break-word}:where(a:any-link):not([class]){background-image:linear-gradient(currentcolor,currentcolor);background-position:0 100%;background-repeat:no-repeat;background-size:0 1px;transition:background-size .2s cubic-bezier(0,0,.34,1)}:where(a:any-link):not([class]):focus,:where(a:any-link):not([class]):hover{background-size:100% 1px}del{background-color:var(--highlight-red-background);box-shadow:0 0 0 2px var(--highlight-red-background);color:var(--highlight-red-foreground)}del,ins{border-radius:.25rem;padding:2px 4px}ins{background-color:var(--highlight-green-background);box-shadow:0 0 0 2px var(--highlight-green-background);color:var(--highlight-green-foreground);text-decoration:none}address{font-style:normal;line-height:inherit}dt{font-weight:600}dd{margin:0;padding:0}ol,ul{padding-left:1rem}ul li::marker{font-size:inherit;font-weight:600;min-inline-size:2rem;text-align:right}ol li::marker{font-feature-settings:"tnum";font-size:inherit;font-variant-numeric:tabular-nums;font-weight:600;min-inline-size:2rem;white-space:nowrap}kbd{border:1px solid var(--dimmed-1);border-radius:.25rem;box-shadow:0 2px 0 var(--dimmed-1);font-weight:600;padding:2px 4px}mark{background:var(--highlight-yellow-background);color:var(--highlight-yellow-foreground);padding:0 2px}abbr{text-decoration:underline dashed var(--cta-default)}label,legend{font-size:inherit}code{background-color:var(--global-vibrancy-background);border-radius:.25rem;font-family:monospace;font-size:1em;padding:0 4px 3px}
1
+ html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;background-color:var(--global-background);box-sizing:border-box;font-size:100%;line-height:1.5}*,:after,:before{-webkit-tap-highlight-color:hsl(0 100% 47%/20%);box-sizing:inherit;margin:0;outline-offset:5px;transition:outline-offset .2s ease-out}:focus-visible{outline:5px auto Highlight;outline:5px auto -webkit-focus-ring-color;outline-offset:2px}body{font-feature-settings:"calt" off;color:var(--global-foreground);font-family:system-ui,sans-serif;font-size:1.125rem;margin:0;scroll-padding:5rem}::selection{background-color:var(--dimmed-7);color:var(--dimmed-0);text-shadow:none}img{display:block;inline-size:100%;max-inline-size:100%}svg:not([fill]){fill:currentcolor}fieldset{border:0;padding:0}[data-elevation]{--shadow-color:0deg 0% 0%}[data-elevation-hover="0"]:hover,[data-elevation="0"]{box-shadow:none;transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="1"]:hover,[data-elevation="1"]{box-shadow:0 3px 13px hsl(var(--shadow-color)/6%),0 2.5px 4.59px hsl(var(--shadow-color)/4.06%),0 1.34px 2.45px hsl(var(--shadow-color)/2.35%),0 .75px 1.37px hsl(var(--shadow-color)/4%),0 .39px .73px hsl(var(--shadow-color)/1.65%),0 .16px .3px hsl(var(--shadow-color)/.94%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="2"]:hover,[data-elevation="2"]{box-shadow:0 9px 25px hsl(var(--shadow-color)/8%),0 3.75px 10.44px hsl(var(--shadow-color)/6.35%),0 2.01px 5.58px hsl(var(--shadow-color)/4.75%),0 1.12px 3.13px hsl(var(--shadow-color)/4.5%),0 .6px 1.66px hsl(var(--shadow-color)/4.25%),0 .25px .69px hsl(var(--shadow-color)/3.65%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="3"]:hover,[data-elevation="3"]{box-shadow:0 18px 40px hsl(var(--shadow-color)/9%),0 7.51px 16.71px hsl(var(--shadow-color)/5.63%),0 4.02px 8.93px hsl(var(--shadow-color)/4.15%),0 2.25px 5px hsl(var(--shadow-color)/4%),0 1.19px 2.66px hsl(var(--shadow-color)/3.85%),0 .49px 1.1px hsl(var(--shadow-color)/3.37%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}[data-elevation-hover="4"]:hover,[data-elevation="4"]{box-shadow:0 33px 78px hsl(var(--shadow-color)/11%),0 12.04px 28.47px hsl(var(--shadow-color)/7.59%),0 5.84px 13.82px hsl(var(--shadow-color)/6.12%),0 2.86px 6.77px hsl(var(--shadow-color)/4.88%),0 1.13px 2.67px hsl(var(--shadow-color)/5.41%);transition:box-shadow .1s cubic-bezier(.3,.07,.34,1)}:where(p){font-size:1rem;line-height:1.5;min-block-size:.01vh}small{font-size:.7em}b,strong{font-weight:600}:where(a:any-link){color:var(--global-interactive-text);text-decoration:none;word-break:break-word}:where(a:any-link):not([class]){background-image:linear-gradient(currentcolor,currentcolor);background-position:0 100%;background-repeat:no-repeat;background-size:0 1px;transition:background-size .2s cubic-bezier(0,0,.34,1)}:where(a:any-link):not([class]):focus,:where(a:any-link):not([class]):hover{background-size:100% 1px}del{background-color:var(--highlight-red-background);box-shadow:0 0 0 2px var(--highlight-red-background);color:var(--highlight-red-foreground)}del,ins{border-radius:.25rem;padding:2px 4px}ins{background-color:var(--highlight-green-background);box-shadow:0 0 0 2px var(--highlight-green-background);color:var(--highlight-green-foreground);text-decoration:none}address{font-style:normal;line-height:inherit}dt{font-weight:600}dd{margin:0;padding:0}ol,ul{padding-left:1rem}ul li::marker{font-size:inherit;font-weight:600;min-inline-size:2rem;text-align:right}ol li::marker{font-feature-settings:"tnum";font-size:inherit;font-variant-numeric:tabular-nums;font-weight:600;min-inline-size:2rem;white-space:nowrap}kbd{border:1px solid var(--dimmed-1);border-radius:.25rem;box-shadow:0 2px 0 var(--dimmed-1);font-weight:600;padding:2px 4px}mark{background:var(--highlight-yellow-background);color:var(--highlight-yellow-foreground);padding:0 2px}abbr{text-decoration:underline dashed var(--cta-default)}label,legend{font-size:inherit}code{background-color:var(--global-vibrancy-background);border-radius:.25rem;font-family:monospace;font-size:1em;padding:0 4px 3px}
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAIA,OAAO,EACsB,SAAS,EACrC,MAAM,OAAO,CAAC;AASf,oBAAY,WAAW,GAAG;IACxB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,eAAe,CAAC,WAAW,CA8F9C,CAAC"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAIA,OAAO,EACsB,SAAS,EACrC,MAAM,OAAO,CAAC;AASf,oBAAY,WAAW,GAAG;IACxB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,eAAe,CAAC,WAAW,CA4F9C,CAAC"}
@@ -9,10 +9,6 @@ import { Elevator, IconButton, Stack, Title, useOverlayContext, } from '../..';
9
9
  import styles from './drawer.module.css';
10
10
  export const Drawer = forwardRef(({ children, className, closeOnClickOutside = true, showHeader = true, maxWidth = '400px', side = 'right', theme = 'light', isModal = true, title, ...otherProps }, forwardedRef) => {
11
11
  const { titleId, onClose } = useOverlayContext();
12
- const cssEasingToArray = (cssEasing) => {
13
- const [x1, y1, x2, y2] = cssEasing.replace(/[^0-9.,]+/g, '').split(',').map(i => parseFloat(i));
14
- return [x1, y1, x2, y2];
15
- };
16
12
  useKeyPress('esc', () => (!isModal && onClose) && onClose());
17
13
  const dynamicStyle = {
18
14
  '--max-w': maxWidth,
@@ -21,14 +17,16 @@ export const Drawer = forwardRef(({ children, className, closeOnClickOutside = t
21
17
  visible: {
22
18
  x: 0,
23
19
  transition: {
24
- ease: cssEasingToArray(tkns.easing.entrance),
20
+ type: 'spring',
21
+ bounce: 0,
25
22
  duration: parseFloat(tkns.duration[500].replace('s', '')),
26
23
  },
27
24
  },
28
25
  hidden: {
29
26
  x: side === 'right' ? '100%' : '-100%',
30
27
  transition: {
31
- ease: cssEasingToArray(tkns.easing.exit),
28
+ type: 'spring',
29
+ bounce: 0,
32
30
  duration: parseFloat(tkns.duration[500].replace('s', '')),
33
31
  },
34
32
  },
@@ -1 +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:1rem 1rem 1.5rem 1.5rem;position:sticky;top:0}.CloseButton.CloseButton{flex-grow:0}
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:100vw;max-inline-size:var(--max-w);overflow:auto;overscroll-behavior:contain}.Header{background-color:inherit;border-bottom:1px solid var(--dimmed-1);padding:1rem 1rem 1.5rem 1.5rem;position:sticky;top:0;z-index:1}.CloseButton.CloseButton{flex-grow:0}
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { StackProps, SymbolProps } from '../..';
3
- export declare type InfoStateProps = {
3
+ export declare type InfoStateProps = PropsWithClass<{
4
4
  /**
5
5
  * Set the main tagline of the info state. This should be catchy and short
6
6
  * as much as possible.
@@ -29,9 +29,40 @@ export declare type InfoStateProps = {
29
29
  * as many elements as you want, we suggest to add no more than two actions.
30
30
  */
31
31
  actions?: ReactNode;
32
- };
32
+ }>;
33
33
  export declare const InfoState: import("react").ForwardRefExoticComponent<{
34
34
  style?: Record<string, any> | undefined;
35
35
  className?: string | undefined;
36
- } & InfoStateProps & import("react").RefAttributes<HTMLDivElement>>;
36
+ } & {
37
+ /**
38
+ * Set the main tagline of the info state. This should be catchy and short
39
+ * as much as possible.
40
+ */
41
+ title: ReactNode;
42
+ /**
43
+ * The icon to display. This is used to enforce the message of the info state.
44
+ * This is not displayed if `image` is set.
45
+ */
46
+ icon?: import("packages/symbols/dist").SymbolNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
47
+ /**
48
+ * Set the icon color. Please use the correct color based on the type of the message.
49
+ * Eg. Don't use `green` for negative informations.
50
+ */
51
+ iconColor?: "gray" | "cyan" | "green" | "purple" | "yellow" | "red" | "blue" | undefined;
52
+ /**
53
+ * An image may be used instead of an icon. The image is centered and scaled.
54
+ */
55
+ image?: string | undefined;
56
+ /**
57
+ * Set the direction of the content (column or row).
58
+ */
59
+ direction?: StackProps['direction'];
60
+ /**
61
+ * Pass the suplementary actions to the info state. Even if you can pass
62
+ * as many elements as you want, we suggest to add no more than two actions.
63
+ */
64
+ actions?: ReactNode;
65
+ } & {
66
+ children?: ReactNode;
67
+ } & import("react").RefAttributes<HTMLDivElement>>;
37
68
  //# sourceMappingURL=info-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"info-state.d.ts","sourceRoot":"","sources":["../../../src/components/info-state/info-state.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EACE,UAAU,EAAU,WAAW,EACvC,MAAM,cAAc,CAAC;AAItB,oBAAY,cAAc,GAAG;IAC3B;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC7E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,SAAS;;;mEAiEpB,CAAC"}
1
+ {"version":3,"file":"info-state.d.ts","sourceRoot":"","sources":["../../../src/components/info-state/info-state.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EACE,UAAU,EAAU,WAAW,EACvC,MAAM,cAAc,CAAC;AAItB,oBAAY,cAAc,GAAG,cAAc,CAAC;IAC1C;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC7E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC,CAAA;AAEF,eAAO,MAAM,SAAS;;;;IA9BpB;;;OAGG;WACI,SAAS;IAChB;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;gBACS,UAAU,CAAC,WAAW,CAAC;IACnC;;;OAGG;cACO,SAAS;;;kDAoEnB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export declare type ModalContentProps = {
1
+ import { PropsWithChildren, ReactNode } from 'react';
2
+ export declare type ModalContentProps = PropsWithChildren<PropsWithClass<{
3
3
  /**
4
4
  * Set the accessible title of the modal. This is used by screen readers to
5
5
  * announce the title of the modal when opened.
@@ -10,9 +10,22 @@ export declare type ModalContentProps = {
10
10
  * this is set to `light` by default.
11
11
  */
12
12
  theme?: 'dark' | 'light' | 'auto';
13
- };
13
+ }>>;
14
14
  export declare const ModalContent: import("react").ForwardRefExoticComponent<{
15
15
  style?: Record<string, any> | undefined;
16
16
  className?: string | undefined;
17
- } & ModalContentProps & import("react").RefAttributes<HTMLDivElement>>;
17
+ } & {
18
+ /**
19
+ * Set the accessible title of the modal. This is used by screen readers to
20
+ * announce the title of the modal when opened.
21
+ */
22
+ title: ReactNode;
23
+ /**
24
+ * Set the theme of the content card. To ensure contrast with the default overlay color (dark),
25
+ * this is set to `light` by default.
26
+ */
27
+ theme?: "auto" | "dark" | "light" | undefined;
28
+ } & {
29
+ children?: ReactNode;
30
+ } & import("react").RefAttributes<HTMLDivElement>>;
18
31
  //# sourceMappingURL=modal-content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal-content.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/content/modal-content.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAS9C,oBAAY,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACnC,CAAA;AAED,eAAO,MAAM,YAAY;;;sEA2BvB,CAAC"}
1
+ {"version":3,"file":"modal-content.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/content/modal-content.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjE,oBAAY,iBAAiB,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAC/D;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACnC,CAAC,CAAC,CAAA;AAEH,eAAO,MAAM,YAAY;;;;IAZvB;;;OAGG;WACI,SAAS;IAChB;;;OAGG;;;;kDA+BH,CAAC"}
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
1
+ import { PropsWithChildren } from 'react';
2
2
  import { ModalContentProps } from './content/modal-content';
3
- export declare type ModalProps = {
3
+ export declare type ModalProps = PropsWithChildren<PropsWithClass<{
4
4
  /**
5
5
  * This enable the modal to be closed by clicking on the overlay.
6
6
  * Even if this can be set to `false` we strongly recommend to leave
7
7
  * it to `true` as it ensures the accessibility of the modal.
8
8
  */
9
9
  closeOnClickOutside?: boolean;
10
- };
10
+ }>>;
11
11
  declare type ModalComponent = React.ForwardRefExoticComponent<ModalProps> & {
12
12
  Content: React.ForwardRefExoticComponent<ModalContentProps>;
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":";AASA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG1E,oBAAY,UAAU,GAAG;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAED,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAWD,eAAO,MAAM,KAAK,gBAyDE,CAAC"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAK/D,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG1E,oBAAY,UAAU,GAAG,iBAAiB,CAAC,cAAc,CAAC;IACxD;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC,CAAC,CAAA;AAEH,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAOD,eAAO,MAAM,KAAK,gBAyDE,CAAC"}
@@ -1,23 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
3
- import { configResponsive, useResponsive } from 'ahooks';
4
3
  import clsx from 'clsx';
5
4
  import { domMax, LazyMotion, m } from 'framer-motion';
6
5
  import { forwardRef, useMemo } from 'react';
7
6
  import { FocusOn } from 'react-focus-on';
8
- import { useOverlayContext } from '../..';
7
+ import { useOverlayContext, useResponsiveContext } from '../..';
9
8
  import { ModalContent } from './content/modal-content';
10
9
  import styles from './modal.module.css';
11
10
  const cssEasingToArray = (cssEasing) => {
12
11
  const [x1, y1, x2, y2] = cssEasing.replace(/[^0-9.,]+/g, '').split(',').map(i => parseFloat(i));
13
12
  return [x1, y1, x2, y2];
14
13
  };
15
- configResponsive({
16
- wide: 768,
17
- });
18
14
  export const Modal = forwardRef(({ children, className, closeOnClickOutside = true, ...otherProps }, forwardedRef) => {
19
15
  const { titleId, onClose } = useOverlayContext();
20
- const responsive = useResponsive();
16
+ const { matches } = useResponsiveContext();
21
17
  const ModalAnimation = useMemo(() => ({
22
18
  visible: {
23
19
  scale: 1,
@@ -29,15 +25,15 @@ export const Modal = forwardRef(({ children, className, closeOnClickOutside = tr
29
25
  },
30
26
  },
31
27
  hidden: {
32
- scale: responsive.wide ? 0.98 : 1,
33
- opacity: responsive.wide ? 0 : 1,
34
- y: responsive.wide ? 0 : '100%',
28
+ scale: matches.small ? 0.98 : 1,
29
+ opacity: matches.small ? 0 : 1,
30
+ y: matches.small ? 0 : '100%',
35
31
  transition: {
36
32
  ease: cssEasingToArray(tkns.easing.exit),
37
- duration: responsive.wide ? parseFloat(tkns.duration[200].replace('s', '')) : parseFloat(tkns.duration[500].replace('s', '')),
33
+ duration: matches.small ? parseFloat(tkns.duration[200].replace('s', '')) : parseFloat(tkns.duration[500].replace('s', '')),
38
34
  },
39
35
  },
40
- }), [responsive]);
36
+ }), [matches]);
41
37
  return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: children }) }) }) }));
42
38
  });
43
39
  Modal.displayName = 'Modal';
@@ -1,4 +1,3 @@
1
1
  export type { OverlayContainerProps } from './overlay-container';
2
2
  export { OverlayContainer } from './overlay-container';
3
- export { OverlayContext, OverlayProvider, useOverlayContext } from './overlay-context';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +1 @@
1
1
  export { OverlayContainer } from './overlay-container';
2
- export { OverlayContext, OverlayProvider, useOverlayContext } from './overlay-context';
@@ -1 +1 @@
1
- {"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAO7C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,qBAAqB,CA8C9D,CAAC"}
1
+ {"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAQ7C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,qBAAqB,CA8C9D,CAAC"}
@@ -3,8 +3,8 @@ import { AnimatePresence, domMax, LazyMotion, m, } from 'framer-motion';
3
3
  import { useEffect } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { useUIDSeed } from 'react-uid';
6
+ import { OverlayProvider } from '../..';
6
7
  import styles from './overlay-container.module.css';
7
- import { OverlayProvider } from './overlay-context';
8
8
  export const OverlayContainer = ({ children, root = document.body, overlayColor = 'dark', index = 4, obfuscate = true, onClose, }) => {
9
9
  const seedID = useUIDSeed();
10
10
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/selection-controls/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAAc,mBAAmB,EAC7C,MAAM,OAAO,CAAC;AAIf,oBAAY,aAAa,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAA;AAED,eAAO,MAAM,QAAQ;IApBnB;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;wBACgB,YAAY,gBAAgB,CAAC,KAAK,IAAI;oDAuCzD,CAAC"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/selection-controls/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAAc,mBAAmB,EAC7C,MAAM,OAAO,CAAC;AAIf,oBAAY,aAAa,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAA;AAED,eAAO,MAAM,QAAQ;IApBnB;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;wBACgB,YAAY,gBAAgB,CAAC,KAAK,IAAI;oDA0CzD,CAAC"}
@@ -3,13 +3,13 @@ import clsx from 'clsx';
3
3
  import { domAnimation, LazyMotion, m } from 'framer-motion';
4
4
  import { forwardRef, useEffect, useRef, } from 'react';
5
5
  import styles from './selection-controls.module.css';
6
- export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, ...otherProps }, forwardedRef) => {
6
+ export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, hidden, ...otherProps }, forwardedRef) => {
7
7
  const ref = useRef(forwardedRef);
8
8
  useEffect(() => {
9
9
  if (ref.current) {
10
10
  ref.current.indeterminate = indeterminate;
11
11
  }
12
12
  }, [indeterminate]);
13
- return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.CheckboxInput, className), ref: ref, ...otherProps }) }) }));
13
+ return (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: clsx(styles.InputWrapper, className), whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, "data-radio-control": hidden, children: _jsx("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: styles.CheckboxInput, ref: ref, hidden: hidden, ...otherProps }) }) }));
14
14
  });
15
15
  Checkbox.displayName = 'Checkbox';
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../src/components/selection-controls/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,oBAAY,UAAU,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAA;AAED,eAAO,MAAM,KAAK;IAfhB;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;wBACgB,YAAY,gBAAgB,CAAC,KAAK,IAAI;oDA4BzD,CAAC"}
1
+ {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../src/components/selection-controls/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,oBAAY,UAAU,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAA;AAED,eAAO,MAAM,KAAK;IAfhB;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;wBACgB,YAAY,gBAAgB,CAAC,KAAK,IAAI;oDA+BzD,CAAC"}
@@ -3,5 +3,5 @@ import clsx from 'clsx';
3
3
  import { domAnimation, LazyMotion, m } from 'framer-motion';
4
4
  import { forwardRef } from 'react';
5
5
  import styles from './selection-controls.module.css';
6
- export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: styles.InputWrapper, whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, children: _jsx("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(styles.RadioInput, className), ref: forwardedRef, ...otherProps }) }) })));
6
+ export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, hidden, ...otherProps }, forwardedRef) => (_jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx(m.span, { className: clsx(styles.InputWrapper, className), whileTap: { scale: 1.15 }, transition: { duration: 0.3, ease: 'backOut' }, "data-radio-control": hidden, children: _jsx("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: styles.RadioInput, ref: forwardedRef, hidden: hidden, ...otherProps }) }) })));
7
7
  Radio.displayName = 'Radio';
@@ -1 +1 @@
1
- .InputWrapper{display:inline-block;line-height:0}.CheckboxInput{--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:.25rem;box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2);color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput: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)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px transparent}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput: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:RadioInput;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
+ .InputWrapper{display:inline-block;line-height:0}.InputWrapper[data-radio-control=true]{position:absolute}.CheckboxInput{--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:.25rem;box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2);color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput: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)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px transparent}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput: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:RadioInput;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 +1 @@
1
- {"version":3,"file":"snackbar.d.ts","sourceRoot":"","sources":["../../../src/components/snackbar/snackbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EACG,WAAW,EAAiB,WAAW,EAChD,MAAM,cAAc,CAAC;AAItB,oBAAY,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC9D;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA4CI,CAAC"}
1
+ {"version":3,"file":"snackbar.d.ts","sourceRoot":"","sources":["../../../src/components/snackbar/snackbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EACG,WAAW,EAAiB,WAAW,EAEhD,MAAM,cAAc,CAAC;AAItB,oBAAY,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC9D;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA8CI,CAAC"}
@@ -1,15 +1,15 @@
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 { Button, Stack, Symbol, Title, } from '../..';
4
+ import { Button, Stack, Symbol, Text, Title, } from '../..';
5
5
  import styles from './snackbar.module.css';
6
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
- warning: 'triangle-exclamation',
9
+ warning: 'circle-exclamation',
10
10
  neutral: 'compass',
11
- positive: 'check',
11
+ positive: 'circle-check',
12
12
  danger: 'circle-x',
13
13
  };
14
- return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, fill: false, children: [_jsx(Symbol, { className: styles.Icon, weight: "duotone", source: icon ?? defaultIcons[kind], dimension: 24 }), _jsxs(Stack, { rowGap: 16, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "5", children: title }), _jsx("p", { children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, children: dismissLabel }) }))] })] }) }));
14
+ return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, children: [_jsx(Symbol, { className: styles.Icon, weight: "duotone", source: icon ?? defaultIcons[kind], dimension: 24 }), _jsxs(Stack, { rowGap: 16, vPadding: 4, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "6", responsive: false, children: title }), _jsx(Text, { size: 14, lineHeight: "small", children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, dimension: "small", children: dismissLabel }) }))] })] }) }));
15
15
  });
@@ -1 +1 @@
1
- .Snackbar{background:linear-gradient(to right,var(--snackbar-fg) 4px,var(--snackbar-bg) 4px);border-radius:.25rem;color:var(--snackbar-fg);display:block;overflow:hidden;padding:1rem 1.5rem}.Snackbar p{font-size:1rem}.Snackbar[data-snackbar-kind=neutral]{--heading-foreground:var(--highlight-gray-foreground);--snackbar-bg:var(--highlight-gray-background);--snackbar-fg:var(--highlight-gray-foreground)}.Snackbar[data-snackbar-kind=positive]{--heading-foreground:var(--highlight-green-foreground);--snackbar-bg:var(--highlight-green-background);--snackbar-fg:var(--highlight-green-foreground)}.Snackbar[data-snackbar-kind=warning]{--heading-foreground:var(--highlight-yellow-foreground);--snackbar-bg:var(--highlight-yellow-background);--snackbar-fg:var(--highlight-yellow-foreground)}.Snackbar[data-snackbar-kind=info]{--heading-foreground:var(--highlight-blue-foreground);--snackbar-bg:var(--highlight-blue-background);--snackbar-fg:var(--highlight-blue-foreground)}.Snackbar[data-snackbar-kind=danger]{--heading-foreground:var(--highlight-red-foreground);--snackbar-bg:var(--highlight-red-background);--snackbar-fg:var(--highlight-red-foreground)}.Icon{flex-grow:0;flex-shrink:0}.Action:is(.Action.Action){background-color:var(--snackbar-fg);color:var(--snackbar-bg)}.Action:is(.Action.Action):active{background-color:var(--snackbar-fg);color:var(--snackbar-bg);opacity:.8}
1
+ .Snackbar{background:var(--global-background);border:1px solid var(--global-vibrancy-background);border-radius:.5rem;display:block;overflow:hidden;padding:.5rem 1rem}.Snackbar p{font-size:1rem}.Snackbar[data-snackbar-kind=neutral]{--heading-foreground:var(--highlight-gray-foreground);--snackbar-bg:var(--highlight-gray-background);--snackbar-fg:var(--highlight-gray-foreground)}.Snackbar[data-snackbar-kind=positive]{--heading-foreground:var(--highlight-green-foreground);--snackbar-bg:var(--highlight-green-background);--snackbar-fg:var(--highlight-green-foreground)}.Snackbar[data-snackbar-kind=warning]{--heading-foreground:var(--highlight-yellow-foreground);--snackbar-bg:var(--highlight-yellow-background);--snackbar-fg:var(--highlight-yellow-foreground)}.Snackbar[data-snackbar-kind=info]{--heading-foreground:var(--highlight-blue-foreground);--snackbar-bg:var(--highlight-blue-background);--snackbar-fg:var(--highlight-blue-foreground)}.Snackbar[data-snackbar-kind=danger]{--heading-foreground:var(--highlight-red-foreground);--snackbar-bg:var(--highlight-red-background);--snackbar-fg:var(--highlight-red-foreground)}.Icon{color:var(--snackbar-fg);flex-grow:0;flex-shrink:0;height:1rem;margin-top:.5rem;width:1rem}.Action:is(.Action.Action){background-color:var(--snackbar-fg);color:var(--snackbar-bg)}.Action:is(.Action.Action):active{background-color:var(--snackbar-fg);color:var(--snackbar-bg);opacity:.8}
@@ -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:.25rem;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:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:transparent;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{-webkit-text-fill-color:var(--global-vibrancy-foreground);border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}:is(.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:hover,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:active)::selection{-webkit-text-fill-color:var(--dimmed-0)}.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:2rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + 1rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:.3}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField:hover::-webkit-calendar-picker-indicator{background-color:transparent}
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:.25rem;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;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:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:transparent;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{-webkit-text-fill-color:var(--global-vibrancy-foreground);border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}:is(.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:hover,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:active)::selection{-webkit-text-fill-color:var(--dimmed-0)}.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:2rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + 1rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:.3}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField:hover::-webkit-calendar-picker-indicator{background-color:transparent}
@@ -1 +1 @@
1
- {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,oBAAY,UAAU,GAAG;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IACtD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE5E,eAAO,MAAM,KAAK,kBAkCI,CAAC"}
1
+ {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,oBAAY,UAAU,GAAG;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IACtD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE5E,eAAO,MAAM,KAAK,kBA6CI,CAAC"}
@@ -1,15 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import clsx from 'clsx';
3
- import { forwardRef } from 'react';
4
- import { useUIDSeed } from 'react-uid';
3
+ import { Children, forwardRef, useCallback, } from 'react';
5
4
  import slugify from 'slugify';
6
5
  import styles from './title.module.css';
7
6
  export const Title = forwardRef(({ children, className, as: Wrapper = 'span', lineHeight = 'small', level = '1', textAlign = 'start', maxWidth, responsive = true, style, id, ...otherProps }, forwardedRef) => {
8
7
  const computedLevel = level.match(/\d/g) ? `H${level}` : `${level.charAt(0).toUpperCase()}${level.slice(1)}`;
9
- const uid = useUIDSeed();
8
+ const getTextFromChildren = useCallback(() => {
9
+ let label = '';
10
+ Children.map(children, (child) => {
11
+ if (typeof child === 'string') {
12
+ label += child;
13
+ }
14
+ });
15
+ return label;
16
+ }, [children]);
10
17
  const dynamicStyle = {
11
18
  '--max-w': maxWidth,
12
19
  '--t-align': textAlign,
13
20
  };
14
- return (_jsx(Wrapper, { ref: forwardedRef, "data-title-line-height": lineHeight, "data-title-responsive": responsive, className: clsx(styles.Title, styles[computedLevel], className), style: { ...dynamicStyle, ...style }, id: slugify(String(id ?? uid('title-section')), { lower: true }), ...otherProps, children: children }));
21
+ return (_jsx(Wrapper, { ref: forwardedRef, "data-title-line-height": lineHeight, "data-title-responsive": responsive, className: clsx(styles.Title, styles[computedLevel], className), style: { ...dynamicStyle, ...style }, id: slugify(String(id ?? getTextFromChildren()), { lower: true }), ...otherProps, children: children }));
15
22
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './components';
2
+ export * from './providers';
2
3
  export * from './types';
3
- export { UIDReset as IdProvider } from 'react-uid';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './components';
2
+ export * from './providers';
2
3
  export * from './types';
3
- export { UIDReset as IdProvider } from 'react-uid';
@@ -0,0 +1,4 @@
1
+ export { OverlayProvider, useOverlayContext } from './overlay';
2
+ export { ResponsiveProvider, useResponsiveContext } from './responsive';
3
+ export { UIDReset as IdProvider } from 'react-uid';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { OverlayProvider, useOverlayContext } from './overlay';
2
+ export { ResponsiveProvider, useResponsiveContext } from './responsive';
3
+ export { UIDReset as IdProvider } from 'react-uid';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { OverlayContainerProps } from './overlay-container';
2
+ import { OverlayContainerProps } from '../components/overlay-container/overlay-container';
3
3
  declare type OverlayContextProps = Partial<OverlayContainerProps> & {
4
4
  titleId?: string;
5
5
  };
@@ -7,4 +7,4 @@ export declare const OverlayContext: import("react").Context<OverlayContextProps
7
7
  export declare const OverlayProvider: FCChildren<OverlayContextProps>;
8
8
  export declare const useOverlayContext: () => OverlayContextProps;
9
9
  export {};
10
- //# sourceMappingURL=overlay-context.d.ts.map
10
+ //# sourceMappingURL=overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/providers/overlay.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAE1F,aAAK,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,eAAO,MAAM,cAAc,8CAGzB,CAAC;AAIH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,mBAAmB,CAiB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,2BAQ7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ declare type ResponsiveContextProps = {
3
+ /**
4
+ * Current breakpoints
5
+ */
6
+ breakpoints: {
7
+ extraSmall: number;
8
+ small: number;
9
+ medium: number;
10
+ large: number;
11
+ extraLarge: number;
12
+ };
13
+ /**
14
+ * Object with breakpoints matching the current screen size.
15
+ */
16
+ matches: Record<keyof ResponsiveContextProps['breakpoints'], boolean>;
17
+ };
18
+ declare type ResponsiveProviderProps = {
19
+ breakpoints?: ResponsiveContextProps['breakpoints'];
20
+ };
21
+ export declare const ResponsiveContext: import("react").Context<ResponsiveContextProps>;
22
+ export declare const ResponsiveProvider: FCChildren<ResponsiveProviderProps>;
23
+ export declare const useResponsiveContext: () => ResponsiveContextProps;
24
+ export {};
25
+ //# sourceMappingURL=responsive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../src/providers/responsive.tsx"],"names":[],"mappings":";AAKA,aAAK,sBAAsB,GAAG;IAC5B;;MAEE;IACF,WAAW,EAAE;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF;;MAEE;IACF,OAAO,EAAE,MAAM,CAAC,MAAM,sBAAsB,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;CACvE,CAAA;AAED,aAAK,uBAAuB,GAAG;IAC7B,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACrD,CAAA;AAUD,eAAO,MAAM,iBAAiB,iDAS5B,CAAC;AAIH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,uBAAuB,CAuBlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,8BAQhC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { configResponsive, useResponsive as responsiveAhook } from 'ahooks';
3
+ import { createContext, useContext, useEffect, useState, } from 'react';
4
+ const DEFAULT_BREAKPOINTS = {
5
+ extraSmall: 480,
6
+ small: 768,
7
+ medium: 960,
8
+ large: 1280,
9
+ extraLarge: 1600,
10
+ };
11
+ export const ResponsiveContext = createContext({
12
+ breakpoints: DEFAULT_BREAKPOINTS,
13
+ matches: {
14
+ extraSmall: false,
15
+ small: false,
16
+ medium: false,
17
+ large: false,
18
+ extraLarge: false,
19
+ },
20
+ });
21
+ ResponsiveContext.displayName = 'ResponsiveContext';
22
+ export const ResponsiveProvider = ({ children, breakpoints = DEFAULT_BREAKPOINTS, }) => {
23
+ configResponsive(breakpoints);
24
+ const responsiveHook = responsiveAhook();
25
+ const [matching, setMatching] = useState({
26
+ extraSmall: false,
27
+ small: false,
28
+ medium: false,
29
+ large: false,
30
+ extraLarge: false,
31
+ });
32
+ useEffect(() => {
33
+ setMatching(responsiveHook);
34
+ }, [breakpoints, responsiveHook]);
35
+ return (_jsx(ResponsiveContext.Provider, { value: { breakpoints, matches: matching }, children: children }));
36
+ };
37
+ export const useResponsiveContext = () => {
38
+ const context = useContext(ResponsiveContext);
39
+ if (!context) {
40
+ throw new Error('useResponsiveContext hook must be used inside ResponsiveProvider to access context data.');
41
+ }
42
+ return context;
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "10.0.0-next.2",
3
+ "version": "10.0.0-next.5",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
@@ -70,8 +70,8 @@
70
70
  "@types/react": "17.0.43",
71
71
  "@types/react-dom": "17.0.14",
72
72
  "@types/react-table": "7.7.12",
73
- "@wonderflow/config": "10.0.0-next.2",
74
- "@wonderflow/tokens": "10.0.0-next.2",
73
+ "@wonderflow/config": "10.0.0-next.3",
74
+ "@wonderflow/tokens": "10.0.0-next.3",
75
75
  "babel-loader": "8.2.5",
76
76
  "cpy-cli": "3.1.1",
77
77
  "postcss": "8.4.14",
@@ -80,7 +80,7 @@
80
80
  "react-dom": "17.0.2",
81
81
  "storybook-addon-themes": "6.1.0",
82
82
  "storybook-css-modules-preset": "1.1.1",
83
- "tsconfig": "*",
83
+ "tsconfig": "1.0.0-next.0",
84
84
  "typescript": "4.7.3",
85
85
  "typescript-plugin-css-modules": "3.4.0"
86
86
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay-context.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-context.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,aAAK,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,eAAO,MAAM,cAAc,8CAGzB,CAAC;AAIH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,mBAAmB,CAiB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,2BAQ7B,CAAC"}