@una-ui/nuxt 0.2.0-beta.6 → 0.3.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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.2.0-beta.6",
4
+ "version": "0.3.0-beta.1",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0-rc.8"
7
7
  }
package/dist/module.mjs CHANGED
@@ -6,7 +6,7 @@ import prefixes from '@una-ui/preset/prefixes';
6
6
  import extratorUna from '@una-ui/extractor-vue-script';
7
7
 
8
8
  const name = "@una-ui/nuxt";
9
- const version = "0.2.0-beta.6";
9
+ const version = "0.3.0-beta.1";
10
10
 
11
11
  function extendUnocssOptions(user = {}) {
12
12
  return {
@@ -0,0 +1,84 @@
1
+ <script setup lang="ts">
2
+ import { useVModel } from '@vueuse/core'
3
+ import { computed } from 'vue'
4
+ import NIcon from '../elements/Icon.vue'
5
+ import { randomId } from '../../utils'
6
+ import type { NCheckboxProps } from '../../types/checkbox'
7
+
8
+ defineOptions({
9
+ inheritAttrs: false,
10
+ })
11
+
12
+ const props = withDefaults(
13
+ defineProps<NCheckboxProps>(),
14
+ {
15
+ modelValue: false,
16
+ disabled: false,
17
+ una: () => ({
18
+ checkboxIcon: 'checkbox-icon',
19
+ }),
20
+ },
21
+ )
22
+ const emit = defineEmits<{ (...args: any): void }>()
23
+
24
+ const slots = defineSlots<{
25
+ default?: void
26
+ icon?: any
27
+ }>()
28
+
29
+ const id = computed(() => props.id ?? randomId('checkbox'))
30
+
31
+ const checked = useVModel(props, 'modelValue', emit, { passive: true })
32
+ </script>
33
+
34
+ <template>
35
+ <label
36
+ checkbox="wrapper"
37
+ :for="props.for ?? id"
38
+ :class="[
39
+ una?.checkboxWrapper,
40
+ {
41
+ 'checkbox-reverse': reverse,
42
+ 'checkbox-disabled': disabled,
43
+ },
44
+ ]"
45
+ :checked="checked || null"
46
+ :disabled="disabled || null"
47
+ >
48
+ <input
49
+ :id="id"
50
+ v-model="checked"
51
+ type="checkbox"
52
+ class="peer"
53
+ checkbox="input"
54
+ :disabled="disabled"
55
+ :name="name"
56
+ @keypress.enter="checked = !checked"
57
+ >
58
+ <span
59
+ :checkbox="checkbox"
60
+ :size="size"
61
+ class="checkbox checkbox-peer-focus"
62
+ v-bind="$attrs"
63
+ >
64
+ <slot name="icon">
65
+ <NIcon
66
+ checkbox="icon-base icon-checked"
67
+ :name="una.checkboxIcon!"
68
+ :class="[
69
+ una.checkboxIconBase,
70
+ ]"
71
+ />
72
+ </slot>
73
+ </span>
74
+ <div
75
+ v-if="slots.default || label"
76
+ checkbox="label"
77
+ :class="una?.checkboxLabel"
78
+ >
79
+ <slot>
80
+ {{ label }}
81
+ </slot>
82
+ </div>
83
+ </label>
84
+ </template>
@@ -57,27 +57,22 @@ const model = useVModel(props, 'modelValue', emit, { passive: true })
57
57
  :value="value"
58
58
  @keypress.enter="model = value!"
59
59
  >
60
- <div
60
+ <span
61
61
  :radio="radio"
62
62
  :size="size"
63
- class="radio radio-(peer-focus)"
64
- :class="[
65
- una?.radioPeerFocus,
66
- ]"
63
+ class="radio radio-peer-focus"
67
64
  v-bind="$attrs"
68
65
  >
69
- <div radio="icon-wrapper">
70
- <slot name="icon">
71
- <NIcon
72
- :class="[
73
- una.radioIconBase,
74
- ]"
75
- radio="icon-base icon-checked"
76
- :name="una.radioIcon!"
77
- />
78
- </slot>
79
- </div>
80
- </div>
66
+ <slot name="icon">
67
+ <NIcon
68
+ :class="[
69
+ una.radioIconBase,
70
+ ]"
71
+ radio="icon-base icon-checked"
72
+ :name="una.radioIcon!"
73
+ />
74
+ </slot>
75
+ </span>
81
76
  <div
