@una-ui/preset 0.23.0-beta.1 → 0.25.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.
package/dist/prefixes.cjs CHANGED
@@ -81,6 +81,8 @@ const prefixes = [
81
81
  "slider",
82
82
  "square",
83
83
  "switch",
84
+ "switch-checked",
85
+ "switch-unchecked",
84
86
  "table",
85
87
  "table-body",
86
88
  "table-caption",
package/dist/prefixes.mjs CHANGED
@@ -79,6 +79,8 @@ const prefixes = [
79
79
  "slider",
80
80
  "square",
81
81
  "switch",
82
+ "switch-checked",
83
+ "switch-unchecked",
82
84
  "table",
83
85
  "table-body",
84
86
  "table-caption",
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const utils = require('@unocss/preset-mini/utils');
4
+ const presetMini = require('@unocss/preset-mini');
4
5
 
5
6
  const staticAccordion = {
6
7
  // config
@@ -135,11 +136,11 @@ const staticBreadcrumb = {
135
136
  "breadcrumb-elipsis-icon": "i-radix-icons-dots-horizontal",
136
137
  // components
137
138
  "breadcrumb-root": "",
138
- "breadcrumb-list": "flex flex-wrap items-center break-words text-muted gap-0.5",
139
- "breadcrumb-link": "transition-colors font-normal btn-square",
140
- "breadcrumb-item": "inline-flex items-center",
139
+ "breadcrumb-list": "flex flex-wrap items-center break-words text-muted",
140
+ "breadcrumb-link": "transition-colors font-normal",
141
+ "breadcrumb-item": "inline-flex items-center gap-1.5",
141
142
  // TODO
142
- "breadcrumb-ellipsis": "flex h-9 w-9 items-center justify-center"
143
+ "breadcrumb-ellipsis": "flex items-center justify-center"
143
144
  };
144
145
  const dynamicBreadcrumb = [
145
146
  // states
@@ -163,7 +164,7 @@ const staticBtn = {
163
164
  "btn-loading-icon": "i-loading",
164
165
  "btn-default-radius": "rounded-md",
165
166
  // base
166
- "btn": "btn-rectangle px-0.7142857142857143em py-0.42857142857142855em bg-transparent transition-colors text-0.875em leading-5 gap-x-0.42857142857142855em rounded-md whitespace-nowrap inline-flex justify-center items-center btn-disabled font-medium cursor-pointer",
167
+ "btn": "btn-rectangle px-1em py-0.5em bg-transparent transition-colors text-0.875em leading-5 gap-x-0.5em rounded-md whitespace-nowrap inline-flex justify-center items-center btn-disabled font-medium cursor-pointer",
167
168
  "btn-disabled": "disabled:n-disabled",
168
169
  "btn-label": "",
169
170
  "btn-icon-label": "text-1.191em",
@@ -331,7 +332,7 @@ const staticGeneral = {
331
332
  "text-inverted": "text-$c-background",
332
333
  "text-muted": "text-$c-muted-foreground",
333
334
  "text-accent": "text-$c-accent-foreground",
334
- "text-accent-forground": "text-$c-accent",
335
+ "text-accent-foreground": "text-$c-accent",
335
336
  "text-popover": "text-$c-popover-foreground",
336
337
  "text-popover-foreground": "text-$c-popover",
337
338
  "text-info": "text-info-500 dark:text-info-400",
@@ -366,7 +367,9 @@ const staticGeneral = {
366
367
  "i-dot": "i-tabler-circle-filled",
367
368
  "i-check": "i-lucide-check",
368
369
  // transition
369
- "transition-base": "transition-all duration-100 ease-out"
370
+ "transition-base": "transition-all duration-100 ease-out",
371
+ // overrides
372
+ "square-false": ""
370
373
  };
371
374
  const dynamicGeneral = [
372
375
  // TODO: una-text-<color><-number><-number>
@@ -429,7 +432,7 @@ const staticInput = {
429
432
  "input-leading-padding": "pl-2.9em",
430
433
  "input-trailing-padding": "pr-2.9em",
431
434
  // base
432
- "input": "text-0.875em leading-6 px-0.8571428571428571em py-0.42857142857142855em w-full input-disabled ring-base ring-inset placeholder:text-$c-gray-400 block outline-none rounded-md border-0 shadow-sm bg-transparent",
435
+ "input": "text-0.875em leading-6 px-0.8571428571428571em py-0.5em w-full input-disabled ring-base ring-inset placeholder:text-$c-gray-400 block outline-none rounded-md border-0 shadow-sm bg-transparent",
433
436
  "input-disabled": "disabled:(n-disabled)",
434
437
  "input-status-ring": "ring-opacity-50 dark:ring-opacity-40",
435
438
  "input-status-icon-base": "text-1.042em",
@@ -753,37 +756,38 @@ const slider = [
753
756
 
754
757
  const staticSwitch = {
755
758
  // base
756
- "switch": "switch-primary bg-transparent relative inline-flex items-center justify-center flex-shrink-0 cursor-pointer rounded-full",
757
- "switch-disabled": "n-disabled",
758
- "switch-focus": "focus:outline-none focus:ring-2 focus:ring-offset-2 ring-offset-base focus:ring-brand",
759
- // inset
760
- "switch-inset": "h-1.5em w-2.75em",
761
- "switch-track-inset": "h-1.5em w-2.75em",
762
- // outset
763
- "switch-outset": "h-1.25em w-2.5em",
764
- "switch-track-outset": "h-1em w-2.25em",
759
+ "switch": "bg-brand switch-focus h-1.25em w-2.25em switch-disabled inline-flex shrink-0 cursor-pointer items-center border-2 border-transparent rounded-full shadow-sm",
760
+ "switch-disabled": "data-[disabled]:n-disabled",
761
+ "switch-focus": "focus-visible:ring-brand focus-visible:ring-offset-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
765
762
  // thumb
766
- "switch-thumb": "flex items-center justify-center h-1.25em w-1.25em absolute bg-base pointer-events-none inline-block transform rounded-full shadow transition-base",
767
- "switch-thumb-on": "translate-x-1.25em",
768
- "switch-thumb-off": "translate-x-0",
769
- // track
770
- "switch-track": "pointer-events-none absolute mx-auto rounded-full transition-base",
771
- "switch-track-on": "bg-brand",
772
- "switch-track-off": "bg-$c-gray-200",
763
+ "switch-thumb": "square-1em flex items-center justify-center absolute pointer-events-none block border border-base rounded-full bg-base shadow-lg ring-0 transition-transform",
764
+ "switch-thumb-checked": "translate-x-1.01em",
765
+ "switch-thumb-unchecked": "translate-x-0.03em",
773
766
  // icon
774
- "switch-icon-base": "text-0.8em",
775
- "switch-icon-off": "text-muted",
776
- "switch-icon-on": "text-muted",
767
+ "switch-icon": "text-0.7em",
768
+ "switch-icon-unchecked": "text-muted",
769
+ "switch-icon-checked": "text-muted",
777
770
  // loading
778
- "switch-loading-icon": "i-loading",
779
- "switch-loading": "text-gray animate-spin text-0.8em"
771
+ "switch-loading-icon": "text-gray animate-spin text-0.8em",
772
+ "switch-loading-icon-name": "i-loading"
780
773
  };
781
774
  const dynamicSwitch = [
782
- [/^switch-(.*)$/, ([, body], { theme }) => {
783
- const color = utils.parseColor(body, theme);
784
- if ((color?.cssColor?.type === "rgb" || color?.cssColor?.type === "rgba") && color.cssColor.components)
785
- return `n-${body}-600 dark:n-${body}-500`;
786
- }]
775
+ [
776
+ /^switch-checked(?:-([^-]+))?(?:-([^-]+))?$/,
777
+ ([, color = "primary"], { theme }) => {
778
+ const parsedColor = presetMini.parseColor(color, theme);
779
+ if ((parsedColor?.cssColor?.type === "rgb" || parsedColor?.cssColor?.type === "rgba") && parsedColor.cssColor.components)
780
+ return `data-[state=checked]:n-${color}-600 dark:data-[state=checked]:n-${color}-500`;
781
+ }
782
+ ],
783
+ [
784
+ /^switch-unchecked(?:-([^-]+))?(?:-([^-]+))?$/,
785
+ ([, color = "primary"], { theme }) => {
786
+ const parsedColor = presetMini.parseColor(color, theme);
787
+ if ((parsedColor?.cssColor?.type === "rgb" || parsedColor?.cssColor?.type === "rgba") && parsedColor.cssColor.components)
788
+ return `data-[state=unchecked]:n-${color}-200 dark:data-[state=unchecked]:n-${color}-700/58`;
789
+ }
790
+ ]
787
791
  ];
788
792
  const _switch = [
789
793
  ...dynamicSwitch,
@@ -856,7 +860,11 @@ const staticTooltip = {
856
860
  "tooltip-black": "border border-foreground bg-popover-foreground text-popover-foreground"
857
861
  };
858
862
  const dynamicTooltip = [
859
- [/^tooltip(?:-(\S+))?$/, ([, c = "gray"]) => `bg-${c}-100 border-${c}-50 text-${c}-800 dark:bg-${c}-800 dark:border-${c}-800 dark:text-${c}-100`]
863
+ [/^tooltip-(.*)$/, ([, c], { theme }) => {
864
+ const color = utils.parseColor(c, theme);
865
+ if ((color?.cssColor?.type === "rgb" || color?.cssColor?.type === "rgba") && color.cssColor.components)
866
+ return `bg-${c}-100 border-${c}-50 text-${c}-800 dark:bg-${c}-800 dark:border-${c}-800 dark:text-${c}-100`;
867
+ }]
860
868
  ];
861
869
  const tooltip = [
862
870
  ...dynamicTooltip,
@@ -1,4 +1,5 @@
1
1
  import { parseColor } from '@unocss/preset-mini/utils';
2
+ import { parseColor as parseColor$1 } from '@unocss/preset-mini';
2
3
 
3
4
  const staticAccordion = {
4
5
  // config
@@ -133,11 +134,11 @@ const staticBreadcrumb = {
133
134
  "breadcrumb-elipsis-icon": "i-radix-icons-dots-horizontal",
134
135
  // components
135
136
  "breadcrumb-root": "",
136
- "breadcrumb-list": "flex flex-wrap items-center break-words text-muted gap-0.5",
137
- "breadcrumb-link": "transition-colors font-normal btn-square",
138
- "breadcrumb-item": "inline-flex items-center",
137
+ "breadcrumb-list": "flex flex-wrap items-center break-words text-muted",
138
+ "breadcrumb-link": "transition-colors font-normal",
139
+ "breadcrumb-item": "inline-flex items-center gap-1.5",
139
140
  // TODO
140
- "breadcrumb-ellipsis": "flex h-9 w-9 items-center justify-center"
141
+ "breadcrumb-ellipsis": "flex items-center justify-center"
141
142
  };
142
143
  const dynamicBreadcrumb = [
143
144
  // states
@@ -161,7 +162,7 @@ const staticBtn = {
161
162
  "btn-loading-icon": "i-loading",
162
163
  "btn-default-radius": "rounded-md",
163
164
  // base
164
- "btn": "btn-rectangle px-0.7142857142857143em py-0.42857142857142855em bg-transparent transition-colors text-0.875em leading-5 gap-x-0.42857142857142855em rounded-md whitespace-nowrap inline-flex justify-center items-center btn-disabled font-medium cursor-pointer",
165
+ "btn": "btn-rectangle px-1em py-0.5em bg-transparent transition-colors text-0.875em leading-5 gap-x-0.5em rounded-md whitespace-nowrap inline-flex justify-center items-center btn-disabled font-medium cursor-pointer",
165
166
  "btn-disabled": "disabled:n-disabled",
166
167
  "btn-label": "",
167
168
  "btn-icon-label": "text-1.191em",
@@ -329,7 +330,7 @@ const staticGeneral = {
329
330
  "text-inverted": "text-$c-background",
330
331
  "text-muted": "text-$c-muted-foreground",
331
332
  "text-accent": "text-$c-accent-foreground",
332
- "text-accent-forground": "text-$c-accent",
333
+ "text-accent-foreground": "text-$c-accent",
333
334
  "text-popover": "text-$c-popover-foreground",
334
335
  "text-popover-foreground": "text-$c-popover",
335
336
  "text-info": "text-info-500 dark:text-info-400",
@@ -364,7 +365,9 @@ const staticGeneral = {
364
365
  "i-dot": "i-tabler-circle-filled",
365
366
  "i-check": "i-lucide-check",
366
367
  // transition
367
- "transition-base": "transition-all duration-100 ease-out"
368
+ "transition-base": "transition-all duration-100 ease-out",
369
+ // overrides
370
+ "square-false": ""
368
371
  };
369
372
  const dynamicGeneral = [
370
373
  // TODO: una-text-<color><-number><-number>
@@ -427,7 +430,7 @@ const staticInput = {
427
430
  "input-leading-padding": "pl-2.9em",
428
431
  "input-trailing-padding": "pr-2.9em",
429
432
  // base
430
- "input": "text-0.875em leading-6 px-0.8571428571428571em py-0.42857142857142855em w-full input-disabled ring-base ring-inset placeholder:text-$c-gray-400 block outline-none rounded-md border-0 shadow-sm bg-transparent",
433
+ "input": "text-0.875em leading-6 px-0.8571428571428571em py-0.5em w-full input-disabled ring-base ring-inset placeholder:text-$c-gray-400 block outline-none rounded-md border-0 shadow-sm bg-transparent",
431
434
  "input-disabled": "disabled:(n-disabled)",
432
435
  "input-status-ring": "ring-opacity-50 dark:ring-opacity-40",
433
436
  "input-status-icon-base": "text-1.042em",
@@ -751,37 +754,38 @@ const slider = [
751
754
 
752
755
  const staticSwitch = {
753
756
  // base
754
- "switch": "switch-primary bg-transparent relative inline-flex items-center justify-center flex-shrink-0 cursor-pointer rounded-full",
755
- "switch-disabled": "n-disabled",
756
- "switch-focus": "focus:outline-none focus:ring-2 focus:ring-offset-2 ring-offset-base focus:ring-brand",
757
- // inset
758
- "switch-inset": "h-1.5em w-2.75em",
759
- "switch-track-inset": "h-1.5em w-2.75em",
760
- // outset
761
- "switch-outset": "h-1.25em w-2.5em",
762
- "switch-track-outset": "h-1em w-2.25em",
757
+ "switch": "bg-brand switch-focus h-1.25em w-2.25em switch-disabled inline-flex shrink-0 cursor-pointer items-center border-2 border-transparent rounded-full shadow-sm",
758
+ "switch-disabled": "data-[disabled]:n-disabled",
759
+ "switch-focus": "focus-visible:ring-brand focus-visible:ring-offset-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
763
760
  // thumb
764
- "switch-thumb": "flex items-center justify-center h-1.25em w-1.25em absolute bg-base pointer-events-none inline-block transform rounded-full shadow transition-base",
765
- "switch-thumb-on": "translate-x-1.25em",
766
- "switch-thumb-off": "translate-x-0",
767
- // track
768
- "switch-track": "pointer-events-none absolute mx-auto rounded-full transition-base",
769
- "switch-track-on": "bg-brand",
770
- "switch-track-off": "bg-$c-gray-200",
761
+ "switch-thumb": "square-1em flex items-center justify-center absolute pointer-events-none block border border-base rounded-full bg-base shadow-lg ring-0 transition-transform",
762
+ "switch-thumb-checked": "translate-x-1.01em",
763
+ "switch-thumb-unchecked": "translate-x-0.03em",
771
764
  // icon
772
- "switch-icon-base": "text-0.8em",
773
- "switch-icon-off": "text-muted",
774
- "switch-icon-on": "text-muted",
765
+ "switch-icon": "text-0.7em",
766
+ "switch-icon-unchecked": "text-muted",
767
+ "switch-icon-checked": "text-muted",
775
768
  // loading
776
- "switch-loading-icon": "i-loading",
777
- "switch-loading": "text-gray animate-spin text-0.8em"
769
+ "switch-loading-icon": "text-gray animate-spin text-0.8em",
770
+ "switch-loading-icon-name": "i-loading"
778
771
  };
779
772
  const dynamicSwitch = [
780
- [/^switch-(.*)$/, ([, body], { theme }) => {
781
- const color = parseColor(body, theme);
782
- if ((color?.cssColor?.type === "rgb" || color?.cssColor?.type === "rgba") && color.cssColor.components)
783
- return `n-${body}-600 dark:n-${body}-500`;
784
- }]
773
+ [
774
+ /^switch-checked(?:-([^-]+))?(?:-([^-]+))?$/,
775
+ ([, color = "primary"], { theme }) => {
776
+ const parsedColor = parseColor$1(color, theme);
777
+ if ((parsedColor?.cssColor?.type === "rgb" || parsedColor?.cssColor?.type === "rgba") && parsedColor.cssColor.components)
778
+ return `data-[state=checked]:n-${color}-600 dark:data-[state=checked]:n-${color}-500`;
779
+ }
780
+ ],
781
+ [
782
+ /^switch-unchecked(?:-([^-]+))?(?:-([^-]+))?$/,
783
+ ([, color = "primary"], { theme }) => {
784
+ const parsedColor = parseColor$1(color, theme);
785
+ if ((parsedColor?.cssColor?.type === "rgb" || parsedColor?.cssColor?.type === "rgba") && parsedColor.cssColor.components)
786
+ return `data-[state=unchecked]:n-${color}-200 dark:data-[state=unchecked]:n-${color}-700/58`;
787
+ }
788
+ ]
785
789
  ];
786
790
  const _switch = [
787
791
  ...dynamicSwitch,
@@ -854,7 +858,11 @@ const staticTooltip = {
854
858
  "tooltip-black": "border border-foreground bg-popover-foreground text-popover-foreground"
855
859
  };
856
860
  const dynamicTooltip = [
857
- [/^tooltip(?:-(\S+))?$/, ([, c = "gray"]) => `bg-${c}-100 border-${c}-50 text-${c}-800 dark:bg-${c}-800 dark:border-${c}-800 dark:text-${c}-100`]
861
+ [/^tooltip-(.*)$/, ([, c], { theme }) => {
862
+ const color = parseColor(c, theme);
863
+ if ((color?.cssColor?.type === "rgb" || color?.cssColor?.type === "rgba") && color.cssColor.components)
864
+ return `bg-${c}-100 border-${c}-50 text-${c}-800 dark:bg-${c}-800 dark:border-${c}-800 dark:text-${c}-100`;
865
+ }]
858
866
  ];
859
867
  const tooltip = [
860
868
  ...dynamicTooltip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@una-ui/preset",
3
- "version": "0.23.0-beta.1",
3
+ "version": "0.25.0-beta.1",
4
4
  "description": "The default preset for @una-ui",
5
5
  "author": "Phojie Rengel <phojrengel@gmail.com>",
6
6
  "license": "MIT",
@@ -49,9 +49,9 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@unocss/core": "^0.62.4",
53
- "@unocss/preset-mini": "^0.62.4",
54
- "unocss": "^0.62.4"
52
+ "@unocss/core": "^0.63.1",
53
+ "@unocss/preset-mini": "^0.63.1",
54
+ "unocss": "^0.63.1"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "unbuild",