@brosco/ui 0.0.81 → 0.0.83

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/dist/index.css CHANGED
@@ -25,7 +25,6 @@
25
25
  --tw-ring-offset-color: #fff;
26
26
  --tw-ring-offset-shadow: 0 0 #0000;
27
27
  --tw-border-style: solid;
28
- --tw-duration: initial;
29
28
  }
30
29
  }
31
30
  }
@@ -43,9 +42,21 @@
43
42
  }
44
43
  :root,
45
44
  :host {
46
- --color-background: var(--background);
47
- --color-foreground: var(--foreground);
48
- --color-muted: var(--muted);
45
+ --color-red-500: oklch(63.7% 0.237 25.331);
46
+ --color-green-600: oklch(62.7% 0.194 149.214);
47
+ --color-blue-500: oklch(62.3% 0.214 259.815);
48
+ --color-zinc-500: oklch(55.2% 0.016 285.938);
49
+ --color-zinc-900: oklch(21% 0.006 285.885);
50
+ --color-white: #fff;
51
+ --spacing: 0.25rem;
52
+ --text-sm: 0.875rem;
53
+ --text-sm--line-height: calc(1.25 / 0.875);
54
+ --text-base: 1rem;
55
+ --text-base--line-height: calc(1.5 / 1);
56
+ --font-weight-medium: 500;
57
+ --animate-spin: spin 1s linear infinite;
58
+ --default-transition-duration: 0.15s;
59
+ --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
49
60
  }
50
61
  @layer utilities;
51
62
  @layer components {
@@ -129,20 +140,17 @@
129
140
  .button {
130
141
  justify-content: center;
131
142
  align-items: center;
132
- gap: calc(var(--spacing, 0.25rem) * 2);
133
- --tw-font-weight: var(--font-weight-medium, 500);
134
- font-weight: var(--font-weight-medium, 500);
143
+ gap: calc(var(--spacing) * 2);
144
+ --tw-font-weight: var(--font-weight-medium);
145
+ font-weight: var(--font-weight-medium);
135
146
  white-space: nowrap;
136
147
  color: var(--fg);
137
148
  transition-property: background-color, scale;
138
149
  transition-timing-function: var(
139
150
  --tw-ease,
140
- var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1))
141
- );
142
- transition-duration: var(
143
- --tw-duration,
144
- var(--default-transition-duration, 0.15s)
151
+ var(--default-transition-timing-function)
145
152
  );
153
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
146
154
  -webkit-user-select: none;
147
155
  user-select: none;
148
156
  display: inline-flex;
@@ -168,40 +176,31 @@
168
176
  pointer-events: none;
169
177
  }
170
178
  .button--sm {
171
- height: calc(var(--spacing, 0.25rem) * 9);
172
- font-size: var(--text-sm, 0.875rem);
173
- line-height: var(
174
- --tw-leading,
175
- var(--text-sm--line-height, calc(1.25 / 0.875))
176
- );
179
+ height: calc(var(--spacing) * 9);
180
+ font-size: var(--text-sm);
181
+ line-height: var(--tw-leading, var(--text-sm--line-height));
177
182
  }
178
183
  .button--md {
179
- height: calc(var(--spacing, 0.25rem) * 10);
180
- font-size: var(--text-sm, 0.875rem);
181
- line-height: var(
182
- --tw-leading,
183
- var(--text-sm--line-height, calc(1.25 / 0.875))
184
- );
184
+ height: calc(var(--spacing) * 10);
185
+ font-size: var(--text-sm);
186
+ line-height: var(--tw-leading, var(--text-sm--line-height));
185
187
  }
186
188
  .button--lg {
187
- height: calc(var(--spacing, 0.25rem) * 11);
188
- font-size: var(--text-base, 1rem);
189
- line-height: var(
190
- --tw-leading,
191
- var(--text-base--line-height, calc(1.5 / 1))
192
- );
189
+ height: calc(var(--spacing) * 11);
190
+ font-size: var(--text-base);
191
+ line-height: var(--tw-leading, var(--text-base--line-height));
193
192
  }
194
193
  .button--icon-only {
195
194
  flex-shrink: 0;
196
195
  }
197
196
  .button--icon-only.button--sm {
198
- width: calc(var(--spacing, 0.25rem) * 9);
197
+ width: calc(var(--spacing) * 9);
199
198
  }
200
199
  .button--icon-only.button--md {
201
- width: calc(var(--spacing, 0.25rem) * 10);
200
+ width: calc(var(--spacing) * 10);
202
201
  }
