nuance-ui 0.2.7 → 0.2.9

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 (172) hide show
  1. package/LICENSE.md +9 -9
  2. package/README.md +75 -75
  3. package/dist/module.json +1 -1
  4. package/dist/runtime/components/action-icon/action-icon-group.vue +3 -3
  5. package/dist/runtime/components/action-icon/action-icon.d.vue.ts +1 -1
  6. package/dist/runtime/components/action-icon/action-icon.vue.d.ts +1 -1
  7. package/dist/runtime/components/app-shell/app-shell-aside.vue +30 -30
  8. package/dist/runtime/components/app-shell/app-shell-footer.vue +29 -29
  9. package/dist/runtime/components/app-shell/app-shell-header.vue +30 -30
  10. package/dist/runtime/components/app-shell/app-shell-main.vue +18 -18
  11. package/dist/runtime/components/app-shell/app-shell-navbar.vue +34 -34
  12. package/dist/runtime/components/app-shell/app-shell-section.vue +10 -10
  13. package/dist/runtime/components/app-shell/app-shell.vue +34 -34
  14. package/dist/runtime/components/breadcrumbs.vue +78 -78
  15. package/dist/runtime/components/button/button.d.vue.ts +5 -3
  16. package/dist/runtime/components/button/button.vue +7 -3
  17. package/dist/runtime/components/button/button.vue.d.ts +5 -3
  18. package/dist/runtime/components/button/unstyled-button.vue +23 -23
  19. package/dist/runtime/components/calendar/calendar.d.vue.ts +1 -1
  20. package/dist/runtime/components/calendar/calendar.vue.d.ts +1 -1
  21. package/dist/runtime/components/calendar/types.d.ts +4 -3
  22. package/dist/runtime/components/calendar/ui/core/calendar-header.d.vue.ts +7 -1
  23. package/dist/runtime/components/calendar/ui/core/calendar-header.vue +95 -95
  24. package/dist/runtime/components/calendar/ui/core/calendar-header.vue.d.ts +7 -1
  25. package/dist/runtime/components/calendar/ui/core/calendar-root.vue +3 -3
  26. package/dist/runtime/components/calendar/ui/levels/calendar-decade.d.vue.ts +3 -1
  27. package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue +40 -40
  28. package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue.d.ts +3 -1
  29. package/dist/runtime/components/calendar/ui/levels/calendar-month.d.vue.ts +2 -1
  30. package/dist/runtime/components/calendar/ui/levels/calendar-month.vue.d.ts +2 -1
  31. package/dist/runtime/components/calendar/ui/levels/calendar-year.d.vue.ts +3 -1
  32. package/dist/runtime/components/calendar/ui/levels/calendar-year.vue +40 -40
  33. package/dist/runtime/components/calendar/ui/levels/calendar-year.vue.d.ts +3 -1
  34. package/dist/runtime/components/card/card-section.d.vue.ts +2 -1
  35. package/dist/runtime/components/card/card-section.vue +3 -3
  36. package/dist/runtime/components/card/card-section.vue.d.ts +2 -1
  37. package/dist/runtime/components/card/card.d.vue.ts +1 -0
  38. package/dist/runtime/components/card/card.vue +3 -3
  39. package/dist/runtime/components/card/card.vue.d.ts +1 -0
  40. package/dist/runtime/components/checkbox/checkbox-card.d.vue.ts +4 -1
  41. package/dist/runtime/components/checkbox/checkbox-card.vue.d.ts +4 -1
  42. package/dist/runtime/components/checkbox/checkbox-indicator.d.vue.ts +6 -0
  43. package/dist/runtime/components/checkbox/checkbox-indicator.vue +117 -117
  44. package/dist/runtime/components/checkbox/checkbox-indicator.vue.d.ts +6 -0
  45. package/dist/runtime/components/checkbox/checkbox.d.vue.ts +12 -2
  46. package/dist/runtime/components/checkbox/checkbox.vue.d.ts +12 -2
  47. package/dist/runtime/components/chip/chip-group.d.vue.ts +3 -0
  48. package/dist/runtime/components/chip/chip-group.vue +2 -2
  49. package/dist/runtime/components/chip/chip-group.vue.d.ts +3 -0
  50. package/dist/runtime/components/chip/chip.d.vue.ts +9 -0
  51. package/dist/runtime/components/chip/chip.vue.d.ts +9 -0
  52. package/dist/runtime/components/combobox/combobox-dropdown.vue +14 -14
  53. package/dist/runtime/components/combobox/combobox-empty.vue +3 -3
  54. package/dist/runtime/components/combobox/combobox-group.d.vue.ts +1 -0
  55. package/dist/runtime/components/combobox/combobox-group.vue +21 -21
  56. package/dist/runtime/components/combobox/combobox-group.vue.d.ts +1 -0
  57. package/dist/runtime/components/combobox/combobox-option-list.vue +3 -3
  58. package/dist/runtime/components/combobox/combobox-option.d.vue.ts +3 -0
  59. package/dist/runtime/components/combobox/combobox-option.vue +22 -22
  60. package/dist/runtime/components/combobox/combobox-option.vue.d.ts +3 -0
  61. package/dist/runtime/components/combobox/combobox-options-dropdown.d.vue.ts +10 -0
  62. package/dist/runtime/components/combobox/combobox-options-dropdown.vue.d.ts +10 -0
  63. package/dist/runtime/components/combobox/combobox-root.d.vue.ts +8 -4
  64. package/dist/runtime/components/combobox/combobox-root.vue +3 -3
  65. package/dist/runtime/components/combobox/combobox-root.vue.d.ts +8 -4
  66. package/dist/runtime/components/combobox/combobox-target.vue +3 -3
  67. package/dist/runtime/components/combobox/types.d.ts +11 -0
  68. package/dist/runtime/components/container.d.vue.ts +2 -0
  69. package/dist/runtime/components/container.vue +8 -8
  70. package/dist/runtime/components/container.vue.d.ts +2 -0
  71. package/dist/runtime/components/date-time-picker.d.vue.ts +3 -3
  72. package/dist/runtime/components/date-time-picker.vue +66 -66
  73. package/dist/runtime/components/date-time-picker.vue.d.ts +3 -3
  74. package/dist/runtime/components/dialog/types.d.ts +1 -0
  75. package/dist/runtime/components/dialog/ui/dialog-close-button.vue +11 -11
  76. package/dist/runtime/components/dialog/ui/dialog-header.vue +5 -5
  77. package/dist/runtime/components/dialog/ui/dialog-title.vue +5 -5
  78. package/dist/runtime/components/drawer/drawer-close-button.vue +3 -3
  79. package/dist/runtime/components/drawer/drawer-header.vue +3 -3
  80. package/dist/runtime/components/drawer/drawer-root.vue +15 -15
  81. package/dist/runtime/components/drawer/drawer-title.vue +3 -3
  82. package/dist/runtime/components/files/file-upload-button.d.vue.ts +4 -2
  83. package/dist/runtime/components/files/file-upload-button.vue.d.ts +4 -2
  84. package/dist/runtime/components/files/file-upload-icon.d.vue.ts +4 -2
  85. package/dist/runtime/components/files/file-upload-icon.vue.d.ts +4 -2
  86. package/dist/runtime/components/input/date-picker.vue +85 -85
  87. package/dist/runtime/components/input/email-input.d.vue.ts +5 -5
  88. package/dist/runtime/components/input/email-input.vue +21 -22
  89. package/dist/runtime/components/input/email-input.vue.d.ts +5 -5
  90. package/dist/runtime/components/input/lib/input-wrapper.context.d.ts +8 -2
  91. package/dist/runtime/components/input/number-input.d.vue.ts +7 -5
  92. package/dist/runtime/components/input/number-input.vue +136 -132
  93. package/dist/runtime/components/input/number-input.vue.d.ts +7 -5
  94. package/dist/runtime/components/input/password-input.vue +29 -28
  95. package/dist/runtime/components/input/text-input.d.vue.ts +7 -5
  96. package/dist/runtime/components/input/text-input.vue +6 -3
  97. package/dist/runtime/components/input/text-input.vue.d.ts +7 -5
  98. package/dist/runtime/components/input/ui/input-inline.d.vue.ts +7 -3
  99. package/dist/runtime/components/input/ui/input-inline.vue.d.ts +7 -3
  100. package/dist/runtime/components/input/ui/input-wrapper.d.vue.ts +4 -1
  101. package/dist/runtime/components/input/ui/input-wrapper.vue.d.ts +4 -1
  102. package/dist/runtime/components/link/link-button.vue +17 -16
  103. package/dist/runtime/components/link/link.vue +10 -10
  104. package/dist/runtime/components/loader/_loaders/bars-loader.vue +5 -5
  105. package/dist/runtime/components/loader/_loaders/dots-loader.vue +5 -5
  106. package/dist/runtime/components/loader/_loaders/oval-loader.vue +1 -1
  107. package/dist/runtime/components/modal/modal-close-button.vue +3 -3
  108. package/dist/runtime/components/modal/modal-header.vue +3 -3
  109. package/dist/runtime/components/modal/modal-root.vue +13 -13
  110. package/dist/runtime/components/modal/modal-title.vue +3 -3
  111. package/dist/runtime/components/nav-link/nav-icon-link.vue +15 -15
  112. package/dist/runtime/components/nav-link/nav-link.d.vue.ts +6 -4
  113. package/dist/runtime/components/nav-link/nav-link.vue +135 -131
  114. package/dist/runtime/components/nav-link/nav-link.vue.d.ts +6 -4
  115. package/dist/runtime/components/paper.d.vue.ts +3 -1
  116. package/dist/runtime/components/paper.vue.d.ts +3 -1
  117. package/dist/runtime/components/popover/popover-dropdown.vue +69 -70
  118. package/dist/runtime/components/popover/popover-target.vue +8 -8
  119. package/dist/runtime/components/popover/popover.vue +1 -1
  120. package/dist/runtime/components/progress/progress-label.vue +3 -3
  121. package/dist/runtime/components/progress/progress-root.vue +3 -3
  122. package/dist/runtime/components/progress/progress-section.d.vue.ts +1 -1
  123. package/dist/runtime/components/progress/progress-section.vue +8 -8
  124. package/dist/runtime/components/progress/progress-section.vue.d.ts +1 -1
  125. package/dist/runtime/components/progress/progress.vue +9 -9
  126. package/dist/runtime/components/renderless/renderless.vue +3 -3
  127. package/dist/runtime/components/roving-focus/roving-focus-item.vue +14 -14
  128. package/dist/runtime/components/select.d.vue.ts +2 -0
  129. package/dist/runtime/components/select.vue.d.ts +2 -0
  130. package/dist/runtime/components/switch/switch-group.vue +16 -16
  131. package/dist/runtime/components/table/table.d.ts +30 -30
  132. package/dist/runtime/components/table/types.d.ts +10 -1
  133. package/dist/runtime/components/table/ui/table-sortable-header.vue +12 -11
  134. package/dist/runtime/components/tabs/tabs-list.d.vue.ts +2 -0
  135. package/dist/runtime/components/tabs/tabs-list.vue +10 -10
  136. package/dist/runtime/components/tabs/tabs-list.vue.d.ts +2 -0
  137. package/dist/runtime/components/tabs/tabs-panel.d.vue.ts +1 -0
  138. package/dist/runtime/components/tabs/tabs-panel.vue +11 -11
  139. package/dist/runtime/components/tabs/tabs-panel.vue.d.ts +1 -0
  140. package/dist/runtime/components/tabs/tabs-root.d.vue.ts +36 -9
  141. package/dist/runtime/components/tabs/tabs-root.vue +8 -8
  142. package/dist/runtime/components/tabs/tabs-root.vue.d.ts +36 -9
  143. package/dist/runtime/components/tabs/tabs-tab.d.vue.ts +7 -3
  144. package/dist/runtime/components/tabs/tabs-tab.vue +25 -22
  145. package/dist/runtime/components/tabs/tabs-tab.vue.d.ts +7 -3
  146. package/dist/runtime/components/text.d.vue.ts +6 -1
  147. package/dist/runtime/components/text.vue +67 -67
  148. package/dist/runtime/components/text.vue.d.ts +6 -1
  149. package/dist/runtime/components/textarea.d.vue.ts +7 -5
  150. package/dist/runtime/components/textarea.vue +38 -35
  151. package/dist/runtime/components/textarea.vue.d.ts +7 -5
  152. package/dist/runtime/components/title.d.vue.ts +5 -0
  153. package/dist/runtime/components/title.vue +14 -14
  154. package/dist/runtime/components/title.vue.d.ts +5 -0
  155. package/dist/runtime/components/transition.d.vue.ts +12 -2
  156. package/dist/runtime/components/transition.vue +3 -3
  157. package/dist/runtime/components/transition.vue.d.ts +12 -2
  158. package/dist/runtime/components/tree/_ui/tree-item.d.vue.ts +1 -0
  159. package/dist/runtime/components/tree/_ui/tree-item.vue +128 -129
  160. package/dist/runtime/components/tree/_ui/tree-item.vue.d.ts +1 -0
  161. package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +8 -0
  162. package/dist/runtime/components/tree/_ui/tree-root.vue +21 -21
  163. package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +8 -0
  164. package/dist/runtime/components/tree/lib/context.d.ts +15 -0
  165. package/dist/runtime/components/tree/types.d.ts +9 -0
  166. package/dist/runtime/components/visually-hidden/visually-hidden-input.d.vue.ts +2 -0
  167. package/dist/runtime/components/visually-hidden/visually-hidden-input.vue.d.ts +2 -0
  168. package/dist/runtime/components/visually-hidden/visually-hidden.d.vue.ts +1 -0
  169. package/dist/runtime/components/visually-hidden/visually-hidden.vue +9 -9
  170. package/dist/runtime/components/visually-hidden/visually-hidden.vue.d.ts +1 -0
  171. package/dist/runtime/styles/dark-theme.css +1 -1
  172. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
