@una-ui/preset 0.24.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
@@ -755,37 +756,38 @@ const slider = [
755
756
 
756
757
  const staticSwitch = {
757
758
  // base
758
- "switch": "switch-primary bg-transparent relative inline-flex items-center justify-center flex-shrink-0 cursor-pointer rounded-full",
759
- "switch-disabled": "n-disabled",
760
- "switch-focus": "focus:outline-none focus:ring-2 focus:ring-offset-2 ring-offset-base focus:ring-brand",
761
- // inset
762
- "switch-inset": "h-1.5em w-2.75em",
763
- "switch-track-inset": "h-1.5em w-2.75em",
764
- // outset
765
- "switch-outset": "h-1.25em w-2.5em",
766
- "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",
767
762
  // thumb
768
- "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",
769
- "switch-thumb-on": "translate-x-1.25em",
770
- "switch-thumb-off": "translate-x-0",
771
- // track
772
- "switch-track": "pointer-events-none absolute mx-auto rounded-full transition-base",
773
- "switch-track-on": "bg-brand",
774
- "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",
775
766
  // icon
776
- "switch-icon-base": "text-0.8em",
777
- "switch-icon-off": "text-muted",
778
- "switch-icon-on": "text-muted",
767
+ "switch-icon": "text-0.7em",
768
+ "switch-icon-unchecked": "text-muted",
769
+ "switch-icon-checked": "text-muted",
779
770
  // loading
780
- "switch-loading-icon": "i-loading",
781
- "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"
782
773
  };
783
774
  const dynamicSwitch = [
784
- [/^switch-(.*)$/, ([, body], { theme }) => {
785
- const color = utils.parseColor(body, theme);
786
- if ((color?.cssColor?.type === "rgb" || color?.cssColor?.type === "rgba") && color.cssColor.components)
787
- return `n-${body}-600 dark:n-${body}-500`;
788
- }]
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
+ ]
789
791
  ];
790
792
  const _switch = [
791
793
  ...dynamicSwitch,
@@ -858,7 +860,11 @@ const staticTooltip = {
858
860
  "tooltip-black": "border border-foreground bg-popover-foreground text-popover-foreground"
859
861
  };
860
862
  const dynamicTooltip = [
861
- [/^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
+ }]
862
868
  ];
863
869
  const tooltip = [
864
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
@@ -753,37 +754,38 @@ const slider = [
753
754
 
754
755
  const staticSwitch = {
755
756
  // 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",
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",
765
760
  // 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",
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",
773
764
  // icon
774
- "switch-icon-base": "text-0.8em",
775
- "switch-icon-off": "text-muted",
776
- "switch-icon-on": "text-muted",
765
+ "switch-icon": "text-0.7em",
766
+ "switch-icon-unchecked": "text-muted",
767
+ "switch-icon-checked": "text-muted",
777
768
  // loading
778
- "switch-loading-icon": "i-loading",
779
- "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"
780
771
  };
781
772
  const dynamicSwitch = [
782
- [/^switch-(.*)$/, ([, body], { theme }) => {
783
- const color = 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
- }]
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
+ ]
787
789
  ];
788
790
  const _switch = [
789
791
  ...dynamicSwitch,
@@ -856,7 +858,11 @@ const staticTooltip = {
856
858
  "tooltip-black": "border border-foreground bg-popover-foreground text-popover-foreground"
857
859
  };
858
860
  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`]
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
+ }]
860
866
  ];
861
867
  const tooltip = [
862
868
  ...dynamicTooltip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@una-ui/preset",
3
- "version": "0.24.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",