@photoroom/ui 0.1.85 → 0.1.86

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photoroom/ui",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "private": false,
5
5
  "description": "Photoroom design system components",
6
6
  "sideEffects": [
@@ -1,8 +1,22 @@
1
1
  /* oxlint-disable typescript/no-require-imports */
2
- const { default: flattenColorPalette } = require("tailwindcss/lib/util/flattenColorPalette");
3
- const { default: toColorValue } = require("tailwindcss/lib/util/toColorValue");
4
2
  const plugin = require("tailwindcss/plugin");
5
3
 
4
+ // Inlined from tailwindcss v3 internals (removed in v4).
5
+ const flattenColorPalette = (colors) =>
6
+ Object.assign(
7
+ {},
8
+ ...Object.entries(colors ?? {}).flatMap(([color, values]) =>
9
+ typeof values === "object"
10
+ ? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
11
+ [color + (number === "DEFAULT" ? "" : `-${number}`)]: hex,
12
+ }))
13
+ : [{ [color]: values }]
14
+ )
15
+ );
16
+
17
+ const toColorValue = (maybeFn, opts = {}) =>
18
+ typeof maybeFn === "function" ? maybeFn(opts) : maybeFn;
19
+
6
20
  module.exports = plugin(({ theme, addUtilities, matchUtilities }) => {
7
21
  matchUtilities(
8
22
  {
package/plugins/colors.js CHANGED
@@ -396,31 +396,27 @@ module.exports = plugin(({ addBase, addUtilities }) => {
396
396
  });
397
397
 
398
398
  // Background (gradient)
399
+ const proGradient = (from, to) =>
400
+ `linear-gradient(to right, var(--color-${from}), var(--color-${to}))`;
399
401
  addUtilities({
400
402
  ".bg-background-pro": {
401
- "@apply from-accent-500": {},
402
- "@apply to-magic-accent-500": {},
403
+ "background-image": proGradient("accent-500", "magic-accent-500"),
403
404
  },
404
405
  ".bg-background-pro-hover": {
405
- "@apply from-accent-400": {},
406
- "@apply to-magic-accent-400": {},
406
+ "background-image": proGradient("accent-400", "magic-accent-400"),
407
407
  },
408
408
  ".bg-background-pro-down": {
409
- "@apply from-accent-600": {},
410
- "@apply to-magic-accent-600": {},
409
+ "background-image": proGradient("accent-600", "magic-accent-600"),
411
410
  },
412
411
  ".theme-dark": {
413
412
  ".bg-background-pro": {
414
- "@apply from-accent-500": {},
415
- "@apply to-magic-accent-500": {},
413
+ "background-image": proGradient("accent-500", "magic-accent-500"),
416
414
  },
417
415
  ".bg-background-pro-hover": {
418
- "@apply from-accent-600": {},
419
- "@apply to-magic-accent-600": {},
416
+ "background-image": proGradient("accent-600", "magic-accent-600"),
420
417
  },
421
418
  ".bg-background-pro-down": {
422
- "@apply from-accent-400": {},
423
- "@apply to-magic-accent-400": {},
419
+ "background-image": proGradient("accent-400", "magic-accent-400"),
424
420
  },
425
421
  },
426
422
  });
@@ -428,13 +424,11 @@ module.exports = plugin(({ addBase, addUtilities }) => {
428
424
  // Content (gradient)
429
425
  addUtilities({
430
426
  ".bg-content-pro": {
431
- "@apply from-accent-500": {},
432
- "@apply to-magic-accent-500": {},
427
+ "background-image": proGradient("accent-500", "magic-accent-500"),
433
428
  },
434
429
  ".theme-dark": {
435
430
  ".bg-content-pro": {
436
- "@apply from-accent-500": {},
437
- "@apply to-magic-accent-500": {},
431
+ "background-image": proGradient("accent-500", "magic-accent-500"),
438
432
  },
439
433
  },
440
434
  });
package/plugins/forms.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // oxlint-disable-next-line typescript/no-require-imports
2
2
  const plugin = require("tailwindcss/plugin");
3
3
 
4
- module.exports = plugin(({ addComponents }) => {
5
- addComponents({
4
+ module.exports = plugin(({ addBase }) => {
5
+ addBase({
6
6
  // this removes the up / down arrows in the number inputs
7
7
  'input[type="number"]': {
8
8
  "-moz-appearance": "textfield",
package/plugins/misc.js CHANGED
@@ -72,20 +72,30 @@ module.exports = plugin(({ addComponents, addUtilities }) => {
72
72
  },
73
73
  });
74
74
 
75
- // Color picker utilities (overrides for react-colorful)
75
+ // Color picker utilities (overrides for react-colorful).
76
+ // !important is needed because react-colorful injects unlayered <style>,
77
+ // which beats anything inside @layer utilities regardless of specificity.
76
78
  addUtilities({
77
79
  ".misc-color-picker": {
78
80
  ".react-colorful": {
79
- "@apply flex w-full flex-col gap-3": {},
81
+ display: "flex !important",
82
+ width: "100% !important",
83
+ flexDirection: "column !important",
84
+ gap: "0.75rem !important",
80
85
  },
81
86
  ".react-colorful__saturation": {
82
- "@apply h-40 w-full rounded-400 border-0": {},
87
+ height: "10rem !important",
88
+ width: "100% !important",
89
+ borderRadius: "8px !important",
90
+ border: "0 !important",
83
91
  },
84
92
  ".react-colorful__hue": {
85
- "@apply h-4 rounded-full": {},
93
+ height: "1rem !important",
94
+ borderRadius: "9999px !important",
86
95
  },
87
96
  ".react-colorful__pointer": {
88
- "@apply h-4 w-4": {},
97
+ height: "1rem !important",
98
+ width: "1rem !important",
89
99
  },
90
100
  },
91
101
  });
@@ -93,7 +103,10 @@ module.exports = plugin(({ addComponents, addUtilities }) => {
93
103
  // Magic gradient on HeroBlock
94
104
  addUtilities({
95
105
  ".text-hero-magic": {
96
- [`@apply bg-gradient-to-br from-[#410CD9] to-[#F68EFE] bg-clip-text text-transparent`]: {},
106
+ "background-image": "linear-gradient(to bottom right, #410CD9, #F68EFE)",
107
+ "background-clip": "text",
108
+ "-webkit-background-clip": "text",
109
+ color: "transparent",
97
110
  },
98
111
  });
99
112
  });
@@ -0,0 +1,9 @@
1
+ // oxlint-disable-next-line typescript/no-require-imports
2
+ const plugin = require("tailwindcss/plugin");
3
+
4
+ // Custom variants that aren't expressible as plain breakpoint values in v4.
5
+ // `tall` is a min-height media query; `mobile` is a max-width media query.
6
+ module.exports = plugin(({ addVariant }) => {
7
+ addVariant("tall", "@media (min-height: 780px)");
8
+ addVariant("mobile", "@media (max-width: 600px)");
9
+ });
@@ -1,37 +1,6 @@
1
1
  // oxlint-disable typescript/no-require-imports
2
2
  const defaultTheme = require("tailwindcss/defaultTheme");
3
3
 
4
- /**
5
- * Returns a hex color from a tailwind color name
6
- * @param {string} color - The desired color – could be a variable (e.g. --my-custom-color) or an hex value (e.g #BADA55)
7
- * @returns {string} - The formatted string for tailwind
8
- */
9
- function withOpacityValue(color) {
10
- const isVariable = color.startsWith("--");
11
-
12
- const rgb = hexToRgb(color);
13
-
14
- const value = isVariable ? `var(${color})` : `${rgb.r} ${rgb.g} ${rgb.b}`;
15
-
16
- return ({ opacityValue }) => {
17
- if (opacityValue === undefined) {
18
- return `rgb(${value})`;
19
- }
20
- return `rgb(${value} / ${opacityValue})`;
21
- };
22
- }
23
-
24
- function hexToRgb(hex) {
25
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
26
- return result
27
- ? {
28
- r: parseInt(result[1], 16),
29
- g: parseInt(result[2], 16),
30
- b: parseInt(result[3], 16),
31
- }
32
- : null;
33
- }
34
-
35
4
  module.exports = {
36
5
  darkMode: ["class", ".theme-dark"], // https://tailwindcss.com/docs/dark-mode#basic-usage
37
6
  content: [
@@ -65,9 +34,8 @@ module.exports = {
65
34
  },
66
35
  extend: {
67
36
  screens: {
68
- tall: { raw: "(min-height: 780px)" },
69
- "2xl": { raw: "(min-width: 1512px)" },
70
- "3xl": { raw: "(min-width: 1800px)" },
37
+ "2xl": "1512px",
38
+ "3xl": "1800px",
71
39
  },
72
40
  // Aspect Ratio: https://tailwindcss.com/docs/aspect-ratio#customizing-your-theme
73
41
  aspectRatio: {
@@ -294,23 +262,23 @@ module.exports = {
294
262
  /**
295
263
  * Do not use the tokens below (deprecated) !!
296
264
  */
297
- yellow: withOpacityValue("#FFC710"),
298
- green: withOpacityValue("#23D114"),
299
- blue: withOpacityValue("#339CFF"),
300
- pink: withOpacityValue("#FF47E0"),
265
+ yellow: "#FFC710",
266
+ green: "#23D114",
267
+ blue: "#339CFF",
268
+ pink: "#FF47E0",
301
269
  pastel: {
302
- pink: withOpacityValue("#F68EFE"),
303
- coral: withOpacityValue("#FFAAAA"),
304
- yellow: withOpacityValue("#FFEC8D"),
305
- "cyan-1": withOpacityValue("#22CBE8"),
306
- "cyan-2": withOpacityValue("#B5F6FB"),
270
+ pink: "#F68EFE",
271
+ coral: "#FFAAAA",
272
+ yellow: "#FFEC8D",
273
+ "cyan-1": "#22CBE8",
274
+ "cyan-2": "#B5F6FB",
307
275
  },
308
276
  facebook: {
309
- DEFAULT: withOpacityValue("#1877F2"),
310
- dark: withOpacityValue("#0B63D4"),
311
- light: withOpacityValue("#2C83F2"),
312
- 800: withOpacityValue("#5071FC"),
313
- 900: withOpacityValue("#4866e3"),
277
+ DEFAULT: "#1877F2",
278
+ dark: "#0B63D4",
279
+ light: "#2C83F2",
280
+ 800: "#5071FC",
281
+ 900: "#4866e3",
314
282
  },
315
283
  },
316
284
  boxShadow: {
@@ -505,6 +473,7 @@ module.exports = {
505
473
  require("tailwindcss-radix"),
506
474
  // Custom plugins
507
475
  require("./src/plugins/forms"),
476
+ require("./src/plugins/variants"),
508
477
  require("./src/plugins/typography"),
509
478
  require("./src/plugins/backgrounds"),
510
479
  require("./src/plugins/colors"),