orio-ui 1.14.0 → 1.15.0

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0 || ^4.0.0"
6
6
  },
7
- "version": "1.14.0",
7
+ "version": "1.15.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,7 +1,8 @@
1
- type __VLS_Props = {
1
+ export interface CheckBoxProps {
2
2
  checkedIcon?: string;
3
3
  uncheckedIcon?: string;
4
- };
4
+ }
5
+ type __VLS_Props = CheckBoxProps;
5
6
  type __VLS_ModelProps = {
6
7
  modelValue?: boolean;
7
8
  };
@@ -75,8 +75,7 @@ defineProps({
75
75
  content: "";
76
76
  width: calc(var(--box-size) * 0.3);
77
77
  height: calc(var(--box-size) * 0.6);
78
- position: relative;
79
- bottom: 0.1rem;
78
+ position: absolute;
80
79
  border: solid var(--color-accent-ink);
81
80
  border-width: 0 2px 2px 0;
82
81
  transform: rotate(45deg);
@@ -1,7 +1,8 @@
1
- type __VLS_Props = {
1
+ export interface CheckBoxProps {
2
2
  checkedIcon?: string;
3
3
  uncheckedIcon?: string;
4
- };
4
+ }
5
+ type __VLS_Props = CheckBoxProps;
5
6
  type __VLS_ModelProps = {
6
7
  modelValue?: boolean;
7
8
  };
@@ -0,0 +1,35 @@
1
+ import { type ControlProps } from "./ControlElement.vue.js";
2
+ export interface CheckboxOption {
3
+ label: string;
4
+ value: unknown;
5
+ }
6
+ export interface CheckboxGroupProps extends Omit<ControlProps, "appearance" | "group" | "id"> {
7
+ options?: CheckboxOption[];
8
+ }
9
+ type __VLS_Props = CheckboxGroupProps;
10
+ type __VLS_ModelProps = {
11
+ modelValue?: unknown[];
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare var __VLS_8: {};
15
+ type __VLS_Slots = {} & {
16
+ default?: (props: typeof __VLS_8) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: unknown[]) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: unknown[]) => any) | undefined;
22
+ }>, {
23
+ error: string | null;
24
+ layout: import("./ControlElement.vue.js").ControlLayout;
25
+ size: import("./ControlElement.vue.js").ControlSize;
26
+ options: CheckboxOption[];
27
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,50 @@
1
+ <script setup>
2
+ import {} from "./ControlElement.vue";
3
+ const props = defineProps({
4
+ options: { type: Array, required: false, default: () => [] },
5
+ error: { type: [String, null], required: false, default: null },
6
+ label: { type: String, required: false },
7
+ layout: { type: String, required: false, default: "vertical" },
8
+ size: { type: String, required: false, default: "md" }
9
+ });
10
+ const modelValue = defineModel({ type: Array, ...{ default: () => [] } });
11
+ function isChecked(value) {
12
+ return modelValue.value.includes(value);
13
+ }
14
+ function toggle(value) {
15
+ if (isChecked(value)) {
16
+ modelValue.value = modelValue.value.filter((v) => v !== value);
17
+ } else {
18
+ modelValue.value = [...modelValue.value, value];
19
+ }
20
+ }
21
+ </script>
22
+
23
+ <template>
24
+ <orio-control-element group :label :layout :size :error class="group-control">
25
+ <div class="checkboxes">
26
+ <slot>
27
+ <orio-check-box
28
+ v-for="option in options"
29
+ :key="String(option.value)"
30
+ appearance="minimal"
31
+ :model-value="isChecked(option.value)"
32
+ @update:model-value="toggle(option.value)"
33
+ >
34
+ {{ option.label }}
35
+ </orio-check-box>
36
+ </slot>
37
+ </div>
38
+ </orio-control-element>
39
+ </template>
40
+
41
+ <style scoped>
42
+ .checkboxes {
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+
47
+ .group-control.control.horizontal {
48
+ align-items: flex-start;
49
+ }
50
+ </style>
@@ -0,0 +1,35 @@
1
+ import { type ControlProps } from "./ControlElement.vue.js";
2
+ export interface CheckboxOption {
3
+ label: string;
4
+ value: unknown;
5
+ }
6
+ export interface CheckboxGroupProps extends Omit<ControlProps, "appearance" | "group" | "id"> {
7
+ options?: CheckboxOption[];
8
+ }
9
+ type __VLS_Props = CheckboxGroupProps;
10
+ type __VLS_ModelProps = {
11
+ modelValue?: unknown[];
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare var __VLS_8: {};
15
+ type __VLS_Slots = {} & {
16
+ default?: (props: typeof __VLS_8) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: unknown[]) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: unknown[]) => any) | undefined;
22
+ }>, {
23
+ error: string | null;
24
+ layout: import("./ControlElement.vue.js").ControlLayout;
25
+ size: import("./ControlElement.vue.js").ControlSize;
26
+ options: CheckboxOption[];
27
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -9,10 +9,20 @@ export interface ControlProps {
9
9
  * Error message to display below the control
10
10
  */
11
11
  error?: string | null;
12
+ /**
13
+ * Marks this control as a group (adds role="group" and aria-labelledby).
14
+ * The label renders as a <span> instead of <label>.
15
+ * Use for groups of related controls (e.g. CheckboxGroup).
16
+ */
17
+ group?: boolean;
12
18
  /**
13
19
  * ID for the control's form element, auto-generated if not provided
14
20
  */
15
21
  id?: string;
22
+ /**
23
+ * Label text for the control (or legend text when group is true)
24
+ */
25
+ label?: string;
16
26
  /**
17
27
  * Label position relative to the control
18
28
  */
@@ -22,15 +32,16 @@ export interface ControlProps {
22
32
  */
23
33
  size?: ControlSize;
24
34
  }
25
- declare var __VLS_1: {
35
+ declare var __VLS_7: {
26
36
  id: string;
27
37
  };
28
38
  type __VLS_Slots = {} & {
29
- default?: (props: typeof __VLS_1) => any;
39
+ default?: (props: typeof __VLS_7) => any;
30
40
  };
31
41
  declare const __VLS_base: import("vue").DefineComponent<ControlProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ControlProps> & Readonly<{}>, {
32
42
  appearance: "normal" | "minimal";
33
43
  error: string | null;
44
+ group: boolean;
34
45
  id: string;
35
46
  layout: ControlLayout;
36
47
  size: ControlSize;
@@ -3,7 +3,9 @@ import { useId } from "vue";
3
3
  const props = defineProps({
4
4
  appearance: { type: String, required: false, default: "normal" },
5
5
  error: { type: [String, null], required: false, default: null },
6
+ group: { type: Boolean, required: false, default: false },
6
7
  id: { type: String, required: false, default: () => useId() },
8
+ label: { type: String, required: false },
7
9
  layout: { type: String, required: false, default: "vertical" },
8
10
  size: { type: String, required: false, default: "md" }
9
11
  });
@@ -12,11 +14,17 @@ const props = defineProps({
12
14
  <template>
13
15
  <div
14
16
  class="control"
15
- :class="[appearance, layout, `size-${size}`, { 'has-error': error }]"
17
+ :class="[appearance, layout, `size-${size}`, { 'has-error': error, group }]"
18
+ v-bind="group ? { role: 'group', 'aria-labelledby': id } : {}"
16
19
  >
17
- <label v-if="$attrs.label" class="control-label" :for="id">
18
- {{ $attrs.label }}
19
- </label>
20
+ <component
21
+ :is="group ? 'span' : 'label'"
22
+ v-if="label"
23
+ class="control-label"
24
+ v-bind="group ? { id } : { for: id }"
25
+ >
26
+ {{ label }}
27
+ </component>
20
28
  <div class="control-group">
21
29
  <div class="slot-wrapper" v-bind="$attrs">
22
30
  <slot :id />
@@ -9,10 +9,20 @@ export interface ControlProps {
9
9
  * Error message to display below the control
10
10
  */
11
11
  error?: string | null;
12
+ /**
13
+ * Marks this control as a group (adds role="group" and aria-labelledby).
14
+ * The label renders as a <span> instead of <label>.
15
+ * Use for groups of related controls (e.g. CheckboxGroup).
16
+ */
17
+ group?: boolean;
12
18
  /**
13
19
  * ID for the control's form element, auto-generated if not provided
14
20
  */
15
21
  id?: string;
22
+ /**
23
+ * Label text for the control (or legend text when group is true)
24
+ */
25
+ label?: string;
16
26
  /**
17
27
  * Label position relative to the control
18
28
  */
@@ -22,15 +32,16 @@ export interface ControlProps {
22
32
  */
23
33
  size?: ControlSize;
24
34
  }
25
- declare var __VLS_1: {
35
+ declare var __VLS_7: {
26
36
  id: string;
27
37
  };
28
38
  type __VLS_Slots = {} & {
29
- default?: (props: typeof __VLS_1) => any;
39
+ default?: (props: typeof __VLS_7) => any;
30
40
  };
31
41
  declare const __VLS_base: import("vue").DefineComponent<ControlProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ControlProps> & Readonly<{}>, {
32
42
  appearance: "normal" | "minimal";
33
43
  error: string | null;
44
+ group: boolean;
34
45
  id: string;
35
46
  layout: ControlLayout;
36
47
  size: ControlSize;
@@ -0,0 +1,32 @@
1
+ export interface RadioButtonProps {
2
+ /** The value this radio represents; compared to v-model to determine checked state */
3
+ value?: unknown;
4
+ /** HTML name attribute — groups radios together so only one is selected at a time */
5
+ name?: string;
6
+ /** Inline label text (alternative to default slot) */
7
+ label?: string;
8
+ /** Visually hides the label while keeping it accessible to SR (screen readers) */
9
+ hideLabel?: boolean;
10
+ }
11
+ type __VLS_Props = RadioButtonProps;
12
+ type __VLS_ModelProps = {
13
+ modelValue?: unknown;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_8: {};
17
+ type __VLS_Slots = {} & {
18
+ default?: (props: typeof __VLS_8) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "update:modelValue": (value: unknown) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
24
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,100 @@
1
+ <script setup>
2
+ const modelValue = defineModel({ type: null });
3
+ defineProps({
4
+ value: { type: null, required: false },
5
+ name: { type: String, required: false },
6
+ label: { type: String, required: false },
7
+ hideLabel: { type: Boolean, required: false }
8
+ });
9
+ </script>
10
+
11
+ <template>
12
+ <orio-control-element class="radio">
13
+ <label class="radio-label">
14
+ <input
15
+ v-model="modelValue"
16
+ type="radio"
17
+ :name="name"
18
+ :value="value"
19
+ class="radio-input"
20
+ tabindex="-1"
21
+ />
22
+ <span class="radio-box" />
23
+ <span
24
+ v-if="label || $slots.default"
25
+ class="radio-text"
26
+ :class="{ 'sr-only': hideLabel }"
27
+ >
28
+ <slot>{{ label }}</slot>
29
+ </span>
30
+ </label>
31
+ </orio-control-element>
32
+ </template>
33
+
34
+ <style scoped>
35
+ .radio {
36
+ --box-size: var(--control-icon-size, 1rem);
37
+ }
38
+ .radio-label {
39
+ position: relative;
40
+ user-select: none;
41
+ display: inline-flex;
42
+ align-items: center;
43
+ gap: var(--control-gap, 0.4rem);
44
+ color: var(--color-text);
45
+ cursor: pointer;
46
+ }
47
+ .radio-input {
48
+ position: absolute;
49
+ inset: 0;
50
+ width: var(--box-size);
51
+ height: 1rem;
52
+ margin: 0;
53
+ opacity: 0;
54
+ cursor: pointer;
55
+ }
56
+ .radio-box {
57
+ cursor: pointer;
58
+ flex-shrink: 0;
59
+ width: var(--box-size);
60
+ height: var(--box-size);
61
+ border: 2px solid var(--color-border);
62
+ border-radius: var(--border-radius-pill);
63
+ background-color: var(--color-bg);
64
+ display: inline-flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ transition: background-color 0.2s ease, border-color 0.2s ease;
68
+ }
69
+ .radio .radio-input:checked + .radio-box {
70
+ background-color: var(--color-accent);
71
+ border-color: var(--color-accent);
72
+ }
73
+ .radio .radio-input:checked + .radio-box::after {
74
+ position: absolute;
75
+ content: "";
76
+ width: calc(var(--box-size) * 0.4);
77
+ height: calc(var(--box-size) * 0.4);
78
+ border-radius: var(--border-radius-pill);
79
+ background-color: var(--color-accent-ink);
80
+ }
81
+ .radio-label:hover .radio-box {
82
+ border-color: var(--color-accent);
83
+ }
84
+ .radio .radio-input:focus-visible + .radio-box {
85
+ outline: 2px solid var(--color-accent);
86
+ outline-offset: 2px;
87
+ }
88
+
89
+ .sr-only {
90
+ position: absolute;
91
+ width: 1px;
92
+ height: 1px;
93
+ padding: 0;
94
+ margin: -1px;
95
+ overflow: hidden;
96
+ clip: rect(0, 0, 0, 0);
97
+ white-space: nowrap;
98
+ border-width: 0;
99
+ }
100
+ </style>
@@ -0,0 +1,32 @@
1
+ export interface RadioButtonProps {
2
+ /** The value this radio represents; compared to v-model to determine checked state */
3
+ value?: unknown;
4
+ /** HTML name attribute — groups radios together so only one is selected at a time */
5
+ name?: string;
6
+ /** Inline label text (alternative to default slot) */
7
+ label?: string;
8
+ /** Visually hides the label while keeping it accessible to SR (screen readers) */
9
+ hideLabel?: boolean;
10
+ }
11
+ type __VLS_Props = RadioButtonProps;
12
+ type __VLS_ModelProps = {
13
+ modelValue?: unknown;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_8: {};
17
+ type __VLS_Slots = {} & {
18
+ default?: (props: typeof __VLS_8) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "update:modelValue": (value: unknown) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
24
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -7,6 +7,8 @@ export { default as NumberInputVertical } from "./components/NumberInput/Vertica
7
7
  export { default as NumberInputHorizontal } from "./components/NumberInput/Horizontal.vue.js";
8
8
  export { default as Textarea } from "./components/Textarea.vue.js";
9
9
  export { default as CheckBox } from "./components/CheckBox.vue.js";
10
+ export { default as CheckboxGroup, type CheckboxOption, type CheckboxGroupProps, } from "./components/CheckboxGroup.vue.js";
11
+ export { default as RadioButton, type RadioButtonProps, } from "./components/RadioButton.vue.js";
10
12
  export { default as SwitchButton } from "./components/SwitchButton.vue.js";
11
13
  export { default as DatePicker } from "./components/DatePicker.vue.js";
12
14
  export { default as DateRangePicker } from "./components/DateRangePicker.vue.js";
@@ -7,6 +7,12 @@ export { default as NumberInputVertical } from "./components/NumberInput/Vertica
7
7
  export { default as NumberInputHorizontal } from "./components/NumberInput/Horizontal.vue";
8
8
  export { default as Textarea } from "./components/Textarea.vue";
9
9
  export { default as CheckBox } from "./components/CheckBox.vue";
10
+ export {
11
+ default as CheckboxGroup
12
+ } from "./components/CheckboxGroup.vue";
13
+ export {
14
+ default as RadioButton
15
+ } from "./components/RadioButton.vue";
10
16
  export { default as SwitchButton } from "./components/SwitchButton.vue";
11
17
  export { default as DatePicker } from "./components/DatePicker.vue";
12
18
  export { default as DateRangePicker } from "./components/DateRangePicker.vue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orio-ui",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Modern Nuxt component library with theme support",
5
5
  "type": "module",
6
6
  "main": "./dist/module.mjs",