welcome-ui 0.32.1 → 1.0.0-beta.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.
@@ -0,0 +1,459 @@
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) {
5
+ return n ? o.map((t) => `url('${e}.${t}') format('${t}-variations')`).join(", ") : o.map((t) => `url('${e}.${t}') format('${t}')`).join(", ");
6
+ }
7
+ function h({
8
+ name: e,
9
+ variation: {
10
+ display: o = "swap",
11
+ extensions: n = ["woff2", "woff"],
12
+ isVariable: t,
13
+ style: r,
14
+ unicodeRange: s,
15
+ url: l,
16
+ weight: c
17
+ }
18
+ }) {
19
+ return i`
20
+ @font-face {
21
+ font-family: ${e};
22
+ src: ${g(l, n, t)};
23
+ font-display: ${o};
24
+ ${c && i`
25
+ font-weight: ${c};
26
+ `}
27
+ ${r && i`
28
+ font-style: ${r};
29
+ `}
30
+ ${s && i`
31
+ unicode-range: ${s};
32
+ `}
33
+ }
34
+ `;
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`
39
+ html,
40
+ body,
41
+ div,
42
+ span,
43
+ applet,
44
+ object,
45
+ iframe,
46
+ h1,
47
+ h2,
48
+ h3,
49
+ h4,
50
+ h5,
51
+ h6,
52
+ p,
53
+ blockquote,
54
+ pre,
55
+ a,
56
+ abbr,
57
+ acronym,
58
+ address,
59
+ big,
60
+ cite,
61
+ code,
62
+ del,
63
+ dfn,
64
+ em,
65
+ img,
66
+ ins,
67
+ kbd,
68
+ q,
69
+ s,
70
+ samp,
71
+ small,
72
+ strike,
73
+ strong,
74
+ sub,
75
+ sup,
76
+ tt,
77
+ var,
78
+ b,
79
+ u,
80
+ i,
81
+ center,
82
+ dl,
83
+ dt,
84
+ dd,
85
+ ol,
86
+ ul,
87
+ li,
88
+ fieldset,
89
+ form,
90
+ label,
91
+ legend,
92
+ table,
93
+ caption,
94
+ tbody,
95
+ tfoot,
96
+ thead,
97
+ tr,
98
+ th,
99
+ td,
100
+ article,
101
+ aside,
102
+ canvas,
103
+ details,
104
+ embed,
105
+ figure,
106
+ figcaption,
107
+ footer,
108
+ header,
109
+ hgroup,
110
+ menu,
111
+ nav,
112
+ output,
113
+ ruby,
114
+ section,
115
+ summary,
116
+ time,
117
+ mark,
118
+ audio,
119
+ video {
120
+ min-width: 0;
121
+ min-height: 0;
122
+ margin: 0;
123
+ padding: 0;
124
+ border: 0;
125
+ font-size: 100%;
126
+ vertical-align: baseline;
127
+ }
128
+ article,
129
+ aside,
130
+ details,
131
+ figcaption,
132
+ figure,
133
+ footer,
134
+ header,
135
+ hgroup,
136
+ menu,
137
+ nav,
138
+ section {
139
+ display: block;
140
+ }
141
+ ol,
142
+ ul {
143
+ list-style: none;
144
+ }
145
+ blockquote,
146
+ q {
147
+ quotes: none;
148
+ }
149
+ blockquote::before,
150
+ blockquote::after,
151
+ q::before,
152
+ q::after {
153
+ content: '';
154
+ content: none;
155
+ }
156
+ table {
157
+ border-collapse: collapse;
158
+ border-spacing: 0;
159
+ }
160
+ a {
161
+ text-decoration: none;
162
+ }
163
+ img {
164
+ overflow: hidden;
165
+ }
166
+ input {
167
+ -webkit-appearance: none;
168
+ -moz-appearance: none;
169
+ appearance: none;
170
+ }
171
+ input::-webkit-search-cancel-button {
172
+ display: none;
173
+ }
174
+ :focus {
175
+ outline: none !important; /* important for firefox */
176
+ }
177
+ *,
178
+ *::after,
179
+ *::before {
180
+ box-sizing: border-box;
181
+ -webkit-font-smoothing: antialiased;
182
+ -moz-osx-font-smoothing: grayscale;
183
+ }
184
+ html {
185
+ height: 100%;
186
+ }
187
+ body {
188
+ min-height: 100%;
189
+ padding-top: 1px;
190
+ margin-top: -1px;
191
+ }
192
+ `, x = i`
193
+ html {
194
+ line-height: 1.15;
195
+ -webkit-text-size-adjust: 100%;
196
+ }
197
+
198
+ body {
199
+ margin: 0;
200
+ }
201
+
202
+ main {
203
+ display: block;
204
+ }
205
+
206
+ h1 {
207
+ font-size: 2em;
208
+ margin: 0.67em 0;
209
+ }
210
+
211
+ hr {
212
+ box-sizing: content-box;
213
+ height: 0;
214
+ overflow: visible;
215
+ }
216
+
217
+ pre {
218
+ font-family: monospace, monospace;
219
+ font-size: 1em;
220
+ }
221
+
222
+ a {
223
+ background-color: transparent;
224
+ }
225
+
226
+ abbr[title] {
227
+ border-bottom: none;
228
+ text-decoration: underline;
229
+ text-decoration: underline dotted;
230
+ }
231
+
232
+ b,
233
+ strong {
234
+ font-weight: bolder;
235
+ }
236
+
237
+ code,
238
+ kbd,
239
+ samp {
240
+ font-family: monospace, monospace;
241
+ font-size: 1em;
242
+ }
243
+
244
+ small {
245
+ font-size: 80%;
246
+ }
247
+
248
+ sub,
249
+ sup {
250
+ font-size: 75%;
251
+ line-height: 0;
252
+ position: relative;
253
+ vertical-align: baseline;
254
+ }
255
+
256
+ sub {
257
+ bottom: -0.25em;
258
+ }
259
+
260
+ sup {
261
+ top: -0.5em;
262
+ }
263
+
264
+ img {
265
+ border-style: none;
266
+ }
267
+
268
+ button,
269
+ input,
270
+ optgroup,
271
+ select,
272
+ textarea {
273
+ font-family: inherit;
274
+ font-size: 100%;
275
+ line-height: 1.15;
276
+ margin: 0;
277
+ }
278
+
279
+ button,
280
+ input {
281
+ overflow: visible;
282
+ }
283
+
284
+ button,
285
+ select {
286
+ text-transform: none;
287
+ }
288
+
289
+ button,
290
+ [type='button'],
291
+ [type='reset'],
292
+ [type='submit'] {
293
+ -webkit-appearance: button;
294
+ }
295
+
296
+ button::-moz-focus-inner,
297
+ [type='button']::-moz-focus-inner,
298
+ [type='reset']::-moz-focus-inner,
299
+ [type='submit']::-moz-focus-inner {
300
+ border-style: none;
301
+ padding: 0;
302
+ }
303
+
304
+ button:-moz-focusring,
305
+ [type='button']:-moz-focusring,
306
+ [type='reset']:-moz-focusring,
307
+ [type='submit']:-moz-focusring {
308
+ outline: 1px dotted ButtonText;
309
+ }
310
+
311
+ fieldset {
312
+ padding: 0.35em 0.75em 0.625em;
313
+ }
314
+
315
+ legend {
316
+ box-sizing: border-box;
317
+ color: inherit;
318
+ display: table;
319
+ max-width: 100%;
320
+ padding: 0;
321
+ white-space: normal;
322
+ }
323
+
324
+ progress {
325
+ vertical-align: baseline;
326
+ }
327
+
328
+ textarea {
329
+ overflow: auto;
330
+ }
331
+
332
+ [type='checkbox'],
333
+ [type='radio'] {
334
+ box-sizing: border-box;
335
+ padding: 0;
336
+ }
337
+
338
+ [type='number']::-webkit-inner-spin-button,
339
+ [type='number']::-webkit-outer-spin-button {
340
+ height: auto;
341
+ }
342
+
343
+ [type='search'] {
344
+ -webkit-appearance: textfield;
345
+ outline-offset: -2px;
346
+ }
347
+
348
+ [type='search']::-webkit-search-decoration {
349
+ -webkit-appearance: none;
350
+ }
351
+
352
+ ::-webkit-file-upload-button {
353
+ -webkit-appearance: button;
354
+ font: inherit;
355
+ }
356
+
357
+ details {
358
+ display: block;
359
+ }
360
+
361
+ summary {
362
+ display: list-item;
363
+ }
364
+
365
+ template {
366
+ display: none;
367
+ }
368
+
369
+ [hidden] {
370
+ display: none;
371
+ }
372
+ `, k = i`
373
+ * {
374
+ &,
375
+ &::before,
376
+ &::after {
377
+ box-sizing: border-box;
378
+ }
379
+ }
380
+ `;
381
+ function v() {
382
+ return i`
383
+ body,
384
+ button,
385
+ input,
386
+ select,
387
+ textarea {
388
+ /* stylelint-disable-next-line */
389
+ font-family: texts;
390
+ -webkit-font-smoothing: antialiased;
391
+ line-height: html;
392
+ letter-spacing: html;
393
+ }
394
+ `;
395
+ }
396
+ const z = p(
397
+ ({ useReset: e }) => i`
398
+ ${x};
399
+ ${y()};
400
+ ${v()};
401
+ ${e ? w : k};
402
+
403
+ html {
404
+ color: neutral-60;
405
+ }
406
+
407
+ ::selection {
408
+ ${m("selection")};
409
+ }
410
+
411
+ /* for firefox */
412
+ &[type='search'] {
413
+ appearance: none;
414
+ }
415
+
416
+ /* to remove x on macos */
417
+ input[type='search']::-webkit-search-decoration,
418
+ input[type='search']::-webkit-search-cancel-button,
419
+ input[type='search']::-webkit-search-results-button,
420
+ input[type='search']::-webkit-search-results-decoration {
421
+ appearance: none;
422
+ }
423
+
424
+ /* Fix to toast notification when useReset prop is add to WUI provider */
425
+ .Toaster__message-wrapper {
426
+ min-height: 'auto';
427
+ }
428
+ `
429
+ ), u = "data-wui-hidefocusrings", $ = p(
430
+ () => i`
431
+ [${u}] *:focus {
432
+ outline: none;
433
+ }
434
+ `
435
+ ), F = ({
436
+ children: e,
437
+ reactRootId: o
438
+ }) => {
439
+ const [n, t] = b(!1);
440
+ return d(() => {
441
+ const r = n ? "keydown" : "mousemove", s = () => t((c) => !c);
442
+ window.addEventListener(r, s);
443
+ const l = document.getElementById(o);
444
+ return l && (n ? l.setAttribute(u, "true") : l.removeAttribute(u)), () => {
445
+ window.removeEventListener(r, s);
446
+ };
447
+ }, [n, o]), /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement($, null), e);
448
+ }, E = ({
449
+ children: e,
450
+ hasGlobalStyle: o = !0,
451
+ reactRootId: n = "root",
452
+ shouldHideFocusRingOnClick: t = !0,
453
+ theme: r,
454
+ useReset: s
455
+ }) => /* @__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));
456
+ E.displayName = "WuiProvider";
457
+ export {
458
+ E as WuiProvider
459
+ };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@xstyled/styled-components"),b=require("./Test.js"),p=require("./WuiProvider.js"),f=e=>{const{colors:t}=e;return{default:{backgroundColor:t["primary-50"]}}};function m(e,t){if(typeof e!="object"||e===null)return t;if(typeof t!="object"||t===null)return e;const o={...e};for(const l in t)t.hasOwnProperty(l)&&(o[l]=m(o[l],t[l]));return o}const x={"beige-10":"#FBF9F7","beige-20":"#F6F3EF","beige-30":"#EAE4DE","beige-40":"#D2CBC3","beige-50":"#A7A096","beige-60":"#605B55","beige-70":"#4D4944","beige-80":"#33302D","beige-90":"#1E1C1A","blue-10":"#E0F5FF","blue-20":"#BBEAFF","blue-30":"#9BDEF7","blue-40":"#55C3E9","blue-50":"#27A5D0","blue-60":"#057AA3","blue-70":"#025A79","blue-80":"#013C50","blue-90":"#00202B","green-10":"#EAFFD4","green-20":"#D6F6B4","green-30":"#BADE94","green-40":"#9FC873","green-50":"#83AD57","green-60":"#5A8034","green-70":"#40611F","green-80":"#2A4210","green-90":"#142603","neutral-10":"#FFFFFF","neutral-20":"#F3F3F3","neutral-30":"#DEDEDE","neutral-40":"#BDBDBD","neutral-50":"#989898","neutral-60":"#585858","neutral-70":"#444444","neutral-80":"#212121","neutral-90":"#000000","orange-10":"#FFEBCE","orange-20":"#FFD495","orange-30":"#FFBB59","orange-40":"#FF9F14","orange-50":"#DB860A","orange-60":"#A6670A","orange-70":"#824F06","orange-80":"#573607","orange-90":"#382303","pink-10":"#FFEAF5","pink-20":"#FFD5EB","pink-30":"#FEB7DC","pink-40":"#F696C8","pink-50":"#E468A8","pink-60":"#C24887","pink-70":"#972962","pink-80":"#6D1142","pink-90":"#3C0725","red-10":"#FBDEDC","red-20":"#FCC7C3","red-30":"#FDB3AE","red-40":"#FF9490","red-50":"#FF6165","red-60":"#E1003A","red-70":"#A80029","red-80":"#75001A","red-90":"#450101","red-orange-10":"#FFDED0","red-orange-20":"#FFC9B2","red-orange-30":"#FFB595","red-orange-40":"#FF9868","red-orange-50":"#E67B49","red-orange-60":"#C45927","red-orange-70":"#9F4217","red-orange-80":"#6D2605","red-orange-90":"#451701","teal-10":"#D5FFFA","teal-20":"#AAF4EB","teal-30":"#6DE1D2","teal-40":"#00C7AE","teal-50":"#01AA95","teal-60":"#008070","teal-70":"#00544A","teal-80":"#003D35","teal-90":"#00211D","violet-10":"#F2F2FF","violet-20":"#E0E0FF","violet-30":"#C9C9FF","violet-40":"#ACACFF","violet-50":"#9080F0","violet-60":"#7958D6","violet-70":"#593CAC","violet-80":"#422A86","violet-90":"#1F0E51","yellow-10":"#FFF8D9","yellow-20":"#FFF1B2","yellow-30":"#FFE166","yellow-40":"#FFCD00","yellow-50":"#E5B800","yellow-60":"#B69200","yellow-70":"#846A01","yellow-80":"#604D00","yellow-90":"#423500"},h=e=>({...e,"primary-10":e["yellow-10"],"primary-20":e["yellow-20"],"primary-30":e["yellow-30"],"primary-40":e["yellow-40"],"primary-50":e["yellow-50"],"primary-60":e["yellow-60"],"primary-70":e["yellow-70"],"primary-80":e["yellow-80"],"primary-90":e["yellow-90"],"secondary-blue":e["blue-40"],"secondary-green":e["green-30"],"secondary-orange":e["red-orange-40"],"secondary-pink":e["pink-40"],"secondary-teal":e["teal-40"],"secondary-violet":e["violet-40"],overlay:"rgba(0, 0, 0, 0.55)"}),g=h(x),w=Object.keys(g).reduce((e,t)=>{if(t.startsWith("secondary-")||t==="overlay")return e;const o=100-Number(t.slice(-2)),l=t.slice(0,t.length-2);return{...e,[t]:g[`${l}${o}`]}},{}),A={...g,...h(w)},E={colors:A},y=e=>({"welcome-font":[{url:`${e.fontsUrl}/welcome-font-regular`,weight:"400"},{url:`${e.fontsUrl}/welcome-font-medium`,weight:"500"},{url:`${e.fontsUrl}/welcome-font-bold`,weight:"600"},{url:`${e.fontsUrl}/welcome-font-regular-italic`,style:"italic",weight:"400"},{url:`${e.fontsUrl}/welcome-font-medium-italic`,style:"italic",weight:"500"},{url:`${e.fontsUrl}/welcome-font-bold-italic`,style:"italic",weight:"600"}],"welcome-icon-font":[{url:`${e.fontsUrl}/icon-font/__ICON_FONT_HASH__/welcome-icon-font`,display:"block"}],"work-sans":[{url:`${e.fontsUrl}/work-sans-variable`,isVariable:!0,stretch:"75% 125%",weight:"100 1000"}]}),D=(e,t)=>{const{toEm:o,toRem:l}=t,n=l;return{h0:n(65),h1:n(45),h2:n(36),h3:n(26),h4:n(20),h5:n(16),h6:n(14),lg:n(18),md:n(16),sm:n(14),"subtitle-md":n(13),"subtitle-sm":n(11),xs:n(12)}},T=({defaultLineHeight:e,toRem:t})=>({html:e,h0:t(72),h1:t(48),h2:t(40),h3:t(32),h4:t(24),h5:t(18),h6:t(16),lg:t(24),md:t(18),sm:t(18),xs:t(14),"subtitle-md":e,"subtitle-sm":e}),B={regular:400,medium:500,bold:600},v=({defaultLetterSpacing:e,toRem:t})=>({html:e,h0:t(-1.7),h1:t(-1.2),h2:t(-1),h3:t(-.9),h4:t(-.6),h5:t(-.5),h6:t(-.5),lg:e,md:e,sm:e,xs:t(-.2),"subtitle-md":t(-.2),"subtitle-sm":t(-.2)}),k=e=>{const{fontWeights:t}=e;return{h0:t.bold,h1:t.bold,h2:t.bold,h3:t.bold,h4:t.bold,h5:t.bold,h6:t.bold,lg:t.regular,md:t.regular,sm:t.regular,"subtitle-md":t.bold,"subtitle-sm":t.medium,xs:t.regular}},C=e=>{const{fonts:t}=e;return{h0:t.headings,h1:t.headings,h2:t.headings,h3:t.headings,h4:t.headings,h5:t.headings,h6:t.headings,"subtitle-md":t.headings,"subtitle-sm":t.headings}},_=()=>({"subtitle-md":"uppercase","subtitle-sm":"uppercase"}),$=e=>{const{colors:t}=e;return{h0:t["neutral-90"],h1:t["neutral-90"],h2:t["neutral-90"],h3:t["neutral-90"],h4:t["neutral-90"],h5:t["neutral-90"],h6:t["neutral-90"]}},S=e=>{const{fontSizes:t,letterSpacings:o,lineHeights:l,textsFontColors:n,textsFontFamily:u,textsFontWeights:F,textsTextTransform:d}=e;return Object.keys(t).reduce((s,r)=>({...s,[r]:{color:n[r],fontFamily:u[r]||void 0,fontWeight:F[r],fontSize:t[r],lineHeight:l[r]||l.lg,letterSpacing:o[r]||void 0,textTransform:d[r]||void 0}}),{})},U=(e,t,o)=>({texts:[e,"sans-serif"].join(", "),headings:[t,"sans-serif"].join(", "),icons:o}),a={primary:"ease",secondary:"linear",tertiary:"cubic-bezier(0.41, 0.094, 0.54, 0.07)"},W={slow:`500ms ${a.tertiary}`,medium:`300ms ${a.primary}`,fast:`100ms ${a.secondary}`},N=({colors:e})=>({default:c.css`
2
+ background-image: linear-gradient(
3
+ 0deg,
4
+ ${e["primary-40"]},
5
+ ${e["primary-40"]} 100%
6
+ );
7
+ background-repeat: no-repeat;
8
+ background-size: 100% 50%;
9
+ background-position-y: calc(200% - 2px);
10
+ transition:
11
+ background-position-y 250ms,
12
+ background-size 250ms,
13
+ color 250ms;
14
+ `,hover:c.css`
15
+ opacity: 1;
16
+ background-position-y: 100%;
17
+ background-size: 100% 100%;
18
+ `}),O=e=>({none:"0",sm:e.toRem(2),md:e.toRem(4),lg:e.toRem(8),xl:e.toRem(16),xxl:e.toRem(24),full:"100%"}),L={sm:"1px",md:"2px",lg:"3px"},I={xs:0,sm:480,md:736,lg:980,xl:1280,xxl:1440,"3xl":1620,"4xl":1920},z={sm:"1px 2px 4px 0 rgba(0,0,0,0.05)",md:"3px 4px 10px 0 rgba(0,0,0,0.07)"},H=e=>({xxs:e.toRem(2),xs:e.toRem(4),sm:e.toRem(8),md:e.toRem(12),lg:e.toRem(16),xl:e.toRem(24),xxl:e.toRem(32),"3xl":e.toRem(48),"4xl":e.toRem(64),"5xl":e.toRem(96),"6xl":e.toRem(128),"7xl":e.toRem(192)}),P=e=>({backgroundColor:e.colors["primary-40"],color:e.colors["neutral-90"]}),M=({colors:e})=>{function t(o=e["primary-40"]){return{boxShadow:`0 0 0 2px ${o}`}}return t},R="work-sans",q=16,G="-0.019rem",Y=1.15,V="https://cdn.welcome-ui.com/fonts",Z="welcome-font",J="welcome-icon-font",K=(e={})=>{const{defaultFontFamily:t=R,defaultFontSize:o=q,defaultLetterSpacing:l=G,defaultLineHeight:n=Y,fontsUrl:u=V,headingFontFamily:F=Z,iconFontFamily:d=J,...s}=e;let r={};return r.transformers={...c.rpxTransformers},r.toEm=i=>`${i/o}em`,r.toRem=i=>`${i/o}rem`,r.toPx=i=>`${i*o}px`,r.colors=g,r.fontsUrl=u,r.fontFaces=y(r),r.fontSizes=D("rem",r),r.defaultLineHeight=n,r.defaultLetterSpacing=l,r.lineHeights=T(r),r.fontWeights=B,r.letterSpacings=v(r),r.fonts=U(t,F,d),r.borderWidths=L,r.screens=I,r.space=H(r),r.inset=r.space,r.radii=O(r),r.transitions=W,r.timingFunction=a,r.shadows=z,r=m(r,s),r.selection=P(r),r.underline=N(r),r.focus=M(r),r.textsFontWeights=k(r),r.textsFontFamily=C(r),r.textsFontColors=$(r),r.textsTextTransform=_(),r.texts=S(r),r.test=f(r),r.states=c.defaultTheme.states,r=m(r,s),r};exports.Test=b.Test;exports.WuiProvider=p.WuiProvider;exports.createTheme=K;exports.darkTheme=E;