1
  <script setup>
2
2
  import TextInput from "./text-input.vue";
3
- const props = defineProps({
3
+ const { icon = "gravity-ui:at", ...rest } = defineProps({
4
4
  multiline: { type: Boolean, required: false },
5
5
  withAria: { type: Boolean, required: false },
6
6
  classes: { type: Object, required: false },
7
+ icon: { type: String, required: false },
7
8
  error: { type: String, required: false },
8
9
  description: { type: String, required: false },
9
10
  label: { type: String, required: false },
@@ -21,25 +22,23 @@ const props = defineProps({
21
22
  </script>
22
23
 
23
24
  <template>
24
- <TextInput type='email' v-bind='props'>
25
- <template #leftSection>
26
- <slot name='leftSection'>
27
- <Icon name='gravity-ui:at' />
28
- </slot>
29
- </template>
30
-
31
- <template v-if='!!$slots.rightSection' #rightSection>
32
- <slot name='rightSection' />
33
- </template>
34
-
35
- <template v-if='!!$slots.label' #label>
36
- <slot name='label' />
37
- </template>
38
- <template v-if='!!$slots.error' #error>
39
- <slot name='error' />
40
- </template>
41
- <template v-if='!!$slots.description' #description>
42
- <slot name='description' />
43
- </template>
44
- </TextInput>
25
+ <TextInput type='email' :icon v-bind='rest'>
26
+ <template v-if='!!$slots.leftSection' #leftSection>
27
+ <slot name='leftSection' />
28
+ </template>
29
+
30
+ <template v-if='!!$slots.rightSection' #rightSection>
31
+ <slot name='rightSection' />
32
+ </template>
33
+
34
+ <template v-if='!!$slots.label' #label>
35
+ <slot name='label' />
36
+ </template>
37
+ <template v-if='!!$slots.error' #error>
38
+ <slot name='error' />
39
+ </template>
40
+ <template v-if='!!$slots.description' #description>
41
+ <slot name='description' />
42
+ </template>
43
+ </TextInput>
45
44
  </template>
@@ -1,15 +1,15 @@
1
1
  import type { TextInputProps } from './index.js';
2
- declare var __VLS_9: {}, __VLS_17: {}, __VLS_20: {}, __VLS_23: {}, __VLS_26: {};
2
+ declare var __VLS_9: {}, __VLS_12: {}, __VLS_15: {}, __VLS_18: {}, __VLS_21: {};
3
3
  type __VLS_Slots = {} & {
4
4
  leftSection?: (props: typeof __VLS_9) => any;
5
5
  } & {
6
- rightSection?: (props: typeof __VLS_17) => any;
6
+ rightSection?: (props: typeof __VLS_12) => any;
7
7
  } & {
8
- label?: (props: typeof __VLS_20) => any;
8
+ label?: (props: typeof __VLS_15) => any;
9
9
  } & {
10
- error?: (props: typeof __VLS_23) => any;
10
+ error?: (props: typeof __VLS_18) => any;
11
11
  } & {
12
- description?: (props: typeof __VLS_26) => any;
12
+ description?: (props: typeof __VLS_21) => any;
13
13
  };
14
14
  declare const __VLS_base: import("vue").DefineComponent<TextInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
15
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -4,15 +4,21 @@ import type { InputVariant } from '../types.js';
4
4
  export interface WrapperContext {
5
5
  /** Id used to bind input and label, auto-generated if not provided */
6
6
  id?: string | null;
7
+ /** Marks the field as required */
7
8
  required?: boolean;
9
+ /** Border radius */
8
10
  radius?: NuanceSize | string;
11
+ /** Component size */
9
12
  size?: NuanceSize | string;
13
+ /** Visual variant */
10
14
  variant?: InputVariant;
15
+ /** Enables multiline (textarea) mode */
11
16
  multiline?: boolean;
17
+ /** CSS resize behavior for multiline inputs */
12
18
  resize?: CSSProperties['resize'];
13
- /** section pointer-events */
19
+ /** `pointer-events` value for the left section */
14
20
  leftSectionPE?: CSSStyleDeclaration['pointerEvents'];
15
- /** section pointer-events */
21
+ /** `pointer-events` value for the right section */
16
22
  rightSectionPE?: CSSStyleDeclaration['pointerEvents'];
17
23
  }
18
24
  export declare const useProvideInputWrapper: (init: any) => any;
@@ -9,23 +9,25 @@ export interface NumberInputProps extends InputBaseProps, Omit<InputWrapperProps
9
9
  step?: number;
10
10
  /** Determines whether the up/down controls should be hidden, `false` by default */
11
11
  hideControls?: boolean;
12
+ /** Icon displayed in the left section */
13
+ icon?: string;
12
14
  }
13
15
  type __VLS_Props = NumberInputProps;
14
16
  type __VLS_ModelProps = {
15
17
  modelValue?: number;
16
18
  };
17
19
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
- declare var __VLS_15: {}, __VLS_19: {}, __VLS_48: {}, __VLS_51: {}, __VLS_54: {};
20
+ declare var __VLS_15: {}, __VLS_24: {}, __VLS_53: {}, __VLS_56: {}, __VLS_59: {};
19
21
  type __VLS_Slots = {} & {
20
22
  leftSection?: (props: typeof __VLS_15) => any;
21
23
  } & {
22
- rightSection?: (props: typeof __VLS_19) => any;
24
+ rightSection?: (props: typeof __VLS_24) => any;
23
25
  } & {
24
- label?: (props: typeof __VLS_48) => any;
26
+ label?: (props: typeof __VLS_53) => any;
25
27
  } & {
26
- error?: (props: typeof __VLS_51) => any;
28
+ error?: (props: typeof __VLS_56) => any;
27
29
  } & {
28
- description?: (props: typeof __VLS_54) => any;
30
+ description?: (props: typeof __VLS_59) => any;
29
31
  };
30
32
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
33
  "update:modelValue": (value: number) => any;
@@ -9,6 +9,7 @@ const {
9
9
  max = Number.MAX_SAFE_INTEGER,
10
10
  step = 1,
11
11
  hideControls,
12
+ icon,
12
13
  rightSectionPE = "all",
13
14
  ...rest
14
15
  } = defineProps({
@@ -16,6 +17,7 @@ const {
16
17
  max: { type: Number, required: false },
17
18
  step: { type: Number, required: false },
18
19
  hideControls: { type: Boolean, required: false },
20
+ icon: { type: String, required: false },
19
21
  readonly: { type: Boolean, required: false },
20
22
  disabled: { type: Boolean, required: false },
21
23
  error: { type: String, required: false },
@@ -47,139 +49,141 @@ function handleBlur() {
47
49
  </script>
48
50
 
49
51
  <template>
50
- <InputWrapper v-bind='rest' :class='$style.root' :right-section-p-e>
51
- <BaseInput>
52
- <template v-if='!!$slots.leftSection' #leftSection>
53
- <slot name='leftSection' />
54
- </template>
55
-
56
- <template #default='{ id, css }'>
57
- <input
58
- :id
59
- v-model='value'
60
- :class='css'
61
- :min
62
- :max
63
- :step
64
- type='number'
65
- @focus='focused = true'
66
- @blur='handleBlur()'
67
- @wheel.prevent='handleWheel'
68
- >
69
- </template>
70
-
71
- <template v-if='!!$slots.rightSection || !hideControls' #rightSection>
72
- <slot name='rightSection'>
73
- <div :class='$style.controls'>
74
- <UnstyledButton
75
- :class='$style.control'
76
- :disabled='disabled || typeof value === "number" && !Number.isNaN(max) && value >= max'
77
- @click='value = clamp(value + step, min, max)'
78
- >
79
- <Icon name='gravity-ui:chevron-up' />
80
- </UnstyledButton>
81
- <UnstyledButton
82
- :class='$style.control'
83
- :disabled='disabled || typeof value === "number" && !Number.isNaN(min) && value <= min'
84
- @click='value = clamp(value - step, min, max)'
85
- >
86
- <Icon name='gravity-ui:chevron-down' />
87
- </UnstyledButton>
88
- </div>
89
- </slot>
90
- </template>
91
- </BaseInput>
92
-
93
- <template v-if='!!$slots.label' #label>
94
- <slot name='label' />
95
- </template>
96
- <template v-if='!!$slots.error' #error>
97
- <slot name='error' />
98
- </template>
99
- <template v-if='!!$slots.description' #description>
100
- <slot name='description' />
101
- </template>
102
- </InputWrapper>
52
+ <InputWrapper v-bind='rest' :class='$style.root' :right-section-p-e>
53
+ <BaseInput>
54
+ <template v-if='!!$slots.leftSection || icon' #leftSection>
55
+ <slot name='leftSection'>
56
+ <Icon v-if='icon' :name='icon' />
57
+ </slot>
58
+ </template>
59
+
60
+ <template #default='{ id, css }'>
61
+ <input
62
+ :id
63
+ v-model='value'
64
+ :class='css'
65
+ :min
66
+ :max
67
+ :step
68
+ type='number'
69
+ @focus='focused = true'
70
+ @blur='handleBlur()'
71
+ @wheel.prevent='handleWheel'
72
+ >
73
+ </template>
74
+
75
+ <template v-if='!!$slots.rightSection || !hideControls' #rightSection>
76
+ <slot name='rightSection'>
77
+ <div :class='$style.controls'>
78
+ <UnstyledButton
79
+ :class='$style.control'
80
+ :disabled='disabled || typeof value === "number" && !Number.isNaN(max) && value >= max'
81
+ @click='value = clamp(value + step, min, max)'
82
+ >
83
+ <Icon name='gravity-ui:chevron-up' />
84
+ </UnstyledButton>
85
+ <UnstyledButton
86
+ :class='$style.control'
87
+ :disabled='disabled || typeof value === "number" && !Number.isNaN(min) && value <= min'
88
+ @click='value = clamp(value - step, min, max)'
89
+ >
90
+ <Icon name='gravity-ui:chevron-down' />
91
+ </UnstyledButton>
92
+ </div>
93
+ </slot>
94
+ </template>
95
+ </BaseInput>
96
+
97
+ <template v-if='!!$slots.label' #label>
98
+ <slot name='label' />
99
+ </template>
100
+ <template v-if='!!$slots.error' #error>
101
+ <slot name='error' />
102
+ </template>
103
+ <template v-if='!!$slots.description' #description>
104
+ <slot name='description' />
105
+ </template>
106
+ </InputWrapper>
103
107
  </template>
104
108
 
105
109
  <style module lang="postcss">
106
- .root {
107
- --ni-right-section-width-xs: rem(17px);
108
- --ni-right-section-width-sm: rem(24px);
109
- --ni-right-section-width-md: rem(27px);
110
- --ni-right-section-width-lg: rem(31px);
111
- --ni-right-section-width-xl: rem(34px);
112
- }
113
-
114
- .controls {
115
- --ni-chevron-size-xs: rem(10px);
116
- --ni-chevron-size-sm: rem(14px);
117
- --ni-chevron-size-md: rem(16px);
118
- --ni-chevron-size-lg: rem(18px);
119
- --ni-chevron-size-xl: rem(20px);
120
- --ni-chevron-size: var(--ni-chevron-size-sm);
121
-
122
- display: flex;
123
- flex-direction: column;
124
-
125
- width: 100%;
126
- max-width: calc(var(--ni-chevron-size) * 1.7);
127
- height: calc(var(--input-height) - rem(2px));
128
- margin-inline-start: auto;
129
- }
130
-
131
- .control {
132
- --control-border: 1px solid var(--input-bd);
133
- --control-radius: calc(var(--input-radius) - rem(1px));
134
-
135
- cursor: pointer;
136
-
137
- display: flex;
138
-
139
- flex: 0 0 50%;
140
- align-items: center;
141
- justify-content: center;
142
-
143
- width: 100%;
144
- height: calc(var(--input-height) / 2 - rem(1px));
145
- padding: 0;
146
- border-inline-start: var(--control-border);
147
-
148
- color: var(--color-text);
149
-
150
- background-color: transparent;
151
-
152
- &:where(:disabled) {
153
- cursor: not-allowed;
154
-
155
- color: var(--color-disabled-text);
156
-
157
- opacity: 0.6;
158
- background-color: transparent;
159
- }
160
-
161
- .root[data-error] :where(&) {
162
- color: var(--color-error);
163
- }
164
-
165
- &:where(:first-of-type) {
166
- border-radius: 0;
167
- border-start-end-radius: var(--control-radius);
168
- }
169
-
170
- &:last-of-type {
171
- border-radius: 0;
172
- border-end-end-radius: var(--control-radius);
173
- }
174
-
175
- @mixin hover {
176
- @mixin where-light {
177
- background-color: var(--color-gray-0);
178
- }
179
-
180
- @mixin where-dark {
181
- background-color: var(--color-dark-4);
182
- }
183
- }
184
- }
110
+ .root {
111
+ --ni-right-section-width-xs: rem(17px);
112
+ --ni-right-section-width-sm: rem(24px);
113
+ --ni-right-section-width-md: rem(27px);
114
+ --ni-right-section-width-lg: rem(31px);
115
+ --ni-right-section-width-xl: rem(34px);
116
+ }
117
+
118
+ .controls {
119
+ --ni-chevron-size-xs: rem(10px);
120
+ --ni-chevron-size-sm: rem(14px);
121
+ --ni-chevron-size-md: rem(16px);
122
+ --ni-chevron-size-lg: rem(18px);
123
+ --ni-chevron-size-xl: rem(20px);
124
+ --ni-chevron-size: var(--ni-chevron-size-sm);
125
+
126
+ display: flex;
127
+ flex-direction: column;
128
+
129
+ width: 100%;
130
+ max-width: calc(var(--ni-chevron-size) * 1.7);
131
+ height: calc(var(--input-height) - rem(2px));
132
+ margin-inline-start: auto;
133
+ }
134
+
135
+ .control {
136
+ --control-border: 1px solid var(--input-bd);
137
+ --control-radius: calc(var(--input-radius) - rem(1px));
138
+
139
+ cursor: pointer;
140
+
141
+ display: flex;
142
+
143
+ flex: 0 0 50%;
144
+ align-items: center;
145
+ justify-content: center;
146
+
147
+ width: 100%;
148
+ height: calc(var(--input-height) / 2 - rem(1px));
149
+ padding: 0;
150
+ border-inline-start: var(--control-border);
151
+
152
+ color: var(--color-text);
153
+
154
+ background-color: transparent;
155
+
156
+ &:where(:disabled) {
157
+ cursor: not-allowed;
158
+
159
+ color: var(--color-disabled-text);
160
+
161
+ opacity: 0.6;
162
+ background-color: transparent;
163
+ }
164
+
165
+ .root[data-error] :where(&) {
166
+ color: var(--color-error);
167
+ }
168
+
169
+ &:where(:first-of-type) {
170
+ border-radius: 0;
171
+ border-start-end-radius: var(--control-radius);
172
+ }
173
+
174
+ &:last-of-type {
175
+ border-radius: 0;
176
+ border-end-end-radius: var(--control-radius);
177
+ }
178
+
179
+ @mixin hover {
180
+ @mixin where-light {
181
+ background-color: var(--color-gray-0);
182
+ }
183
+
184
+ @mixin where-dark {
185
+ background-color: var(--color-dark-4);
186
+ }
187
+ }
188
+ }
185
189
  </style>
@@ -9,23 +9,25 @@ export interface NumberInputProps extends InputBaseProps, Omit<InputWrapperProps
9
9
  step?: number;
10
10
  /** Determines whether the up/down controls should be hidden, `false` by default */
11
11
  hideControls?: boolean;
12
+ /** Icon displayed in the left section */
13
+ icon?: string;
12
14
  }
13
15
  type __VLS_Props = NumberInputProps;
14
16
  type __VLS_ModelProps = {
15
17
  modelValue?: number;
16
18
  };
17
19
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
- declare var __VLS_15: {}, __VLS_19: {}, __VLS_48: {}, __VLS_51: {}, __VLS_54: {};
20
+ declare var __VLS_15: {}, __VLS_24: {}, __VLS_53: {}, __VLS_56: {}, __VLS_59: {};
19
21
  type __VLS_Slots = {} & {
20
22
  leftSection?: (props: typeof __VLS_15) => any;
21
23
  } & {
22
- rightSection?: (props: typeof __VLS_19) => any;
24
+ rightSection?: (props: typeof __VLS_24) => any;
23
25
  } & {
24
- label?: (props: typeof __VLS_48) => any;
26
+ label?: (props: typeof __VLS_53) => any;
25
27
  } & {
26
- error?: (props: typeof __VLS_51) => any;
28
+ error?: (props: typeof __VLS_56) => any;
27
29
  } & {
28
- description?: (props: typeof __VLS_54) => any;
30
+ description?: (props: typeof __VLS_59) => any;
29
31
  };
30
32
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
33
  "update:modelValue": (value: number) => any;
@@ -6,6 +6,7 @@ const props = defineProps({
6
6
  multiline: { type: Boolean, required: false },
7
7
  withAria: { type: Boolean, required: false },
8
8
  classes: { type: Object, required: false },
9
+ icon: { type: String, required: false },
9
10
  error: { type: String, required: false },
10
11
  description: { type: String, required: false },
11
12
  label: { type: String, required: false },
@@ -24,32 +25,32 @@ const password = ref(true);
24
25
  </script>
25
26
 
26
27
  <template>
27
- <TextInput
28
- v-bind='props'
29
- :type='password ? "password" : "text"'
30
- right-section-p-e='all'
31
- >
32
- <template #rightSection>
33
- <slot name='rightSection'>
34
- <ActionIcon variant='subtle' @click='password = !password'>
35
- <Icon v-if='password' name='gravity-ui:eye' />
36
- <Icon v-else name='gravity-ui:eye-slash' />
37
- </ActionIcon>
38
- </slot>
39
- </template>
40
-
41
- <template v-if='!!$slots.leftSection' #leftSection>
42
- <slot name='leftSection' />
43
- </template>
44
-
45
- <template v-if='!!$slots.label' #label>
46
- <slot name='label' />
47
- </template>
48
- <template v-if='!!$slots.error' #error>
49
- <slot name='error' />
50
- </template>
51
- <template v-if='!!$slots.description' #description>
52
- <slot name='description' />
53
- </template>
54
- </TextInput>
28
+ <TextInput
29
+ v-bind='props'
30
+ :type='password ? "password" : "text"'
31
+ right-section-p-e='all'
32
+ >
33
+ <template #rightSection>
34
+ <slot name='rightSection'>
35
+ <ActionIcon variant='subtle' @click='password = !password'>
36
+ <Icon v-if='password' name='gravity-ui:eye' />
37
+ <Icon v-else name='gravity-ui:eye-slash' />
38
+ </ActionIcon>
39
+ </slot>
40
+ </template>
41
+
42
+ <template v-if='!!$slots.leftSection' #leftSection>
43
+ <slot name='leftSection' />
44
+ </template>
45
+
46
+ <template v-if='!!$slots.label' #label>
47
+ <slot name='label' />
48
+ </template>
49
+ <template v-if='!!$slots.error' #error>
50
+ <slot name='error' />
51
+ </template>
52
+ <template v-if='!!$slots.description' #description>
53
+ <slot name='description' />
54
+ </template>
55
+ </TextInput>
55
56
  </template>
@@ -8,23 +8,25 @@ export interface TextInputProps extends InputWrapperProps, InputBaseProps {
8
8
  withAria?: boolean;
9
9
  /** Styles API */
10
10
  classes?: Classes<'wrapper' | 'input'>;
11
+ /** Icon displayed in the left section */
12
+ icon?: string;
11
13
  }
12
14
  type __VLS_Props = TextInputProps;
13
15
  type __VLS_ModelProps = {
14
16
  modelValue?: string;
15
17
  };
16
18
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
- declare var __VLS_15: {}, __VLS_19: {}, __VLS_22: {}, __VLS_25: {}, __VLS_28: {};
19
+ declare var __VLS_15: {}, __VLS_24: {}, __VLS_27: {}, __VLS_30: {}, __VLS_33: {};
18
20
  type __VLS_Slots = {} & {
19
21
  leftSection?: (props: typeof __VLS_15) => any;
20
22
  } & {
21
- rightSection?: (props: typeof __VLS_19) => any;
23
+ rightSection?: (props: typeof __VLS_24) => any;
22
24
  } & {
23
- label?: (props: typeof __VLS_22) => any;
25
+ label?: (props: typeof __VLS_27) => any;
24
26
  } & {
25
- error?: (props: typeof __VLS_25) => any;
27
+ error?: (props: typeof __VLS_30) => any;
26
28
  } & {
27
- description?: (props: typeof __VLS_28) => any;
29
+ description?: (props: typeof __VLS_33) => any;
28
30
  };
29
31
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
30
32
  readonly $el: HTMLElement | null | undefined;
@@ -3,10 +3,11 @@ import { unrefElement } from "@vueuse/core";
3
3
  import { useTemplateRef } from "vue";
4
4
  import BaseInput from "./ui/input-base.vue";
5
5
  import InputWrapper from "./ui/input-wrapper.vue";
6
- const { classes, ...props } = defineProps({
6
+ const { classes, icon, ...props } = defineProps({
7
7
  multiline: { type: Boolean, required: false },
8
8
  withAria: { type: Boolean, required: false },
9
9
  classes: { type: Object, required: false },
10
+ icon: { type: String, required: false },
10
11
  error: { type: String, required: false },
11
12
  description: { type: String, required: false },
12
13
  label: { type: String, required: false },
@@ -33,8 +34,10 @@ defineExpose({
33
34
  <template>
34
35
  <InputWrapper v-bind='props' :class='[$attrs.class, classes?.wrapper]'>
35
36
  <BaseInput>
36
- <template v-if='!!$slots.leftSection' #leftSection>
37
- <slot name='leftSection' />
37
+ <template v-if='!!$slots.leftSection || icon' #leftSection>
38
+ <slot name='leftSection'>
39
+ <Icon v-if='icon' :name='icon' />
40
+ </slot>
38
41
  </template>
39
42
 
40
43
  <template #default='{ id, css }'>
@@ -8,23 +8,25 @@ export interface TextInputProps extends InputWrapperProps, InputBaseProps {
8
8
  withAria?: boolean;
9
9
  /** Styles API */
10
10
  classes?: Classes<'wrapper' | 'input'>;
11
+ /** Icon displayed in the left section */
12
+ icon?: string;
11
13
  }
12
14
  type __VLS_Props = TextInputProps;
13
15
  type __VLS_ModelProps = {
14
16
  modelValue?: string;
15
17
  };
16
18
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
- declare var __VLS_15: {}, __VLS_19: {}, __VLS_22: {}, __VLS_25: {}, __VLS_28: {};
19
+ declare var __VLS_15: {}, __VLS_24: {}, __VLS_27: {}, __VLS_30: {}, __VLS_33: {};
18
20
  type __VLS_Slots = {} & {
19
21
  leftSection?: (props: typeof __VLS_15) => any;
20
22
  } & {
21
- rightSection?: (props: typeof __VLS_19) => any;
23
+ rightSection?: (props: typeof __VLS_24) => any;
22
24
  } & {
23
- label?: (props: typeof __VLS_22) => any;
25
+ label?: (props: typeof __VLS_27) => any;
24
26
  } & {
25
- error?: (props: typeof __VLS_25) => any;
27
+ error?: (props: typeof __VLS_30) => any;
26
28
  } & {
27
- description?: (props: typeof __VLS_28) => any;
29
+ description?: (props: typeof __VLS_33) => any;
28
30
  };
29
31
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
30
32
  readonly $el: HTMLElement | null | undefined;
@@ -3,17 +3,21 @@ import type { BoxProps } from '../../box.vue.js';
3
3
  export interface InlineInputProps extends BoxProps {
4
4
  /** Input id */
5
5
  id: string;
6
+ /** Label text */
6
7
  label?: string;
8
+ /** Helper text displayed below the label */
7
9
  description?: string;
10
+ /** Error message displayed below the label */
8
11
  error?: string;
9
- /** Disabled input prop */
12
+ /** Disables the component */
10
13
  disabled?: boolean | undefined;
11
14
  /** Component size */
12
15
  size?: NuanceSize | string;
16
+ /** Position of the label relative to the input control */
13
17
  labelPosition?: 'left' | 'right';
14
- /** Body html element */
18
+ /** HTML element used for the body wrapper */
15
19
  bodyElement?: keyof HTMLElementTagNameMap;
16
- /** Label html element */
20
+ /** HTML element used for the label */
17
21
  labelElement?: keyof HTMLElementTagNameMap;
18
22
  }
19
23
  declare var __VLS_14: {}, __VLS_22: {}, __VLS_30: {}, __VLS_38: {};