@sabrenski/spire-ui 0.0.1
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 +21 -0
- package/README.md +233 -0
- package/dist/index.d.ts +4981 -0
- package/dist/spire-ui.css +1 -0
- package/dist/spire-ui.es.js +18403 -0
- package/dist/spire-ui.umd.js +45 -0
- package/package.json +83 -0
- package/src/components/Accordion/Accordion.test.ts +218 -0
- package/src/components/Accordion/AccordionContent.vue +112 -0
- package/src/components/Accordion/AccordionItem.vue +87 -0
- package/src/components/Accordion/AccordionRoot.vue +111 -0
- package/src/components/Accordion/AccordionTrigger.vue +125 -0
- package/src/components/Accordion/index.ts +11 -0
- package/src/components/Accordion/keys.ts +23 -0
- package/src/components/Avatar/Avatar.test.ts +181 -0
- package/src/components/Avatar/Avatar.vue +150 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.test.ts +141 -0
- package/src/components/Badge/Badge.vue +133 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/BadgeContainer/BadgeContainer.test.ts +150 -0
- package/src/components/BadgeContainer/BadgeContainer.vue +90 -0
- package/src/components/BadgeContainer/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.test.ts +342 -0
- package/src/components/Breadcrumb/BreadcrumbEllipsis.vue +96 -0
- package/src/components/Breadcrumb/BreadcrumbItem.vue +16 -0
- package/src/components/Breadcrumb/BreadcrumbLink.vue +67 -0
- package/src/components/Breadcrumb/BreadcrumbList.vue +20 -0
- package/src/components/Breadcrumb/BreadcrumbPage.vue +25 -0
- package/src/components/Breadcrumb/BreadcrumbRoot.vue +41 -0
- package/src/components/Breadcrumb/BreadcrumbSeparator.vue +63 -0
- package/src/components/Breadcrumb/index.ts +13 -0
- package/src/components/Breadcrumb/keys.ts +7 -0
- package/src/components/Button/Button.test.ts +231 -0
- package/src/components/Button/Button.vue +349 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.test.ts +260 -0
- package/src/components/Callout/Callout.vue +341 -0
- package/src/components/Callout/index.ts +2 -0
- package/src/components/Card/Card.test.ts +565 -0
- package/src/components/Card/Card.vue +209 -0
- package/src/components/Card/CardContent.vue +57 -0
- package/src/components/Card/CardFooter.vue +72 -0
- package/src/components/Card/CardHeader.vue +111 -0
- package/src/components/Card/CardImage.vue +124 -0
- package/src/components/Card/index.ts +14 -0
- package/src/components/Chart/BarChart.vue +208 -0
- package/src/components/Chart/BaseChart.vue +444 -0
- package/src/components/Chart/Chart.test.ts +359 -0
- package/src/components/Chart/DonutChart.vue +283 -0
- package/src/components/Chart/LineChart.vue +211 -0
- package/src/components/Chart/index.ts +20 -0
- package/src/components/Chart/useChartTheme.ts +192 -0
- package/src/components/Checkbox/Checkbox.test.ts +209 -0
- package/src/components/Checkbox/Checkbox.vue +285 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/ChoiceChip/ChoiceChip.test.ts +142 -0
- package/src/components/ChoiceChip/ChoiceChip.vue +218 -0
- package/src/components/ChoiceChip/index.ts +2 -0
- package/src/components/ChoiceChipGroup/ChoiceChipGroup.test.ts +151 -0
- package/src/components/ChoiceChipGroup/ChoiceChipGroup.vue +70 -0
- package/src/components/ChoiceChipGroup/index.ts +2 -0
- package/src/components/ColorPicker/ColorArea.vue +159 -0
- package/src/components/ColorPicker/ColorPicker.test.ts +250 -0
- package/src/components/ColorPicker/ColorPicker.vue +339 -0
- package/src/components/ColorPicker/ColorSlider.vue +191 -0
- package/src/components/ColorPicker/index.ts +7 -0
- package/src/components/Combobox/Combobox.test.ts +891 -0
- package/src/components/Combobox/Combobox.vue +934 -0
- package/src/components/Combobox/index.ts +2 -0
- package/src/components/DataTable/DataTable.test.ts +1221 -0
- package/src/components/DataTable/DataTable.vue +1415 -0
- package/src/components/DataTable/index.ts +10 -0
- package/src/components/DatePicker/DatePicker.test.ts +625 -0
- package/src/components/DatePicker/DatePicker.vue +1586 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/Drawer/Drawer.test.ts +336 -0
- package/src/components/Drawer/Drawer.vue +466 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Dropdown/Dropdown.test.ts +607 -0
- package/src/components/Dropdown/Dropdown.vue +807 -0
- package/src/components/Dropdown/DropdownItem.vue +227 -0
- package/src/components/Dropdown/DropdownSeparator.vue +14 -0
- package/src/components/Dropdown/DropdownSub.vue +104 -0
- package/src/components/Dropdown/DropdownSubContent.vue +187 -0
- package/src/components/Dropdown/DropdownSubTrigger.vue +151 -0
- package/src/components/Dropdown/index.ts +14 -0
- package/src/components/EmptyState/EmptyState.test.ts +180 -0
- package/src/components/EmptyState/EmptyState.vue +137 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/FileUpload/FileUpload.test.ts +1151 -0
- package/src/components/FileUpload/FileUpload.vue +1042 -0
- package/src/components/FileUpload/index.ts +2 -0
- package/src/components/Heading/Heading.test.ts +107 -0
- package/src/components/Heading/Heading.vue +67 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Icon/Icon.test.ts +157 -0
- package/src/components/Icon/Icon.vue +86 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Input/Input.test.ts +273 -0
- package/src/components/Input/Input.vue +388 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Layout/Container.vue +67 -0
- package/src/components/Layout/Grid.vue +159 -0
- package/src/components/Layout/GridItem.vue +154 -0
- package/src/components/Layout/Layout.test.ts +202 -0
- package/src/components/Layout/Stack.vue +128 -0
- package/src/components/Layout/index.ts +9 -0
- package/src/components/Layout/keys.ts +7 -0
- package/src/components/Modal/Modal.test.ts +311 -0
- package/src/components/Modal/Modal.vue +336 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Pagination/Pagination.test.ts +303 -0
- package/src/components/Pagination/Pagination.vue +212 -0
- package/src/components/Pagination/index.ts +3 -0
- package/src/components/Pagination/utils.ts +86 -0
- package/src/components/Popover/Popover.test.ts +285 -0
- package/src/components/Popover/Popover.vue +441 -0
- package/src/components/Popover/index.ts +2 -0
- package/src/components/Progress/Progress.test.ts +361 -0
- package/src/components/Progress/Progress.vue +363 -0
- package/src/components/Progress/index.ts +7 -0
- package/src/components/Radio/Radio.test.ts +216 -0
- package/src/components/Radio/Radio.vue +214 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/Rating/Rating.test.ts +319 -0
- package/src/components/Rating/Rating.vue +247 -0
- package/src/components/Rating/index.ts +2 -0
- package/src/components/SegmentedControl/SegmentedControl.test.ts +292 -0
- package/src/components/SegmentedControl/SegmentedControl.vue +288 -0
- package/src/components/SegmentedControl/index.ts +2 -0
- package/src/components/Select/Select.test.ts +589 -0
- package/src/components/Select/Select.vue +666 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Sidebar/Sidebar.test.ts +301 -0
- package/src/components/Sidebar/SidebarGroup.vue +103 -0
- package/src/components/Sidebar/SidebarItem.vue +196 -0
- package/src/components/Sidebar/SidebarLayout.vue +42 -0
- package/src/components/Sidebar/SidebarRoot.vue +122 -0
- package/src/components/Sidebar/index.ts +11 -0
- package/src/components/Sidebar/keys.ts +14 -0
- package/src/components/Skeleton/Skeleton.test.ts +130 -0
- package/src/components/Skeleton/Skeleton.vue +104 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Slider/Slider.test.ts +416 -0
- package/src/components/Slider/Slider.vue +435 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Slider/utils.ts +91 -0
- package/src/components/Spinner/Spinner.test.ts +79 -0
- package/src/components/Spinner/Spinner.vue +159 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/SpireProvider/SpireProvider.vue +71 -0
- package/src/components/SpireProvider/index.ts +11 -0
- package/src/components/Stepper/Stepper.test.ts +221 -0
- package/src/components/Stepper/StepperContent.vue +51 -0
- package/src/components/Stepper/StepperItem.vue +89 -0
- package/src/components/Stepper/StepperRoot.vue +101 -0
- package/src/components/Stepper/StepperSeparator.vue +52 -0
- package/src/components/Stepper/StepperTrigger.vue +144 -0
- package/src/components/Stepper/index.ts +11 -0
- package/src/components/Stepper/keys.ts +27 -0
- package/src/components/Switch/Switch.test.ts +214 -0
- package/src/components/Switch/Switch.vue +235 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Tabs/Tabs.test.ts +363 -0
- package/src/components/Tabs/Tabs.vue +318 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Text/Text.test.ts +154 -0
- package/src/components/Text/Text.vue +100 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Textarea/Textarea.test.ts +432 -0
- package/src/components/Textarea/Textarea.vue +411 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/TimePicker/TimePicker.test.ts +352 -0
- package/src/components/TimePicker/TimePicker.vue +569 -0
- package/src/components/TimePicker/index.ts +2 -0
- package/src/components/Timeline/Timeline.test.ts +193 -0
- package/src/components/Timeline/Timeline.vue +111 -0
- package/src/components/Timeline/TimelineItem.vue +167 -0
- package/src/components/Timeline/index.ts +13 -0
- package/src/components/Timeline/keys.ts +21 -0
- package/src/components/Toast/ToastItem.test.ts +289 -0
- package/src/components/Toast/ToastItem.vue +370 -0
- package/src/components/Toast/ToastProvider.test.ts +158 -0
- package/src/components/Toast/ToastProvider.vue +181 -0
- package/src/components/Toast/index.ts +83 -0
- package/src/components/Toast/toastState.test.ts +165 -0
- package/src/components/Toast/toastState.ts +161 -0
- package/src/components/ToggleButton/ToggleButton.test.ts +166 -0
- package/src/components/ToggleButton/ToggleButton.vue +197 -0
- package/src/components/ToggleButton/index.ts +2 -0
- package/src/components/ToggleGroup/ToggleGroup.test.ts +181 -0
- package/src/components/ToggleGroup/ToggleGroup.vue +130 -0
- package/src/components/ToggleGroup/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.test.ts +238 -0
- package/src/components/Tooltip/Tooltip.vue +217 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/TreeView/TreeView.test.ts +357 -0
- package/src/components/TreeView/TreeView.vue +251 -0
- package/src/components/TreeView/TreeViewItem.vue +288 -0
- package/src/components/TreeView/index.ts +11 -0
- package/src/components/TreeView/keys.ts +35 -0
- package/src/composables/index.ts +12 -0
- package/src/composables/useClickOutside.ts +36 -0
- package/src/composables/useClipboard.ts +35 -0
- package/src/composables/useEventListener.ts +48 -0
- package/src/composables/useFocusTrap.ts +58 -0
- package/src/composables/useHoverReveal.ts +98 -0
- package/src/composables/useId.ts +10 -0
- package/src/composables/useMagnetic.ts +171 -0
- package/src/composables/useRelativePosition.ts +127 -0
- package/src/composables/useRipple.ts +146 -0
- package/src/composables/useScrollLock.ts +25 -0
- package/src/composables/useSpireConfig.ts +27 -0
- package/src/composables/useStagger.ts +224 -0
- package/src/config/icons.test.ts +115 -0
- package/src/config/icons.ts +170 -0
- package/src/index.ts +361 -0
- package/src/styles/depth.css +129 -0
- package/src/styles/effects.css +169 -0
- package/src/styles/fallback.css +152 -0
- package/src/styles/main.css +25 -0
- package/src/styles/mood.css +211 -0
- package/src/styles/motion.css +159 -0
- package/src/styles/reset.css +97 -0
- package/src/styles/theme.css +708 -0
- package/src/styles/tokens.css +183 -0
- package/src/utils/.gitkeep +0 -0
- package/src/utils/color.ts +277 -0
- package/src/utils/date.test.ts +522 -0
- package/src/utils/date.ts +380 -0
- package/src/utils/index.ts +23 -0
- package/src/utils/object.test.ts +80 -0
- package/src/utils/object.ts +25 -0
- package/src/utils/string.test.ts +64 -0
- package/src/utils/string.ts +32 -0
- package/src/utils/time.ts +156 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useSlots, type InputHTMLAttributes } from 'vue'
|
|
3
|
+
import Icon from '../Icon/Icon.vue'
|
|
4
|
+
import Spinner from '../Spinner/Spinner.vue'
|
|
5
|
+
import type { IconInput } from '../Icon/Icon.vue'
|
|
6
|
+
import { useId } from '../../composables'
|
|
7
|
+
|
|
8
|
+
export interface InputProps {
|
|
9
|
+
/** Input value (v-model) */
|
|
10
|
+
modelValue?: string | number
|
|
11
|
+
/** Input type */
|
|
12
|
+
type?: 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'number'
|
|
13
|
+
/** Label text above the input */
|
|
14
|
+
label?: string
|
|
15
|
+
/** Placeholder text */
|
|
16
|
+
placeholder?: string
|
|
17
|
+
/** Helper text below input */
|
|
18
|
+
hint?: string
|
|
19
|
+
/** Error message (also sets error state) */
|
|
20
|
+
error?: string
|
|
21
|
+
/** Input size - matches Button heights */
|
|
22
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
23
|
+
/** Disabled state */
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
/** Read-only state */
|
|
26
|
+
readonly?: boolean
|
|
27
|
+
/** Loading state - shows spinner */
|
|
28
|
+
loading?: boolean
|
|
29
|
+
/** Required field */
|
|
30
|
+
required?: boolean
|
|
31
|
+
/** Icon on the left side */
|
|
32
|
+
iconLeft?: IconInput
|
|
33
|
+
/** Icon on the right side */
|
|
34
|
+
iconRight?: IconInput
|
|
35
|
+
/** HTML id attribute (auto-generated if not provided) */
|
|
36
|
+
id?: string
|
|
37
|
+
/** HTML name attribute */
|
|
38
|
+
name?: string
|
|
39
|
+
/** Autocomplete attribute */
|
|
40
|
+
autocomplete?: InputHTMLAttributes['autocomplete']
|
|
41
|
+
/** Make input full width */
|
|
42
|
+
block?: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const props = withDefaults(defineProps<InputProps>(), {
|
|
46
|
+
type: 'text',
|
|
47
|
+
size: 'md',
|
|
48
|
+
disabled: false,
|
|
49
|
+
readonly: false,
|
|
50
|
+
loading: false,
|
|
51
|
+
required: false,
|
|
52
|
+
block: false
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
(e: 'update:modelValue', value: string | number): void
|
|
57
|
+
(e: 'focus', event: FocusEvent): void
|
|
58
|
+
(e: 'blur', event: FocusEvent): void
|
|
59
|
+
}>()
|
|
60
|
+
|
|
61
|
+
const slots = useSlots()
|
|
62
|
+
|
|
63
|
+
const uid = useId('input')
|
|
64
|
+
const inputId = computed(() => props.id || uid)
|
|
65
|
+
const hintId = computed(() => `${inputId.value}-hint`)
|
|
66
|
+
const errorId = computed(() => `${inputId.value}-error`)
|
|
67
|
+
|
|
68
|
+
const describedBy = computed(() => {
|
|
69
|
+
if (props.error) return errorId.value
|
|
70
|
+
if (props.hint) return hintId.value
|
|
71
|
+
return undefined
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const hasLeft = computed(() => props.iconLeft || slots.left)
|
|
75
|
+
const hasRight = computed(() => props.iconRight || slots.right || props.loading)
|
|
76
|
+
|
|
77
|
+
const iconSizeMap: Record<string, string> = {
|
|
78
|
+
xs: 'var(--text-xs)',
|
|
79
|
+
sm: 'var(--text-sm)',
|
|
80
|
+
md: 'var(--text-md)',
|
|
81
|
+
lg: 'var(--text-lg)',
|
|
82
|
+
xl: 'var(--text-xl)'
|
|
83
|
+
}
|
|
84
|
+
const iconSize = computed(() => iconSizeMap[props.size])
|
|
85
|
+
|
|
86
|
+
function handleInput(event: Event) {
|
|
87
|
+
const target = event.target as HTMLInputElement
|
|
88
|
+
const value = props.type === 'number' ? Number(target.value) : target.value
|
|
89
|
+
emit('update:modelValue', value)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function handleFocus(event: FocusEvent) {
|
|
93
|
+
emit('focus', event)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function handleBlur(event: FocusEvent) {
|
|
97
|
+
emit('blur', event)
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<div
|
|
103
|
+
class="ui-input-field"
|
|
104
|
+
:class="[
|
|
105
|
+
`ui-input-field--${size}`,
|
|
106
|
+
{
|
|
107
|
+
'ui-input-field--block': block,
|
|
108
|
+
'ui-input-field--disabled': disabled,
|
|
109
|
+
'ui-input-field--error': error,
|
|
110
|
+
'ui-input-field--readonly': readonly
|
|
111
|
+
}
|
|
112
|
+
]"
|
|
113
|
+
>
|
|
114
|
+
<label
|
|
115
|
+
v-if="label"
|
|
116
|
+
:for="inputId"
|
|
117
|
+
class="ui-input-field__label"
|
|
118
|
+
>
|
|
119
|
+
{{ label }}
|
|
120
|
+
<span v-if="required" class="ui-input-field__required" aria-hidden="true">*</span>
|
|
121
|
+
</label>
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
class="ui-input-wrapper"
|
|
125
|
+
:class="[
|
|
126
|
+
`ui-input-wrapper--${size}`,
|
|
127
|
+
{
|
|
128
|
+
'ui-input-wrapper--disabled': disabled,
|
|
129
|
+
'ui-input-wrapper--error': error,
|
|
130
|
+
'ui-input-wrapper--readonly': readonly,
|
|
131
|
+
'ui-input-wrapper--has-left': hasLeft,
|
|
132
|
+
'ui-input-wrapper--has-right': hasRight
|
|
133
|
+
}
|
|
134
|
+
]"
|
|
135
|
+
>
|
|
136
|
+
<span v-if="hasLeft" class="ui-input-wrapper__addon ui-input-wrapper__addon--left">
|
|
137
|
+
<slot name="left">
|
|
138
|
+
<Icon v-if="iconLeft" :icon="iconLeft" :size="iconSize" />
|
|
139
|
+
</slot>
|
|
140
|
+
</span>
|
|
141
|
+
|
|
142
|
+
<input
|
|
143
|
+
:id="inputId"
|
|
144
|
+
:type="type"
|
|
145
|
+
:value="modelValue"
|
|
146
|
+
:name="name"
|
|
147
|
+
:placeholder="placeholder"
|
|
148
|
+
:disabled="disabled"
|
|
149
|
+
:readonly="readonly"
|
|
150
|
+
:required="required"
|
|
151
|
+
:autocomplete="autocomplete"
|
|
152
|
+
:aria-invalid="error ? 'true' : undefined"
|
|
153
|
+
:aria-describedby="describedBy"
|
|
154
|
+
class="ui-input-wrapper__input"
|
|
155
|
+
@input="handleInput"
|
|
156
|
+
@focus="handleFocus"
|
|
157
|
+
@blur="handleBlur"
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
<span v-if="hasRight" class="ui-input-wrapper__addon ui-input-wrapper__addon--right">
|
|
161
|
+
<Spinner v-if="loading" :size="iconSize" />
|
|
162
|
+
<slot v-else name="right">
|
|
163
|
+
<Icon v-if="iconRight" :icon="iconRight" :size="iconSize" />
|
|
164
|
+
</slot>
|
|
165
|
+
</span>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<p
|
|
169
|
+
v-if="error"
|
|
170
|
+
:id="errorId"
|
|
171
|
+
class="ui-input-field__message ui-input-field__message--error"
|
|
172
|
+
role="alert"
|
|
173
|
+
>
|
|
174
|
+
{{ error }}
|
|
175
|
+
</p>
|
|
176
|
+
<p
|
|
177
|
+
v-else-if="hint"
|
|
178
|
+
:id="hintId"
|
|
179
|
+
class="ui-input-field__message ui-input-field__message--hint"
|
|
180
|
+
>
|
|
181
|
+
{{ hint }}
|
|
182
|
+
</p>
|
|
183
|
+
</div>
|
|
184
|
+
</template>
|
|
185
|
+
|
|
186
|
+
<style scoped>
|
|
187
|
+
.ui-input-field {
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-direction: column;
|
|
190
|
+
gap: var(--space-1);
|
|
191
|
+
font-family: var(--font-sans);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.ui-input-field--block {
|
|
195
|
+
width: 100%;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ui-input-field__label {
|
|
199
|
+
font-size: var(--text-sm);
|
|
200
|
+
font-weight: var(--font-medium);
|
|
201
|
+
color: var(--input-label);
|
|
202
|
+
line-height: var(--leading-tight);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.ui-input-field__required {
|
|
206
|
+
color: var(--input-error);
|
|
207
|
+
margin-left: var(--space-1);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ui-input-field__message {
|
|
211
|
+
font-size: var(--text-xs);
|
|
212
|
+
line-height: var(--leading-normal);
|
|
213
|
+
margin: 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ui-input-field__message--hint {
|
|
217
|
+
color: var(--input-hint);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.ui-input-field__message--error {
|
|
221
|
+
color: var(--input-error);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.ui-input-wrapper {
|
|
225
|
+
position: relative;
|
|
226
|
+
display: inline-flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
width: 100%;
|
|
229
|
+
background-color: var(--input-bg);
|
|
230
|
+
border: 1px solid var(--input-border);
|
|
231
|
+
box-shadow: var(--input-shadow, none);
|
|
232
|
+
transition:
|
|
233
|
+
border-color var(--duration-fast) var(--ease-default),
|
|
234
|
+
box-shadow var(--duration-fast) var(--ease-default);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.ui-input-wrapper:focus-within {
|
|
238
|
+
border-color: var(--input-border-focus);
|
|
239
|
+
box-shadow: 0 0 0 3px var(--input-ring), var(--input-shadow-focus, none);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.ui-input-wrapper:not(:focus-within):not(.ui-input-wrapper--disabled):not(.ui-input-wrapper--readonly):hover {
|
|
243
|
+
border-color: var(--input-border-hover);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.ui-input-wrapper--error {
|
|
247
|
+
border-color: var(--input-border-error);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.ui-input-wrapper--error:focus-within {
|
|
251
|
+
border-color: var(--input-border-error);
|
|
252
|
+
box-shadow: 0 0 0 3px var(--input-ring-error);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.ui-input-wrapper--disabled {
|
|
256
|
+
background-color: var(--input-bg-disabled);
|
|
257
|
+
cursor: not-allowed;
|
|
258
|
+
opacity: 0.6;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.ui-input-wrapper--readonly {
|
|
262
|
+
background-color: transparent;
|
|
263
|
+
border-color: var(--input-border-readonly);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.ui-input-wrapper--readonly:focus-within {
|
|
267
|
+
border-color: var(--input-border-readonly);
|
|
268
|
+
box-shadow: none;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.ui-input-wrapper--xs {
|
|
272
|
+
height: var(--input-height-xs);
|
|
273
|
+
padding: 0 var(--space-1);
|
|
274
|
+
font-size: var(--text-xs);
|
|
275
|
+
border-radius: var(--radius-sm);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.ui-input-wrapper--sm {
|
|
279
|
+
height: var(--input-height-sm);
|
|
280
|
+
padding: 0 var(--space-2);
|
|
281
|
+
font-size: var(--text-sm);
|
|
282
|
+
border-radius: var(--radius-md);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.ui-input-wrapper--md {
|
|
286
|
+
height: var(--input-height-md);
|
|
287
|
+
padding: 0 var(--space-3);
|
|
288
|
+
font-size: var(--text-sm);
|
|
289
|
+
border-radius: var(--radius-md);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.ui-input-wrapper--lg {
|
|
293
|
+
height: var(--input-height-lg);
|
|
294
|
+
padding: 0 var(--space-3);
|
|
295
|
+
font-size: var(--text-base);
|
|
296
|
+
border-radius: var(--radius-md);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.ui-input-wrapper--xl {
|
|
300
|
+
height: var(--input-height-xl);
|
|
301
|
+
padding: 0 var(--space-4);
|
|
302
|
+
font-size: var(--text-base);
|
|
303
|
+
border-radius: var(--radius-lg);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.ui-input-wrapper__input {
|
|
307
|
+
flex: 1;
|
|
308
|
+
min-width: 0;
|
|
309
|
+
height: 100%;
|
|
310
|
+
padding: 0;
|
|
311
|
+
border: none;
|
|
312
|
+
background: transparent !important;
|
|
313
|
+
background-color: transparent !important;
|
|
314
|
+
font-family: inherit;
|
|
315
|
+
font-size: inherit;
|
|
316
|
+
color: var(--input-text) !important;
|
|
317
|
+
outline: none;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.ui-input-wrapper__input::placeholder {
|
|
321
|
+
color: var(--input-placeholder);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.ui-input-wrapper__input:disabled {
|
|
325
|
+
cursor: not-allowed;
|
|
326
|
+
color: var(--input-text-disabled);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.ui-input-wrapper__input:read-only {
|
|
330
|
+
cursor: default;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.ui-input-wrapper__input:-webkit-autofill,
|
|
334
|
+
.ui-input-wrapper__input:-webkit-autofill:hover,
|
|
335
|
+
.ui-input-wrapper__input:-webkit-autofill:focus,
|
|
336
|
+
.ui-input-wrapper__input:-webkit-autofill:active {
|
|
337
|
+
-webkit-text-fill-color: var(--input-text) !important;
|
|
338
|
+
-webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
|
|
339
|
+
box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
|
|
340
|
+
background-color: var(--input-bg) !important;
|
|
341
|
+
background-clip: content-box !important;
|
|
342
|
+
transition: background-color 600000s 0s, box-shadow 600000s 0s;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.ui-input-wrapper__input[type='number']::-webkit-outer-spin-button,
|
|
346
|
+
.ui-input-wrapper__input[type='number']::-webkit-inner-spin-button {
|
|
347
|
+
-webkit-appearance: none;
|
|
348
|
+
margin: 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.ui-input-wrapper__input[type='number'] {
|
|
352
|
+
-moz-appearance: textfield;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.ui-input-wrapper__addon {
|
|
356
|
+
display: inline-flex;
|
|
357
|
+
align-items: center;
|
|
358
|
+
justify-content: center;
|
|
359
|
+
flex-shrink: 0;
|
|
360
|
+
color: var(--input-icon);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.ui-input-wrapper__addon--left {
|
|
364
|
+
margin-right: var(--space-2);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.ui-input-wrapper__addon--right {
|
|
368
|
+
margin-left: var(--space-2);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.ui-input-wrapper--disabled .ui-input-wrapper__addon {
|
|
372
|
+
opacity: 0.5;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.ui-input-field--xs .ui-input-field__label {
|
|
376
|
+
font-size: var(--text-xs);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.ui-input-field--sm .ui-input-field__label,
|
|
380
|
+
.ui-input-field--md .ui-input-field__label {
|
|
381
|
+
font-size: var(--text-sm);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.ui-input-field--lg .ui-input-field__label,
|
|
385
|
+
.ui-input-field--xl .ui-input-field__label {
|
|
386
|
+
font-size: var(--text-md);
|
|
387
|
+
}
|
|
388
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface ContainerProps {
|
|
5
|
+
/** If true, width is 100%. If false, max-width snaps to breakpoints. */
|
|
6
|
+
fluid?: boolean
|
|
7
|
+
/** Auto margins (mx-auto). Default: true */
|
|
8
|
+
centered?: boolean
|
|
9
|
+
/** HTML tag to render */
|
|
10
|
+
as?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<ContainerProps>(), {
|
|
14
|
+
fluid: false,
|
|
15
|
+
centered: true,
|
|
16
|
+
as: 'div'
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const containerClasses = computed(() => [
|
|
20
|
+
'ui-container',
|
|
21
|
+
{
|
|
22
|
+
'ui-container--fluid': props.fluid,
|
|
23
|
+
'ui-container--centered': props.centered
|
|
24
|
+
}
|
|
25
|
+
])
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<component :is="as" :class="containerClasses">
|
|
30
|
+
<slot />
|
|
31
|
+
</component>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
.ui-container {
|
|
36
|
+
width: 100%;
|
|
37
|
+
padding-left: var(--space-4);
|
|
38
|
+
padding-right: var(--space-4);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ui-container:not(.ui-container--fluid) {
|
|
42
|
+
max-width: var(--container-sm);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (min-width: 768px) {
|
|
46
|
+
.ui-container:not(.ui-container--fluid) {
|
|
47
|
+
max-width: var(--container-md);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (min-width: 1024px) {
|
|
52
|
+
.ui-container:not(.ui-container--fluid) {
|
|
53
|
+
max-width: var(--container-lg);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (min-width: 1280px) {
|
|
58
|
+
.ui-container:not(.ui-container--fluid) {
|
|
59
|
+
max-width: var(--container-xl);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ui-container--centered {
|
|
64
|
+
margin-left: auto;
|
|
65
|
+
margin-right: auto;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, provide, toRef } from 'vue'
|
|
3
|
+
import { GridKey } from './keys'
|
|
4
|
+
import type { SpacingToken } from './Stack.vue'
|
|
5
|
+
|
|
6
|
+
export type ColumnCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
7
|
+
|
|
8
|
+
export interface ResponsiveColumns {
|
|
9
|
+
default?: ColumnCount
|
|
10
|
+
sm?: ColumnCount
|
|
11
|
+
md?: ColumnCount
|
|
12
|
+
lg?: ColumnCount
|
|
13
|
+
xl?: ColumnCount
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface GridProps {
|
|
17
|
+
/** Number of columns (or responsive object) */
|
|
18
|
+
columns?: ColumnCount | ResponsiveColumns
|
|
19
|
+
/** Grid gap using spacing tokens */
|
|
20
|
+
gap?: SpacingToken
|
|
21
|
+
/** Column gap override */
|
|
22
|
+
gapX?: SpacingToken
|
|
23
|
+
/** Row gap override */
|
|
24
|
+
gapY?: SpacingToken
|
|
25
|
+
/** HTML tag to render */
|
|
26
|
+
as?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<GridProps>(), {
|
|
30
|
+
columns: 1,
|
|
31
|
+
gap: 4,
|
|
32
|
+
as: 'div'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const isResponsive = computed(() => typeof props.columns === 'object')
|
|
36
|
+
|
|
37
|
+
const gridClasses = computed(() => {
|
|
38
|
+
const classes = ['ui-grid']
|
|
39
|
+
|
|
40
|
+
if (isResponsive.value) {
|
|
41
|
+
const cols = props.columns as ResponsiveColumns
|
|
42
|
+
if (cols.default) classes.push(`ui-grid--cols-${cols.default}`)
|
|
43
|
+
if (cols.sm) classes.push(`ui-grid--cols-sm-${cols.sm}`)
|
|
44
|
+
if (cols.md) classes.push(`ui-grid--cols-md-${cols.md}`)
|
|
45
|
+
if (cols.lg) classes.push(`ui-grid--cols-lg-${cols.lg}`)
|
|
46
|
+
if (cols.xl) classes.push(`ui-grid--cols-xl-${cols.xl}`)
|
|
47
|
+
} else {
|
|
48
|
+
classes.push(`ui-grid--cols-${props.columns}`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return classes
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const gridStyle = computed(() => {
|
|
55
|
+
const style: Record<string, string> = {
|
|
56
|
+
'--grid-gap': `var(--space-${props.gap})`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (props.gapX !== undefined) {
|
|
60
|
+
style['--grid-gap-x'] = `var(--space-${props.gapX})`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (props.gapY !== undefined) {
|
|
64
|
+
style['--grid-gap-y'] = `var(--space-${props.gapY})`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return style
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
provide(GridKey, {
|
|
71
|
+
gap: toRef(props, 'gap')
|
|
72
|
+
})
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<component :is="as" :class="gridClasses" :style="gridStyle">
|
|
77
|
+
<slot />
|
|
78
|
+
</component>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.ui-grid {
|
|
83
|
+
display: grid;
|
|
84
|
+
gap: var(--grid-gap-y, var(--grid-gap)) var(--grid-gap-x, var(--grid-gap));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ui-grid--cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
88
|
+
.ui-grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
89
|
+
.ui-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
90
|
+
.ui-grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
91
|
+
.ui-grid--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
92
|
+
.ui-grid--cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
93
|
+
.ui-grid--cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
94
|
+
.ui-grid--cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
|
|
95
|
+
.ui-grid--cols-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
|
|
96
|
+
.ui-grid--cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
|
|
97
|
+
.ui-grid--cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
|
|
98
|
+
.ui-grid--cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
|
|
99
|
+
|
|
100
|
+
@media (min-width: 640px) {
|
|
101
|
+
.ui-grid--cols-sm-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
102
|
+
.ui-grid--cols-sm-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
103
|
+
.ui-grid--cols-sm-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
104
|
+
.ui-grid--cols-sm-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
105
|
+
.ui-grid--cols-sm-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
106
|
+
.ui-grid--cols-sm-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
107
|
+
.ui-grid--cols-sm-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
108
|
+
.ui-grid--cols-sm-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
|
|
109
|
+
.ui-grid--cols-sm-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
|
|
110
|
+
.ui-grid--cols-sm-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
|
|
111
|
+
.ui-grid--cols-sm-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
|
|
112
|
+
.ui-grid--cols-sm-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (min-width: 768px) {
|
|
116
|
+
.ui-grid--cols-md-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
117
|
+
.ui-grid--cols-md-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
118
|
+
.ui-grid--cols-md-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
119
|
+
.ui-grid--cols-md-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
120
|
+
.ui-grid--cols-md-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
121
|
+
.ui-grid--cols-md-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
122
|
+
.ui-grid--cols-md-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
123
|
+
.ui-grid--cols-md-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
|
|
124
|
+
.ui-grid--cols-md-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
|
|
125
|
+
.ui-grid--cols-md-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
|
|
126
|
+
.ui-grid--cols-md-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
|
|
127
|
+
.ui-grid--cols-md-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (min-width: 1024px) {
|
|
131
|
+
.ui-grid--cols-lg-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
132
|
+
.ui-grid--cols-lg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
133
|
+
.ui-grid--cols-lg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
134
|
+
.ui-grid--cols-lg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
135
|
+
.ui-grid--cols-lg-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
136
|
+
.ui-grid--cols-lg-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
137
|
+
.ui-grid--cols-lg-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
138
|
+
.ui-grid--cols-lg-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
|
|
139
|
+
.ui-grid--cols-lg-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
|
|
140
|
+
.ui-grid--cols-lg-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
|
|
141
|
+
.ui-grid--cols-lg-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
|
|
142
|
+
.ui-grid--cols-lg-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media (min-width: 1280px) {
|
|
146
|
+
.ui-grid--cols-xl-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
147
|
+
.ui-grid--cols-xl-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
148
|
+
.ui-grid--cols-xl-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
149
|
+
.ui-grid--cols-xl-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
150
|
+
.ui-grid--cols-xl-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
|
151
|
+
.ui-grid--cols-xl-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
152
|
+
.ui-grid--cols-xl-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
153
|
+
.ui-grid--cols-xl-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
|
|
154
|
+
.ui-grid--cols-xl-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
|
|
155
|
+
.ui-grid--cols-xl-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
|
|
156
|
+
.ui-grid--cols-xl-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
|
|
157
|
+
.ui-grid--cols-xl-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
|
|
158
|
+
}
|
|
159
|
+
</style>
|