nuance-ui 0.2.9 → 0.2.11

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.
Files changed (153) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/action-icon/action-icon-section.d.vue.ts +11 -10
  3. package/dist/runtime/components/action-icon/action-icon-section.vue +17 -20
  4. package/dist/runtime/components/action-icon/action-icon-section.vue.d.ts +11 -10
  5. package/dist/runtime/components/action-icon/action-icon.d.vue.ts +17 -14
  6. package/dist/runtime/components/action-icon/action-icon.vue +18 -17
  7. package/dist/runtime/components/action-icon/action-icon.vue.d.ts +17 -14
  8. package/dist/runtime/components/alert.d.vue.ts +8 -6
  9. package/dist/runtime/components/alert.vue +15 -101
  10. package/dist/runtime/components/alert.vue.d.ts +8 -6
  11. package/dist/runtime/components/app-shell/app-shell-aside.vue +2 -28
  12. package/dist/runtime/components/app-shell/app-shell-footer.vue +2 -27
  13. package/dist/runtime/components/app-shell/app-shell-header.vue +2 -28
  14. package/dist/runtime/components/app-shell/app-shell-main.vue +2 -16
  15. package/dist/runtime/components/app-shell/app-shell-navbar.vue +2 -32
  16. package/dist/runtime/components/app-shell/app-shell-section.vue +2 -8
  17. package/dist/runtime/components/app-shell/app-shell.vue +20 -44
  18. package/dist/runtime/components/avatar/avatar-group.d.vue.ts +2 -2
  19. package/dist/runtime/components/avatar/avatar-group.vue +1 -1
  20. package/dist/runtime/components/avatar/avatar-group.vue.d.ts +2 -2
  21. package/dist/runtime/components/avatar/avatar.d.vue.ts +9 -5
  22. package/dist/runtime/components/avatar/avatar.vue +26 -26
  23. package/dist/runtime/components/avatar/avatar.vue.d.ts +9 -5
  24. package/dist/runtime/components/background-image.d.vue.ts +2 -2
  25. package/dist/runtime/components/background-image.vue +3 -19
  26. package/dist/runtime/components/background-image.vue.d.ts +2 -2
  27. package/dist/runtime/components/badge.d.vue.ts +9 -8
  28. package/dist/runtime/components/badge.vue +18 -154
  29. package/dist/runtime/components/badge.vue.d.ts +9 -8
  30. package/dist/runtime/components/breadcrumbs.d.vue.ts +4 -4
  31. package/dist/runtime/components/breadcrumbs.vue +2 -48
  32. package/dist/runtime/components/breadcrumbs.vue.d.ts +4 -4
  33. package/dist/runtime/components/button/button.d.vue.ts +21 -26
  34. package/dist/runtime/components/button/button.module.css +1 -1
  35. package/dist/runtime/components/button/button.vue +36 -42
  36. package/dist/runtime/components/button/button.vue.d.ts +21 -26
  37. package/dist/runtime/components/button/unstyled-button.vue +2 -21
  38. package/dist/runtime/components/calendar/calendar.d.vue.ts +2 -2
  39. package/dist/runtime/components/calendar/calendar.vue +3 -10
  40. package/dist/runtime/components/calendar/calendar.vue.d.ts +2 -2
  41. package/dist/runtime/components/calendar/ui/core/calendar-cell.d.vue.ts +2 -2
  42. package/dist/runtime/components/calendar/ui/core/calendar-cell.vue +3 -114
  43. package/dist/runtime/components/calendar/ui/core/calendar-cell.vue.d.ts +2 -2
  44. package/dist/runtime/components/calendar/ui/core/calendar-header.vue +2 -67
  45. package/dist/runtime/components/calendar/ui/levels/calendar-decade.d.vue.ts +2 -2
  46. package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue +3 -25
  47. package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue.d.ts +2 -2
  48. package/dist/runtime/components/calendar/ui/levels/calendar-month.d.vue.ts +2 -2
  49. package/dist/runtime/components/calendar/ui/levels/calendar-month.vue +9 -34
  50. package/dist/runtime/components/calendar/ui/levels/calendar-month.vue.d.ts +2 -2
  51. package/dist/runtime/components/calendar/ui/levels/calendar-year.d.vue.ts +2 -2
  52. package/dist/runtime/components/calendar/ui/levels/calendar-year.vue +3 -25
  53. package/dist/runtime/components/calendar/ui/levels/calendar-year.vue.d.ts +2 -2
  54. package/dist/runtime/components/checkbox/checkbox-card.vue +2 -28
  55. package/dist/runtime/components/checkbox/checkbox-group.vue +3 -3
  56. package/dist/runtime/components/checkbox/checkbox-indicator.d.vue.ts +5 -4
  57. package/dist/runtime/components/checkbox/checkbox-indicator.vue +15 -123
  58. package/dist/runtime/components/checkbox/checkbox-indicator.vue.d.ts +5 -4
  59. package/dist/runtime/components/checkbox/checkbox.d.vue.ts +5 -7
  60. package/dist/runtime/components/checkbox/checkbox.vue +30 -136
  61. package/dist/runtime/components/checkbox/checkbox.vue.d.ts +5 -7
  62. package/dist/runtime/components/chip/chip.d.vue.ts +3 -2
  63. package/dist/runtime/components/chip/chip.vue +29 -212
  64. package/dist/runtime/components/chip/chip.vue.d.ts +3 -2
  65. package/dist/runtime/components/combobox/combobox-dropdown.vue +2 -4
  66. package/dist/runtime/components/container.d.vue.ts +2 -2
  67. package/dist/runtime/components/container.vue +1 -1
  68. package/dist/runtime/components/container.vue.d.ts +2 -2
  69. package/dist/runtime/components/date-time-picker.vue +6 -10
  70. package/dist/runtime/components/dialog/ui/dialog-close-button.vue +11 -7
  71. package/dist/runtime/components/dialog/ui/dialog-root.d.vue.ts +11 -9
  72. package/dist/runtime/components/dialog/ui/dialog-root.vue +5 -5
  73. package/dist/runtime/components/dialog/ui/dialog-root.vue.d.ts +11 -9
  74. package/dist/runtime/components/dialog/ui/dialog-title.vue +2 -2
  75. package/dist/runtime/components/drawer/drawer-close-button.vue +6 -6
  76. package/dist/runtime/components/drawer/drawer-root.vue +4 -4
  77. package/dist/runtime/components/drawer/drawer-title.vue +2 -2
  78. package/dist/runtime/components/files/file-upload-button.vue +8 -7
  79. package/dist/runtime/components/files/file-upload-icon.vue +5 -5
  80. package/dist/runtime/components/input/date-picker.vue +6 -10
  81. package/dist/runtime/components/input/email-input.vue +4 -4
  82. package/dist/runtime/components/input/lib/input-wrapper.context.d.ts +5 -5
  83. package/dist/runtime/components/input/number-input.vue +6 -84
  84. package/dist/runtime/components/input/password-input.vue +4 -4
  85. package/dist/runtime/components/input/text-input.vue +4 -4
  86. package/dist/runtime/components/input/ui/button-input.vue +6 -25
  87. package/dist/runtime/components/input/ui/input-base.vue +6 -265
  88. package/dist/runtime/components/input/ui/input-inline.d.vue.ts +2 -2
  89. package/dist/runtime/components/input/ui/input-inline.vue +3 -82
  90. package/dist/runtime/components/input/ui/input-inline.vue.d.ts +2 -2
  91. package/dist/runtime/components/input/ui/input-label.d.vue.ts +2 -2
  92. package/dist/runtime/components/input/ui/input-label.vue +1 -1
  93. package/dist/runtime/components/input/ui/input-label.vue.d.ts +2 -2
  94. package/dist/runtime/components/input/ui/input-wrapper.d.vue.ts +5 -1
  95. package/dist/runtime/components/input/ui/input-wrapper.vue +13 -65
  96. package/dist/runtime/components/input/ui/input-wrapper.vue.d.ts +5 -1
  97. package/dist/runtime/components/input/ui/spin-input.vue +2 -53
  98. package/dist/runtime/components/link/link-button.vue +9 -8
  99. package/dist/runtime/components/link/link.vue +2 -2
  100. package/dist/runtime/components/loader/loader.d.vue.ts +7 -7
  101. package/dist/runtime/components/loader/loader.vue +8 -7
  102. package/dist/runtime/components/loader/loader.vue.d.ts +7 -7
  103. package/dist/runtime/components/modal/modal-close-button.vue +6 -6
  104. package/dist/runtime/components/modal/modal-root.vue +4 -4
  105. package/dist/runtime/components/modal/modal-title.vue +2 -2
  106. package/dist/runtime/components/nav-link/nav-icon-link.vue +4 -4
  107. package/dist/runtime/components/nav-link/nav-link.d.vue.ts +6 -5
  108. package/dist/runtime/components/nav-link/nav-link.vue +30 -113
  109. package/dist/runtime/components/nav-link/nav-link.vue.d.ts +6 -5
  110. package/dist/runtime/components/paper.vue +2 -31
  111. package/dist/runtime/components/popover/popover-dropdown.vue +2 -54
  112. package/dist/runtime/components/progress/progress-root.d.vue.ts +3 -3
  113. package/dist/runtime/components/progress/progress-root.vue +2 -2
  114. package/dist/runtime/components/progress/progress-root.vue.d.ts +3 -3
  115. package/dist/runtime/components/progress/progress-section.d.vue.ts +3 -0
  116. package/dist/runtime/components/progress/progress-section.vue +8 -6
  117. package/dist/runtime/components/progress/progress-section.vue.d.ts +3 -0
  118. package/dist/runtime/components/progress/progress.vue +2 -2
  119. package/dist/runtime/components/select.vue +6 -10
  120. package/dist/runtime/components/switch/switch-group.vue +3 -3
  121. package/dist/runtime/components/switch/switch.d.vue.ts +3 -0
  122. package/dist/runtime/components/switch/switch.vue +15 -205
  123. package/dist/runtime/components/switch/switch.vue.d.ts +3 -0
  124. package/dist/runtime/components/table/types.d.ts +4 -3
  125. package/dist/runtime/components/table/ui/table-sortable-header.vue +9 -8
  126. package/dist/runtime/components/table/ui/table.vue +9 -174
  127. package/dist/runtime/components/tabs/tabs-root.d.vue.ts +14 -16
  128. package/dist/runtime/components/tabs/tabs-root.vue +14 -12
  129. package/dist/runtime/components/tabs/tabs-root.vue.d.ts +14 -16
  130. package/dist/runtime/components/text.d.vue.ts +10 -9
  131. package/dist/runtime/components/text.vue +16 -77
  132. package/dist/runtime/components/text.vue.d.ts +10 -9
  133. package/dist/runtime/components/textarea.vue +4 -4
  134. package/dist/runtime/components/time-picker/time-picker.vue +6 -132
  135. package/dist/runtime/components/title.vue +4 -8
  136. package/dist/runtime/components/tree/_ui/tree-item.vue +2 -62
  137. package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +7 -6
  138. package/dist/runtime/components/tree/_ui/tree-root.vue +13 -19
  139. package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +7 -6
  140. package/dist/runtime/components/tree/tree.vue +5 -5
  141. package/dist/runtime/composables/index.d.ts +1 -1
  142. package/dist/runtime/composables/index.js +1 -1
  143. package/dist/runtime/composables/use-vars-resolver.d.ts +4 -0
  144. package/dist/runtime/composables/use-vars-resolver.js +6 -0
  145. package/dist/runtime/types/index.d.ts +2 -2
  146. package/dist/runtime/types/styling.d.ts +6 -0
  147. package/dist/runtime/types/styling.js +0 -0
  148. package/dist/runtime/types/theme.d.ts +10 -15
  149. package/dist/runtime/utils/color/parse-theme-color.d.ts +2 -2
  150. package/dist/runtime/utils/style/create-variant-color-resolver.d.ts +2 -2
  151. package/package.json +2 -2
  152. package/dist/runtime/composables/use-style-resolver.d.ts +0 -6
  153. package/dist/runtime/composables/use-style-resolver.js +0 -5
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { useStyleResolver } from "@nui/composables";
2
+ import { useVarsResolver } from "@nui/composables";
3
3
  import { getRadius, getSize, getThemeColor, parseThemeColor } from "@nui/utils";