82
77
  v-if="slots.default || label"
83
78
  radio="label"
@@ -0,0 +1,69 @@
1
+ export interface NCheckboxProps {
2
+ /**
3
+ * v-model binding value if the checkbox is checked.
4
+ */
5
+ modelValue?: boolean | null;
6
+ /**
7
+ * Disable the checkbox.
8
+ */
9
+ disabled?: boolean;
10
+ /**
11
+ * Switch the position of label and checkbox.
12
+ */
13
+ reverse?: boolean;
14
+ /**
15
+ * Allows you to add `UnaUI` checkbox preset properties,
16
+ * Think of it as a shortcut for adding options or variants to the preset if available.
17
+ */
18
+ checkbox?: string;
19
+ /**
20
+ * Add name attribute to the checkbox.
21
+ *
22
+ * @default null
23
+ */
24
+ name?: string;
25
+ /**
26
+ * Manually set the id attribute.
27
+ * By default, the id attribute is generated randomly for accessibility reasons.
28
+ *
29
+ * @default randomId
30
+ */
31
+ id?: string;
32
+ /**
33
+ * Manually set the for attribute.
34
+ *
35
+ * By default, the for attribute is synced with the id attribute for accessibility reasons.
36
+ *
37
+ * @default randomId
38
+ * @example
39
+ * for="options"
40
+ */
41
+ for?: string;
42
+ /**
43
+ * Display label text.
44
+ *
45
+ * @default null
46
+ */
47
+ label?: string;
48
+ /**
49
+ * Allows you to change the size of the checkbox.
50
+ *
51
+ * @default size="sm"
52
+ *
53
+ * @example
54
+ * size="sm" | size="2cm" | size="2rem" | size="2px"
55
+ */
56
+ size?: string;
57
+ /**
58
+ * `UnaUI` preset configuration
59
+ *
60
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/checkbox.ts
61
+ */
62
+ una?: {
63
+ checkbox?: string;
64
+ checkboxWrapper?: string;
65
+ checkboxLabel?: string;
66
+ checkboxIconBase?: string;
67
+ checkboxIcon?: string;
68
+ };
69
+ }
File without changes
@@ -14,3 +14,4 @@ export * from './nav-link';
14
14
  export * from './nav-link-group';
15
15
  export * from './link';
16
16
  export * from './radio';
17
+ export * from './checkbox';
@@ -14,3 +14,4 @@ export * from "./nav-link.mjs";
14
14
  export * from "./nav-link-group.mjs";
15
15
  export * from "./link.mjs";
16
16
  export * from "./radio.mjs";
17
+ export * from "./checkbox.mjs";
@@ -83,7 +83,6 @@ export interface NRadioProps {
83
83
  radio?: string;
84
84
  radioWrapper?: string;
85
85
  radioLabel?: string;
86
- radioPeerFocus?: string;
87
86
  radioIconBase?: string;
88
87
  radioIcon?: string;
89
88
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "type": "module",
4
- "version": "0.2.0-beta.6",
4
+ "version": "0.3.0-beta.1",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -24,9 +24,9 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@headlessui/vue": "^1.7.16",
27
- "@iconify-json/heroicons": "^1.1.12",
28
- "@iconify-json/tabler": "^1.1.94",
29
- "@nuxt/kit": "^3.7.4",
27
+ "@iconify-json/heroicons": "^1.1.13",
28
+ "@iconify-json/tabler": "^1.1.95",
29
+ "@nuxt/kit": "^3.8.0",
30
30
  "@nuxtjs/color-mode": "^3.3.0",
31
31
  "@unocss/core": "^0.55.7",
32
32
  "@unocss/nuxt": "^0.55.7",
@@ -37,12 +37,12 @@
37
37
  "@vueuse/nuxt": "^10.5.0",
38
38
  "ohash": "^1.1.3",
39
39
  "unocss": "^0.55.7",
40
- "@una-ui/extractor-vue-script": "^0.2.0-beta.6",
41
- "@una-ui/preset": "^0.2.0-beta.6"
40
+ "@una-ui/preset": "^0.3.0-beta.1",
41
+ "@una-ui/extractor-vue-script": "^0.3.0-beta.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@nuxt/module-builder": "^0.4.0",
45
- "@nuxt/schema": "^3.7.4",
45
+ "@nuxt/schema": "^3.8.0",
46
46
  "nuxt": "3.7.3"
47
47
  },
48
48
  "publishConfig": {