203
202
  .button--icon-only.button--lg {
204
- width: calc(var(--spacing, 0.25rem) * 11);
203
+ width: calc(var(--spacing) * 11);
205
204
  }
206
205
  .button--solid {
207
206
  background-color: var(--bg);
@@ -243,108 +242,16 @@
243
242
  }
244
243
  }
245
244
  .button--light:focus-visible:not(.button--pending):after {
246
- top: calc(var(--spacing, 0.25rem) * 2);
247
- right: calc(var(--spacing, 0.25rem) * 3);
248
- left: calc(var(--spacing, 0.25rem) * 3);
249
- height: calc(var(--spacing, 0.25rem) * 0.5);
245
+ top: calc(var(--spacing) * 2);
246
+ right: calc(var(--spacing) * 3);
247
+ left: calc(var(--spacing) * 3);
248
+ height: calc(var(--spacing) * 0.5);
250
249
  content: "";
251
250
  background-color: currentColor;
252
251
  position: absolute;
253
252
  }
254
253
  .spinner {
255
- animation: var(--animate-spin, spin 1s linear infinite);
256
- }
257
- [role="tabs"] {
258
- display: flex;
259
- }
260
- [role="tabs"] [role="tablist"] {
261
- gap: var(--spacing, 0.25rem);
262
- display: flex;
263
- position: relative;
264
- }
265
- [role="tabs"] [role="tab"],
266
- [role="tabs"] .menu-tab {
267
- z-index: 10;
268
- height: calc(var(--spacing, 0.25rem) * 9);
269
- cursor: pointer;
270
- padding-inline: calc(var(--spacing, 0.25rem) * 4);
271
- font-size: var(--text-sm, 0.875rem);
272
- line-height: var(
273
- --tw-leading,
274
- var(--text-sm--line-height, calc(1.25 / 0.875))
275
- );
276
- --tw-font-weight: var(--font-weight-medium, 500);
277
- font-weight: var(--font-weight-medium, 500);
278
- white-space: nowrap;
279
- color: var(--color-muted);
280
- -webkit-user-select: none;
281
- user-select: none;
282
- justify-content: center;
283
- align-items: center;
284
- display: inline-flex;
285
- position: relative;
286
- }
287
- :is([role="tabs"] [role="tab"], [role="tabs"] .menu-tab):focus-visible {
288
- --tw-outline-style: none;
289
- outline-style: none;
290
- }
291
- :is([role="tabs"] [role="tab"], [role="tabs"] .menu-tab):hover,
292
- :is([role="tabs"] [role="tab"], [role="tabs"] .menu-tab)[data-active],
293
- :is([role="tabs"] [role="tab"], [role="tabs"] .menu-tab)[data-popup-open] {
294
- color: var(--color-foreground);
295
- }
296
- [role="tabs"] [role="presentation"] {
297
- background-color: var(--color-foreground);
298
- transition-property: left, width;
299
- transition-timing-function: var(
300
- --tw-ease,
301
- var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1))
302
- );
303
- transition-duration: var(
304
- --tw-duration,
305
- var(--default-transition-duration, 0.15s)
306
- );
307
- --tw-duration: 0.2s;
308
- bottom: 0;
309
- left: var(--active-tab-left);
310
- width: var(--active-tab-width);
311
- border-radius: 2147483647px;
312
- height: 3px;
313
- transition-duration: 0.2s;
314
- position: absolute;
315
- }
316
- .menu-popup {
317
- min-width: calc(var(--spacing, 0.25rem) * 40);
318
- border-radius: var(--radius-md, 0.375rem);
319
- border-style: var(--tw-border-style);
320
- background-color: var(--color-background);
321
- padding: var(--spacing, 0.25rem);
322
- --tw-shadow:
323
- 0 10px 15px -3px var(--tw-shadow-color, #0000001a),
324
- 0 4px 6px -4px var(--tw-shadow-color, #0000001a);
325
- box-shadow:
326
- var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
327
- var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
328
- border-width: 1px;
329
- }
330
- .menu-item {
331
- cursor: pointer;
332
- border-radius: var(--radius-sm, 0.25rem);
333
- padding-inline: calc(var(--spacing, 0.25rem) * 3);
334
- padding-block: calc(var(--spacing, 0.25rem) * 2);
335
- font-size: var(--text-sm, 0.875rem);
336
- line-height: var(
337
- --tw-leading,
338
- var(--text-sm--line-height, calc(1.25 / 0.875))
339
- );
340
- --tw-outline-style: none;
341
- outline-style: none;
342
- align-items: center;
343
- display: flex;
344
- }
345
- .menu-item:hover,
346
- .menu-item[data-highlighted] {
347
- background-color: var(--color-muted);
254
+ animation: var(--animate-spin);
348
255
  }
349
256
  :disabled,
350
257
  [data-disabled] {
@@ -441,10 +348,6 @@
441
348
  inherits: false;
442
349
  initial-value: solid;
443
350
  }
444
- @property --tw-duration {
445
- syntax: "*";
446
- inherits: false;
447
- }
448
351
  @keyframes spin {
449
352
  to {
450
353
  transform: rotate(360deg);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import "./_css/styles.css";
2
2
  export * from "./button";
3
3
  export * from "./spinner";
4
- export * from "./tabs-navigation ";
package/dist/index.js CHANGED
@@ -1,191 +1 @@
1
- import { Button as e } from "@base-ui/react"
2
- import { Menu as a } from "@base-ui/react/menu"
3
- import { Tabs as o } from "@base-ui/react/tabs"
4
- import { cn as t } from "cn"
5
- import * as s from "react"
6
- import { jsx as n, jsxs as r } from "react/jsx-runtime"
7
- import { tv as i } from "tailwind-variants"
8
- import "./index.css"
9
-
10
- var c = ({ className: e, size: r = 24 }) =>
11
- n(`svg`, {
12
- className: t(`spinner`, e),
13
- fill: `currentColor`,
14
- height: r,
15
- stroke: `currentColor`,
16
- strokeWidth: `0`,
17
- version: `1.1`,
18
- viewBox: `0 0 16 16`,
19
- width: r,
20
- xmlns: `http://www.w3.org/2000/svg`,
21
- children: n(`path`, {
22
- d: `M16 8c-0.020-1.045-0.247-2.086-0.665-3.038-0.417-0.953-1.023-1.817-1.766-2.53s-1.624-1.278-2.578-1.651c-0.953-0.374-1.978-0.552-2.991-0.531-1.013 0.020-2.021 0.24-2.943 0.646-0.923 0.405-1.758 0.992-2.449 1.712s-1.237 1.574-1.597 2.497c-0.361 0.923-0.533 1.914-0.512 2.895 0.020 0.981 0.234 1.955 0.627 2.847 0.392 0.892 0.961 1.7 1.658 2.368s1.523 1.195 2.416 1.543c0.892 0.348 1.851 0.514 2.799 0.493 0.949-0.020 1.89-0.227 2.751-0.608 0.862-0.379 1.642-0.929 2.287-1.604s1.154-1.472 1.488-2.335c0.204-0.523 0.342-1.069 0.415-1.622 0.019 0.001 0.039 0.002 0.059 0.002 0.552 0 1-0.448 1-1 0-0.028-0.001-0.056-0.004-0.083h0.004zM14.411 10.655c-0.367 0.831-0.898 1.584-1.55 2.206s-1.422 1.112-2.254 1.434c-0.832 0.323-1.723 0.476-2.608 0.454-0.884-0.020-1.759-0.215-2.56-0.57-0.801-0.354-1.526-0.867-2.125-1.495s-1.071-1.371-1.38-2.173c-0.31-0.801-0.457-1.66-0.435-2.512s0.208-1.694 0.551-2.464c0.342-0.77 0.836-1.468 1.441-2.044s1.321-1.029 2.092-1.326c0.771-0.298 1.596-0.438 2.416-0.416s1.629 0.202 2.368 0.532c0.74 0.329 1.41 0.805 1.963 1.387s0.988 1.27 1.272 2.011c0.285 0.74 0.418 1.532 0.397 2.32h0.004c-0.002 0.027-0.004 0.055-0.004 0.083 0 0.516 0.39 0.94 0.892 0.994-0.097 0.544-0.258 1.075-0.481 1.578z`,
23
- }),
24
- }),
25
- l = i({
26
- base: `button`,
27
- variants: {
28
- variant: {
29
- solid: `button--solid`,
30
- bordered: `button--bordered`,
31
- light: `button--light`,
32
- },
33
- color: {
34
- primary: `button--primary`,
35
- secondary: `button--secondary`,
36
- success: `button--success`,
37
- danger: `button--danger`,
38
- },
39
- rounded: {
40
- full: `rounded-full`,
41
- lg: `rounded-lg`,
42
- md: `rounded-md`,
43
- sm: `rounded-sm`,
44
- none: `rounded-none`,
45
- },
46
- size: { sm: `button--sm`, md: `button--md`, lg: `button--lg` },
47
- isIconOnly: { true: `button--icon-only`, false: `px-4` },
48
- fullWidth: { true: `w-full` },
49
- },
50
- defaultVariants: {
51
- variant: `light`,
52
- color: `primary`,
53
- rounded: `lg`,
54
- size: `md`,
55
- },
56
- }),
57
- u = i({
58
- extend: l,
59
- variants: { isPending: { true: `button--pending` } },
60
- defaultVariants: { variant: `solid` },
61
- }),
62
- d = ({
63
- children: i,
64
- icon: a,
65
- className: o,
66
- disabled: s,
67
- variant: d,
68
- color: f,
69
- rounded: p,
70
- size: m,
71
- isIconOnly: h,
72
- fullWidth: g,
73
- isPending: _,
74
- ...v
75
- }) => {
76
- let y = !!v.render,
77
- b = y
78
- ? l({
79
- variant: d,
80
- color: f,
81
- rounded: p,
82
- size: m,
83
- isIconOnly: h,
84
- fullWidth: g,
85
- })
86
- : u({
87
- variant: d,
88
- color: f,
89
- rounded: p,
90
- size: m,
91
- isIconOnly: h,
92
- fullWidth: g,
93
- isPending: _,
94
- })
95
- return r(e, {
96
- className: t(b, o),
97
- disabled: !y && s,
98
- nativeButton: !y,
99
- ...v,
100
- children: [_ && !y ? n(c, {}) : a, !h && n(`span`, { children: i })],
101
- })
102
- },
103
- f = s.createContext(null)
104
- function p({ defaultValue: e, children: t }) {
105
- let i = s.useRef(null),
106
- a = s.useRef(new Map()),
107
- [c, l] = s.useState(null),
108
- u = s.useCallback((e, t, n) => {
109
- t && a.current.set(e, { element: t, active: n })
110
- }, []),
111
- d = s.useCallback((e) => {
112
- a.current.delete(e)
113
- }, []),
114
- p = s.useCallback(() => {
115
- let e = i.current
116
- if (!e) return
117
- let t = Array.from(a.current.values()).find((e) => e.active)
118
- if (!t) {
119
- l(null)
120
- return
121
- }
122
- let n = e.getBoundingClientRect(),
123
- r = t.element.getBoundingClientRect()
124
- l({ left: r.left - n.left, width: r.width })
125
- }, [])
126
- return n(o.Root, {
127
- defaultValue: e,
128
- role: `tabs`,
129
- children: n(f.Provider, {
130
- value: { registerMenuTab: u, unregisterMenuTab: d, updateIndicator: p },
131
- children: r(o.List, {
132
- ref: i,
133
- children: [
134
- t,
135
- n(o.Indicator, {
136
- style: c ? { left: c.left, width: c.width } : void 0,
137
- }),
138
- ],
139
- }),
140
- }),
141
- })
142
- }
143
- function m({ id: e, active: t = !1, children: i, items: o }) {
144
- let c = s.useContext(f),
145
- l = s.useRef(null)
146
- return (
147
- s.useLayoutEffect(() => {
148
- if (c)
149
- return (
150
- c.registerMenuTab(e, l.current, t),
151
- c.updateIndicator(),
152
- () => {
153
- c.unregisterMenuTab(e)
154
- }
155
- )
156
- }, [c, e, t]),
157
- r(a.Root, {
158
- children: [
159
- n(a.Trigger, {
160
- className: `menu-tab`,
161
- "data-active": t ? `` : void 0,
162
- ref: l,
163
- children: i,
164
- }),
165
- n(a.Portal, {
166
- children: n(a.Positioner, {
167
- sideOffset: 6,
168
- children: n(a.Popup, {
169
- className: `menu-popup`,
170
- children: o.map((e) =>
171
- n(
172
- a.LinkItem,
173
- { className: `menu-item`, href: e.href, children: e.label },
174
- e.href,
175
- ),
176
- ),
177
- }),
178
- }),
179
- }),
180
- ],
181
- })
182
- )
183
- }
184
- export {
185
- d as Button,
186
- m as MenuTab,
187
- c as Spinner,
188
- p as TabsNavigation,
189
- u as buttonVariants,
190
- l as linkVariants,
191
- }
1
+ import{Button as e}from"@base-ui/react";import{cn as t}from"cn";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{tv as i}from"tailwind-variants";import './index.css';var a=({className:e,size:r=24})=>n(`svg`,{className:t(`spinner`,e),fill:`currentColor`,height:r,stroke:`currentColor`,strokeWidth:`0`,version:`1.1`,viewBox:`0 0 16 16`,width:r,xmlns:`http://www.w3.org/2000/svg`,children:n(`path`,{d:`M16 8c-0.020-1.045-0.247-2.086-0.665-3.038-0.417-0.953-1.023-1.817-1.766-2.53s-1.624-1.278-2.578-1.651c-0.953-0.374-1.978-0.552-2.991-0.531-1.013 0.020-2.021 0.24-2.943 0.646-0.923 0.405-1.758 0.992-2.449 1.712s-1.237 1.574-1.597 2.497c-0.361 0.923-0.533 1.914-0.512 2.895 0.020 0.981 0.234 1.955 0.627 2.847 0.392 0.892 0.961 1.7 1.658 2.368s1.523 1.195 2.416 1.543c0.892 0.348 1.851 0.514 2.799 0.493 0.949-0.020 1.89-0.227 2.751-0.608 0.862-0.379 1.642-0.929 2.287-1.604s1.154-1.472 1.488-2.335c0.204-0.523 0.342-1.069 0.415-1.622 0.019 0.001 0.039 0.002 0.059 0.002 0.552 0 1-0.448 1-1 0-0.028-0.001-0.056-0.004-0.083h0.004zM14.411 10.655c-0.367 0.831-0.898 1.584-1.55 2.206s-1.422 1.112-2.254 1.434c-0.832 0.323-1.723 0.476-2.608 0.454-0.884-0.020-1.759-0.215-2.56-0.57-0.801-0.354-1.526-0.867-2.125-1.495s-1.071-1.371-1.38-2.173c-0.31-0.801-0.457-1.66-0.435-2.512s0.208-1.694 0.551-2.464c0.342-0.77 0.836-1.468 1.441-2.044s1.321-1.029 2.092-1.326c0.771-0.298 1.596-0.438 2.416-0.416s1.629 0.202 2.368 0.532c0.74 0.329 1.41 0.805 1.963 1.387s0.988 1.27 1.272 2.011c0.285 0.74 0.418 1.532 0.397 2.32h0.004c-0.002 0.027-0.004 0.055-0.004 0.083 0 0.516 0.39 0.94 0.892 0.994-0.097 0.544-0.258 1.075-0.481 1.578z`})}),o=i({base:`button`,variants:{variant:{solid:`button--solid`,bordered:`button--bordered`,light:`button--light`},color:{primary:`button--primary`,secondary:`button--secondary`,success:`button--success`,danger:`button--danger`},rounded:{full:`rounded-full`,lg:`rounded-lg`,md:`rounded-md`,sm:`rounded-sm`,none:`rounded-none`},size:{sm:`button--sm`,md:`button--md`,lg:`button--lg`},isIconOnly:{true:`button--icon-only`,false:`px-4`},fullWidth:{true:`w-full`}},defaultVariants:{variant:`light`,color:`primary`,rounded:`lg`,size:`md`}}),s=i({extend:o,variants:{isPending:{true:`button--pending`}},defaultVariants:{variant:`solid`}}),c=({children:i,icon:c,className:l,disabled:u,variant:d,color:f,rounded:p,size:m,isIconOnly:h,fullWidth:g,isPending:_,...v})=>{let y=!!v.render,b=y?o({variant:d,color:f,rounded:p,size:m,isIconOnly:h,fullWidth:g}):s({variant:d,color:f,rounded:p,size:m,isIconOnly:h,fullWidth:g,isPending:_});return r(e,{className:t(b,l),disabled:!y&&u,nativeButton:!y,...v,children:[_&&!y?n(a,{}):c,!h&&n(`span`,{children:i})]})};export{c as Button,a as Spinner,s as buttonVariants,o as linkVariants};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brosco/ui",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1 +0,0 @@
1
- export * from "./tabs-navigation ";
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- export declare function TabsNavigation({ defaultValue, children, }: {
3
- defaultValue: string;
4
- children: React.ReactNode;
5
- }): React.JSX.Element;
6
- export declare function MenuTab({ id, active, children, items, }: {
7
- id: string;
8
- active?: boolean;
9
- children: React.ReactNode;
10
- items: Array<{
11
- label: string;
12
- href: string;
13
- }>;
14
- }): React.JSX.Element;