@bitrix24/b24ui-nuxt 0.2.3 → 0.2.4
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/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/input-number.ts +417 -0
- package/README.md +1 -1
- package/dist/meta.cjs +2321 -14
- package/dist/meta.d.cts +2321 -14
- package/dist/meta.d.mts +2321 -14
- package/dist/meta.d.ts +2321 -14
- package/dist/meta.mjs +2321 -14
- package/dist/module.cjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/DropdownMenu.vue +3 -3
- package/dist/runtime/components/InputNumber.vue +218 -0
- package/dist/runtime/composables/useComponentIcons.d.ts +2 -2
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/shared/{b24ui-nuxt.Ce3hzs_q.cjs → b24ui-nuxt.DGjopCKm.cjs} +399 -0
- package/dist/shared/{b24ui-nuxt.DY8ePXC7.mjs → b24ui-nuxt.V9TzyCqH.mjs} +399 -0
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const defu = require('defu');
|
|
4
4
|
const kit = require('@nuxt/kit');
|
|
5
|
-
const templates = require('./shared/b24ui-nuxt.
|
|
5
|
+
const templates = require('./shared/b24ui-nuxt.DGjopCKm.cjs');
|
|
6
6
|
require('node:url');
|
|
7
7
|
require('scule');
|
|
8
8
|
|
|
@@ -41,6 +41,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
41
41
|
await registerModule("@nuxtjs/color-mode", { classSuffix: "", disableTransition: true });
|
|
42
42
|
}
|
|
43
43
|
kit.addPlugin({ src: resolve("./runtime/plugins/colors") });
|
|
44
|
+
kit.addPlugin({ src: resolve("./runtime/plugins/modal") });
|
|
44
45
|
kit.addComponentsDir({
|
|
45
46
|
path: resolve("./runtime/components"),
|
|
46
47
|
prefix: "B24",
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.
|
|
3
|
+
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.V9TzyCqH.mjs';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import 'scule';
|
|
6
6
|
|
|
@@ -38,6 +38,7 @@ const module = defineNuxtModule({
|
|
|
38
38
|
await registerModule("@nuxtjs/color-mode", { classSuffix: "", disableTransition: true });
|
|
39
39
|
}
|
|
40
40
|
addPlugin({ src: resolve("./runtime/plugins/colors") });
|
|
41
|
+
addPlugin({ src: resolve("./runtime/plugins/modal") });
|
|
41
42
|
addComponentsDir({
|
|
42
43
|
path: resolve("./runtime/components"),
|
|
43
44
|
prefix: "B24",
|
|
@@ -89,7 +89,7 @@ import { defu } from 'defu'
|
|
|
89
89
|
import { DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuArrow, useForwardPropsEmits } from 'reka-ui'
|
|
90
90
|
import { reactivePick } from '@vueuse/core'
|
|
91
91
|
import { omit } from '../utils'
|
|
92
|
-
import
|
|
92
|
+
import B24DropdownMenuContent from './DropdownMenuContent.vue'
|
|
93
93
|
|
|
94
94
|
const props = withDefaults(defineProps<DropdownMenuProps<T>>(), {
|
|
95
95
|
portal: true,
|
|
@@ -115,7 +115,7 @@ const b24ui = computed(() => dropdownMenu({
|
|
|
115
115
|
<slot :open="open" />
|
|
116
116
|
</DropdownMenuTrigger>
|
|
117
117
|
|
|
118
|
-
<
|
|
118
|
+
<B24DropdownMenuContent
|
|
119
119
|
:class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })"
|
|
120
120
|
:b24ui="b24ui"
|
|
121
121
|
:b24ui-override="props.b24ui"
|
|
@@ -130,6 +130,6 @@ const b24ui = computed(() => dropdownMenu({
|
|
|
130
130
|
</template>
|
|
131
131
|
|
|
132
132
|
<DropdownMenuArrow v-if="!!arrow" v-bind="arrowProps" :class="b24ui.arrow({ class: props.b24ui?.arrow })" />
|
|
133
|
-
</
|
|
133
|
+
</B24DropdownMenuContent>
|
|
134
134
|
</DropdownMenuRoot>
|
|
135
135
|
</template>
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { NumberFieldRootProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/b24ui/input-number'
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
|
+
import type { ButtonProps, IconComponent } from '../types'
|
|
9
|
+
|
|
10
|
+
const appConfigInputNumber = _appConfig as AppConfig & { b24ui: { inputNumber: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const inputNumber = tv({ extend: tv(theme), ...(appConfigInputNumber.b24ui?.inputNumber || {}) })
|
|
13
|
+
|
|
14
|
+
type InputNumberVariants = VariantProps<typeof inputNumber>
|
|
15
|
+
|
|
16
|
+
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
|
|
17
|
+
/**
|
|
18
|
+
* The element or component this component should render as.
|
|
19
|
+
* @defaultValue 'div'
|
|
20
|
+
*/
|
|
21
|
+
as?: any
|
|
22
|
+
/** The placeholder text when the input is empty. */
|
|
23
|
+
placeholder?: string
|
|
24
|
+
color?: InputNumberVariants['color']
|
|
25
|
+
size?: InputNumberVariants['size']
|
|
26
|
+
/** Removes padding from input. */
|
|
27
|
+
noPadding?: boolean
|
|
28
|
+
/** removes all borders (rings). */
|
|
29
|
+
noBorder?: boolean
|
|
30
|
+
/** removes all borders (rings) except the bottom one. */
|
|
31
|
+
underline?: boolean
|
|
32
|
+
/** Rounds the corners of the button. */
|
|
33
|
+
rounded?: boolean
|
|
34
|
+
tag?: string
|
|
35
|
+
tagColor?: InputNumberVariants['tagColor']
|
|
36
|
+
/** Highlight the ring color like a focus state. */
|
|
37
|
+
highlight?: boolean
|
|
38
|
+
class?: any
|
|
39
|
+
b24ui?: Partial<typeof inputNumber.slots>
|
|
40
|
+
/**
|
|
41
|
+
* The orientation of the input menu.
|
|
42
|
+
* @defaultValue 'horizontal'
|
|
43
|
+
*/
|
|
44
|
+
orientation?: 'vertical' | 'horizontal'
|
|
45
|
+
/**
|
|
46
|
+
* Configure the increment button. The `size` is inherited.
|
|
47
|
+
* @defaultValue { color: 'link', depth: 'light' }
|
|
48
|
+
*/
|
|
49
|
+
increment?: ButtonProps
|
|
50
|
+
/**
|
|
51
|
+
* The icon displayed to increment the value.
|
|
52
|
+
* @defaultValue icons.plus = Plus30Icon
|
|
53
|
+
*/
|
|
54
|
+
incrementIcon?: IconComponent
|
|
55
|
+
/**
|
|
56
|
+
* Configure the decrement button. The `size` is inherited.
|
|
57
|
+
* @defaultValue { color: 'link', depth: 'light' }
|
|
58
|
+
*/
|
|
59
|
+
decrement?: ButtonProps
|
|
60
|
+
/**
|
|
61
|
+
* The icon displayed to decrement the value.
|
|
62
|
+
* @defaultValue icons.minus = Minus30Icon
|
|
63
|
+
*/
|
|
64
|
+
decrementIcon?: IconComponent
|
|
65
|
+
autofocus?: boolean
|
|
66
|
+
autofocusDelay?: number
|
|
67
|
+
/**
|
|
68
|
+
* The locale to use for formatting and parsing numbers.
|
|
69
|
+
* @defaultValue B24App.locale.code
|
|
70
|
+
*/
|
|
71
|
+
locale?: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface InputNumberEmits {
|
|
75
|
+
(e: 'update:modelValue', payload: number): void
|
|
76
|
+
(e: 'blur', event: FocusEvent): void
|
|
77
|
+
(e: 'change', payload: Event): void
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface InputNumberSlots {
|
|
81
|
+
increment(props?: {}): any
|
|
82
|
+
decrement(props?: {}): any
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import { onMounted, ref, computed } from 'vue'
|
|
88
|
+
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
|
|
89
|
+
import { reactivePick } from '@vueuse/core'
|
|
90
|
+
import { useFormField } from '../composables/useFormField'
|
|
91
|
+
import { useLocale } from '../composables/useLocale'
|
|
92
|
+
import icons from '../dictionary/icons'
|
|
93
|
+
import B24Button from './Button.vue'
|
|
94
|
+
|
|
95
|
+
defineOptions({ inheritAttrs: false })
|
|
96
|
+
|
|
97
|
+
const props = withDefaults(defineProps<InputNumberProps>(), {
|
|
98
|
+
orientation: 'horizontal',
|
|
99
|
+
color: 'primary',
|
|
100
|
+
size: 'md'
|
|
101
|
+
})
|
|
102
|
+
const emits = defineEmits<InputNumberEmits>()
|
|
103
|
+
defineSlots<InputNumberSlots>()
|
|
104
|
+
|
|
105
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emits)
|
|
106
|
+
|
|
107
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField<InputNumberProps>(props)
|
|
108
|
+
|
|
109
|
+
const { t, code: codeLocale } = useLocale()
|
|
110
|
+
const locale = computed(() => props.locale || codeLocale.value)
|
|
111
|
+
|
|
112
|
+
const isTag = computed(() => {
|
|
113
|
+
return props.tag
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const b24ui = computed(() => inputNumber({
|
|
117
|
+
color: color.value,
|
|
118
|
+
size: size.value,
|
|
119
|
+
tagColor: props.tagColor,
|
|
120
|
+
highlight: highlight.value,
|
|
121
|
+
rounded: Boolean(props.rounded),
|
|
122
|
+
noPadding: Boolean(props.noPadding),
|
|
123
|
+
noBorder: Boolean(props.noBorder),
|
|
124
|
+
underline: Boolean(props.underline),
|
|
125
|
+
orientation: props.orientation
|
|
126
|
+
}))
|
|
127
|
+
|
|
128
|
+
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? icons.plus : icons.chevronUp))
|
|
129
|
+
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? icons.minus : icons.chevronDown))
|
|
130
|
+
|
|
131
|
+
const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
|
|
132
|
+
|
|
133
|
+
function autoFocus() {
|
|
134
|
+
if (props.autofocus) {
|
|
135
|
+
inputRef.value?.$el?.focus()
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onMounted(() => {
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
autoFocus()
|
|
142
|
+
}, props.autofocusDelay)
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
function onUpdate(value: number) {
|
|
146
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
147
|
+
const event = new Event('change', { target: { value } })
|
|
148
|
+
emits('change', event)
|
|
149
|
+
|
|
150
|
+
emitFormChange()
|
|
151
|
+
emitFormInput()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function onBlur(event: FocusEvent) {
|
|
155
|
+
emitFormBlur()
|
|
156
|
+
emits('blur', event)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
defineExpose({
|
|
160
|
+
inputRef
|
|
161
|
+
})
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<NumberFieldRoot
|
|
166
|
+
v-bind="rootProps"
|
|
167
|
+
:id="id"
|
|
168
|
+
:class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
|
|
169
|
+
:name="name"
|
|
170
|
+
:disabled="disabled"
|
|
171
|
+
:locale="locale"
|
|
172
|
+
@update:model-value="onUpdate"
|
|
173
|
+
>
|
|
174
|
+
<div v-if="isTag" :class="b24ui.tag({ class: props.b24ui?.tag })">
|
|
175
|
+
{{ props.tag }}
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<NumberFieldInput
|
|
179
|
+
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
180
|
+
ref="inputRef"
|
|
181
|
+
:placeholder="placeholder"
|
|
182
|
+
:required="required"
|
|
183
|
+
:class="b24ui.base({ class: props.b24ui?.base })"
|
|
184
|
+
@blur="onBlur"
|
|
185
|
+
@focus="emitFormFocus"
|
|
186
|
+
/>
|
|
187
|
+
|
|
188
|
+
<div :class="b24ui.increment({ class: props.b24ui?.increment })">
|
|
189
|
+
<NumberFieldIncrement as-child :disabled="disabled">
|
|
190
|
+
<slot name="increment">
|
|
191
|
+
<B24Button
|
|
192
|
+
:icon="incrementIcon"
|
|
193
|
+
:size="size"
|
|
194
|
+
color="link"
|
|
195
|
+
depth="light"
|
|
196
|
+
:aria-label="t('inputNumber.increment')"
|
|
197
|
+
v-bind="typeof increment === 'object' ? increment : undefined"
|
|
198
|
+
/>
|
|
199
|
+
</slot>
|
|
200
|
+
</NumberFieldIncrement>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div :class="b24ui.decrement({ class: props.b24ui?.decrement })">
|
|
204
|
+
<NumberFieldDecrement as-child :disabled="disabled">
|
|
205
|
+
<slot name="decrement">
|
|
206
|
+
<B24Button
|
|
207
|
+
:icon="decrementIcon"
|
|
208
|
+
:size="size"
|
|
209
|
+
color="link"
|
|
210
|
+
depth="light"
|
|
211
|
+
:aria-label="t('inputNumber.decrement')"
|
|
212
|
+
v-bind="typeof decrement === 'object' ? decrement : undefined"
|
|
213
|
+
/>
|
|
214
|
+
</slot>
|
|
215
|
+
</NumberFieldDecrement>
|
|
216
|
+
</div>
|
|
217
|
+
</NumberFieldRoot>
|
|
218
|
+
</template>
|
|
@@ -15,6 +15,6 @@ export interface UseComponentIconsProps {
|
|
|
15
15
|
export declare function useComponentIcons(componentProps: MaybeRefOrGetter<UseComponentIconsProps>): {
|
|
16
16
|
isLeading: import("vue").ComputedRef<any>;
|
|
17
17
|
isTrailing: import("vue").ComputedRef<boolean>;
|
|
18
|
-
leadingIconName: import("vue").ComputedRef<
|
|
19
|
-
trailingIconName: import("vue").ComputedRef<
|
|
18
|
+
leadingIconName: import("vue").ComputedRef<IconComponent | undefined>;
|
|
19
|
+
trailingIconName: import("vue").ComputedRef<IconComponent | undefined>;
|
|
20
20
|
};
|
|
@@ -15,6 +15,7 @@ export * from '../components/Form.vue';
|
|
|
15
15
|
export * from '../components/FormField.vue';
|
|
16
16
|
export * from '../components/Input.vue';
|
|
17
17
|
export * from '../components/InputMenu.vue';
|
|
18
|
+
export * from '../components/InputNumber.vue';
|
|
18
19
|
export * from '../components/Kbd.vue';
|
|
19
20
|
export * from '../components/Link.vue';
|
|
20
21
|
export * from '../components/Modal.vue';
|
|
@@ -15,6 +15,7 @@ export * from "../components/Form.vue";
|
|
|
15
15
|
export * from "../components/FormField.vue";
|
|
16
16
|
export * from "../components/Input.vue";
|
|
17
17
|
export * from "../components/InputMenu.vue";
|
|
18
|
+
export * from "../components/InputNumber.vue";
|
|
18
19
|
export * from "../components/Kbd.vue";
|
|
19
20
|
export * from "../components/Link.vue";
|
|
20
21
|
export * from "../components/Modal.vue";
|