numori-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +651 -0
- package/README.md +466 -0
- package/dist/components/Alert.js +137 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/Avatar.js +133 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.js +93 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Button.js +428 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/ButtonsGroup.js +153 -0
- package/dist/components/ButtonsGroup.js.map +1 -0
- package/dist/components/Checkbox.js +93 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Divider.js +79 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Dropdown.js +166 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/DropdownItem.js +106 -0
- package/dist/components/DropdownItem.js.map +1 -0
- package/dist/components/DropdownRow.js +41 -0
- package/dist/components/DropdownRow.js.map +1 -0
- package/dist/components/DropdownSubmenu.js +142 -0
- package/dist/components/DropdownSubmenu.js.map +1 -0
- package/dist/components/FileInput.js +122 -0
- package/dist/components/FileInput.js.map +1 -0
- package/dist/components/FormField.js +112 -0
- package/dist/components/FormField.js.map +1 -0
- package/dist/components/Input.js +603 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Kbd.js +35 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/ListMenu.js +143 -0
- package/dist/components/ListMenu.js.map +1 -0
- package/dist/components/ListMenuItem.js +189 -0
- package/dist/components/ListMenuItem.js.map +1 -0
- package/dist/components/Modal.js +206 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/Numpad.js +123 -0
- package/dist/components/Numpad.js.map +1 -0
- package/dist/components/Popup.js +170 -0
- package/dist/components/Popup.js.map +1 -0
- package/dist/components/ProgressBar.js +118 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/Prompt.js +201 -0
- package/dist/components/Prompt.js.map +1 -0
- package/dist/components/Radio.js +81 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/Select.js +441 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Slider.js +116 -0
- package/dist/components/Slider.js.map +1 -0
- package/dist/components/Stepper.js +65 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/Toggle.js +133 -0
- package/dist/components/Toggle.js.map +1 -0
- package/dist/components/Tooltip.js +120 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/index.js +81 -0
- package/dist/components/index.js.map +1 -0
- package/dist/composables/onClickOutside.js +51 -0
- package/dist/composables/onClickOutside.js.map +1 -0
- package/dist/composables/useBackButton.js +98 -0
- package/dist/composables/useBackButton.js.map +1 -0
- package/dist/composables/useEventListener.js +63 -0
- package/dist/composables/useEventListener.js.map +1 -0
- package/dist/icons/Icon.js +120 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/mdi.js +69 -0
- package/dist/icons/mdi.js.map +1 -0
- package/dist/icons/registry.js +63 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/icons/resolver.js +49 -0
- package/dist/icons/resolver.js.map +1 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +157 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.js +89 -0
- package/dist/manifest.js.map +1 -0
- package/dist/numori-ui.css +184 -0
- package/dist/nuxt.d.ts +35 -0
- package/dist/nuxt.mjs +243 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.mjs +187 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +138 -0
- package/src/components/Alert.vue +127 -0
- package/src/components/Avatar.vue +100 -0
- package/src/components/Badge.vue +77 -0
- package/src/components/Button.vue +419 -0
- package/src/components/ButtonsGroup.vue +140 -0
- package/src/components/Checkbox.vue +81 -0
- package/src/components/Divider.vue +64 -0
- package/src/components/Dropdown.vue +150 -0
- package/src/components/DropdownItem.vue +78 -0
- package/src/components/DropdownRow.vue +37 -0
- package/src/components/DropdownSubmenu.vue +127 -0
- package/src/components/FileInput.vue +107 -0
- package/src/components/FormField.vue +86 -0
- package/src/components/Input.vue +619 -0
- package/src/components/Kbd.vue +30 -0
- package/src/components/ListMenu.vue +127 -0
- package/src/components/ListMenuItem.vue +171 -0
- package/src/components/Modal.vue +209 -0
- package/src/components/Numpad.vue +118 -0
- package/src/components/Popup.vue +156 -0
- package/src/components/ProgressBar.vue +107 -0
- package/src/components/Prompt.vue +161 -0
- package/src/components/Radio.vue +50 -0
- package/src/components/Select.vue +470 -0
- package/src/components/Slider.vue +93 -0
- package/src/components/Stepper.vue +53 -0
- package/src/components/Toggle.vue +125 -0
- package/src/components/Tooltip.vue +113 -0
- package/src/components/index.js +109 -0
- package/src/composables/onClickOutside.js +61 -0
- package/src/composables/useBackButton.js +98 -0
- package/src/composables/useEventListener.js +65 -0
- package/src/icons/Icon.vue +139 -0
- package/src/icons/mdi.js +67 -0
- package/src/icons/registry.js +64 -0
- package/src/icons/resolver.js +48 -0
- package/src/index.js +167 -0
- package/src/manifest.js +86 -0
- package/src/nuxt.js +315 -0
- package/src/style.css +20 -0
- package/src/tailwind.css +18 -0
- package/src/theme.css +172 -0
- package/src/vite.js +235 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[containerClasses, bordered ? borderClass : '']" role="alert">
|
|
3
|
+
<div v-if="icon || $slots.icon" :class="hasBody ? 'flex gap-2' : 'flex items-center gap-2'">
|
|
4
|
+
<slot name="icon">
|
|
5
|
+
<UiIcon
|
|
6
|
+
v-if="icon"
|
|
7
|
+
:name="icon"
|
|
8
|
+
:class="[iconClasses, hasBody ? 'mt-0.5' : '']"
|
|
9
|
+
class="shrink-0"
|
|
10
|
+
/>
|
|
11
|
+
</slot>
|
|
12
|
+
<div class="flex-1 min-w-0">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<template v-else>
|
|
17
|
+
<slot />
|
|
18
|
+
</template>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
/**
|
|
24
|
+
* UiAlert — Inline alert/callout box for errors, warnings, success, and info messages.
|
|
25
|
+
*
|
|
26
|
+
* Renders a rounded box with colored background, optional leading icon, and optional
|
|
27
|
+
* border. Supports four color themes and two sizes. Content is passed via the default
|
|
28
|
+
* slot for maximum flexibility (plain text, rich HTML, or structured layouts).
|
|
29
|
+
*
|
|
30
|
+
* @example Simple error message
|
|
31
|
+
* <UiAlert color="red">Something went wrong.</UiAlert>
|
|
32
|
+
*
|
|
33
|
+
* @example Warning with icon and border
|
|
34
|
+
* <UiAlert color="amber" icon="mdi:alert-outline" bordered>
|
|
35
|
+
* <p class="font-semibold">Warning</p>
|
|
36
|
+
* <p>This action cannot be undone.</p>
|
|
37
|
+
* </UiAlert>
|
|
38
|
+
*
|
|
39
|
+
* @example Success feedback
|
|
40
|
+
* <UiAlert color="green" icon="mdi:check-circle">Saved successfully.</UiAlert>
|
|
41
|
+
*
|
|
42
|
+
* @example Compact error (xs size)
|
|
43
|
+
* <UiAlert color="red" size="xs">Invalid email address</UiAlert>
|
|
44
|
+
*
|
|
45
|
+
* @slot default — Alert content (plain text, rich HTML, or structured layouts)
|
|
46
|
+
* @slot icon — Custom icon element (replaces the icon prop)
|
|
47
|
+
*/
|
|
48
|
+
import { computed, useSlots } from 'vue'
|
|
49
|
+
import UiIcon from '../icons/Icon.vue'
|
|
50
|
+
const props = defineProps({
|
|
51
|
+
/**
|
|
52
|
+
* Color theme for background and text.
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @default 'red'
|
|
55
|
+
* @values 'red' | 'amber' | 'green' | 'blue' | 'gray'
|
|
56
|
+
*/
|
|
57
|
+
color: { type: String, default: 'red' },
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Optional MDI icon name displayed at the start.
|
|
61
|
+
* @type {string}
|
|
62
|
+
* @default ''
|
|
63
|
+
*/
|
|
64
|
+
icon: { type: String, default: '' },
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Show a colored border around the alert.
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
bordered: { type: Boolean, default: false },
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Size preset controlling padding and font size.
|
|
75
|
+
* @type {string}
|
|
76
|
+
* @default 'sm'
|
|
77
|
+
* @values 'xs' (compact, text-xs) | 'sm' (standard, text-xs) | 'md' (spacious, text-sm)
|
|
78
|
+
*/
|
|
79
|
+
size: { type: String, default: 'sm' },
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const slots = useSlots()
|
|
83
|
+
// Detect if slot has multiple elements (structured body) for icon alignment
|
|
84
|
+
const hasBody = computed(() => {
|
|
85
|
+
const children = slots.default?.()
|
|
86
|
+
return children && children.length > 1
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const containerClasses = computed(() => {
|
|
90
|
+
const sizeMap = {
|
|
91
|
+
xs: 'px-3 py-2 rounded-lg text-xs',
|
|
92
|
+
sm: 'px-3 py-2 rounded-lg text-xs',
|
|
93
|
+
md: 'px-3 py-2.5 rounded-lg text-sm',
|
|
94
|
+
}
|
|
95
|
+
const colorMap = {
|
|
96
|
+
red: 'bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300',
|
|
97
|
+
amber: 'bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300',
|
|
98
|
+
green: 'bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300',
|
|
99
|
+
blue: 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300',
|
|
100
|
+
gray: 'bg-gray-50 dark:bg-gray-800 text-gray-700 dark:text-gray-300',
|
|
101
|
+
}
|
|
102
|
+
return `${sizeMap[props.size] || sizeMap.sm} ${colorMap[props.color] || colorMap.red}`
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
const borderClass = computed(() => {
|
|
106
|
+
const map = {
|
|
107
|
+
red: 'border border-red-300 dark:border-red-800',
|
|
108
|
+
amber: 'border border-amber-200 dark:border-amber-800',
|
|
109
|
+
green: 'border border-green-300 dark:border-green-800',
|
|
110
|
+
blue: 'border border-blue-300 dark:border-blue-800',
|
|
111
|
+
gray: 'border border-gray-200 dark:border-gray-700',
|
|
112
|
+
}
|
|
113
|
+
return map[props.color] || map.red
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const iconClasses = computed(() => {
|
|
117
|
+
const sizeMap = { xs: 'w-3.5 h-3.5', sm: 'w-4 h-4', md: 'w-5 h-5' }
|
|
118
|
+
const colorMap = {
|
|
119
|
+
red: 'text-red-600 dark:text-red-400',
|
|
120
|
+
amber: 'text-amber-600 dark:text-amber-400',
|
|
121
|
+
green: 'text-green-600 dark:text-green-400',
|
|
122
|
+
blue: 'text-blue-600 dark:text-blue-400',
|
|
123
|
+
gray: 'text-gray-500 dark:text-gray-400',
|
|
124
|
+
}
|
|
125
|
+
return `${sizeMap[props.size] || sizeMap.sm} ${colorMap[props.color] || colorMap.red}`
|
|
126
|
+
})
|
|
127
|
+
</script>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Circular avatar container with image or fallback icon -->
|
|
3
|
+
<div
|
|
4
|
+
class="rounded-full flex items-center justify-center overflow-hidden shrink-0"
|
|
5
|
+
:class="[sizeClass, bgClass, ringClass]"
|
|
6
|
+
>
|
|
7
|
+
<img v-if="src" :src="src" :alt="alt" class="w-full h-full object-cover" />
|
|
8
|
+
<UiIcon v-else :name="fallbackIcon" :class="iconSizeClass" />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
/**
|
|
14
|
+
* UiAvatar — Circular avatar component displaying an image or a fallback icon.
|
|
15
|
+
*
|
|
16
|
+
* When a `src` URL is provided, renders a cover-fit image. Otherwise, displays
|
|
17
|
+
* a configurable fallback icon on a colored background. Supports five sizes,
|
|
18
|
+
* two color themes for the fallback state, and an optional ring border.
|
|
19
|
+
*
|
|
20
|
+
* @example Image avatar
|
|
21
|
+
* <UiAvatar src="/img/user.jpg" alt="Jane Doe" size="lg" />
|
|
22
|
+
*
|
|
23
|
+
* @example Fallback icon avatar with ring
|
|
24
|
+
* <UiAvatar size="md" color="primary" ring />
|
|
25
|
+
*
|
|
26
|
+
* @example Small gray avatar with custom icon
|
|
27
|
+
* <UiAvatar size="sm" color="gray" fallback-icon="mdi:account-group" />
|
|
28
|
+
*/
|
|
29
|
+
import { computed } from 'vue'
|
|
30
|
+
import UiIcon from '../icons/Icon.vue'
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
/**
|
|
33
|
+
* Image source URL. When empty, the fallback icon is shown.
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @default ''
|
|
36
|
+
*/
|
|
37
|
+
src: { type: String, default: '' },
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Alt text for the avatar image (accessibility).
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @default 'Avatar'
|
|
43
|
+
*/
|
|
44
|
+
alt: { type: String, default: 'Avatar' },
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Avatar size controlling width, height, and icon dimensions.
|
|
48
|
+
* @type {string}
|
|
49
|
+
* @default 'md'
|
|
50
|
+
* @values 'xs' (24px) | 'sm' (32px) | 'md' (36px) | 'lg' (48px) | 'xl' (64px)
|
|
51
|
+
*/
|
|
52
|
+
size: { type: String, default: 'md' },
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* MDI icon name used when no image src is provided.
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @default 'mdi:account'
|
|
58
|
+
*/
|
|
59
|
+
fallbackIcon: { type: String, default: 'mdi:account' },
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Background color theme for the fallback icon state.
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @default 'primary'
|
|
65
|
+
* @values 'primary' | 'gray'
|
|
66
|
+
*/
|
|
67
|
+
color: { type: String, default: 'primary' },
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Show a ring border around the avatar for emphasis.
|
|
71
|
+
* @type {boolean}
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
ring: { type: Boolean, default: false },
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const sizeClass = computed(() => {
|
|
78
|
+
const map = { xs: 'w-6 h-6', sm: 'w-8 h-8', md: 'w-9 h-9', lg: 'w-12 h-12', xl: 'w-16 h-16' }
|
|
79
|
+
return map[props.size] || map.md
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const iconSizeClass = computed(() => {
|
|
83
|
+
const map = { xs: 'w-3 h-3', sm: 'w-4 h-4', md: 'w-5 h-5', lg: 'w-6 h-6', xl: 'w-8 h-8' }
|
|
84
|
+
return map[props.size] || map.md
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Only apply background color when showing the fallback icon (not when an image is loaded)
|
|
88
|
+
const bgClass = computed(() => {
|
|
89
|
+
if (props.src) return ''
|
|
90
|
+
const map = {
|
|
91
|
+
primary: 'bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400',
|
|
92
|
+
gray: 'bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400',
|
|
93
|
+
}
|
|
94
|
+
return map[props.color] || map.primary
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const ringClass = computed(() =>
|
|
98
|
+
props.ring ? 'ring-2 ring-primary-200 dark:ring-primary-800 shadow-sm' : '',
|
|
99
|
+
)
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Inline pill badge with optional leading icon -->
|
|
3
|
+
<span :class="classes">
|
|
4
|
+
<UiIcon v-if="icon" :name="icon" :class="iconSizeClass" class="shrink-0" />
|
|
5
|
+
<slot />
|
|
6
|
+
</span>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
/**
|
|
11
|
+
* UiBadge — Inline pill-shaped badge with color themes, sizes, and optional icon.
|
|
12
|
+
*
|
|
13
|
+
* Renders a small rounded-full label suitable for status indicators, tags, or counts.
|
|
14
|
+
* Supports five color themes and three sizes. An optional leading icon is sized
|
|
15
|
+
* proportionally to the badge size.
|
|
16
|
+
*
|
|
17
|
+
* @example Primary badge
|
|
18
|
+
* <UiBadge>New</UiBadge>
|
|
19
|
+
*
|
|
20
|
+
* @example Red badge with icon
|
|
21
|
+
* <UiBadge color="red" icon="mdi:alert-circle">Error</UiBadge>
|
|
22
|
+
*
|
|
23
|
+
* @example Medium green badge
|
|
24
|
+
* <UiBadge color="green" size="md">Active</UiBadge>
|
|
25
|
+
*
|
|
26
|
+
* @slot default — Badge text or content
|
|
27
|
+
*/
|
|
28
|
+
import { computed } from 'vue'
|
|
29
|
+
import UiIcon from '../icons/Icon.vue'
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
/**
|
|
32
|
+
* Color theme for the badge background and text.
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @default 'primary'
|
|
35
|
+
* @values 'primary' | 'gray' | 'red' | 'green' | 'amber'
|
|
36
|
+
*/
|
|
37
|
+
color: { type: String, default: 'primary' },
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Badge size controlling padding and font size.
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @default 'xs'
|
|
43
|
+
* @values 'xs' | 'sm' | 'md'
|
|
44
|
+
*/
|
|
45
|
+
size: { type: String, default: 'xs' },
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Optional MDI icon name displayed before the slot content.
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @default ''
|
|
51
|
+
*/
|
|
52
|
+
icon: { type: String, default: '' },
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const classes = computed(() => {
|
|
56
|
+
const base = 'inline-flex items-center gap-1 rounded-full font-medium'
|
|
57
|
+
const sizeMap = {
|
|
58
|
+
xs: 'px-1.5 py-0.5 text-[10px]',
|
|
59
|
+
sm: 'px-2 py-0.5 text-xs',
|
|
60
|
+
md: 'px-2.5 py-1 text-xs',
|
|
61
|
+
}
|
|
62
|
+
const colorMap = {
|
|
63
|
+
primary: 'bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300',
|
|
64
|
+
gray: 'bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400',
|
|
65
|
+
red: 'bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300',
|
|
66
|
+
green: 'bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300',
|
|
67
|
+
amber: 'bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300',
|
|
68
|
+
}
|
|
69
|
+
return `${base} ${sizeMap[props.size] || sizeMap.xs} ${colorMap[props.color] || colorMap.primary}`
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Icon dimensions scale with badge size for visual balance
|
|
73
|
+
const iconSizeClass = computed(() => {
|
|
74
|
+
const map = { xs: 'w-3 h-3', sm: 'w-3.5 h-3.5', md: 'w-4 h-4' }
|
|
75
|
+
return map[props.size] || map.xs
|
|
76
|
+
})
|
|
77
|
+
</script>
|