welcome-ui 7.0.1-alpha.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # Welcome UI
2
+
3
+ ![Welcome UI Logo](https://github.com/user-attachments/assets/e7df47fd-e6c8-462a-ac09-d052d67555bc)
4
+
5
+ Welcome to the _Welcome UI library_ created by [Welcome to the jungle](https://www.welcometothejungle.com), a customizable design system with react • typescript • styled-components • styled-system and ariakit.
6
+
7
+ Here you'll find all the core components you need to create a delightful webapp.
8
+
9
+ 🌴 [Discover all the components](https://welcome-ui.com)
10
+
11
+ ---
12
+
13
+ [![License](https://img.shields.io/npm/l/welcome-ui.svg)](https://github.com/WTTJ/welcome-ui/tree/main/LICENSE) ![Code formating](https://img.shields.io/badge/code%20formating-prettier-blue.svg) ![Code style](https://img.shields.io/badge/code%20style-styled--components-ff69b4.svg) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-mediumspringgreen.svg)](https://github.com/WTTJ/welcome-ui/tree/main/CONTRIBUTING.mdx) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ 1 - Install the `welcome-ui` package and **peer dependencies** listed below:
20
+
21
+ ```bash
22
+ yarn add welcome-ui @xstyled/styled-components@^3.7.3 react@^18.0.0 styled-components@^5.3.9
23
+ ```
24
+
25
+ ## Import library & Theme
26
+
27
+ Getting started
28
+
29
+ ```js
30
+ import React from 'react'
31
+ import { createTheme } from 'welcome-ui/theme'
32
+ import { WuiProvider } from 'welcome-ui/WuiProvider'
33
+ import { Button } from 'welcome-ui/Button'
34
+
35
+ // Add theme options (if you want)
36
+ const options = {
37
+ defaultFontFamily: 'Helvetica',
38
+ headingFontFamily: 'Georgia',
39
+ colors: {
40
+ primary: {
41
+ 50: '#124C80',
42
+ },
43
+ green: {
44
+ 50: '#32CD32',
45
+ },
46
+ },
47
+ }
48
+
49
+ // Create your theme
50
+ const theme = createTheme(options)
51
+ export default function Root() {
52
+ return (
53
+ // Wrap your components with <WuiProvider /> with your theme
54
+ <WuiProvider
55
+ theme={theme}
56
+ // Will inject a CSS reset with normalizer
57
+ hasGlobalStyle
58
+ // Will show the focus ring on keyboard navigation only
59
+ shouldHideFocusRingOnClick
60
+ >
61
+ <Button>Welcome!</Button>
62
+ </WuiProvider>
63
+ )
64
+ }
65
+ ```
66
+
67
+ ## Develop on local
68
+
69
+ 1. Install
70
+
71
+ ```bash
72
+ yarn
73
+ ```
74
+
75
+ 2. Start a watch on all packages to rebuild them easily
76
+
77
+ ```bash
78
+ yarn start
79
+ ```
80
+
81
+ 3. Start documentation website
82
+
83
+ ```bash
84
+ yarn website
85
+ ```
86
+
87
+ 4. and go to http://localhost:3020
88
+
89
+ ## How to release
90
+
91
+ The release of the library is automated by the CI, you just need to bump package version and push git tags to initiate the process.
92
+
93
+ ### Release process
94
+
95
+ **The commands listed below will only prompt for library to bump**. Then they will modify package version, commit changes and create the git tag to finally push everything to github. **No further actions are required once you have validated the packages to bump.**
96
+
97
+ #### How to release
98
+
99
+ ##### Production
100
+
101
+ (ex: **7.1.0**):
102
+
103
+ ```bash
104
+ yarn release
105
+ ```
106
+
107
+ ##### Alpha
108
+
109
+ (ex: **7.1.0-alpha.0**)
110
+
111
+ Generate an alpha release for broader team testing:
112
+
113
+ ```bash
114
+ yarn release:alpha
115
+ ```
116
+
117
+ ##### Development
118
+
119
+ (ex: **dev.1738060597**)
120
+
121
+ Create a development release based on the current timestamp for quick testing of pre-release features:
122
+
123
+ ```bash
124
+ yarn release:dev
125
+ ```
126
+
127
+ ### About the CI
128
+
129
+ The CI will trigger on tags to build the packages and then push them to the npm registry
package/dist/Toast.js CHANGED
@@ -39,4 +39,4 @@
39
39
  ${l.th("toasts.snackbar.separator.default")};
40
40
  ${l.th(`toasts.snackbar.separator.${t}`)};
41
41
  padding-left: sm;
42
- `),X={"top-left":{top:0,left:0},"top-center":{top:0,left:"50%"},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-center":{bottom:0,left:"50%"},"bottom-right":{bottom:0,right:0}},Z=({calculateOffset:t,toast:e,updateHeight:s})=>{var m,g,y;if(typeof e.message=="string")return console.warn("You must pass a React component or a HTML element."),null;const n=t(e,{reverseOrder:!1,gutter:0}),r=d=>{if(d&&typeof e.height!="number"){const b=d.getBoundingClientRect().height;s(e.id,b)}},o=(m=e.position)==null?void 0:m.includes("center"),u=(g=e.position)==null?void 0:g.includes("top"),i=(y=e.position)==null?void 0:y.includes("bottom"),f=()=>{e.onClose&&e.onClose(),S.dismiss(e.id)},p={opacity:e.visible?1:0,transform:`translate(${o?"-50%":"0"}, ${n*(u?1:-1)}px)`,...X[e.position]};return a.createElement(F,{isBottom:i,opacity:p.opacity,ref:r,style:p,transform:p.transform,...e.ariaProps},a.cloneElement(e.message,{onClose:f}))},D=C.forwardRef(({children:t,dataTestId:e,hasCloseButton:s=!0,icon:n,onClose:r,variant:o="default"},u)=>{const i=e?`${e}-close-button`:void 0;return a.createElement(J,{"data-testid":e,hasCloseButton:s,icon:n,ref:u,variant:o},s&&a.createElement(B.CloseButton,{dataTestId:i,onClick:r,position:"absolute",right:"sm",top:"sm"}),a.createElement(w.Box,{pr:"xl"},t))});D.displayName="Growl";const I=C.forwardRef(({children:t,cta:e,hasCloseButton:s=!0,icon:n,onClose:r,variant:o="default",...u},i)=>a.createElement(Q,{icon:n,ref:i,variant:o,...u},a.createElement(w.Box,{alignItems:"center",display:"flex",gap:"sm"},t,e&&a.createElement(V,{variant:o},e),s&&a.createElement(B.CloseButton,{onClick:r,size:"xs"})))),tt=C.forwardRef((t,e)=>a.createElement(q.Button,{flexShrink:0,ref:e,size:"xs",variant:"ghost",...t}));I.displayName="Snackbar";const et=({pauseOnHover:t=!0})=>{const e=a.useContext(l.ThemeContext),s=U(),{handlers:n,toasts:r}=j(),{calculateOffset:o,endPause:u,startPause:i,updateHeight:f}=n,p=t?i:void 0,m=t?u:void 0;return a.createElement(l.ThemeProvider,{theme:e},r.length>0&&s(a.createElement("div",{onMouseEnter:p,onMouseLeave:m},r.map(g=>a.createElement(Z,{calculateOffset:o,key:g.id,toast:g,updateHeight:f})))))},st=({children:t,...e})=>a.createElement(K,{...e},t),ot=(t,e)=>{var o,u;const r={duration:7e3,position:(typeof t=="string"?void 0:((o=t==null?void 0:t.type)==null?void 0:o.displayName)||((u=t==null?void 0:t.type)==null?void 0:u.name))==="Growl"?"top-right":"bottom-center",...e};return S(t,r)},rt=t=>{S.remove(t)},nt=t=>{S.dismiss(t)},at={Title:st,Growl:D,Snackbar:I,SnackbarAction:tt};exports.Notifications=et;exports.Toast=at;exports.dismiss=nt;exports.remove=rt;exports.toast=ot;
42
+ `),X={"top-left":{top:0,left:0},"top-center":{top:0,left:"50%"},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-center":{bottom:0,left:"50%"},"bottom-right":{bottom:0,right:0}},Z=({calculateOffset:t,toast:e,updateHeight:s})=>{var m,g,y;if(typeof e.message=="string")return console.warn("You must pass a React component or a HTML element."),null;const n=t(e,{reverseOrder:!1,gutter:0}),r=d=>{if(d&&typeof e.height!="number"){const b=d.getBoundingClientRect().height;s(e.id,b)}},o=(m=e.position)==null?void 0:m.includes("center"),u=(g=e.position)==null?void 0:g.includes("top"),i=(y=e.position)==null?void 0:y.includes("bottom"),f=()=>{e.onClose&&e.onClose(),S.dismiss(e.id)},p={opacity:e.visible?1:0,transform:`translate(${o?"-50%":"0"}, ${n*(u?1:-1)}px)`,...X[e.position]};return a.createElement(F,{isBottom:i,opacity:p.opacity,ref:r,style:p,transform:p.transform,...e.ariaProps},a.cloneElement(e.message,{onClose:f}))},D=C.forwardRef(({children:t,dataTestId:e,hasCloseButton:s=!0,icon:n,onClose:r,variant:o="default"},u)=>{const i=e?`${e}-close-button`:void 0;return a.createElement(J,{"data-testid":e,hasCloseButton:s,icon:n,ref:u,variant:o},s&&a.createElement(B.CloseButton,{dataTestId:i,onClick:r,position:"absolute",right:"sm",top:"sm"}),a.createElement(w.Box,{pr:"xl"},t))});D.displayName="Growl";const I=C.forwardRef(({children:t,cta:e,hasCloseButton:s=!0,icon:n,onClose:r,variant:o="default",...u},i)=>a.createElement(Q,{icon:n,ref:i,variant:o,...u},a.createElement(w.Box,{alignItems:"center",display:"flex",gap:"sm"},t,e&&a.createElement(V,{variant:o},e),s&&a.createElement(B.CloseButton,{onClick:r,size:"xs"})))),tt=C.forwardRef((t,e)=>a.createElement(q.Button,{flexShrink:0,ref:e,size:"xs",variant:"ghost",...t}));I.displayName="Snackbar";const et=({pauseOnHover:t=!0})=>{const e=a.useContext(l.ThemeContext),s=U(),{handlers:n,toasts:r}=j(),{calculateOffset:o,endPause:u,startPause:i,updateHeight:f}=n,p=t?i:void 0,m=t?u:void 0;return a.createElement(l.ThemeProvider,{theme:e},r.length>0&&s(a.createElement("div",{"data-wui-persistent":!0,onMouseEnter:p,onMouseLeave:m},r.map(g=>a.createElement(Z,{calculateOffset:o,key:g.id,toast:g,updateHeight:f})))))},st=({children:t,...e})=>a.createElement(K,{...e},t),ot=(t,e)=>{var o,u;const r={duration:7e3,position:(typeof t=="string"?void 0:((o=t==null?void 0:t.type)==null?void 0:o.displayName)||((u=t==null?void 0:t.type)==null?void 0:u.name))==="Growl"?"top-right":"bottom-center",...e};return S(t,r)},rt=t=>{S.remove(t)},nt=t=>{S.dismiss(t)},at={Title:st,Growl:D,Snackbar:I,SnackbarAction:tt};exports.Notifications=et;exports.Toast=at;exports.dismiss=nt;exports.remove=rt;exports.toast=ot;
package/dist/Toast.mjs CHANGED
@@ -231,7 +231,7 @@ G.displayName = "Snackbar";
231
231
  const xt = ({ pauseOnHover: t = !0 }) => {
232
232
  const e = H(L), s = st(), { handlers: a, toasts: r } = et(), { calculateOffset: o, endPause: i, startPause: n, updateHeight: c } = a, f = t ? n : void 0, p = t ? i : void 0;
233
233
  return /* @__PURE__ */ d.createElement(W, { theme: e }, r.length > 0 && s(
234
- /* @__PURE__ */ d.createElement("div", { onMouseEnter: f, onMouseLeave: p }, r.map((g) => /* @__PURE__ */ d.createElement(
234
+ /* @__PURE__ */ d.createElement("div", { "data-wui-persistent": !0, onMouseEnter: f, onMouseLeave: p }, r.map((g) => /* @__PURE__ */ d.createElement(
235
235
  dt,
236
236
  {
237
237
  calculateOffset: o,
@@ -1,7 +1,7 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),t=require("@xstyled/styled-components");function b(e,n,i){return i?n.map(o=>`url('${e}.${o}') format('${o}-variations')`).join(", "):n.map(o=>`url('${e}.${o}') format('${o}')`).join(", ")}function d({name:e,variation:{display:n="swap",extensions:i=["woff2","woff"],isVariable:o,style:r,unicodeRange:s,url:l,weight:c}}){return t.css`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),t=require("@xstyled/styled-components");function d(e,n,i){return i?n.map(o=>`url('${e}.${o}') format('${o}-variations')`).join(", "):n.map(o=>`url('${e}.${o}') format('${o}')`).join(", ")}function m({name:e,variation:{display:n="swap",extensions:i=["woff2","woff"],isVariable:o,style:r,unicodeRange:s,url:l,weight:c}}){return t.css`
2
2
  @font-face {
3
3
  font-family: ${e};
4
- src: ${b(l,i,o)};
4
+ src: ${d(l,i,o)};
5
5
  font-display: ${n};
6
6
  ${c&&t.css`
7
7
  font-weight: ${c};
@@ -13,7 +13,7 @@
13
13
  unicode-range: ${s};
14
14
  `}
15
15
  }
16
- `}const m=()=>({theme:e})=>!e||!e.fontFaces?null:Object.entries(e.fontFaces).map(([n,i])=>i.map(o=>d({name:n,variation:o}))),f=t.css`
16
+ `}const f=()=>({theme:e})=>!e||!e.fontFaces?null:Object.entries(e.fontFaces).map(([n,i])=>i.map(o=>m({name:n,variation:o}))),g=t.css`
17
17
  html,
18
18
  body,
19
19
  div,
@@ -167,7 +167,7 @@
167
167
  padding-top: 1px;
168
168
  margin-top: -1px;
169
169
  }
170
- `,g=t.css`
170
+ `,h=t.css`
171
171
  html {
172
172
  line-height: 1.15;
173
173
  -webkit-text-size-adjust: 100%;
@@ -349,7 +349,7 @@
349
349
  [hidden] {
350
350
  display: none;
351
351
  }
352
- `,h=t.css`
352
+ `,y=t.css`
353
353
  * {
354
354
  &,
355
355
  &::before,
@@ -357,7 +357,7 @@
357
357
  box-sizing: border-box;
358
358
  }
359
359
  }
360
- `;function y(){return t.css`
360
+ `;function w(){return t.css`
361
361
  body,
362
362
  button,
363
363
  input,
@@ -369,11 +369,11 @@
369
369
  line-height: html;
370
370
  letter-spacing: html;
371
371
  }
372
- `}const w=t.createGlobalStyle(({useReset:e})=>t.css`
373
- ${g};
374
- ${m()};
375
- ${y()};
376
- ${e?f:h};
372
+ `}const b=t.createGlobalStyle(({useReset:e})=>t.css`
373
+ ${h};
374
+ ${f()};
375
+ ${w()};
376
+ ${e?g:y};
377
377
 
378
378
  html {
379
379
  color: neutral-60;
@@ -404,4 +404,4 @@
404
404
  [${u}] *:focus {
405
405
  outline: none;
406
406
  }
407
- `),k=({children:e,reactRootId:n})=>{const[i,o]=a.useState(!1);return a.useEffect(()=>{const r=i?"keydown":"mousemove",s=()=>o(c=>!c);window.addEventListener(r,s);const l=document.getElementById(n);return l&&(i?l.setAttribute(u,"true"):l.removeAttribute(u)),()=>{window.removeEventListener(r,s)}},[i,n]),a.createElement(a.Fragment,null,a.createElement(x,null),e)},p=({children:e,hasGlobalStyle:n=!0,reactRootId:i="root",shouldHideFocusRingOnClick:o=!0,theme:r,useReset:s})=>a.createElement(t.ThemeProvider,{theme:r},a.createElement(a.Fragment,null,n&&a.createElement(w,{useReset:s}),o?a.createElement(k,{reactRootId:i},e):e));p.displayName="WuiProvider";exports.WuiProvider=p;
407
+ `),k=({children:e,reactRootId:n})=>{const[i,o]=a.useState(!1);return a.useEffect(()=>{const r=i?"keydown":"mousemove",s=()=>o(c=>!c);window.addEventListener(r,s);const l=document.getElementById(n);return l&&(i?l.setAttribute(u,"true"):l.removeAttribute(u)),()=>{window.removeEventListener(r,s)}},[i,n]),a.createElement(a.Fragment,null,a.createElement(x,null),e)},p=({children:e,hasGlobalStyle:n=!0,reactRootId:i="root",shouldHideFocusRingOnClick:o=!0,theme:r,useReset:s})=>a.createElement(t.ThemeProvider,{theme:r},a.createElement(a.Fragment,null,n&&a.createElement(b,{useReset:s}),o?a.createElement(k,{reactRootId:i},e):e)),v=b;p.displayName="WuiProvider";exports.GlobalStyle=v;exports.WuiProvider=p;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import a, { useState as b, useEffect as d } from "react";
3
- import { css as i, createGlobalStyle as p, th as m, ThemeProvider as f } from "@xstyled/styled-components";
4
- function g(e, o, n) {
2
+ import a, { useState as d, useEffect as m } from "react";
3
+ import { css as i, createGlobalStyle as p, th as f, ThemeProvider as g } from "@xstyled/styled-components";
4
+ function h(e, o, n) {
5
5
  return n ? o.map((t) => `url('${e}.${t}') format('${t}-variations')`).join(", ") : o.map((t) => `url('${e}.${t}') format('${t}')`).join(", ");
6
6
  }
7
- function h({
7
+ function y({
8
8
  name: e,
9
9
  variation: {
10
10
  display: o = "swap",
@@ -19,7 +19,7 @@ function h({
19
19
  return i`
20
20
  @font-face {
21
21
  font-family: ${e};
22
- src: ${g(l, n, t)};
22
+ src: ${h(l, n, t)};
23
23
  font-display: ${o};
24
24
  ${c && i`
25
25
  font-weight: ${c};
@@ -33,9 +33,9 @@ function h({
33
33
  }
34
34
  `;
35
35
  }
36
- const y = () => ({ theme: e }) => !e || !e.fontFaces ? null : Object.entries(e.fontFaces).map(
37
- ([o, n]) => n.map((t) => h({ name: o, variation: t }))
38
- ), w = i`
36
+ const w = () => ({ theme: e }) => !e || !e.fontFaces ? null : Object.entries(e.fontFaces).map(
37
+ ([o, n]) => n.map((t) => y({ name: o, variation: t }))
38
+ ), x = i`
39
39
  html,
40
40
  body,
41
41
  div,
@@ -189,7 +189,7 @@ const y = () => ({ theme: e }) => !e || !e.fontFaces ? null : Object.entries(e.f
189
189
  padding-top: 1px;
190
190
  margin-top: -1px;
191
191
  }
192
- `, x = i`
192
+ `, k = i`
193
193
  html {
194
194
  line-height: 1.15;
195
195
  -webkit-text-size-adjust: 100%;
@@ -371,7 +371,7 @@ const y = () => ({ theme: e }) => !e || !e.fontFaces ? null : Object.entries(e.f
371
371
  [hidden] {
372
372
  display: none;
373
373
  }
374
- `, k = i`
374
+ `, v = i`
375
375
  * {
376
376
  &,
377
377
  &::before,
@@ -380,7 +380,7 @@ const y = () => ({ theme: e }) => !e || !e.fontFaces ? null : Object.entries(e.f
380
380
  }
381
381
  }
382
382
  `;
383
- function v() {
383
+ function z() {
384
384
  return i`
385
385
  body,
386
386
  button,
@@ -395,19 +395,19 @@ function v() {
395
395
  }
396
396
  `;
397
397
  }
398
- const z = p(
398
+ const b = p(
399
399
  ({ useReset: e }) => i`
400
- ${x};
401
- ${y()};
402
- ${v()};
403
- ${e ? w : k};
400
+ ${k};
401
+ ${w()};
402
+ ${z()};
403
+ ${e ? x : v};
404
404
 
405
405
  html {
406
406
  color: neutral-60;
407
407
  }
408
408
 
409
409
  ::selection {
410
- ${m("selection")};
410
+ ${f("selection")};
411
411
  }
412
412
 
413
413
  /* for firefox */
@@ -438,8 +438,8 @@ const z = p(
438
438
  children: e,
439
439
  reactRootId: o
440
440
  }) => {
441
- const [n, t] = b(!1);
442
- return d(() => {
441
+ const [n, t] = d(!1);
442
+ return m(() => {
443
443
  const r = n ? "keydown" : "mousemove", s = () => t((c) => !c);
444
444
  window.addEventListener(r, s);
445
445
  const l = document.getElementById(o);
@@ -454,8 +454,9 @@ const z = p(
454
454
  shouldHideFocusRingOnClick: t = !0,
455
455
  theme: r,
456
456
  useReset: s
457
- }) => /* @__PURE__ */ a.createElement(f, { theme: r }, /* @__PURE__ */ a.createElement(a.Fragment, null, o && /* @__PURE__ */ a.createElement(z, { useReset: s }), t ? /* @__PURE__ */ a.createElement(F, { reactRootId: n }, e) : e));
457
+ }) => /* @__PURE__ */ a.createElement(g, { theme: r }, /* @__PURE__ */ a.createElement(a.Fragment, null, o && /* @__PURE__ */ a.createElement(b, { useReset: s }), t ? /* @__PURE__ */ a.createElement(F, { reactRootId: n }, e) : e)), R = b;
458
458
  E.displayName = "WuiProvider";
459
459
  export {
460
+ R as GlobalStyle,
460
461
  E as WuiProvider
461
462
  };
@@ -9,3 +9,7 @@ export interface WuiProviderProps {
9
9
  useReset?: boolean;
10
10
  }
11
11
  export declare const WuiProvider: React.FC<WuiProviderProps>;
12
+ declare const GlobalStyle: import('styled-components').GlobalStyleComponent<{
13
+ useReset?: boolean;
14
+ }, import('styled-components').DefaultTheme>;
15
+ export { GlobalStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "welcome-ui",
3
- "version": "7.0.1-alpha.0",
3
+ "version": "7.0.1",
4
4
  "description": "Customizable design system with react • styled-components • styled-system and ariakit.",
5
5
  "files": [
6
6
  "dist"