welcome-ui 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
1
  import { default as React } from 'react';
2
+ import { Size, Variant } from './theme';
2
3
  import { ButtonProps } from '../Button';
3
4
  import { CreateWuiProps } from '../System';
4
- type Size = 'sm' | 'md';
5
- type Variant = 'danger' | 'success' | 'warning' | 'info' | 'default' | 'beige';
6
5
  export interface AlertOptions {
7
6
  closeButtonDataTestId?: string;
8
7
  cta?: JSX.Element;
@@ -18,7 +17,6 @@ export interface AlertOptions {
18
17
  export type AlertProps = CreateWuiProps<'div', AlertOptions>;
19
18
  export declare const Alert: import('../System').CreateWuiComponent<"div", AlertProps> & {
20
19
  Title: React.FC<import('./Title').AlertTitleProps>;
21
- Button: import('../System').CreateWuiComponent<"button", Omit<ButtonProps, "size" | "variant">>;
22
- SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<ButtonProps, "size" | "variant">>;
20
+ Button: import('../System').CreateWuiComponent<"button", Omit<ButtonProps, "size">>;
21
+ SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<ButtonProps, "size">>;
23
22
  };
24
- export {};
@@ -1,15 +1,15 @@
1
1
  import { CSSObject } from '@xstyled/styled-components';
2
2
  import { ThemeValues } from '../../theme';
3
- type State = 'default' | 'danger' | 'warning' | 'info' | 'success' | 'beige';
4
- type Sizes = 'sm' | 'md';
3
+ export type Variant = 'default' | 'danger' | 'warning' | 'info' | 'success' | 'beige' | 'ai';
4
+ export type Size = 'sm' | 'md';
5
5
  type AttributesState = CSSObject;
6
6
  export type ThemeAlerts = {
7
7
  default: CSSObject;
8
- sizes: Record<Sizes, CSSObject>;
8
+ sizes: Record<Size, CSSObject>;
9
9
  title: {
10
10
  default: CSSObject;
11
- sizes: Record<Sizes, CSSObject>;
11
+ sizes: Record<Size, CSSObject>;
12
12
  };
13
- } & Record<State, AttributesState>;
13
+ } & Record<Variant, AttributesState>;
14
14
  export declare const getAlerts: (theme: ThemeValues) => ThemeAlerts;
15
15
  export {};
@@ -1,14 +1,17 @@
1
1
  import { default as React } from 'react';
2
+ import { Size, Variant } from './theme';
2
3
  import { CreateWuiProps } from '../System';
3
- type Shape = 'circle' | 'square';
4
- type Size = 'xs' | 'sm' | 'md' | 'lg';
5
- type Variant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'disabled';
6
4
  export interface ButtonOptions {
7
- /** Danger button with 3 variants: primary / tertiary / ghost */
5
+ /** AI button with 3 variants: primary / tertiary / ghost */
6
+ ai?: boolean;
7
+ /**
8
+ * Danger button with 3 variants: primary / tertiary / ghost
9
+ * Take precedence hover the AI prop
10
+ */
8
11
  danger?: boolean;
9
12
  disabled?: boolean;
10
13
  isLoading?: boolean;
11
- shape?: Shape;
14
+ shape?: 'circle' | 'square';
12
15
  size?: Size;
13
16
  variant?: Variant;
14
17
  }
@@ -18,4 +21,3 @@ export type ButtonProps = CreateWuiProps<'button', ButtonOptions>;
18
21
  */
19
22
  export declare const Button: import('../System').CreateWuiComponent<"button", ButtonProps>;
20
23
  export declare const StyledButton: import('styled-components').StyledComponent<(props: import('@ariakit/react').ButtonProps) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>, import('@xstyled/system').Theme, ButtonOptions, never>;
21
- export {};
@@ -3,10 +3,10 @@ import { ThemeFocus } from '../../theme/focus';
3
3
  import { ThemeValues } from '../../theme';
4
4
  type CommonAttributesButton = CSSObject;
5
5
  type SizeAttributesButton = CSSObject;
6
- type Variant = 'primary' | 'secondary' | 'tertiary' | 'ghost';
7
- type Size = 'xs' | 'sm' | 'md' | 'lg';
6
+ export type Variant = 'primary' | 'secondary' | 'tertiary' | 'ghost';
7
+ export type Size = 'xs' | 'sm' | 'md' | 'lg';
8
8
  type Icon = 'only' | 'default';
9
- export type ThemeButtons = Record<Variant | 'danger', CommonAttributesButton> & Record<'hover', Record<Variant | 'danger', CommonAttributesButton>> & Record<'focus', Record<Variant | 'danger', unknown>> & Record<'active', Record<Variant | 'danger', CommonAttributesButton>> & Record<'disabled', CommonAttributesButton & {
9
+ export type ThemeButtons = Record<Variant | 'danger' | 'ai', CommonAttributesButton> & Record<'hover', Record<Variant | 'danger' | 'ai', CommonAttributesButton>> & Record<'focus', Record<Variant | 'danger' | 'ai', unknown>> & Record<'active', Record<Variant | 'danger' | 'ai', CommonAttributesButton>> & Record<'disabled', CommonAttributesButton & {
10
10
  '&:focus': ReturnType<ThemeFocus>;
11
11
  }> & Record<'sizes', Record<Size, SizeAttributesButton>> & Record<'icon', Record<Icon, Record<Size, string>>>;
12
12
  export declare const getButtons: (theme: ThemeValues) => ThemeButtons;
@@ -1,8 +1,6 @@
1
- import { ThemeSecondaryColors } from '../../theme/colors';
1
+ import { Size, Variant } from './theme';
2
2
  import { CreateWuiProps } from '../System';
3
3
  import * as S from './styles';
4
- type Size = 'xs' | 'sm' | 'md';
5
- type Variant = ThemeSecondaryColors | 'default' | 'info' | 'success' | 'danger' | 'warning' | 'primary';
6
4
  export interface TagOptions {
7
5
  href?: string;
8
6
  onClick?: () => void;
@@ -14,4 +12,3 @@ export interface TagOptions {
14
12
  export type TagProps = CreateWuiProps<'div', TagOptions>;
15
13
  export declare const Tag: import('../System').CreateWuiComponent<"div", TagProps>;
16
14
  export declare const StyledTag: import('styled-components').StyledComponent<string, import('@xstyled/system').Theme, S.StyledTagProps & import('../System').WuiProps, never>;
17
- export {};
@@ -2,7 +2,7 @@ import { CSSObject } from '@xstyled/styled-components';
2
2
  import { ThemeSecondaryColors } from '../../theme/colors';
3
3
  import { ThemeValues } from '../../theme';
4
4
  export type Size = 'xs' | 'sm' | 'md';
5
- export type Variant = ThemeSecondaryColors | 'default' | 'danger' | 'info' | 'success' | 'warning' | 'primary';
5
+ export type Variant = ThemeSecondaryColors | 'default' | 'danger' | 'info' | 'success' | 'warning' | 'primary' | 'ai';
6
6
  export type ThemeTags = {
7
7
  default: CSSObject;
8
8
  hover: Record<Variant, CSSObject>;
@@ -5,14 +5,14 @@ export declare const ToastWrapper: import('styled-components').StyledComponent<i
5
5
  }, never>;
6
6
  export declare const Growl: import('styled-components').StyledComponent<import('../System').CreateWuiComponent<"div", import('../Alert').AlertProps> & {
7
7
  Title: import('react').FC<import('../Alert/Title').AlertTitleProps>;
8
- Button: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size" | "variant">>;
9
- SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size" | "variant">>;
8
+ Button: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size">>;
9
+ SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size">>;
10
10
  }, import('@xstyled/system').Theme, GrowlOptions, never>;
11
11
  export declare const Title: import('styled-components').StyledComponent<import('../System').CreateWuiComponent<"div", import('../Box').BoxProps>, import('@xstyled/system').Theme, {}, never>;
12
12
  export declare const Snackbar: import('styled-components').StyledComponent<import('../System').CreateWuiComponent<"div", import('../Alert').AlertProps> & {
13
13
  Title: import('react').FC<import('../Alert/Title').AlertTitleProps>;
14
- Button: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size" | "variant">>;
15
- SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size" | "variant">>;
14
+ Button: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size">>;
15
+ SecondaryButton: import('../System').CreateWuiComponent<"button", Omit<import('../Button').ButtonProps, "size">>;
16
16
  }, import('@xstyled/system').Theme, {}, never>;
17
17
  export declare const SnackbarSeparator: import('styled-components').StyledComponent<"div", import('@xstyled/system').Theme, import('@xstyled/system').SystemProps<import('@xstyled/system').Theme> & {
18
18
  variant: SnackbarProps["variant"];
@@ -1,6 +1,5 @@
1
+ import { Size, Variant } from './theme';
1
2
  import { CreateWuiProps } from '../System';
2
- type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
3
- type Variant = 'danger' | 'warning' | 'success' | 'info' | 'default';
4
3
  export interface VariantIconOptions {
5
4
  icon?: JSX.Element;
6
5
  size?: Size;
@@ -8,4 +7,3 @@ export interface VariantIconOptions {
8
7
  }
9
8
  export type VariantIconProps = CreateWuiProps<'div', VariantIconOptions>;
10
9
  export declare const VariantIcon: import('../System').CreateWuiComponent<"div", VariantIconProps>;
11
- export {};
@@ -1,10 +1,6 @@
1
1
  import { CSSObject } from '@xstyled/styled-components';
2
2
  import { ThemeValues } from '../../theme';
3
- export type ThemeVariantIcon = {
4
- danger: CSSObject;
5
- default: CSSObject;
6
- info: CSSObject;
7
- success: CSSObject;
8
- warning: CSSObject;
9
- };
3
+ export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
4
+ export type Variant = 'danger' | 'warning' | 'success' | 'info' | 'default' | 'ai';
5
+ export type ThemeVariantIcon = Record<Variant, CSSObject>;
10
6
  export declare const getVariantIcon: (theme: ThemeValues) => ThemeVariantIcon;
@@ -6,3 +6,4 @@ export * from './throttle';
6
6
  export * from './use-copy-text';
7
7
  export * from './use-fork-ref';
8
8
  export * from './use-isomorphic-layout-effect';
9
+ export * from './use-viewport';
package/dist/utils.mjs CHANGED
@@ -6,8 +6,9 @@ import { o as N } from "./overflow-ellipsis-DGV5Kgt-.mjs";
6
6
  import { t as P } from "./throttle-BDBzFeFj.mjs";
7
7
  import { useState as d, useCallback as m } from "react";
8
8
  import { g as y } from "./_commonjsHelpers-CXJ7dpIk.mjs";
9
- import { s as _, u as j } from "./use-fork-ref-CUZErtAC.mjs";
9
+ import { s as B, u as _ } from "./use-fork-ref-CUZErtAC.mjs";
10
10
  import { u as G } from "./use-isomorphic-layout-effect-Izr-e2pi.mjs";
11
+ import { u as O } from "./use-viewport-m3glsbna.mjs";
11
12
  var g = function() {
12
13
  var e = document.getSelection();
13
14
  if (!e.rangeCount)
@@ -25,8 +26,8 @@ var g = function() {
25
26
  break;
26
27
  }
27
28
  return e.removeAllRanges(), function() {
28
- e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(s) {
29
- e.addRange(s);
29
+ e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(c) {
30
+ e.addRange(c);
30
31
  }), t && t.focus();
31
32
  };
32
33
  }, v = g, f = {
@@ -39,10 +40,10 @@ function C(e) {
39
40
  return e.replace(/#{\s*key\s*}/g, t);
40
41
  }
41
42
  function x(e, t) {
42
- var r, o, s, n, c, a, i = !1;
43
+ var r, o, c, n, s, a, i = !1;
43
44
  t || (t = {}), r = t.debug || !1;
44
45
  try {
45
- s = v(), n = document.createRange(), c = document.getSelection(), a = document.createElement("span"), a.textContent = e, a.ariaHidden = "true", a.style.all = "unset", a.style.position = "fixed", a.style.top = 0, a.style.clip = "rect(0, 0, 0, 0)", a.style.whiteSpace = "pre", a.style.webkitUserSelect = "text", a.style.MozUserSelect = "text", a.style.msUserSelect = "text", a.style.userSelect = "text", a.addEventListener("copy", function(l) {
46
+ c = v(), n = document.createRange(), s = document.getSelection(), a = document.createElement("span"), a.textContent = e, a.ariaHidden = "true", a.style.all = "unset", a.style.position = "fixed", a.style.top = 0, a.style.clip = "rect(0, 0, 0, 0)", a.style.whiteSpace = "pre", a.style.webkitUserSelect = "text", a.style.MozUserSelect = "text", a.style.msUserSelect = "text", a.style.userSelect = "text", a.addEventListener("copy", function(l) {
46
47
  if (l.stopPropagation(), t.format)
47
48
  if (l.preventDefault(), typeof l.clipboardData > "u") {
48
49
  r && console.warn("unable to use e.clipboardData"), r && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
@@ -51,7 +52,7 @@ function x(e, t) {
51
52
  } else
52
53
  l.clipboardData.clearData(), l.clipboardData.setData(t.format, e);
53
54
  t.onCopy && (l.preventDefault(), t.onCopy(l.clipboardData));
54
- }), document.body.appendChild(a), n.selectNodeContents(a), c.addRange(n);
55
+ }), document.body.appendChild(a), n.selectNodeContents(a), s.addRange(n);
55
56
  var p = document.execCommand("copy");
56
57
  if (!p)
57
58
  throw new Error("copy command was unsuccessful");
@@ -64,19 +65,19 @@ function x(e, t) {
64
65
  r && console.error("unable to copy using clipboardData: ", u), r && console.error("falling back to prompt"), o = C("message" in t ? t.message : b), window.prompt(o, e);
65
66
  }
66
67
  } finally {
67
- c && (typeof c.removeRange == "function" ? c.removeRange(n) : c.removeAllRanges()), a && document.body.removeChild(a), s();
68
+ s && (typeof s.removeRange == "function" ? s.removeRange(n) : s.removeAllRanges()), a && document.body.removeChild(a), c();
68
69
  }
69
70
  return i;
70
71
  }
71
72
  var w = x;
72
73
  const D = /* @__PURE__ */ y(w);
73
- function R(e, t) {
74
+ function S(e, t) {
74
75
  const [r, o] = d();
75
76
  return [m(() => {
76
77
  let n;
77
78
  typeof e == "number" || typeof e == "string" ? n = e.toString() : e.current instanceof HTMLInputElement ? n = e.current.value : e.current instanceof HTMLElement && (n = e.current.textContent);
78
- const c = D(n);
79
- o(c), t && setTimeout(o, t);
79
+ const s = D(n);
80
+ o(s), t && setTimeout(o, t);
80
81
  }, [e, t]), r];
81
82
  }
82
83
  export {
@@ -85,9 +86,10 @@ export {
85
86
  k as formatBytes,
86
87
  A as hexToRGBA,
87
88
  N as overflowEllipsis,
88
- _ as setRef,
89
+ B as setRef,
89
90
  P as throttle,
90
- R as useCopyText,
91
- j as useForkRef,
92
- G as useIsomorphicLayoutEffect
91
+ S as useCopyText,
92
+ _ as useForkRef,
93
+ G as useIsomorphicLayoutEffect,
94
+ O as useViewportSize
93
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "welcome-ui",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Customizable design system with react • styled-components • styled-system and ariakit.",
5
5
  "files": [
6
6
  "dist"
@@ -1,31 +0,0 @@
1
- "use client";
2
- import c from "react";
3
- import { Icon as e } from "./Icon.mjs";
4
- const o = 15, n = 15, l = '<path fill="currentColor" d="m55.542 9.07 41.48 66.67a6.395 6.395 0 0 1 .32 6.225 6.482 6.482 0 0 1-5.123 3.604L9.256 94.957A6.502 6.502 0 0 1 3.12 92.15a6.41 6.41 0 0 1-.33-6.703L44.27 9.39v-.001c1.12-2.053 3.193-3.318 5.544-3.385a6.475 6.475 0 0 1 5.728 3.067Zm-3.217 61.689a3.726 3.726 0 0 0-.493-.601c-1.495-1.497-4.173-1.497-5.655 0a4.016 4.016 0 0 0-1.173 2.833c0 1.042.428 2.085 1.173 2.833A3.992 3.992 0 0 0 49.004 77a4.015 4.015 0 0 0 2.828-1.176 4.414 4.414 0 0 0 .867-1.31c.092-.24.173-.494.226-.748a5.24 5.24 0 0 0 .067-.775c0-.268-.028-.535-.067-.789a4.985 4.985 0 0 0-.226-.748 4.443 4.443 0 0 0-.374-.695ZM45 37.009v20.257a4.005 4.005 0 0 0 4 4.009c2.21 0 4-1.796 4-4.01V37.01c0-2.215-1.79-4.01-4-4.01-2.209 0-4 1.795-4 4.01Z"/>', a = {
5
- width: o,
6
- height: n,
7
- block: l
8
- }, A = (t) => /* @__PURE__ */ c.createElement(e, { alt: "Alert", content: a, ...t }), r = 15, h = 15, i = '<path fill="currentColor" fill-rule="evenodd" d="M74.68 21.64a6.51 6.51 0 0 1 9.155-.492 6.453 6.453 0 0 1 .707 8.907l-.211.246-43.47 48.058a6.495 6.495 0 0 1-4.828 2.141c-1.449 0-2.86-.48-4.013-1.385l-.283-.235-15.54-13.665a6.455 6.455 0 0 1-.555-9.153 6.512 6.512 0 0 1 8.902-.756l.248.208 10.72 9.425L74.68 21.641Z" clip-rule="evenodd"/>', s = {
9
- width: r,
10
- height: h,
11
- block: i
12
- }, L = (t) => /* @__PURE__ */ c.createElement(e, { alt: "Check", content: s, ...t }), d = 15, u = 15, m = '<path fill="currentColor" d="M83.95 12.62C74.807 4.513 62.657.85 49.731 2.317 23.412 5.297 2 29.005 2 55.167c0 12.738 4.992 24.178 14.054 32.214C23.876 94.32 33.9 98 44.73 98c1.824 0 3.674-.105 5.536-.315C76.587 94.703 98 70.995 98 44.833c0-12.737-4.99-24.177-14.05-32.213ZM56.492 66.181c2.219-.25 4.228 1.293 4.48 3.432.254 2.139-1.341 4.07-3.562 4.314-.439.048-.878.073-1.314.073-2.838 0-5.599-1.003-7.737-2.84-2.467-2.121-3.882-5.163-3.882-8.347V49.825l-3.97.436c-2.224.244-4.23-1.293-4.482-3.432-.253-2.139 1.342-4.07 3.565-4.314l8.477-.93a4.142 4.142 0 0 1 3.155.963 3.842 3.842 0 0 1 1.352 2.91v17.355a3.29 3.29 0 0 0 1.177 2.529 3.582 3.582 0 0 0 2.74.84Zm-12.33-35.895a4.548 4.548 0 0 1-.365-1.742 4.52 4.52 0 0 1 1.391-3.222c1.092-1.053 2.725-1.533 4.264-1.235.298.052.593.143.877.26.283.104.567.247.81.416.27.17.514.351.728.559a4.51 4.51 0 0 1 1.377 3.223c0 .298-.027.597-.095.883a3.677 3.677 0 0 1-.27.858 3.699 3.699 0 0 1-.43.78c-.175.246-.366.48-.582.688a4.43 4.43 0 0 1-.729.572 5.21 5.21 0 0 1-.81.416 5.177 5.177 0 0 1-.877.26c-.31.051-.62.09-.93.09a4.846 4.846 0 0 1-3.928-2.027 5.523 5.523 0 0 1-.432-.78Z"/>', $ = {
13
- width: d,
14
- height: u,
15
- block: m
16
- }, M = (t) => /* @__PURE__ */ c.createElement(e, { alt: "Information", content: $, ...t }), f = 15, k = 15, p = '<path fill="currentColor" fill-rule="evenodd" d="M80.086 40.154a2.402 2.402 0 0 0-2.25-1.02l-24.929 2.81V6.365a2.37 2.37 0 0 0-1.812-2.294 2.4 2.4 0 0 0-2.692 1.183L19.781 58.402a2.345 2.345 0 0 0 .133 2.443 2.4 2.4 0 0 0 2.25 1.021l24.928-2.81v35.578a2.37 2.37 0 0 0 1.813 2.296c.194.047.388.07.58.07.869 0 1.69-.468 2.111-1.253l28.624-53.15a2.348 2.348 0 0 0-.134-2.443Z" clip-rule="evenodd"/>', v = {
17
- width: f,
18
- height: k,
19
- block: p
20
- }, E = (t) => /* @__PURE__ */ c.createElement(e, { alt: "Promote", content: v, ...t }), C = 15, Z = 15, b = '<path fill="currentColor" fill-rule="evenodd" d="M5.863 49.971c-3.518 3.745-3.835 8.974-.723 11.924L41.114 96c3.378 3.203 9.445 2.476 13.264-1.589L95.137 51.03c3.518-3.745 3.835-8.974.723-11.924L59.886 5c-3.378-3.203-9.445-2.476-13.264 1.589L5.862 49.97ZM53.325 64.76c.145.214.267.454.373.695.093.24.174.494.227.748.039.254.067.522.067.789 0 .254-.028.52-.067.775a5 5 0 0 1-.226.748c-.107.24-.228.481-.374.695a3.822 3.822 0 0 1-.493.615A4.015 4.015 0 0 1 50.004 71a3.991 3.991 0 0 1-2.827-1.176 4.062 4.062 0 0 1-1.173-2.833c0-1.056.428-2.098 1.173-2.833 1.481-1.497 4.16-1.497 5.655 0 .185.173.345.387.493.601ZM46 31.009a4.005 4.005 0 0 1 4-4.01c2.21 0 4 1.796 4 4.01v20.257a4.005 4.005 0 0 1-4 4.009c-2.209 0-4-1.796-4-4.01V31.01Z" clip-rule="evenodd"/>', g = {
21
- width: C,
22
- height: Z,
23
- block: b
24
- }, V = (t) => /* @__PURE__ */ c.createElement(e, { alt: "SquareAlert", content: g, ...t });
25
- export {
26
- A,
27
- L as C,
28
- M as I,
29
- E as P,
30
- V as S
31
- };