@nextui-org/theme 0.0.0-dev-v2-20230501173002 → 0.0.0-dev-v2-20230511041421

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.
@@ -6,16 +6,16 @@ import {
6
6
  import { tv } from "tailwind-variants";
7
7
  var snippet = tv({
8
8
  slots: {
9
- base: "inline-flex items-center justify-between space-x-3 rounded-md",
9
+ base: "inline-flex items-center justify-between rounded-md",
10
10
  pre: "bg-transparent text-inherit font-mono whitespace-pre-wrap",
11
- copy: [
12
- "z-10 appearance-none outline-none rounded-sm",
13
- "data-[focus-visible=true]:outline-none",
14
- "data-[focus-visible=true]:ring-1",
15
- "data-[focus-visible=true]:ring-primary",
16
- "data-[focus-visible=true]:ring-offset-2",
17
- "data-[focus-visible=true]:ring-offset-transparent",
18
- "data-[focus-visible=true]:dark:ring-offset-transparent"
11
+ content: "flex flex-col",
12
+ symbol: "select-none",
13
+ copyButton: ["group", "relative", "z-10", "text-inherit", "data-[hover=true]:bg-transparent"],
14
+ copyIcon: [
15
+ "absolute text-inherit opacity-100 scale-100 group-data-[copied=true]:opacity-0 group-data-[copied=true]:scale-50"
16
+ ],
17
+ checkIcon: [
18
+ "absolute text-inherit opacity-0 scale-50 group-data-[copied=true]:opacity-100 group-data-[copied=true]:scale-100"
19
19
  ]
20
20
  },
21
21
  variants: {
@@ -89,6 +89,13 @@ var snippet = tv({
89
89
  true: {
90
90
  base: "w-full"
91
91
  }
92
+ },
93
+ disableAnimation: {
94
+ true: {},
95
+ false: {
96
+ copyIcon: "transition-transform-opacity",
97
+ checkIcon: "transition-transform-opacity"
98
+ }
92
99
  }
93
100
  },
94
101
  defaultVariants: {
@@ -96,7 +103,8 @@ var snippet = tv({
96
103
  variant: "flat",
97
104
  size: "md",
98
105
  radius: "lg",
99
- fullWidth: false
106
+ fullWidth: false,
107
+ disableAnimation: false
100
108
  },
101
109
  compoundVariants: [
102
110
  {
@@ -0,0 +1,161 @@
1
+ import {
2
+ baseStyles
3
+ } from "./chunk-INZK6TTL.mjs";
4
+ import {
5
+ utilities
6
+ } from "./chunk-XLATS5QU.mjs";
7
+ import {
8
+ semanticColors
9
+ } from "./chunk-LQHWK6UV.mjs";
10
+ import {
11
+ removeDefaultKeys
12
+ } from "./chunk-37PIXVP4.mjs";
13
+ import {
14
+ animations
15
+ } from "./chunk-DMASP6FA.mjs";
16
+ import {
17
+ commonColors
18
+ } from "./chunk-CRCBVLUP.mjs";
19
+
20
+ // src/plugin.ts
21
+ import Color from "color";
22
+ import plugin from "tailwindcss/plugin.js";
23
+ import forEach from "lodash.foreach";
24
+ import flatten from "flat";
25
+ import get from "lodash.get";
26
+ import omit from "lodash.omit";
27
+ import deepMerge from "deepmerge";
28
+ var SCHEME = Symbol("color-scheme");
29
+ var DEFAULT_PREFIX = "nextui";
30
+ var dark = (colors) => {
31
+ return {
32
+ [SCHEME]: "dark",
33
+ ...colors
34
+ };
35
+ };
36
+ var light = (colors) => {
37
+ return {
38
+ [SCHEME]: "light",
39
+ ...colors
40
+ };
41
+ };
42
+ var resolveConfig = (config = {}, defaultTheme, prefix) => {
43
+ const resolved = {
44
+ variants: [],
45
+ utilities: {},
46
+ colors: {}
47
+ };
48
+ const configObject = typeof config === "function" ? config({ dark, light }) : config;
49
+ forEach(configObject, (colors, themeName) => {
50
+ let cssSelector = `.${themeName},[data-theme="${themeName}"]`;
51
+ if (themeName === defaultTheme) {
52
+ cssSelector = `:root,${cssSelector}`;
53
+ }
54
+ resolved.utilities[cssSelector] = colors[SCHEME] ? {
55
+ "color-scheme": colors[SCHEME]
56
+ } : {};
57
+ const flatColors = removeDefaultKeys(
58
+ flatten(colors, {
59
+ safe: true,
60
+ delimiter: "-"
61
+ })
62
+ );
63
+ resolved.variants.push({
64
+ name: themeName,
65
+ definition: [`&.${themeName}`, `&[data-theme='${themeName}']`]
66
+ });
67
+ forEach(flatColors, (colorValue, colorName) => {
68
+ if (colorName === SCHEME || !colorValue)
69
+ return;
70
+ try {
71
+ const [h, s, l, defaultAlphaValue] = Color(colorValue).hsl().round().array();
72
+ const nextuiColorVariable = `--${prefix}-${colorName}`;
73
+ const nextuiOpacityVariable = `--${prefix}-${colorName}-opacity`;
74
+ resolved.utilities[cssSelector][nextuiColorVariable] = `${h} ${s}% ${l}%`;
75
+ if (typeof defaultAlphaValue === "number") {
76
+ resolved.utilities[cssSelector][nextuiOpacityVariable] = defaultAlphaValue.toFixed(2);
77
+ }
78
+ resolved.colors[colorName] = ({ opacityVariable, opacityValue }) => {
79
+ if (!isNaN(+opacityValue)) {
80
+ return `hsl(var(${nextuiColorVariable}) / ${opacityValue})`;
81
+ }
82
+ if (opacityVariable) {
83
+ return `hsl(var(${nextuiColorVariable}) / var(${nextuiOpacityVariable}, var(${opacityVariable})))`;
84
+ }
85
+ return `hsl(var(${nextuiColorVariable}) / var(${nextuiOpacityVariable}, 1))`;
86
+ };
87
+ } catch (error) {
88
+ console.log("error", error == null ? void 0 : error.message);
89
+ }
90
+ });
91
+ });
92
+ return resolved;
93
+ };
94
+ var corePlugin = (config = {}, defaultTheme, prefix) => {
95
+ const resolved = resolveConfig(config, defaultTheme, prefix);
96
+ return plugin(
97
+ ({ addBase, addUtilities, addVariant }) => {
98
+ addBase({
99
+ [":root, [data-theme]"]: {
100
+ ...baseStyles
101
+ }
102
+ });
103
+ addUtilities({ ...resolved.utilities, ...utilities });
104
+ resolved.variants.forEach((variant) => {
105
+ addVariant(variant.name, variant.definition);
106
+ });
107
+ },
108
+ {
109
+ theme: {
110
+ extend: {
111
+ colors: {
112
+ ...commonColors,
113
+ ...resolved.colors
114
+ },
115
+ fontSize: {
116
+ tiny: "0.625rem"
117
+ },
118
+ borderWidth: {
119
+ 1: "1px",
120
+ 1.5: "1.5px",
121
+ 3: "3px",
122
+ 5: "5px"
123
+ },
124
+ backgroundImage: {
125
+ "stripe-gradient": "linear-gradient(45deg, rgba(0, 0, 0, 0.1) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.1) 75%, transparent 75%, transparent)"
126
+ },
127
+ transitionDuration: {
128
+ 0: "0ms",
129
+ 250: "250ms",
130
+ 400: "400ms"
131
+ },
132
+ transitionTimingFunction: {
133
+ "soft-spring": "cubic-bezier(0.155, 1.105, 0.295, 1.12)"
134
+ },
135
+ ...animations
136
+ }
137
+ }
138
+ }
139
+ );
140
+ };
141
+ var nextui = (config = {}) => {
142
+ const themeObject = typeof config.themes === "function" ? config.themes({ dark, light }) : config.themes;
143
+ const userLightColors = get(themeObject, "light", {});
144
+ const userDarkColors = get(themeObject, "dark", {});
145
+ const defaultTheme = config.defaultTheme || "light";
146
+ const defaultPrefix = config.prefix || DEFAULT_PREFIX;
147
+ const otherThemes = omit(themeObject, ["light", "dark"]) || {};
148
+ return corePlugin(
149
+ {
150
+ light: deepMerge(semanticColors.light, userLightColors),
151
+ dark: deepMerge(semanticColors.dark, userDarkColors),
152
+ ...otherThemes
153
+ },
154
+ defaultTheme,
155
+ defaultPrefix
156
+ );
157
+ };
158
+
159
+ export {
160
+ nextui
161
+ };
@@ -0,0 +1,53 @@
1
+ // src/components/skeleton.ts
2
+ import { tv } from "tailwind-variants";
3
+ var skeleton = tv({
4
+ slots: {
5
+ base: [
6
+ "group",
7
+ "relative",
8
+ "space-y-5",
9
+ "overflow-hidden",
10
+ "bg-white/5",
11
+ "before:opacity-100",
12
+ "before:absolute",
13
+ "before:inset-0",
14
+ "before:-translate-x-full",
15
+ "before:animate-[shimmer_2s_infinite]",
16
+ "before:border-t",
17
+ "before:border-content4/70",
18
+ "before:bg-gradient-to-r",
19
+ "before:from-transparent",
20
+ "before:via-content4",
21
+ "dark:before:via-neutral-700/10",
22
+ "before:to-transparent",
23
+ "after:opacity-100",
24
+ "after:absolute",
25
+ "after:inset-0",
26
+ "after:-z-10",
27
+ "after:bg-content3",
28
+ "dark:after:bg-content2",
29
+ "data-[loaded=true]:before:opacity-0",
30
+ "data-[loaded=true]:after:opacity-0"
31
+ ],
32
+ content: ["opacity-0", "group-data-[loaded=true]:opacity-100"]
33
+ },
34
+ variants: {
35
+ disableAnimation: {
36
+ true: {
37
+ base: "before:transition-none",
38
+ content: "transition-none"
39
+ },
40
+ false: {
41
+ base: "before:transition-opacity before:!duration-300",
42
+ content: "transition-opacity motion-reduce:transition-none !duration-300"
43
+ }
44
+ }
45
+ },
46
+ defaultVariants: {
47
+ disableAnimation: false
48
+ }
49
+ });
50
+
51
+ export {
52
+ skeleton
53
+ };
@@ -21,7 +21,6 @@ var button = tv({
21
21
  "data-[pressed=true]:scale-95",
22
22
  "overflow-hidden",
23
23
  "gap-1.5",
24
- "[&>svg]:max-w-[2em]",
25
24
  "data-[focus-visible=true]:outline-none",
26
25
  "data-[focus-visible=true]:ring-2",
27
26
  "data-[focus-visible=true]:ring-primary",
@@ -32,12 +31,12 @@ var button = tv({
32
31
  variants: {
33
32
  variant: {
34
33
  solid: "",
35
- bordered: "border-2 !bg-transparent",
36
- light: "!bg-transparent",
34
+ bordered: "border-2 bg-transparent",
35
+ light: "bg-transparent",
37
36
  flat: "",
38
37
  faded: "border-2",
39
38
  shadow: "",
40
- ghost: "border-2 !bg-transparent"
39
+ ghost: "border-2 bg-transparent"
41
40
  },
42
41
  size: {
43
42
  xs: "px-2 h-6 text-xs",
@@ -47,12 +46,12 @@ var button = tv({
47
46
  xl: "px-8 h-14 text-lg"
48
47
  },
49
48
  color: {
50
- neutral: colorVariants.solid.neutral,
51
- primary: colorVariants.solid.primary,
52
- secondary: colorVariants.solid.secondary,
53
- success: colorVariants.solid.success,
54
- warning: colorVariants.solid.warning,
55
- danger: colorVariants.solid.danger
49
+ neutral: "",
50
+ primary: "",
51
+ secondary: "",
52
+ success: "",
53
+ warning: "",
54
+ danger: ""
56
55
  },
57
56
  radius: {
58
57
  none: "rounded-none",
@@ -75,7 +74,8 @@ var button = tv({
75
74
  true: "[&:not(:first-child):not(:last-child)]:rounded-none"
76
75
  },
77
76
  isIconOnly: {
78
- true: "p-0 gap-0"
77
+ true: "p-0 gap-0",
78
+ false: "[&>svg]:max-w-[2em]"
79
79
  },
80
80
  disableAnimation: {
81
81
  true: "!transition-none",
@@ -93,6 +93,36 @@ var button = tv({
93
93
  disableAnimation: false
94
94
  },
95
95
  compoundVariants: [
96
+ {
97
+ variant: "solid",
98
+ color: "neutral",
99
+ class: colorVariants.solid.neutral
100
+ },
101
+ {
102
+ variant: "solid",
103
+ color: "primary",
104
+ class: colorVariants.solid.primary
105
+ },
106
+ {
107
+ variant: "solid",
108
+ color: "secondary",
109
+ class: colorVariants.solid.secondary
110
+ },
111
+ {
112
+ variant: "solid",
113
+ color: "success",
114
+ class: colorVariants.solid.success
115
+ },
116
+ {
117
+ variant: "solid",
118
+ color: "warning",
119
+ class: colorVariants.solid.warning
120
+ },
121
+ {
122
+ variant: "solid",
123
+ color: "danger",
124
+ class: colorVariants.solid.danger
125
+ },
96
126
  {
97
127
  variant: "shadow",
98
128
  color: "neutral",
@@ -216,32 +246,32 @@ var button = tv({
216
246
  {
217
247
  variant: "light",
218
248
  color: "neutral",
219
- class: [colorVariants.light.neutral, "hover:!bg-neutral-100"]
249
+ class: [colorVariants.light.neutral, "data-[hover=true]:bg-neutral-100"]
220
250
  },
221
251
  {
222
252
  variant: "light",
223
253
  color: "primary",
224
- class: [colorVariants.light.primary, "hover:!bg-primary-50"]
254
+ class: [colorVariants.light.primary, "data-[hover=true]:bg-primary-50"]
225
255
  },
226
256
  {
227
257
  variant: "light",
228
258
  color: "secondary",
229
- class: [colorVariants.light.secondary, "hover:!bg-secondary-100"]
259
+ class: [colorVariants.light.secondary, "data-[hover=true]:bg-secondary-100"]
230
260
  },
231
261
  {
232
262
  variant: "light",
233
263
  color: "success",
234
- class: [colorVariants.light.success, "hover:!bg-success-50"]
264
+ class: [colorVariants.light.success, "data-[hover=true]:bg-success-50"]
235
265
  },
236
266
  {
237
267
  variant: "light",
238
268
  color: "warning",
239
- class: [colorVariants.light.warning, "hover:!bg-warning-50"]
269
+ class: [colorVariants.light.warning, "data-[hover=true]:bg-warning-50"]
240
270
  },
241
271
  {
242
272
  variant: "light",
243
273
  color: "danger",
244
- class: [colorVariants.light.danger, "hover:!bg-danger-50"]
274
+ class: [colorVariants.light.danger, "data-[hover=true]:bg-danger-50"]
245
275
  },
246
276
  {
247
277
  variant: "ghost",
@@ -60,7 +60,7 @@ var link = tv({
60
60
  {
61
61
  isBlock: true,
62
62
  color: "foreground",
63
- class: "hover:after:bg-foreground/20"
63
+ class: "hover:after:bg-foreground/10"
64
64
  },
65
65
  {
66
66
  isBlock: true,
@@ -101,7 +101,9 @@ var link = tv({
101
101
  disableAnimation: false
102
102
  }
103
103
  });
104
+ var linkAnchorClasses = "flex mx-1 text-current self-center";
104
105
 
105
106
  export {
106
- link
107
+ link,
108
+ linkAnchorClasses
107
109
  };
@@ -65,6 +65,7 @@ declare const button: tailwind_variants.TVReturnType<{
65
65
  };
66
66
  isIconOnly: {
67
67
  true: string;
68
+ false: string;
68
69
  };
69
70
  disableAnimation: {
70
71
  true: string;
@@ -117,6 +118,7 @@ declare const button: tailwind_variants.TVReturnType<{
117
118
  };
118
119
  isIconOnly: {
119
120
  true: string;
121
+ false: string;
120
122
  };
121
123
  disableAnimation: {
122
124
  true: string;
@@ -117,7 +117,6 @@ var button = (0, import_tailwind_variants.tv)({
117
117
  "data-[pressed=true]:scale-95",
118
118
  "overflow-hidden",
119
119
  "gap-1.5",
120
- "[&>svg]:max-w-[2em]",
121
120
  "data-[focus-visible=true]:outline-none",
122
121
  "data-[focus-visible=true]:ring-2",
123
122
  "data-[focus-visible=true]:ring-primary",
@@ -128,12 +127,12 @@ var button = (0, import_tailwind_variants.tv)({
128
127
  variants: {
129
128
  variant: {
130
129
  solid: "",
131
- bordered: "border-2 !bg-transparent",
132
- light: "!bg-transparent",
130
+ bordered: "border-2 bg-transparent",
131
+ light: "bg-transparent",
133
132
  flat: "",
134
133
  faded: "border-2",
135
134
  shadow: "",
136
- ghost: "border-2 !bg-transparent"
135
+ ghost: "border-2 bg-transparent"
137
136
  },
138
137
  size: {
139
138
  xs: "px-2 h-6 text-xs",
@@ -143,12 +142,12 @@ var button = (0, import_tailwind_variants.tv)({
143
142
  xl: "px-8 h-14 text-lg"
144
143
  },
145
144
  color: {
146
- neutral: colorVariants.solid.neutral,
147
- primary: colorVariants.solid.primary,
148
- secondary: colorVariants.solid.secondary,
149
- success: colorVariants.solid.success,
150
- warning: colorVariants.solid.warning,
151
- danger: colorVariants.solid.danger
145
+ neutral: "",
146
+ primary: "",
147
+ secondary: "",
148
+ success: "",
149
+ warning: "",
150
+ danger: ""
152
151
  },
153
152
  radius: {
154
153
  none: "rounded-none",
@@ -171,7 +170,8 @@ var button = (0, import_tailwind_variants.tv)({
171
170
  true: "[&:not(:first-child):not(:last-child)]:rounded-none"
172
171
  },
173
172
  isIconOnly: {
174
- true: "p-0 gap-0"
173
+ true: "p-0 gap-0",
174
+ false: "[&>svg]:max-w-[2em]"
175
175
  },
176
176
  disableAnimation: {
177
177
  true: "!transition-none",
@@ -189,6 +189,36 @@ var button = (0, import_tailwind_variants.tv)({
189
189
  disableAnimation: false
190
190
  },
191
191
  compoundVariants: [
192
+ {
193
+ variant: "solid",
194
+ color: "neutral",
195
+ class: colorVariants.solid.neutral
196
+ },
197
+ {
198
+ variant: "solid",
199
+ color: "primary",
200
+ class: colorVariants.solid.primary
201
+ },
202
+ {
203
+ variant: "solid",
204
+ color: "secondary",
205
+ class: colorVariants.solid.secondary
206
+ },
207
+ {
208
+ variant: "solid",
209
+ color: "success",
210
+ class: colorVariants.solid.success
211
+ },
212
+ {
213
+ variant: "solid",
214
+ color: "warning",
215
+ class: colorVariants.solid.warning
216
+ },
217
+ {
218
+ variant: "solid",
219
+ color: "danger",
220
+ class: colorVariants.solid.danger
221
+ },
192
222
  {
193
223
  variant: "shadow",
194
224
  color: "neutral",
@@ -312,32 +342,32 @@ var button = (0, import_tailwind_variants.tv)({
312
342
  {
313
343
  variant: "light",
314
344
  color: "neutral",
315
- class: [colorVariants.light.neutral, "hover:!bg-neutral-100"]
345
+ class: [colorVariants.light.neutral, "data-[hover=true]:bg-neutral-100"]
316
346
  },
317
347
  {
318
348
  variant: "light",
319
349
  color: "primary",
320
- class: [colorVariants.light.primary, "hover:!bg-primary-50"]
350
+ class: [colorVariants.light.primary, "data-[hover=true]:bg-primary-50"]
321
351
  },
322
352
  {
323
353
  variant: "light",
324
354
  color: "secondary",
325
- class: [colorVariants.light.secondary, "hover:!bg-secondary-100"]
355
+ class: [colorVariants.light.secondary, "data-[hover=true]:bg-secondary-100"]
326
356
  },
327
357
  {
328
358
  variant: "light",
329
359
  color: "success",
330
- class: [colorVariants.light.success, "hover:!bg-success-50"]
360
+ class: [colorVariants.light.success, "data-[hover=true]:bg-success-50"]
331
361
  },
332
362
  {
333
363
  variant: "light",
334
364
  color: "warning",
335
- class: [colorVariants.light.warning, "hover:!bg-warning-50"]
365
+ class: [colorVariants.light.warning, "data-[hover=true]:bg-warning-50"]
336
366
  },
337
367
  {
338
368
  variant: "light",
339
369
  color: "danger",
340
- class: [colorVariants.light.danger, "hover:!bg-danger-50"]
370
+ class: [colorVariants.light.danger, "data-[hover=true]:bg-danger-50"]
341
371
  },
342
372
  {
343
373
  variant: "ghost",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  button
3
- } from "../chunk-UM54LZPC.mjs";
3
+ } from "../chunk-YMKJFSPB.mjs";
4
4
  import "../chunk-CMYR6AOY.mjs";
5
5
  import "../chunk-K7LK7NCE.mjs";
6
6
  import "../chunk-RO3WUCFF.mjs";
@@ -1,7 +1,7 @@
1
1
  export { AvatarSlots, AvatarVariantProps, avatar } from './avatar.js';
2
2
  export { AvatarGroupVariantProps, avatarGroup } from './avatar-group.js';
3
3
  export { CardReturnType, CardSlots, CardVariantProps, card } from './card.js';
4
- export { LinkVariantProps, link } from './link.js';
4
+ export { LinkVariantProps, link, linkAnchorClasses } from './link.js';
5
5
  export { UserSlots, user } from './user.js';
6
6
  export { ButtonVariantProps, button } from './button.js';
7
7
  export { ButtonGroupVariantProps, buttonGroup } from './button-group.js';
@@ -35,5 +35,6 @@ export { SpacerVariantProps, spacer } from './spacer.js';
35
35
  export { DividerVariantProps, divider } from './divider.js';
36
36
  export { KbdSlots, KbdVariantProps, kbd } from './kbd.js';
37
37
  export { TabsReturnType, TabsSlots, TabsVariantProps, tabs } from './tabs.js';
38
+ export { SkeletonSlots, SkeletonVariantProps, skeleton } from './skeleton.js';
38
39
  import 'tailwind-variants';
39
40
  import 'tailwind-variants/dist/config';