@teammodlr/ui-kit 2.1.8 → 2.1.10
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/lib/components/avatargroup/symbol.d.ts +2 -2
- package/lib/components/breadcrumb/style/index.d.ts +1 -1
- package/lib/components/breadcrumb/symbol.d.ts +1 -1
- package/lib/components/buttongroup/symbol.d.ts +2 -2
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +1 -1
- package/lib/components/dropdown/Dropdown.vue.d.ts +1 -1
- package/lib/components/dropdown/symbol.d.ts +1 -1
- package/lib/components/form/symbol.d.ts +1 -1
- package/lib/components/messageprovider/style/index.d.ts +1 -1
- package/lib/components/modal/Modal.vue.d.ts +6 -3
- package/lib/components/modal/style/Modal.css.d.ts +3 -0
- package/lib/components/radiobuttongroup/symbol.d.ts +2 -2
- package/lib/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/lib/components/tree/props.d.ts +4 -4
- package/lib/components/tree/types.d.ts +10 -10
- package/lib/composables/element.d.ts +1 -1
- package/lib/composables/useInteractive.d.ts +1 -1
- package/lib/composables/useMount.d.ts +1 -1
- package/lib/composables/usePopper.d.ts +2 -2
- package/lib/composables/useZIndex.d.ts +1 -1
- package/lib/index.cjs.js +9 -9
- package/lib/index.es.js +2256 -2213
- package/lib/install.d.ts +1 -1
- package/lib/nuxt.js +17 -15
- package/lib/nuxt.plugin.js +6 -6
- package/lib/style.css +1 -1
- package/package.json +89 -79
- package/src/__storybook__/argTypes.ts +5 -13
- package/src/__storybook__/createStory.ts +10 -10
- package/src/call.ts +14 -14
- package/src/components/avatar/Avatar.vue +1 -1
- package/src/components/avatar/examples/index.stories.ts +4 -7
- package/src/components/avatar/style/Avatar.css.ts +17 -17
- package/src/components/avatargroup/examples/index.stories.ts +5 -10
- package/src/components/avatargroup/style/AvatarGroup.css.ts +9 -4
- package/src/components/avatargroup/symbol.ts +5 -5
- package/src/components/badge/examples/index.stories.ts +4 -6
- package/src/components/badge/style/Badge.css.ts +36 -36
- package/src/components/breadcrumb/examples/index.stories.ts +6 -10
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +17 -17
- package/src/components/breadcrumb/style/index.ts +1 -1
- package/src/components/breadcrumb/symbol.ts +4 -3
- package/src/components/button/examples/index.stories.ts +4 -4
- package/src/components/button/style/Button.css.ts +143 -133
- package/src/components/buttongroup/examples/index.stories.ts +6 -12
- package/src/components/buttongroup/style/ButtonGroup.css.ts +13 -11
- package/src/components/buttongroup/symbol.ts +5 -4
- package/src/components/checkbox/Checkbox.vue +8 -8
- package/src/components/checkbox/examples/index.stories.ts +4 -9
- package/src/components/checkbox/examples/index.ts +0 -1
- package/src/components/checkbox/style/Checkbox.css.ts +31 -27
- package/src/components/checkbox/style/index.ts +1 -1
- package/src/components/colorpicker/examples/index.stories.ts +5 -10
- package/src/components/colorpicker/examples/index.ts +1 -1
- package/src/components/colorpicker/style/ColorPicker.css.ts +22 -14
- package/src/components/colorpicker/utils.ts +46 -28
- package/src/components/confirm/examples/index.stories.ts +5 -8
- package/src/components/confirm/props.ts +2 -2
- package/src/components/confirm/providerProps.ts +1 -2
- package/src/components/confirm/types.ts +15 -16
- package/src/components/confirm/useConfirm.ts +3 -1
- package/src/components/dialog/examples/index.stories.ts +5 -9
- package/src/components/dialog/style/Dialog.css.ts +38 -37
- package/src/components/dropdown/examples/index.stories.ts +3 -7
- package/src/components/dropdown/hooks.ts +20 -20
- package/src/components/dropdown/style/Dropdown.css.ts +24 -24
- package/src/components/dropdown/symbol.ts +3 -2
- package/src/components/form/Form.vue +1 -1
- package/src/components/form/examples/index.stories.ts +2 -4
- package/src/components/form/style/Form.css.ts +13 -8
- package/src/components/form/style/index.ts +2 -2
- package/src/components/form/symbol.ts +10 -5
- package/src/components/image/examples/index.stories.ts +5 -7
- package/src/components/input/Input.vue +8 -9
- package/src/components/input/examples/index.stories.ts +5 -7
- package/src/components/input/style/Input.css.ts +40 -43
- package/src/components/link/examples/index.stories.ts +4 -9
- package/src/components/messageprovider/examples/index.stories.ts +5 -8
- package/src/components/messageprovider/style/Message.css.ts +31 -31
- package/src/components/messageprovider/style/index.ts +1 -1
- package/src/components/messageprovider/types.ts +31 -22
- package/src/components/messageprovider/useMessage.ts +6 -4
- package/src/components/modal/Modal.vue +72 -54
- package/src/components/modal/examples/index.stories.ts +6 -10
- package/src/components/modal/examples/index.ts +1 -0
- package/src/components/modal/examples/sidebar.vue +75 -0
- package/src/components/modal/style/Modal.css.ts +91 -72
- package/src/components/pagination/examples/index.stories.ts +5 -9
- package/src/components/pagination/examples/index.ts +1 -1
- package/src/components/pagination/style/Pagination.css.ts +41 -37
- package/src/components/radio/Radio.vue +7 -7
- package/src/components/radio/examples/index.stories.ts +4 -9
- package/src/components/radio/examples/index.ts +0 -1
- package/src/components/radio/style/Checkbox.css.ts +30 -31
- package/src/components/radio/style/index.ts +1 -1
- package/src/components/radiobutton/RadioButton.vue +3 -3
- package/src/components/radiobutton/style/RadioButton.css.ts +41 -36
- package/src/components/radiobuttongroup/examples/index.stories.ts +6 -10
- package/src/components/radiobuttongroup/examples/index.ts +0 -1
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +14 -14
- package/src/components/radiobuttongroup/style/index.ts +1 -1
- package/src/components/radiobuttongroup/symbol.ts +8 -7
- package/src/components/renderer/examlpes/index.stories.ts +4 -8
- package/src/components/renderer/props.ts +2 -3
- package/src/components/renderer/renderer.ts +3 -3
- package/src/components/select/Select.vue +3 -4
- package/src/components/select/examples/index.stories.ts +4 -10
- package/src/components/select/style/Select.css.ts +62 -61
- package/src/components/skeleton/examples/index.stories.ts +5 -9
- package/src/components/skeleton/style/Skeleton.css.ts +16 -16
- package/src/components/skeleton/style/index.ts +2 -2
- package/src/components/slider/style/Slider.css.ts +12 -5
- package/src/components/switch/Switch.vue +4 -4
- package/src/components/switch/examples/index.stories.ts +4 -9
- package/src/components/switch/examples/index.ts +0 -1
- package/src/components/switch/style/Switch.css.ts +56 -57
- package/src/components/switch/style/index.ts +1 -1
- package/src/components/tab/examples/index.stories.ts +5 -11
- package/src/components/table/examples/index.stories.ts +6 -12
- package/src/components/table/style/Table.css.ts +22 -17
- package/src/components/table/style/index.ts +1 -1
- package/src/components/table/types/index.ts +1 -1
- package/src/components/tag/examples/index.stories.ts +4 -10
- package/src/components/tag/style/Tag.css.ts +14 -9
- package/src/components/textarea/Textarea.vue +7 -8
- package/src/components/textarea/examples/index.stories.ts +4 -8
- package/src/components/textarea/style/Textarea.css.ts +33 -33
- package/src/components/tooltip/examples/index.stories.ts +5 -10
- package/src/components/tooltip/examples/index.ts +2 -2
- package/src/components/tooltip/style/Tooltip.css.ts +24 -25
- package/src/components/transfer/examples/index.stories.ts +5 -9
- package/src/components/transfer/style/Transfer.css.ts +41 -40
- package/src/components/tree/examples/index.stories.ts +6 -10
- package/src/components/tree/props.ts +20 -18
- package/src/components/tree/style/Tree.css.ts +36 -31
- package/src/components/tree/types.ts +60 -62
- package/src/components/virtualscroll/examples/index.stories.ts +4 -8
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +1 -2
- package/src/composables/element.ts +4 -4
- package/src/composables/useCachedUid.ts +7 -6
- package/src/composables/useEventListener.ts +11 -6
- package/src/composables/useInput.ts +63 -41
- package/src/composables/useInteractive.ts +10 -11
- package/src/composables/useMergedState.ts +7 -7
- package/src/composables/useMount.ts +11 -11
- package/src/composables/usePopper.ts +57 -36
- package/src/composables/useZIndex.ts +5 -5
- package/src/create.ts +10 -6
- package/src/examples/cards/cards.stories.ts +3 -3
- package/src/examples/modal/modal.stories.ts +3 -3
- package/src/exports/nuxt.js +17 -15
- package/src/exports/nuxt.plugin.js +6 -6
- package/src/index.ts +0 -2
- package/src/install.ts +5 -5
- package/src/shims-vue.d.ts +3 -3
- package/src/styles/theme.css.ts +51 -43
- package/src/styles/transitions.css.ts +26 -28
- package/src/types/props.ts +16 -2
- package/src/utils/injection.ts +3 -3
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ref,
|
|
3
|
+
watch,
|
|
4
|
+
nextTick,
|
|
5
|
+
onMounted,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
watchEffect
|
|
8
|
+
} from 'vue';
|
|
2
9
|
import { createPopper as createInternalPopper } from '@popperjs/core';
|
|
3
10
|
|
|
4
|
-
import type { Ref, WatchStopHandle } from
|
|
5
|
-
import type {
|
|
11
|
+
import type { Ref, WatchStopHandle } from 'vue';
|
|
12
|
+
import type {
|
|
13
|
+
Placement,
|
|
14
|
+
Modifier,
|
|
15
|
+
Instance,
|
|
16
|
+
Rect,
|
|
17
|
+
VirtualElement
|
|
18
|
+
} from '@popperjs/core';
|
|
6
19
|
|
|
7
20
|
type OffsetsFunction = (options: {
|
|
8
|
-
popper: Rect
|
|
9
|
-
reference: Rect
|
|
10
|
-
placement: Placement
|
|
21
|
+
popper: Rect;
|
|
22
|
+
reference: Rect;
|
|
23
|
+
placement: Placement;
|
|
11
24
|
}) => [number?, number?];
|
|
12
25
|
|
|
13
26
|
interface UsePopperOptions {
|
|
14
|
-
placement: Ref<Placement
|
|
15
|
-
transfer: Ref<boolean | string
|
|
16
|
-
wrapper: Ref<HTMLElement | null | undefined
|
|
17
|
-
isDrop?: boolean
|
|
18
|
-
reference?: Ref<HTMLElement | VirtualElement | null | undefined
|
|
19
|
-
popper?: Ref<HTMLElement | null | undefined
|
|
20
|
-
offset?: OffsetsFunction | [number?, number?]
|
|
27
|
+
placement: Ref<Placement>;
|
|
28
|
+
transfer: Ref<boolean | string>;
|
|
29
|
+
wrapper: Ref<HTMLElement | null | undefined>;
|
|
30
|
+
isDrop?: boolean;
|
|
31
|
+
reference?: Ref<HTMLElement | VirtualElement | null | undefined>;
|
|
32
|
+
popper?: Ref<HTMLElement | null | undefined>;
|
|
33
|
+
offset?: OffsetsFunction | [number?, number?];
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
export type { Placement, VirtualElement };
|
|
@@ -38,7 +51,7 @@ export const placementWhileList = Object.freeze([
|
|
|
38
51
|
'right',
|
|
39
52
|
'right-start',
|
|
40
53
|
'right-end'
|
|
41
|
-
] as Placement[])
|
|
54
|
+
] as Placement[]);
|
|
42
55
|
|
|
43
56
|
export interface TransferNode extends Node {
|
|
44
57
|
__transferNode?: Node;
|
|
@@ -48,13 +61,15 @@ export interface TransferNode extends Node {
|
|
|
48
61
|
export function usePopper(initialOptions: UsePopperOptions) {
|
|
49
62
|
const { placement, transfer, wrapper, isDrop = false } = initialOptions;
|
|
50
63
|
|
|
51
|
-
const reference: Ref<HTMLElement | null | undefined> =
|
|
52
|
-
|
|
53
|
-
const
|
|
64
|
+
const reference: Ref<HTMLElement | null | undefined> =
|
|
65
|
+
(initialOptions.reference as any) ?? ref(null);
|
|
66
|
+
const popper: Ref<HTMLElement | null | undefined> =
|
|
67
|
+
initialOptions.popper ?? ref(null);
|
|
68
|
+
const transferTo: Ref<string> = ref('body');
|
|
54
69
|
|
|
55
70
|
const options: {
|
|
56
|
-
placement: Placement
|
|
57
|
-
modifiers: Partial<Modifier<any, any>>[]
|
|
71
|
+
placement: Placement;
|
|
72
|
+
modifiers: Partial<Modifier<any, any>>[];
|
|
58
73
|
} = {
|
|
59
74
|
placement: placement.value,
|
|
60
75
|
modifiers: [
|
|
@@ -80,12 +95,12 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
80
95
|
phase: 'afterWrite',
|
|
81
96
|
fn({ state }) {
|
|
82
97
|
const origin = setPopperDropOrigin(state.placement);
|
|
83
|
-
|
|
98
|
+
|
|
84
99
|
if (origin) {
|
|
85
100
|
state.elements.popper.style.transformOrigin = origin;
|
|
86
101
|
}
|
|
87
102
|
}
|
|
88
|
-
})
|
|
103
|
+
});
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
if (initialOptions.offset) {
|
|
@@ -94,7 +109,7 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
94
109
|
options: {
|
|
95
110
|
offset: initialOptions.offset
|
|
96
111
|
}
|
|
97
|
-
})
|
|
112
|
+
});
|
|
98
113
|
}
|
|
99
114
|
|
|
100
115
|
let popperInstance: Instance | null = null;
|
|
@@ -104,7 +119,7 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
104
119
|
popperInstance && popperInstance?.setOptions({ placement: value });
|
|
105
120
|
});
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
const parentWidth = ref(0);
|
|
108
123
|
|
|
109
124
|
watchEffect(() => {
|
|
110
125
|
if (wrapper.value && popper.value) {
|
|
@@ -118,7 +133,7 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
118
133
|
watch(transfer, value => {
|
|
119
134
|
setTransformTo(value);
|
|
120
135
|
updatePopper();
|
|
121
|
-
})
|
|
136
|
+
});
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
onMounted(() => {
|
|
@@ -129,11 +144,11 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
129
144
|
|
|
130
145
|
function updatePopper() {
|
|
131
146
|
nextTick(() => {
|
|
132
|
-
popperInstance && popperInstance.forceUpdate()
|
|
133
|
-
if(wrapper.value) {
|
|
147
|
+
popperInstance && popperInstance.forceUpdate();
|
|
148
|
+
if (wrapper.value) {
|
|
134
149
|
parentWidth.value = wrapper.value.clientWidth;
|
|
135
150
|
}
|
|
136
|
-
})
|
|
151
|
+
});
|
|
137
152
|
}
|
|
138
153
|
|
|
139
154
|
function createPopper() {
|
|
@@ -145,19 +160,24 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
145
160
|
const cancelWatchPopper = watch(popper, createPopperInstance);
|
|
146
161
|
|
|
147
162
|
stopWatchPopper = () => {
|
|
148
|
-
cancelWatchReference()
|
|
149
|
-
cancelWatchPopper()
|
|
150
|
-
}
|
|
163
|
+
cancelWatchReference();
|
|
164
|
+
cancelWatchPopper();
|
|
165
|
+
};
|
|
151
166
|
}
|
|
152
167
|
|
|
153
168
|
function setTransformTo(value: boolean | string) {
|
|
154
|
-
transferTo.value =
|
|
169
|
+
transferTo.value =
|
|
170
|
+
typeof value === 'boolean' ? (value ? 'body' : '') : value;
|
|
155
171
|
}
|
|
156
172
|
|
|
157
173
|
function createPopperInstance() {
|
|
158
174
|
if (reference.value && popper.value) {
|
|
159
|
-
popperInstance && popperInstance.destroy()
|
|
160
|
-
popperInstance = createInternalPopper(
|
|
175
|
+
popperInstance && popperInstance.destroy();
|
|
176
|
+
popperInstance = createInternalPopper(
|
|
177
|
+
reference.value,
|
|
178
|
+
popper.value,
|
|
179
|
+
options
|
|
180
|
+
);
|
|
161
181
|
updatePopper();
|
|
162
182
|
}
|
|
163
183
|
}
|
|
@@ -185,10 +205,11 @@ export function usePopper(initialOptions: UsePopperOptions) {
|
|
|
185
205
|
|
|
186
206
|
function setPopperDropOrigin(placement: Placement) {
|
|
187
207
|
if (placement !== 'left' && placement !== 'right') {
|
|
188
|
-
const [placementStart, placementEnd] = placement.split('-')
|
|
208
|
+
const [placementStart, placementEnd] = placement.split('-');
|
|
189
209
|
|
|
190
|
-
return placementStart === 'bottom' ||
|
|
210
|
+
return placementStart === 'bottom' ||
|
|
211
|
+
(placementStart !== 'top' && placementEnd === 'start')
|
|
191
212
|
? 'center top'
|
|
192
|
-
: 'center bottom'
|
|
213
|
+
: 'center bottom';
|
|
193
214
|
}
|
|
194
215
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {InjectionKey, Ref} from
|
|
2
|
-
import {computed, inject, ref, unref} from
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { computed, inject, ref, unref } from 'vue';
|
|
3
3
|
|
|
4
4
|
const zIndex = ref(0);
|
|
5
5
|
export const initialZIndex = 1000;
|
|
@@ -17,7 +17,7 @@ export const useZIndex = (override?: Ref<number>) => {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const current = computed(() => {
|
|
20
|
-
return initial.value + zIndex.value
|
|
20
|
+
return initial.value + zIndex.value;
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
const nextZIndex = () => {
|
|
@@ -29,5 +29,5 @@ export const useZIndex = (override?: Ref<number>) => {
|
|
|
29
29
|
initial,
|
|
30
30
|
current,
|
|
31
31
|
nextZIndex
|
|
32
|
-
}
|
|
33
|
-
}
|
|
32
|
+
};
|
|
33
|
+
};
|
package/src/create.ts
CHANGED
|
@@ -3,13 +3,15 @@ import type { App } from 'vue';
|
|
|
3
3
|
export type ModlrUIOptions = {
|
|
4
4
|
prefix?: string;
|
|
5
5
|
components?: any;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
|
|
8
8
|
const defaultOptions: ModlrUIOptions = {
|
|
9
9
|
prefix: 'M'
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const create = (
|
|
12
|
+
const create = (
|
|
13
|
+
createOptions: ModlrUIOptions = {}
|
|
14
|
+
): { install: (app: App, installOptions?: ModlrUIOptions) => void } => {
|
|
13
15
|
const install = (app: App, installOptions: ModlrUIOptions = {}) => {
|
|
14
16
|
const options = {
|
|
15
17
|
...defaultOptions,
|
|
@@ -19,16 +21,18 @@ const create = (createOptions: ModlrUIOptions = {}) => {
|
|
|
19
21
|
|
|
20
22
|
if (options.components) {
|
|
21
23
|
options.components.forEach((component: any) => {
|
|
22
|
-
const name = component.name.startsWith('M')
|
|
24
|
+
const name = component.name.startsWith('M')
|
|
25
|
+
? component.name.slice(1)
|
|
26
|
+
: component.name;
|
|
23
27
|
|
|
24
|
-
app.component(`${options.prefix}${name}`, component)
|
|
28
|
+
app.component(`${options.prefix}${name}`, component);
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
return {
|
|
30
34
|
install
|
|
31
|
-
}
|
|
32
|
-
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
33
37
|
|
|
34
38
|
export default create;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Sidebar from
|
|
2
|
-
import {createStory} from
|
|
1
|
+
import Sidebar from './sidebar.vue';
|
|
2
|
+
import { createStory } from '../../__storybook__';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
component: Sidebar,
|
|
6
6
|
title: 'Examples/Cards/Sidebar'
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
export const Basic = createStory(Sidebar);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Modal from
|
|
2
|
-
import {createStory} from
|
|
1
|
+
import Modal from './modal.vue';
|
|
2
|
+
import { createStory } from '../../__storybook__';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
component: Modal,
|
|
6
6
|
title: 'Examples/Modals'
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
export const Basic = createStory(Modal);
|
package/src/exports/nuxt.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
1
|
+
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
4
|
export default defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
6
|
name: '@teammodlr/ui-kit',
|
|
7
7
|
configKey: 'modlr',
|
|
8
8
|
compatibility: {
|
|
9
|
-
nuxt: '^3.0.0-rc.1'
|
|
10
|
-
}
|
|
9
|
+
nuxt: '^3.0.0-rc.1'
|
|
10
|
+
}
|
|
11
11
|
},
|
|
12
12
|
defaults: {
|
|
13
|
-
prefix: 'M'
|
|
13
|
+
prefix: 'M'
|
|
14
14
|
},
|
|
15
15
|
async setup(options, nuxt) {
|
|
16
16
|
// Create resolver to resolve relative paths
|
|
17
|
-
const { resolve } = createResolver(import.meta.url)
|
|
17
|
+
const { resolve } = createResolver(import.meta.url);
|
|
18
18
|
|
|
19
|
-
nuxt.options.runtimeConfig.public.modlrUiOptions = options
|
|
19
|
+
nuxt.options.runtimeConfig.public.modlrUiOptions = options;
|
|
20
20
|
|
|
21
21
|
// plugin install
|
|
22
|
-
addPlugin(resolve('./nuxt.plugin.js'))
|
|
22
|
+
addPlugin(resolve('./nuxt.plugin.js'));
|
|
23
23
|
|
|
24
24
|
// nuxt install
|
|
25
|
-
nuxt.hook('components:dirs',
|
|
25
|
+
nuxt.hook('components:dirs', dirs => {
|
|
26
26
|
dirs.push({
|
|
27
|
-
path: fileURLToPath(
|
|
27
|
+
path: fileURLToPath(
|
|
28
|
+
new URL('../src/components', import.meta.url)
|
|
29
|
+
),
|
|
28
30
|
extensions: ['vue', 'tsx'],
|
|
29
|
-
prefix: options?.prefix ? options?.prefix : 'M'
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
})
|
|
31
|
+
prefix: options?.prefix ? options?.prefix : 'M'
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from '#app'
|
|
2
|
-
import create from '../create'
|
|
1
|
+
import { defineNuxtPlugin } from '#app';
|
|
2
|
+
import create from '../create';
|
|
3
3
|
|
|
4
|
-
export default defineNuxtPlugin(
|
|
5
|
-
const UI = create(nuxtApp.$config.modlrUiOptions)
|
|
4
|
+
export default defineNuxtPlugin(nuxtApp => {
|
|
5
|
+
const UI = create(nuxtApp.$config.modlrUiOptions);
|
|
6
6
|
|
|
7
|
-
nuxtApp.vueApp.use(UI)
|
|
8
|
-
})
|
|
7
|
+
nuxtApp.vueApp.use(UI);
|
|
8
|
+
});
|
package/src/index.ts
CHANGED
package/src/install.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as components from './components'
|
|
2
|
-
import create from './create'
|
|
1
|
+
import * as components from './components';
|
|
2
|
+
import create from './create';
|
|
3
3
|
|
|
4
4
|
export default create({
|
|
5
5
|
components: Object.keys(components).map(
|
|
6
|
-
|
|
7
|
-
)
|
|
8
|
-
})
|
|
6
|
+
key => components[key as keyof object]
|
|
7
|
+
)
|
|
8
|
+
});
|
package/src/shims-vue.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// shims-vue.d.ts
|
|
2
2
|
declare module '*.vue' {
|
|
3
|
-
import type { DefineComponent } from 'vue'
|
|
4
|
-
const component: DefineComponent<{}, {}, any
|
|
5
|
-
export default component
|
|
3
|
+
import type { DefineComponent } from 'vue';
|
|
4
|
+
const component: DefineComponent<{}, {}, any>;
|
|
5
|
+
export default component;
|
|
6
6
|
}
|
package/src/styles/theme.css.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createGlobalTheme,
|
|
3
|
+
globalStyle,
|
|
4
|
+
styleVariants
|
|
5
|
+
} from '@vanilla-extract/css';
|
|
2
6
|
|
|
3
7
|
export const spaceScale = {
|
|
4
8
|
'0': '0px',
|
|
@@ -13,57 +17,60 @@ export const spaceScale = {
|
|
|
13
17
|
'5': '18px',
|
|
14
18
|
'6': '20px',
|
|
15
19
|
'7': '24px',
|
|
16
|
-
'8': '28px'
|
|
20
|
+
'8': '28px'
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
export const marginVariants = styleVariants(spaceScale,
|
|
23
|
+
export const marginVariants = styleVariants(spaceScale, space => ({
|
|
20
24
|
margin: space
|
|
21
25
|
}));
|
|
22
26
|
|
|
23
27
|
export const borderRadiusScale = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
none: '0px',
|
|
29
|
+
xsmall: '1px',
|
|
30
|
+
small: '2px',
|
|
31
|
+
default: '4px',
|
|
32
|
+
medium: '6px',
|
|
33
|
+
large: '8px',
|
|
34
|
+
xlarge: '12px',
|
|
35
|
+
full: '9999px'
|
|
32
36
|
};
|
|
33
37
|
|
|
34
|
-
export const borderRadiusVariants = styleVariants(
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
export const borderRadiusVariants = styleVariants(
|
|
39
|
+
borderRadiusScale,
|
|
40
|
+
borderRadius => ({
|
|
41
|
+
borderRadius
|
|
42
|
+
})
|
|
43
|
+
);
|
|
37
44
|
|
|
38
45
|
export const fontSizeScale = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
base: '14px',
|
|
47
|
+
xsmall: '10px',
|
|
48
|
+
small: '12px',
|
|
49
|
+
large: '16px',
|
|
50
|
+
xlarge: '18px',
|
|
51
|
+
xxlarge: '20px'
|
|
45
52
|
};
|
|
46
53
|
|
|
47
|
-
export const fontSizeVariants = styleVariants(fontSizeScale,
|
|
48
|
-
fontSize
|
|
54
|
+
export const fontSizeVariants = styleVariants(fontSizeScale, fontSize => ({
|
|
55
|
+
fontSize
|
|
49
56
|
}));
|
|
50
57
|
|
|
51
58
|
export const shadows = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
59
|
+
sm: '0px 3px 6px 1px rgb(154 161 171 / 15%)',
|
|
60
|
+
md: '0px 4px 10px 1px rgb(154 161 171 / 20%)',
|
|
61
|
+
lg: '0px 7px 14px 1px rgb(154 161 171 / 23%)'
|
|
62
|
+
};
|
|
56
63
|
|
|
57
|
-
export const shadowVariants = styleVariants(shadows,
|
|
64
|
+
export const shadowVariants = styleVariants(shadows, shadow => ({
|
|
58
65
|
boxShadow: shadow
|
|
59
66
|
}));
|
|
60
67
|
|
|
61
68
|
export const transitions = {
|
|
62
|
-
|
|
63
|
-
}
|
|
69
|
+
default: 'cubic-bezier(0.4, 0, 0.2, 1)'
|
|
70
|
+
};
|
|
64
71
|
|
|
65
|
-
export const transitionsVariants = styleVariants(transitions,
|
|
66
|
-
transition
|
|
72
|
+
export const transitionsVariants = styleVariants(transitions, transition => ({
|
|
73
|
+
transition
|
|
67
74
|
}));
|
|
68
75
|
|
|
69
76
|
export const themeVars = createGlobalTheme(':root', {
|
|
@@ -87,7 +94,7 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
87
94
|
600: '#6e7781',
|
|
88
95
|
700: '#57606a',
|
|
89
96
|
800: '#424a53',
|
|
90
|
-
900: '#32383f'
|
|
97
|
+
900: '#32383f'
|
|
91
98
|
},
|
|
92
99
|
blue: {
|
|
93
100
|
50: 'hsl(214,100%,96.9%)',
|
|
@@ -99,7 +106,7 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
99
106
|
600: 'hsl(221,83.2%,53.3%)',
|
|
100
107
|
700: 'hsl(224,76.3%,48%)',
|
|
101
108
|
800: 'hsl(226,70.7%,40.2%)',
|
|
102
|
-
900: 'hsl(224,64.3%,32.9%)'
|
|
109
|
+
900: 'hsl(224,64.3%,32.9%)'
|
|
103
110
|
},
|
|
104
111
|
amber: {
|
|
105
112
|
50: 'hsl(48,100%,96.1%)',
|
|
@@ -111,7 +118,7 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
111
118
|
600: 'hsl(32,94.6%,43.7%)',
|
|
112
119
|
700: 'hsl(26,90.5%,37.1%)',
|
|
113
120
|
800: 'hsl(23,82.5%,31.4%)',
|
|
114
|
-
900: 'hsl(22,77.8%,26.5%)'
|
|
121
|
+
900: 'hsl(22,77.8%,26.5%)'
|
|
115
122
|
},
|
|
116
123
|
red: {
|
|
117
124
|
50: 'hsl(0,85.7%,97.3%)',
|
|
@@ -123,7 +130,7 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
123
130
|
600: 'hsl(0,72.2%,50.6%)',
|
|
124
131
|
700: 'hsl(0,73.7%,41.8%)',
|
|
125
132
|
800: 'hsl(0,70%,35.3%)',
|
|
126
|
-
900: 'hsl(0,62.8%,30.6%)'
|
|
133
|
+
900: 'hsl(0,62.8%,30.6%)'
|
|
127
134
|
},
|
|
128
135
|
green: {
|
|
129
136
|
50: 'hsl(152,81%,95.9%)',
|
|
@@ -135,7 +142,7 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
135
142
|
600: 'hsl(161,93.5%,30.4%)',
|
|
136
143
|
700: 'hsl(163,93.5%,24.3%)',
|
|
137
144
|
800: 'hsl(163,88.1%,19.8%)',
|
|
138
|
-
900: 'hsl(164,85.7%,16.5%)'
|
|
145
|
+
900: 'hsl(164,85.7%,16.5%)'
|
|
139
146
|
},
|
|
140
147
|
primary: 'hsl(217,91.2%,59.8%)',
|
|
141
148
|
saxe: {
|
|
@@ -156,18 +163,19 @@ export const themeVars = createGlobalTheme(':root', {
|
|
|
156
163
|
fontSize: fontSizeScale,
|
|
157
164
|
shadow: shadows,
|
|
158
165
|
transition: transitions,
|
|
159
|
-
rounded: borderRadiusScale
|
|
166
|
+
rounded: borderRadiusScale
|
|
160
167
|
});
|
|
161
168
|
|
|
162
|
-
globalStyle(
|
|
163
|
-
boxSizing: 'border-box'
|
|
169
|
+
globalStyle('*', {
|
|
170
|
+
boxSizing: 'border-box'
|
|
164
171
|
});
|
|
165
172
|
|
|
166
|
-
globalStyle(
|
|
167
|
-
fontFamily:
|
|
173
|
+
globalStyle('html, body', {
|
|
174
|
+
fontFamily:
|
|
175
|
+
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
168
176
|
color: themeVars.color.font.default
|
|
169
177
|
});
|
|
170
178
|
|
|
171
|
-
globalStyle(
|
|
172
|
-
fontWeight:
|
|
179
|
+
globalStyle('strong, h1, h2, h3, h4, h5, h6', {
|
|
180
|
+
fontWeight: '500'
|
|
173
181
|
});
|
|
@@ -1,99 +1,97 @@
|
|
|
1
1
|
import { style, globalKeyframes } from '@vanilla-extract/css';
|
|
2
|
-
import { themeVars } from
|
|
2
|
+
import { themeVars } from './theme.css';
|
|
3
3
|
|
|
4
|
-
const FADE_NAME =
|
|
4
|
+
const FADE_NAME = 'fade';
|
|
5
5
|
const FADE_DURATION = 0.2;
|
|
6
6
|
globalKeyframes(FADE_NAME, {
|
|
7
7
|
from: {
|
|
8
|
-
opacity: 0
|
|
8
|
+
opacity: 0
|
|
9
9
|
},
|
|
10
10
|
to: {
|
|
11
|
-
opacity: 1
|
|
12
|
-
}
|
|
11
|
+
opacity: 1
|
|
12
|
+
}
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const fade = {
|
|
16
16
|
enterActive: style({
|
|
17
|
-
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default}
|
|
17
|
+
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default}`
|
|
18
18
|
}),
|
|
19
19
|
|
|
20
20
|
leaveActive: style({
|
|
21
|
-
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default} reverse
|
|
21
|
+
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default} reverse`
|
|
22
22
|
}),
|
|
23
23
|
|
|
24
24
|
enterFrom: style({
|
|
25
|
-
opacity: 0
|
|
25
|
+
opacity: 0
|
|
26
26
|
}),
|
|
27
27
|
|
|
28
28
|
leaveTo: style({
|
|
29
|
-
opacity: 0
|
|
30
|
-
})
|
|
29
|
+
opacity: 0
|
|
30
|
+
})
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const SCALE_NAME =
|
|
33
|
+
const SCALE_NAME = 'scale';
|
|
34
34
|
const SCALE_DURATION = 0.12;
|
|
35
35
|
globalKeyframes(SCALE_NAME, {
|
|
36
36
|
'0%': {
|
|
37
37
|
opacity: 0,
|
|
38
|
-
scale: 0.95
|
|
38
|
+
scale: 0.95
|
|
39
39
|
},
|
|
40
40
|
'100%': {
|
|
41
41
|
opacity: 1,
|
|
42
42
|
scale: 1
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export const scale = {
|
|
47
47
|
enterActive: style({
|
|
48
|
-
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default}
|
|
48
|
+
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default}`
|
|
49
49
|
}),
|
|
50
50
|
|
|
51
51
|
leaveActive: style({
|
|
52
|
-
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default} reverse
|
|
52
|
+
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default} reverse`
|
|
53
53
|
}),
|
|
54
54
|
|
|
55
55
|
enterFrom: style({
|
|
56
|
-
opacity: 0
|
|
56
|
+
opacity: 0
|
|
57
57
|
}),
|
|
58
58
|
|
|
59
59
|
leaveTo: style({
|
|
60
|
-
opacity: 0
|
|
61
|
-
})
|
|
60
|
+
opacity: 0
|
|
61
|
+
})
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
const MODAL_NAME = "modal";
|
|
64
|
+
const MODAL_NAME = 'modal';
|
|
66
65
|
const MODAL_DURATION = 0.18;
|
|
67
66
|
globalKeyframes(MODAL_NAME, {
|
|
68
67
|
'0%': {
|
|
69
68
|
opacity: 0,
|
|
70
69
|
scale: 0.95,
|
|
71
70
|
// offset bottom
|
|
72
|
-
transformOrigin:
|
|
71
|
+
transformOrigin: 'bottom',
|
|
73
72
|
transform: `translateY(10%)`
|
|
74
73
|
},
|
|
75
74
|
'100%': {
|
|
76
75
|
opacity: 1,
|
|
77
76
|
scale: 1,
|
|
78
77
|
transform: `translateY(0%)`
|
|
79
|
-
}
|
|
78
|
+
}
|
|
80
79
|
});
|
|
81
80
|
|
|
82
81
|
export const modalScale = {
|
|
83
82
|
enterActive: style({
|
|
84
|
-
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default}
|
|
83
|
+
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default}`
|
|
85
84
|
}),
|
|
86
85
|
|
|
87
86
|
leaveActive: style({
|
|
88
|
-
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default} reverse
|
|
87
|
+
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default} reverse`
|
|
89
88
|
}),
|
|
90
89
|
|
|
91
90
|
enterFrom: style({
|
|
92
|
-
opacity: 0
|
|
91
|
+
opacity: 0
|
|
93
92
|
}),
|
|
94
93
|
|
|
95
94
|
leaveTo: style({
|
|
96
|
-
opacity: 0
|
|
97
|
-
})
|
|
95
|
+
opacity: 0
|
|
96
|
+
})
|
|
98
97
|
};
|
|
99
|
-
|