4
4
  import { computed, useId } from "vue";
5
5
  import Box from "../box.vue";
@@ -19,10 +19,10 @@ const {
19
19
  id: { type: String, required: false },
20
20
  color: { type: null, required: false },
21
21
  iconColor: { type: null, required: false },
22
- variant: { type: String, required: false },
23
- radius: { type: String, required: false },
22
+ radius: { type: [String, Number, Object], required: false },
24
23
  size: { type: String, required: false },
25
24
  value: { type: String, required: false },
25
+ variant: { type: String, required: false },
26
26
  label: { type: String, required: false },
27
27
  description: { type: String, required: false },
28
28
  error: { type: String, required: false },
@@ -56,20 +56,28 @@ const disabled = computed(() => {
56
56
  });
57
57
  const uuid = computed(() => id ?? useId());
58
58
  const size = computed(() => _size ?? ctx?.size);
59
- const style = computed(() => useStyleResolver((theme) => {
59
+ const style = useVarsResolver((theme) => {
60
60
  const parsed = parseThemeColor({ color, theme });
61
61
  const outlineColor = parsed.isThemeColor && parsed.shade === void 0 ? `var(--color-${parsed.color}-outline)` : parsed.color;
62
62
  return {
63
- "--checkbox-size": getSize(size, "checkbox-size"),
64
- "--checkbox-radius": radius === void 0 ? void 0 : getRadius(radius),
65
- "--checkbox-color": variant === "outline" ? outlineColor : getThemeColor(color, theme),
66
- "--checkbox-icon-color": iconColor ? getThemeColor(iconColor, theme) : void 0
63
+ root: {
64
+ "--checkbox-size": getSize(size, "checkbox-size"),
65
+ "--checkbox-radius": radius === void 0 ? void 0 : getRadius(radius),
66
+ "--checkbox-color": variant === "outline" ? outlineColor : getThemeColor(color, theme),
67
+ "--checkbox-icon-color": iconColor ? getThemeColor(iconColor, theme) : void 0
68
+ }
67
69
  };
68
- }));
70
+ });
69
71
  </script>
70
72
 
71
73
  <template>
72
- <InputInline v-bind='rest' :id='uuid' :class='$style.root' :style :size>
74
+ <InputInline
75
+ v-bind='rest'
76
+ :id='uuid'
77
+ :class='$style.root'
78
+ :style='style.root'
79
+ :size
80
+ >
73
81
  <Box :class='$style.inner' :mod='{ "label-position": rest?.labelPosition }'>
74
82
  <input
75
83
  :id
@@ -79,136 +87,22 @@ const style = computed(() => useStyleResolver((theme) => {
79
87
  :disabled
80
88
  >
81
89
 
82
- <slot name='icon' :indeterminate='modelValue === "indeterminate"' :class='$style.icon'>
83
- <Icon v-if='modelValue !== "indeterminate"' name='gravity-ui:check' :class='$style.icon' />
90
+ <slot
91
+ name='icon'
92
+ :indeterminate='modelValue === "indeterminate"'
93
+ :class='$style.icon'
94
+ >
95
+ <Icon
96
+ v-if='modelValue !== "indeterminate"'
97
+ name='gravity-ui:check'
98
+ :class='$style.icon'
99
+ />
84
100
  <Icon v-else name='gravity-ui:minus' :class='$style.icon' />
85
101
  </slot>
86
102
  </Box>
87
103
  </InputInline>
88
104
  </template>
89
105
 
90
- <style module lang="postcss">
91
- .root {
92
- --checkbox-size-xs: rem(16px);
93
- --checkbox-size-sm: rem(20px);
94
- --checkbox-size-md: rem(24px);
95
- --checkbox-size-lg: rem(30px);
96
- --checkbox-size-xl: rem(36px);
97
-
98
- --checkbox-size: var(--checkbox-size-sm);
99
- --checkbox-color: var(--color-primary-filled);
100
- --checkbox-icon-color: var(--color-white);
101
- }
102
-
103
- .inner {
104
- position: relative;
105
-
106
- order: 1;
107
-
108
- width: var(--checkbox-size);
109
- height: var(--checkbox-size);
110
-
111
- &:where([data-label-position='right']) {
112
- order: 2;
113
- }
114
- }
115
-
116
- .input {
117
- cursor: pointer;
118
-
119
- display: block;
120
-
121
- width: var(--checkbox-size);
122
- height: var(--checkbox-size);
123
- margin: 0;
124
- padding: 0;
125
- border: 1px solid transparent;
126
- border-radius: var(--checkbox-radius, var(--radius-default));
127
-
128
- appearance: none;
129
-
130
- transition: border-color 100ms ease,
131
- background-color 100ms ease;
132
- -webkit-tap-highlight-color: transparent;
133
-
134
- &:where([data-error]) {
135
- border-color: var(--color-error);
136
- }
137
-
138
- &[data-indeterminate],
139
- &:checked {
140
- border-color: var(--checkbox-color);
141
-
142
- background-color: var(--checkbox-color);
143
-
144
- &+.icon {
145
- transform: none;
146
-
147
- opacity: 1;
148
- }
149
- }
150
-
151
- &:disabled {
152
- cursor: not-allowed;
153
-
154
- border-color: var(--color-disabled-border);
155
-
156
- background-color: var(--color-disabled);
157
-
158
- &+.icon {
159
- color: var(--color-disabled);
160
- }
161
- }
162
-
163
- @mixin where-light {
164
- border-color: var(--color-gray-4);
165
-
166
- background-color: var(--color-white);
167
- }
168
-
169
- @mixin where-dark {
170
- border-color: var(--color-dark-4);
171
-
172
- background-color: var(--color-dark-6);
173
- }
174
- }
175
-
176
- .input[data-variant='outline'] {
177
- &+.icon {
178
- color: var(--checkbox-color);
179
- }
180
-
181
- &[data-indeterminate]:not(:disabled),
182
- &:checked:not(:disabled) {
183
- border-color: var(--checkbox-color);
184
-
185
- background-color: transparent;
186
-
187
- &+.icon {
188
- transform: none;
189
-
190
- color: var(--checkbox-color);
191
-
192
- opacity: 1;
193
- }
194
- }
195
- }
196
-
197
- .icon {
198
- pointer-events: none;
199
-
200
- position: absolute;
201
- inset: 0;
202
- transform: translateY(.25rem) scale(0.5);
203
-
204
- width: 80%;
205
- margin: auto;
206
-
207
- color: var(--checkbox-icon-color);
208
-
209
- opacity: 0;
210
-
211
- transition: transform 100ms ease,
212
- opacity 100ms ease;
213
- }
106
+ <style module>
107
+ .root{--checkbox-size-xs:rem(16px);--checkbox-size-sm:rem(20px);--checkbox-size-md:rem(24px);--checkbox-size-lg:rem(30px);--checkbox-size-xl:rem(36px);--checkbox-size:var(--checkbox-size-sm);--checkbox-color:var(--color-primary-filled);--checkbox-icon-color:var(--color-white)}.inner{height:var(--checkbox-size);order:1;position:relative;width:var(--checkbox-size)}.inner:where([data-label-position=right]){order:2}.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:1px solid transparent;border-radius:var(--checkbox-radius,var(--radius-default));cursor:pointer;display:block;height:var(--checkbox-size);margin:0;padding:0;transition:border-color .1s ease,background-color .1s ease;width:var(--checkbox-size);-webkit-tap-highlight-color:transparent}.input:where([data-error]){border-color:var(--color-error)}.input:checked,.input[data-indeterminate]{background-color:var(--checkbox-color);border-color:var(--checkbox-color)}.input:checked+.icon,.input[data-indeterminate]+.icon{opacity:1;transform:none}.input:disabled{background-color:var(--color-disabled);border-color:var(--color-disabled-border);cursor:not-allowed}.input:disabled+.icon{color:var(--color-disabled)}.input{@mixin where-light{background-color:var(--color-white);border-color:var(--color-gray-4)}}.input{@mixin where-dark{background-color:var(--color-dark-6);border-color:var(--color-dark-4)}}.input[data-variant=outline]+.icon{color:var(--checkbox-color)}.input[data-variant=outline]:checked:not(:disabled),.input[data-variant=outline][data-indeterminate]:not(:disabled){background-color:transparent;border-color:var(--checkbox-color)}.input[data-variant=outline]:checked:not(:disabled)+.icon,.input[data-variant=outline][data-indeterminate]:not(:disabled)+.icon{color:var(--checkbox-color);opacity:1;transform:none}.icon{color:var(--checkbox-icon-color);inset:0;margin:auto;opacity:0;pointer-events:none;position:absolute;transform:translateY(.25rem) scale(.5);transition:transform .1s ease,opacity .1s ease;width:80%}
214
108
  </style>
@@ -1,5 +1,6 @@
1
- import type { NuanceColor, NuanceSize } from '@nui/types';
1
+ import type { AnyString, NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
2
2
  import type { InlineInputProps } from '../input/index.js';
3
+ export type CheckboxVariant = 'filled' | 'outline';
3
4
  export interface CheckboxProps extends Omit<InlineInputProps, 'id'> {
4
5
  /** Id used to bind input and label, auto-generated if not provided */
5
6
  id?: string;
@@ -7,13 +8,8 @@ export interface CheckboxProps extends Omit<InlineInputProps, 'id'> {
7
8
  color?: NuanceColor;
8
9
  /** Icon color */
9
10
  iconColor?: NuanceColor;
10
- /**
11
- * Visual variant
12
- * @default `'filled'`
13
- */
14
- variant?: 'filled' | 'outline';
15
11
  /** Border radius */
16
- radius?: NuanceSize;
12
+ radius?: NuanceRadius | AnyString;
17
13
  /**
18
14
  * Component size
19
15
  * @default `'sm'`
@@ -21,6 +17,8 @@ export interface CheckboxProps extends Omit<InlineInputProps, 'id'> {
21
17
  size?: NuanceSize;
22
18
  /** Value used in checkbox group context */
23
19
  value?: string;
20
+ /** Visual variant */
21
+ variant?: CheckboxVariant;
24
22
  }
25
23
  type __VLS_Props = CheckboxProps;
26
24
  type __VLS_ModelProps = {
@@ -1,4 +1,5 @@
1
1
  import type { NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
2
+ export type ChipVariant = 'filled' | 'outline' | 'light';
2
3
  export interface ChipProps {
3
4
  /** Border radius */
4
5
  radius?: NuanceRadius;
@@ -10,8 +11,6 @@ export interface ChipProps {
10
11
  color?: NuanceColor;
11
12
  /** Id used to bind input and label, auto-generated if not provided */
12
13
  id?: string;
13
- /** Visual variant */
14
- variant?: 'filled' | 'outline' | 'light';
15
14
  /** Value used in chip group context */
16
15
  value?: string;
17
16
  /** Check icon name */
@@ -20,6 +19,8 @@ export interface ChipProps {
20
19
  hideIcon?: boolean;
21
20
  /** Disables the component */
22
21
  disabled?: boolean;
22
+ /** Visual variant */
23
+ variant?: ChipVariant;
23
24
  }
24
25
  type __VLS_Props = ChipProps;
25
26
  type __VLS_ModelProps = {
@@ -1,7 +1,12 @@
1
1
  <script setup>
2
- import { useStyleResolver } from "@nui/composables";
3
- import { createVariantColorResolver, getFontSize, getRadius, getSize } from "@nui/utils";
4
- import { computed, useId } from "vue";
2
+ import { useVarsResolver } from "@nui/composables";
3
+ import {
4
+ createVariantColorResolver,
5
+ getFontSize,
6
+ getRadius,
7
+ getSize
8
+ } from "@nui/utils";
9
+ import { useId } from "vue";
5
10
  import Box from "../box.vue";
6
11
  import { useChipGroupState, useChipState } from "./lib";
7
12
  const {
@@ -21,11 +26,11 @@ const {
21
26
  type: { type: String, required: false },
22
27
  color: { type: null, required: false },
23
28
  id: { type: String, required: false },
24
- variant: { type: String, required: false },
25
29
  value: { type: String, required: false },
26
30
  icon: { type: String, required: false },
27
31
  hideIcon: { type: Boolean, required: false },
28
- disabled: { type: Boolean, required: false }
32
+ disabled: { type: Boolean, required: false },
33
+ variant: { type: String, required: false }
29
34
  });
30
35
  const id = uid || useId();
31
36
  const modelValue = defineModel({ type: Boolean, ...{ default: false } });
@@ -33,30 +38,28 @@ const ctx = useChipGroupState();
33
38
  const { checked, onUpdate } = useChipState(ctx, modelValue, value);
34
39
  const disabled = ctx?.disabled || _disabled;
35
40
  const type = ctx ? ctx.multiple ? "checkbox" : "radio" : _type;
36
- const style = computed(() => useStyleResolver((theme) => {
37
- const colors = createVariantColorResolver({
38
- color,
39
- theme,
40
- variant
41
- });
41
+ const style = useVarsResolver((theme) => {
42
+ const colors = createVariantColorResolver({ color, theme, variant });
42
43
  return {
43
- "--chip-fz": getFontSize(size),
44
- "--chip-size": getSize(size, "chip-size"),
45
- "--chip-radius": radius === void 0 ? void 0 : getRadius(radius),
46
- "--chip-checked-padding": getSize(size, "chip-checked-padding"),
47
- "--chip-padding": getSize(size, "chip-padding"),
48
- "--chip-icon-size": getSize(size, "chip-icon-size"),
49
- "--chip-bg": color || variant ? colors.background : void 0,
50
- "--chip-hover": color || variant ? colors.hover : void 0,
51
- "--chip-color": color || variant ? colors.text : void 0,
52
- "--chip-bd": color || variant ? colors.border : void 0,
53
- "--chip-spacing": getSize(size, "chip-spacing")
44
+ root: {
45
+ "--chip-fz": getFontSize(size),
46
+ "--chip-size": getSize(size, "chip-size"),
47
+ "--chip-radius": radius === void 0 ? void 0 : getRadius(radius),
48
+ "--chip-checked-padding": getSize(size, "chip-checked-padding"),
49
+ "--chip-padding": getSize(size, "chip-padding"),
50
+ "--chip-icon-size": getSize(size, "chip-icon-size"),
51
+ "--chip-bg": color || variant ? colors.background : void 0,
52
+ "--chip-hover": color || variant ? colors.hover : void 0,
53
+ "--chip-color": color || variant ? colors.text : void 0,
54
+ "--chip-bd": color || variant ? colors.border : void 0,
55
+ "--chip-spacing": getSize(size, "chip-spacing")
56
+ }
54
57
  };
55
- }));
58
+ });
56
59
  </script>
57
60
 
58
61
  <template>
59
- <Box :style :class='[$style.root, $attrs?.style]'>
62
+ <Box :style='style.root' :class='[$style.root, $attrs?.style]'>
60
63
  <input
61
64
  v-bind='{
62
65
  ...$attrs,
@@ -79,192 +82,6 @@ const style = computed(() => useStyleResolver((theme) => {
79
82
  </Box>
80
83
  </template>
81
84
 
82
- <style lang="postcss" module>
83
- .root {
84
- --chip-size-xs: rem(23px);
85
- --chip-size-sm: rem(28px);
86
- --chip-size-md: rem(32px);
87
- --chip-size-lg: rem(36px);
88
- --chip-size-xl: rem(40px);
89
-
90
- --chip-icon-size-xs: rem(12px);
91
- --chip-icon-size-sm: rem(14px);
92
- --chip-icon-size-md: rem(16px);
93
- --chip-icon-size-lg: rem(18px);
94
- --chip-icon-size-xl: rem(20px);
95
-
96
- --chip-padding-xs: rem(16px);
97
- --chip-padding-sm: rem(20px);
98
- --chip-padding-md: rem(24px);
99
- --chip-padding-lg: rem(28px);
100
- --chip-padding-xl: rem(32px);
101
-
102
- --chip-checked-padding-xs: rem(7.5px);
103
- --chip-checked-padding-sm: rem(10px);
104
- --chip-checked-padding-md: rem(11.7px);
105
- --chip-checked-padding-lg: rem(13.5px);
106
- --chip-checked-padding-xl: rem(15.7px);
107
-
108
- --chip-spacing-xs: rem(10px);
109
- --chip-spacing-sm: rem(12px);
110
- --chip-spacing-md: rem(16px);
111
- --chip-spacing-lg: rem(20px);
112
- --chip-spacing-xl: rem(22px);
113
-
114
- --chip-size: var(--chip-size-sm);
115
- --chip-icon-size: var(--chip-icon-size-sm);
116
- --chip-padding: var(--chip-padding-sm);
117
- --chip-spacing: var(--chip-spacing-sm);
118
- --chip-checked-padding: var(--chip-checked-padding-sm);
119
- --chip-bg: var(--color-primary-filled);
120
- --chip-hover: var(--color-primary-filled-hover);
121
- --chip-color: var(--color-white);
122
- --chip-bd: 1px solid transparent;
123
-
124
- --chip-fz: var(--font-size-sm);
125
- --chip-radius: var(--radius-xl);
126
- }
127
-
128
- .label {
129
- cursor: pointer;
130
- user-select: none;
131
-
132
- display: inline-flex;
133
- align-items: center;
134
-
135
- height: var(--chip-size);
136
- padding-inline: var(--chip-padding);
137
-
138
- border: 1px solid transparent;
139
- border-radius: var(--chip-radius);
140
-
141
- font-size: var(--chip-fz);
142
- line-height: calc(var(--chip-size) - rem(2px));
143
- color: var(--color-text);
144
- white-space: nowrap;
145
- -webkit-tap-highlight-color: transparent;
146
- }
147
-
148
- .iconWrapper {
149
- overflow: hidden;
150
- display: flex;
151
- align-items: center;
152
-
153
- width: calc(var(--chip-icon-size) + (var(--chip-spacing) / 1.5));
154
- max-width: calc(var(--chip-icon-size) + (var(--chip-spacing) / 1.5));
155
- height: var(--chip-icon-size);
156
- }
157
-
158
- .icon {
159
- display: block;
160
-
161
- width: var(--chip-icon-size);
162
- height: var(--chip-icon-size);
163
-
164
- color: var(--chip-icon-color, inherit);
165
- }
166
-
167
- .input {
168
- width: 0;
169
- height: 0;
170
- margin: 0;
171
- padding: 0;
172
-
173
- opacity: 0;
174
-
175
- &:focus-visible+.label {
176
- outline: 2px solid var(--color-primary-filled);
177
- outline-offset: 2px;
178
- }
179
- }
180
-
181
- .input:disabled {
182
- &+.label {
183
- cursor: not-allowed;
184
-
185
- color: var(--color-disabled-text);
186
-
187
- background-color: var(--color-disabled);
188
- }
189
- }
190
-
191
- .input:not(:disabled) {
192
- &+.label[data-variant='outline'] {
193
- @mixin where-light {
194
- border: 1px solid var(--color-gray-3);
195
-
196
- background-color: var(--color-white);
197
- }
198
-
199
- @mixin where-dark {
200
- border: 1px solid var(--color-dark-4);
201
-
202
- background-color: var(--color-dark-6);
203
- }
204
-
205
- @mixin hover {
206
- @mixin where-light {
207
- background-color: var(--color-gray-0);
208
- }
209
-
210
- @mixin where-dark {
211
- background-color: var(--color-dark-5);
212
- }
213
- }
214
- }
215
-
216
- &+.label[data-variant='filled'],
217
- &+.label[data-variant='light'] {
218
- border: 1px solid transparent;
219
-
220
- color: var(--color-text);
221
-
222
- @mixin where-light {
223
- background-color: var(--color-gray-1);
224
- }
225
-
226
- @mixin where-dark {
227
- background-color: var(--color-dark-5);
228
- }
229
-
230
- @mixin hover {
231
- @mixin where-light {
232
- background-color: var(--color-gray-2);
233
- }
234
-
235
- @mixin where-dark {
236
- background-color: var(--color-dark-4);
237
- }
238
- }
239
- }
240
- }
241
-
242
- .input:not(:disabled):checked {
243
- &+.label {
244
- padding: var(--chip-checked-padding);
245
- }
246
-
247
- &+.label[data-variant='outline'] {
248
- --chip-icon-color: var(--chip-color);
249
-
250
- border: var(--chip-bd);
251
-
252
- @mixin hover {
253
- background-color: var(--chip-hover);
254
- }
255
- }
256
-
257
- &+.label[data-variant='filled'],
258
- &+.label[data-variant='light'] {
259
- --chip-icon-color: var(--chip-color);
260
-
261
- color: var(--chip-color);
262
-
263
- background-color: var(--chip-bg);
264
-
265
- @mixin hover {
266
- background-color: var(--chip-hover);
267
- }
268
- }
269
- }
85
+ <style module>
86
+ .root{--chip-size-xs:rem(23px);--chip-size-sm:rem(28px);--chip-size-md:rem(32px);--chip-size-lg:rem(36px);--chip-size-xl:rem(40px);--chip-icon-size-xs:rem(12px);--chip-icon-size-sm:rem(14px);--chip-icon-size-md:rem(16px);--chip-icon-size-lg:rem(18px);--chip-icon-size-xl:rem(20px);--chip-padding-xs:rem(16px);--chip-padding-sm:rem(20px);--chip-padding-md:rem(24px);--chip-padding-lg:rem(28px);--chip-padding-xl:rem(32px);--chip-checked-padding-xs:rem(7.5px);--chip-checked-padding-sm:rem(10px);--chip-checked-padding-md:rem(11.7px);--chip-checked-padding-lg:rem(13.5px);--chip-checked-padding-xl:rem(15.7px);--chip-spacing-xs:rem(10px);--chip-spacing-sm:rem(12px);--chip-spacing-md:rem(16px);--chip-spacing-lg:rem(20px);--chip-spacing-xl:rem(22px);--chip-size:var(--chip-size-sm);--chip-icon-size:var(--chip-icon-size-sm);--chip-padding:var(--chip-padding-sm);--chip-spacing:var(--chip-spacing-sm);--chip-checked-padding:var(--chip-checked-padding-sm);--chip-bg:var(--color-primary-filled);--chip-hover:var(--color-primary-filled-hover);--chip-color:var(--color-white);--chip-bd:1px solid transparent;--chip-fz:var(--font-size-sm);--chip-radius:var(--radius-xl)}.label{align-items:center;border:1px solid transparent;border-radius:var(--chip-radius);color:var(--color-text);cursor:pointer;display:inline-flex;font-size:var(--chip-fz);height:var(--chip-size);line-height:calc(var(--chip-size) - rem(2px));padding-inline:var(--chip-padding);-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}.iconWrapper{align-items:center;display:flex;max-width:calc(var(--chip-icon-size) + var(--chip-spacing)/1.5);overflow:hidden;width:calc(var(--chip-icon-size) + var(--chip-spacing)/1.5)}.icon,.iconWrapper{height:var(--chip-icon-size)}.icon{color:var(--chip-icon-color,inherit);display:block;width:var(--chip-icon-size)}.input{height:0;margin:0;opacity:0;padding:0;width:0}.input:focus-visible+.label{outline:2px solid var(--color-primary-filled);outline-offset:2px}.input:disabled+.label{background-color:var(--color-disabled);color:var(--color-disabled-text);cursor:not-allowed}.input:not(:disabled)+.label[data-variant=outline]{@mixin where-light{background-color:var(--color-white);border-bottom-color:var(--color-gray-3);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-gray-3);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-gray-3);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-gray-3);border-top-style:solid;border-top-width:1px}@mixin where-dark{background-color:var(--color-dark-6);border-bottom-color:var(--color-dark-4);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-dark-4);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-dark-4);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-dark-4);border-top-style:solid;border-top-width:1px}@mixin hover{@mixin where-light{background-color:var(--color-gray-0)}@mixin where-dark{background-color:var(--color-dark-5)}}}.input:not(:disabled)+.label[data-variant=filled],.input:not(:disabled)+.label[data-variant=light]{border:1px solid transparent;color:var(--color-text);@mixin where-light{background-color:var(--color-gray-1)}@mixin where-dark{background-color:var(--color-dark-5)}@mixin hover{@mixin where-light{background-color:var(--color-gray-2)}@mixin where-dark{background-color:var(--color-dark-4)}}}.input:not(:disabled):checked+.label{padding:var(--chip-checked-padding)}.input:not(:disabled):checked+.label[data-variant=outline]{--chip-icon-color:var(--chip-color);border:var(--chip-bd);@mixin hover{background-color:var(--chip-hover)}}.input:not(:disabled):checked+.label[data-variant=filled],.input:not(:disabled):checked+.label[data-variant=light]{--chip-icon-color:var(--chip-color);background-color:var(--chip-bg);color:var(--chip-color);@mixin hover{background-color:var(--chip-hover)}}
270
87
  </style>
@@ -1,4 +1,5 @@
1
1
  import type { NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
2
+ export type ChipVariant = 'filled' | 'outline' | 'light';
2
3
  export interface ChipProps {
3
4
  /** Border radius */
4
5
  radius?: NuanceRadius;
@@ -10,8 +11,6 @@ export interface ChipProps {
10
11
  color?: NuanceColor;
11
12
  /** Id used to bind input and label, auto-generated if not provided */
12
13
  id?: string;
13
- /** Visual variant */
14
- variant?: 'filled' | 'outline' | 'light';
15
14
  /** Value used in chip group context */
16
15
  value?: string;
17
16
  /** Check icon name */
@@ -20,6 +19,8 @@ export interface ChipProps {
20
19
  hideIcon?: boolean;
21
20
  /** Disables the component */
22
21
  disabled?: boolean;
22
+ /** Visual variant */
23
+ variant?: ChipVariant;
23
24
  }
24
25
  type __VLS_Props = ChipProps;
25
26
  type __VLS_ModelProps = {
@@ -26,8 +26,6 @@ const style = computed(() => ({
26
26
  </PopoverDropdown>
27
27
  </template>
28
28
 
29
- <style module lang="postcss">
30
- .dropdown {
31
- padding: 0;
32
- }
29
+ <style module>
30
+ .dropdown{padding:0}
33
31
  </style>
@@ -1,8 +1,8 @@
1
- import type { NuanceSize } from '@nui/types';
1
+ import type { AnyString, NuanceSize } from '@nui/types';
2
2
  import type { BoxProps } from './box.vue.js';
3
3
  export interface ContainerProps extends BoxProps {
4
4
  /** Component size */
5
- size?: NuanceSize | string | number;
5
+ size?: NuanceSize | AnyString;
6
6
  /** Removes max-width constraint */
7
7
  fluid?: boolean;
8
8
  }
@@ -8,7 +8,7 @@ const {
8
8
  fluid,
9
9
  size
10
10
  } = defineProps({
11
- size: { type: [String, Number], required: false },
11
+ size: { type: [String, Object], required: false },
12
12
  fluid: { type: Boolean, required: false },
13
13
  is: { type: null, required: false },
14
14
  mod: { type: [Object, Array, null], required: false }
@@ -1,8 +1,8 @@
1
- import type { NuanceSize } from '@nui/types';
1
+ import type { AnyString, NuanceSize } from '@nui/types';
2
2
  import type { BoxProps } from './box.vue.js';
3
3
  export interface ContainerProps extends BoxProps {
4
4
  /** Component size */
5
- size?: NuanceSize | string | number;
5
+ size?: NuanceSize | AnyString;
6
6
  /** Removes max-width constraint */
7
7
  fluid?: boolean;
8
8
  }
@@ -31,12 +31,12 @@ const {
31
31
  label: { type: String, required: false },
32
32
  required: { type: Boolean, required: false },
33
33
  id: { type: [String, null], required: false },
34
- radius: { type: String, required: false },
35
- size: { type: String, required: false },
34
+ radius: { type: [String, Number, Object], required: false },
35
+ size: { type: [String, Object], required: false },
36
36
  variant: { type: String, required: false },
37
37
  resize: { type: void 0, required: false },
38
- leftSectionPE: { type: null, required: false },
39
- rightSectionPE: { type: null, required: false },
38
+ leftSectionPE: { type: void 0, required: false },
39
+ rightSectionPE: { type: void 0, required: false },
40
40
  readonly: { type: Boolean, required: false },
41
41
  disabled: { type: Boolean, required: false },
42
42
  withSeconds: { type: Boolean, required: false }
@@ -152,10 +152,6 @@ const isClearable = computed(() => clearable && !props.disabled && !props.readon
152
152
  </Popover>
153
153
  </template>
154
154
 
155
- <style lang="postcss" module>
156
- .list {
157
- display: flex;
158
- flex-wrap: wrap;
159
- gap: .25rem;
160
- }
155
+ <style module>
156
+ .list{display:flex;flex-wrap:wrap;gap:.25rem}
161
157
  </style>
@@ -1,17 +1,21 @@
1
1
  <script setup>
2
2
  import ActionIcon from "../../action-icon/action-icon.vue";
3
3
  import { useDialogState } from "../lib";
4
- const { variant = "subtle", icon = "gravity-ui:xmark", ...props } = defineProps({
4
+ const {
5
+ variant = "subtle",
6
+ icon = "gravity-ui:xmark",
7
+ ...props
8
+ } = defineProps({
5
9
  size: { type: null, required: false },
6
- variant: { type: String, required: false },
7
10
  gradient: { type: Object, required: false },
8
- loading: { type: Boolean, required: false },
9
11
  color: { type: null, required: false },
10
- radius: { type: [String, Number], required: false },
11
- classes: { type: Object, required: false },
12
- mod: { type: [Object, Array, null], required: false },
12
+ radius: { type: [String, Number, Object], required: false },
13
+ loading: { type: Boolean, required: false },
13
14
  icon: { type: String, required: false },
14
- disabled: { type: Boolean, required: false }
15
+ disabled: { type: Boolean, required: false },
16
+ mod: { type: [Object, Array, null], required: false },
17
+ variant: { type: String, required: false },
18
+ classes: { type: Object, required: false }
15
19
  });
16
20
  const close = useDialogState();
17
21
  </script>