@iris-ui-kit/vue 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 +21 -0
- package/dist/admin.cjs +1869 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +376 -0
- package/dist/admin.d.ts +376 -0
- package/dist/admin.js +10 -0
- package/dist/admin.js.map +1 -0
- package/dist/async.cjs +76 -0
- package/dist/async.cjs.map +1 -0
- package/dist/async.d.cts +59 -0
- package/dist/async.d.ts +59 -0
- package/dist/async.js +3 -0
- package/dist/async.js.map +1 -0
- package/dist/behaviors.cjs +659 -0
- package/dist/behaviors.cjs.map +1 -0
- package/dist/behaviors.d.cts +441 -0
- package/dist/behaviors.d.ts +441 -0
- package/dist/behaviors.js +3 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/chunk-3FJUCHCC.js +146 -0
- package/dist/chunk-3FJUCHCC.js.map +1 -0
- package/dist/chunk-3R3QDLJC.js +172 -0
- package/dist/chunk-3R3QDLJC.js.map +1 -0
- package/dist/chunk-4FLIW67H.js +137 -0
- package/dist/chunk-4FLIW67H.js.map +1 -0
- package/dist/chunk-4FQ7XF52.js +3 -0
- package/dist/chunk-4FQ7XF52.js.map +1 -0
- package/dist/chunk-72PZMU6R.js +99 -0
- package/dist/chunk-72PZMU6R.js.map +1 -0
- package/dist/chunk-75GSYEJS.js +17 -0
- package/dist/chunk-75GSYEJS.js.map +1 -0
- package/dist/chunk-7IOJADZC.js +38 -0
- package/dist/chunk-7IOJADZC.js.map +1 -0
- package/dist/chunk-CIZGSGXN.js +651 -0
- package/dist/chunk-CIZGSGXN.js.map +1 -0
- package/dist/chunk-F77KIPOH.js +103 -0
- package/dist/chunk-F77KIPOH.js.map +1 -0
- package/dist/chunk-FJBYAIL4.js +1318 -0
- package/dist/chunk-FJBYAIL4.js.map +1 -0
- package/dist/chunk-H7HVVPYR.js +66 -0
- package/dist/chunk-H7HVVPYR.js.map +1 -0
- package/dist/chunk-I6D5VXQK.js +167 -0
- package/dist/chunk-I6D5VXQK.js.map +1 -0
- package/dist/chunk-PPYNXNGZ.js +73 -0
- package/dist/chunk-PPYNXNGZ.js.map +1 -0
- package/dist/chunk-QLUIKEMJ.js +1197 -0
- package/dist/chunk-QLUIKEMJ.js.map +1 -0
- package/dist/chunk-ROJV6RON.js +3 -0
- package/dist/chunk-ROJV6RON.js.map +1 -0
- package/dist/chunk-S43IHHBU.js +82 -0
- package/dist/chunk-S43IHHBU.js.map +1 -0
- package/dist/chunk-TCAXRWT6.js +108 -0
- package/dist/chunk-TCAXRWT6.js.map +1 -0
- package/dist/chunk-TQB5LVOH.js +17 -0
- package/dist/chunk-TQB5LVOH.js.map +1 -0
- package/dist/chunk-VM2CXEUA.js +46 -0
- package/dist/chunk-VM2CXEUA.js.map +1 -0
- package/dist/chunk-W2JVHGFR.js +103 -0
- package/dist/chunk-W2JVHGFR.js.map +1 -0
- package/dist/chunk-WL67XCH5.js +59 -0
- package/dist/chunk-WL67XCH5.js.map +1 -0
- package/dist/chunk-XCNCIG2I.js +165 -0
- package/dist/chunk-XCNCIG2I.js.map +1 -0
- package/dist/chunk-XSLBANUV.js +16 -0
- package/dist/chunk-XSLBANUV.js.map +1 -0
- package/dist/chunk-ZY4NLITM.js +73 -0
- package/dist/chunk-ZY4NLITM.js.map +1 -0
- package/dist/data.cjs +59 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +46 -0
- package/dist/data.d.ts +46 -0
- package/dist/data.js +4 -0
- package/dist/data.js.map +1 -0
- package/dist/error-boundary.cjs +115 -0
- package/dist/error-boundary.cjs.map +1 -0
- package/dist/error-boundary.d.cts +60 -0
- package/dist/error-boundary.d.ts +60 -0
- package/dist/error-boundary.js +4 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/floating.cjs +149 -0
- package/dist/floating.cjs.map +1 -0
- package/dist/floating.d.cts +106 -0
- package/dist/floating.d.ts +106 -0
- package/dist/floating.js +4 -0
- package/dist/floating.js.map +1 -0
- package/dist/form.cjs +144 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +128 -0
- package/dist/form.d.ts +128 -0
- package/dist/form.js +3 -0
- package/dist/form.js.map +1 -0
- package/dist/i18n.cjs +112 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +99 -0
- package/dist/i18n.d.ts +99 -0
- package/dist/i18n.js +3 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +18673 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8087 -0
- package/dist/index.d.ts +8087 -0
- package/dist/index.js +13525 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.cjs +392 -0
- package/dist/layouts.cjs.map +1 -0
- package/dist/layouts.d.cts +406 -0
- package/dist/layouts.d.ts +406 -0
- package/dist/layouts.js +5 -0
- package/dist/layouts.js.map +1 -0
- package/dist/machine.cjs +19 -0
- package/dist/machine.cjs.map +1 -0
- package/dist/machine.d.cts +18 -0
- package/dist/machine.d.ts +18 -0
- package/dist/machine.js +4 -0
- package/dist/machine.js.map +1 -0
- package/dist/modal-utils.cjs +170 -0
- package/dist/modal-utils.cjs.map +1 -0
- package/dist/modal-utils.d.cts +43 -0
- package/dist/modal-utils.d.ts +43 -0
- package/dist/modal-utils.js +3 -0
- package/dist/modal-utils.js.map +1 -0
- package/dist/motion.cjs +88 -0
- package/dist/motion.cjs.map +1 -0
- package/dist/motion.d.cts +43 -0
- package/dist/motion.d.ts +43 -0
- package/dist/motion.js +3 -0
- package/dist/motion.js.map +1 -0
- package/dist/provider.cjs +272 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +130 -0
- package/dist/provider.d.ts +130 -0
- package/dist/provider.js +6 -0
- package/dist/provider.js.map +1 -0
- package/dist/resource.cjs +25 -0
- package/dist/resource.cjs.map +1 -0
- package/dist/resource.d.cts +17 -0
- package/dist/resource.d.ts +17 -0
- package/dist/resource.js +3 -0
- package/dist/resource.js.map +1 -0
- package/dist/skeletons.cjs +1659 -0
- package/dist/skeletons.cjs.map +1 -0
- package/dist/skeletons.d.cts +179 -0
- package/dist/skeletons.d.ts +179 -0
- package/dist/skeletons.js +7 -0
- package/dist/skeletons.js.map +1 -0
- package/dist/skins.cjs +138 -0
- package/dist/skins.cjs.map +1 -0
- package/dist/skins.d.cts +67 -0
- package/dist/skins.d.ts +67 -0
- package/dist/skins.js +3 -0
- package/dist/skins.js.map +1 -0
- package/dist/theme.cjs +106 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +103 -0
- package/dist/theme.d.ts +103 -0
- package/dist/theme.js +3 -0
- package/dist/theme.js.map +1 -0
- package/dist/undo.cjs +51 -0
- package/dist/undo.cjs.map +1 -0
- package/dist/undo.d.cts +48 -0
- package/dist/undo.d.ts +48 -0
- package/dist/undo.js +3 -0
- package/dist/undo.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,1197 @@
|
|
|
1
|
+
import { IrisContainer, IrisStack, IrisDashboardGrid, IrisDashboardCard } from './chunk-3R3QDLJC.js';
|
|
2
|
+
import { findFirstElement, mergeSlotProps } from './chunk-F77KIPOH.js';
|
|
3
|
+
import { IrisSidebarLayout, IrisHeaderLayout } from './chunk-I6D5VXQK.js';
|
|
4
|
+
import { useI18n } from './chunk-TCAXRWT6.js';
|
|
5
|
+
import { defineComponent, ref, computed, h, useId, cloneVNode, Fragment, watch } from 'vue';
|
|
6
|
+
|
|
7
|
+
var IrisInput = defineComponent({
|
|
8
|
+
name: "IrisInput",
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: { type: [String, Number], default: "" },
|
|
12
|
+
type: { type: String, default: "text" },
|
|
13
|
+
size: { type: String, default: "md" },
|
|
14
|
+
placeholder: { type: String, default: "" },
|
|
15
|
+
disabled: { type: Boolean, default: false },
|
|
16
|
+
readonly: { type: Boolean, default: false },
|
|
17
|
+
/** Visual error state — does NOT enforce validation. */
|
|
18
|
+
invalid: { type: Boolean, default: false },
|
|
19
|
+
id: { type: String, default: void 0 },
|
|
20
|
+
/** Forwarded as `aria-describedby` on the inner <input>. Set by IrisFormField. */
|
|
21
|
+
ariaDescribedby: { type: String, default: void 0 }
|
|
22
|
+
},
|
|
23
|
+
emits: {
|
|
24
|
+
"update:modelValue": (_value) => true,
|
|
25
|
+
focus: (_event) => true,
|
|
26
|
+
blur: (_event) => true
|
|
27
|
+
},
|
|
28
|
+
setup(props, { slots, attrs, emit }) {
|
|
29
|
+
const focused = ref(false);
|
|
30
|
+
const sizeStyles = computed(() => {
|
|
31
|
+
const map = {
|
|
32
|
+
sm: {
|
|
33
|
+
padding: "4px var(--iris-padding-sm)",
|
|
34
|
+
fontSize: "12px",
|
|
35
|
+
minHeight: "28px"
|
|
36
|
+
},
|
|
37
|
+
md: {
|
|
38
|
+
padding: "6px var(--iris-padding-md)",
|
|
39
|
+
fontSize: "14px",
|
|
40
|
+
minHeight: "34px"
|
|
41
|
+
},
|
|
42
|
+
lg: {
|
|
43
|
+
padding: "8px var(--iris-padding-md)",
|
|
44
|
+
fontSize: "16px",
|
|
45
|
+
minHeight: "40px"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return map[props.size];
|
|
49
|
+
});
|
|
50
|
+
const wrapperStyle = computed(() => {
|
|
51
|
+
const borderColor = props.invalid ? "var(--iris-danger)" : focused.value ? "var(--iris-primary)" : "var(--iris-border)";
|
|
52
|
+
const boxShadow = focused.value ? `0 0 0 3px ${props.invalid ? "rgba(239, 68, 68, 0.18)" : "rgba(99, 102, 241, 0.18)"}` : "none";
|
|
53
|
+
return {
|
|
54
|
+
display: "inline-flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
gap: "var(--iris-gap-sm)",
|
|
57
|
+
background: "var(--iris-background)",
|
|
58
|
+
color: "var(--iris-foreground)",
|
|
59
|
+
border: `1px solid ${borderColor}`,
|
|
60
|
+
borderRadius: "var(--iris-radius-md)",
|
|
61
|
+
cursor: props.disabled ? "not-allowed" : "text",
|
|
62
|
+
opacity: props.disabled ? "0.6" : "1",
|
|
63
|
+
transition: "border-color 120ms ease, box-shadow 120ms ease",
|
|
64
|
+
boxShadow,
|
|
65
|
+
...sizeStyles.value,
|
|
66
|
+
padding: sizeStyles.value.padding,
|
|
67
|
+
minHeight: sizeStyles.value.minHeight
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
const inputStyle = {
|
|
71
|
+
flex: "1",
|
|
72
|
+
minWidth: "0",
|
|
73
|
+
border: "none",
|
|
74
|
+
outline: "none",
|
|
75
|
+
background: "transparent",
|
|
76
|
+
color: "inherit",
|
|
77
|
+
fontFamily: "inherit",
|
|
78
|
+
fontSize: "inherit",
|
|
79
|
+
padding: "0"
|
|
80
|
+
};
|
|
81
|
+
const onInput = (event) => {
|
|
82
|
+
emit("update:modelValue", event.target.value);
|
|
83
|
+
};
|
|
84
|
+
const onFocus = (event) => {
|
|
85
|
+
focused.value = true;
|
|
86
|
+
emit("focus", event);
|
|
87
|
+
};
|
|
88
|
+
const onBlur = (event) => {
|
|
89
|
+
focused.value = false;
|
|
90
|
+
emit("blur", event);
|
|
91
|
+
};
|
|
92
|
+
return () => {
|
|
93
|
+
const prefix = slots.prefix?.();
|
|
94
|
+
const suffix = slots.suffix?.();
|
|
95
|
+
return h(
|
|
96
|
+
"label",
|
|
97
|
+
{
|
|
98
|
+
...attrs,
|
|
99
|
+
"data-iris-input": "",
|
|
100
|
+
"data-iris-input-size": props.size,
|
|
101
|
+
"data-state": props.invalid ? "invalid" : focused.value ? "focused" : "idle",
|
|
102
|
+
style: {
|
|
103
|
+
...wrapperStyle.value,
|
|
104
|
+
...attrs.style ?? {}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
[
|
|
108
|
+
prefix && h(
|
|
109
|
+
"span",
|
|
110
|
+
{
|
|
111
|
+
"data-iris-input-prefix": "",
|
|
112
|
+
style: { display: "inline-flex", alignItems: "center", color: "var(--iris-muted)" }
|
|
113
|
+
},
|
|
114
|
+
prefix
|
|
115
|
+
),
|
|
116
|
+
h("input", {
|
|
117
|
+
id: props.id,
|
|
118
|
+
type: props.type,
|
|
119
|
+
value: props.modelValue,
|
|
120
|
+
placeholder: props.placeholder,
|
|
121
|
+
disabled: props.disabled || void 0,
|
|
122
|
+
readonly: props.readonly || void 0,
|
|
123
|
+
"aria-invalid": props.invalid ? "true" : void 0,
|
|
124
|
+
"aria-describedby": props.ariaDescribedby,
|
|
125
|
+
style: inputStyle,
|
|
126
|
+
onInput,
|
|
127
|
+
onFocus,
|
|
128
|
+
onBlur
|
|
129
|
+
}),
|
|
130
|
+
suffix && h(
|
|
131
|
+
"span",
|
|
132
|
+
{
|
|
133
|
+
"data-iris-input-suffix": "",
|
|
134
|
+
style: { display: "inline-flex", alignItems: "center", color: "var(--iris-muted)" }
|
|
135
|
+
},
|
|
136
|
+
suffix
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
var IrisPasswordInput = defineComponent({
|
|
144
|
+
name: "IrisPasswordInput",
|
|
145
|
+
inheritAttrs: false,
|
|
146
|
+
props: {
|
|
147
|
+
modelValue: { type: String, default: "" },
|
|
148
|
+
size: { type: String, default: "md" },
|
|
149
|
+
placeholder: { type: String, default: "" },
|
|
150
|
+
disabled: { type: Boolean, default: false },
|
|
151
|
+
readonly: { type: Boolean, default: false },
|
|
152
|
+
invalid: { type: Boolean, default: false },
|
|
153
|
+
id: { type: String, default: void 0 },
|
|
154
|
+
/** Allow the user to toggle visibility. Default `true`. */
|
|
155
|
+
showToggle: { type: Boolean, default: true }
|
|
156
|
+
},
|
|
157
|
+
emits: {
|
|
158
|
+
"update:modelValue": (_value) => true,
|
|
159
|
+
focus: (_event) => true,
|
|
160
|
+
blur: (_event) => true
|
|
161
|
+
},
|
|
162
|
+
setup(props, { attrs, emit, slots }) {
|
|
163
|
+
const { t } = useI18n();
|
|
164
|
+
const visible = ref(false);
|
|
165
|
+
const onUpdate = (value) => emit("update:modelValue", value);
|
|
166
|
+
const onFocus = (e) => emit("focus", e);
|
|
167
|
+
const onBlur = (e) => emit("blur", e);
|
|
168
|
+
const toggle = () => {
|
|
169
|
+
if (props.disabled || props.readonly) return;
|
|
170
|
+
visible.value = !visible.value;
|
|
171
|
+
};
|
|
172
|
+
return () => h(
|
|
173
|
+
IrisInput,
|
|
174
|
+
{
|
|
175
|
+
...attrs,
|
|
176
|
+
modelValue: props.modelValue,
|
|
177
|
+
type: visible.value ? "text" : "password",
|
|
178
|
+
size: props.size,
|
|
179
|
+
placeholder: props.placeholder,
|
|
180
|
+
disabled: props.disabled,
|
|
181
|
+
readonly: props.readonly,
|
|
182
|
+
invalid: props.invalid,
|
|
183
|
+
id: props.id,
|
|
184
|
+
"data-iris-password-input": "",
|
|
185
|
+
"onUpdate:modelValue": onUpdate,
|
|
186
|
+
onFocus,
|
|
187
|
+
onBlur
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
prefix: slots.prefix,
|
|
191
|
+
suffix: () => [
|
|
192
|
+
slots.suffix?.(),
|
|
193
|
+
props.showToggle ? h(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
"data-iris-password-input-toggle": "",
|
|
198
|
+
"aria-label": visible.value ? t("passwordInput.hide") : t("passwordInput.show"),
|
|
199
|
+
"aria-pressed": visible.value ? "true" : "false",
|
|
200
|
+
onClick: toggle,
|
|
201
|
+
style: {
|
|
202
|
+
background: "transparent",
|
|
203
|
+
border: "none",
|
|
204
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
205
|
+
color: "var(--iris-muted)",
|
|
206
|
+
padding: "0 2px",
|
|
207
|
+
fontSize: "13px",
|
|
208
|
+
lineHeight: "1"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
visible.value ? "\u{1F648}" : "\u{1F441}"
|
|
212
|
+
) : null
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
var IrisCheckbox = defineComponent({
|
|
219
|
+
name: "IrisCheckbox",
|
|
220
|
+
inheritAttrs: false,
|
|
221
|
+
props: {
|
|
222
|
+
modelValue: {
|
|
223
|
+
type: [Boolean, String],
|
|
224
|
+
default: false
|
|
225
|
+
},
|
|
226
|
+
size: { type: String, default: "md" },
|
|
227
|
+
disabled: { type: Boolean, default: false },
|
|
228
|
+
id: { type: String, default: void 0 },
|
|
229
|
+
name: { type: String, default: void 0 },
|
|
230
|
+
value: { type: [String, Number], default: void 0 },
|
|
231
|
+
/** Forwarded as `aria-describedby` on the native checkbox input. Set by IrisFormField. */
|
|
232
|
+
ariaDescribedby: { type: String, default: void 0 },
|
|
233
|
+
/**
|
|
234
|
+
* Accessible name for the native checkbox input. Bound as `aria-label` on
|
|
235
|
+
* the `<input>` itself (the element with the checkbox role), NOT the label
|
|
236
|
+
* wrapper. Use when there is no visible label text.
|
|
237
|
+
*/
|
|
238
|
+
ariaLabel: { type: String, default: void 0 },
|
|
239
|
+
/** Invalid state — sets aria-invalid. Set by IrisFormField. */
|
|
240
|
+
invalid: { type: Boolean, default: false }
|
|
241
|
+
},
|
|
242
|
+
emits: {
|
|
243
|
+
"update:modelValue": (_value) => true,
|
|
244
|
+
change: (_value) => true
|
|
245
|
+
},
|
|
246
|
+
setup(props, { slots, attrs, emit }) {
|
|
247
|
+
const state = computed(() => {
|
|
248
|
+
if (props.modelValue === "indeterminate") return "indeterminate";
|
|
249
|
+
return props.modelValue ? "checked" : "unchecked";
|
|
250
|
+
});
|
|
251
|
+
const dim = computed(() => {
|
|
252
|
+
const map = { sm: "14px", md: "18px", lg: "22px" };
|
|
253
|
+
return map[props.size];
|
|
254
|
+
});
|
|
255
|
+
const boxStyle = computed(() => ({
|
|
256
|
+
display: "inline-flex",
|
|
257
|
+
alignItems: "center",
|
|
258
|
+
justifyContent: "center",
|
|
259
|
+
width: dim.value,
|
|
260
|
+
height: dim.value,
|
|
261
|
+
borderRadius: "var(--iris-radius-sm)",
|
|
262
|
+
border: "1px solid var(--iris-border)",
|
|
263
|
+
background: state.value === "unchecked" ? "var(--iris-background)" : "var(--iris-primary)",
|
|
264
|
+
borderColor: state.value === "unchecked" ? "var(--iris-border)" : "var(--iris-primary)",
|
|
265
|
+
color: "var(--iris-primary-foreground)",
|
|
266
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
267
|
+
opacity: props.disabled ? "0.6" : "1",
|
|
268
|
+
transition: "background-color 120ms ease, border-color 120ms ease",
|
|
269
|
+
verticalAlign: "middle"
|
|
270
|
+
}));
|
|
271
|
+
const onChange = (event) => {
|
|
272
|
+
const next = event.target.checked;
|
|
273
|
+
emit("update:modelValue", next);
|
|
274
|
+
emit("change", next);
|
|
275
|
+
};
|
|
276
|
+
const renderIndicator = () => {
|
|
277
|
+
if (state.value === "unchecked") return null;
|
|
278
|
+
if (state.value === "indeterminate") {
|
|
279
|
+
return h("span", {
|
|
280
|
+
"aria-hidden": "true",
|
|
281
|
+
style: { width: "60%", height: "2px", background: "currentColor", borderRadius: "1px" }
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return h(
|
|
285
|
+
"svg",
|
|
286
|
+
{
|
|
287
|
+
"aria-hidden": "true",
|
|
288
|
+
viewBox: "0 0 16 16",
|
|
289
|
+
width: "80%",
|
|
290
|
+
height: "80%",
|
|
291
|
+
fill: "none"
|
|
292
|
+
},
|
|
293
|
+
[
|
|
294
|
+
h("path", {
|
|
295
|
+
d: "M3 8.5 L6.5 12 L13 4.5",
|
|
296
|
+
stroke: "currentColor",
|
|
297
|
+
"stroke-width": "2.4",
|
|
298
|
+
"stroke-linecap": "round",
|
|
299
|
+
"stroke-linejoin": "round"
|
|
300
|
+
})
|
|
301
|
+
]
|
|
302
|
+
);
|
|
303
|
+
};
|
|
304
|
+
return () => h(
|
|
305
|
+
"label",
|
|
306
|
+
{
|
|
307
|
+
...attrs,
|
|
308
|
+
"data-iris-checkbox": "",
|
|
309
|
+
"data-iris-checkbox-size": props.size,
|
|
310
|
+
"data-state": state.value,
|
|
311
|
+
style: {
|
|
312
|
+
display: "inline-flex",
|
|
313
|
+
alignItems: "center",
|
|
314
|
+
gap: "var(--iris-gap-sm)",
|
|
315
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
316
|
+
userSelect: "none",
|
|
317
|
+
...attrs.style ?? {}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
[
|
|
321
|
+
h("input", {
|
|
322
|
+
type: "checkbox",
|
|
323
|
+
id: props.id,
|
|
324
|
+
name: props.name,
|
|
325
|
+
value: props.value,
|
|
326
|
+
checked: props.modelValue === true,
|
|
327
|
+
indeterminate: props.modelValue === "indeterminate",
|
|
328
|
+
disabled: props.disabled || void 0,
|
|
329
|
+
"aria-checked": state.value === "indeterminate" ? "mixed" : state.value === "checked" ? "true" : "false",
|
|
330
|
+
"aria-describedby": props.ariaDescribedby,
|
|
331
|
+
"aria-label": props.ariaLabel,
|
|
332
|
+
"aria-invalid": props.invalid ? "true" : void 0,
|
|
333
|
+
style: {
|
|
334
|
+
position: "absolute",
|
|
335
|
+
opacity: "0",
|
|
336
|
+
width: "0",
|
|
337
|
+
height: "0",
|
|
338
|
+
pointerEvents: "none"
|
|
339
|
+
},
|
|
340
|
+
onChange
|
|
341
|
+
}),
|
|
342
|
+
h("span", { "aria-hidden": "true", style: boxStyle.value }, [renderIndicator()]),
|
|
343
|
+
slots.default && h("span", null, slots.default())
|
|
344
|
+
]
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// src/primitives/button/styles.ts
|
|
350
|
+
var STYLE_ID = "iris-button-styles";
|
|
351
|
+
var CSS = `
|
|
352
|
+
.iris-button {
|
|
353
|
+
cursor: pointer;
|
|
354
|
+
display: inline-flex;
|
|
355
|
+
align-items: center;
|
|
356
|
+
justify-content: center;
|
|
357
|
+
gap: var(--iris-gap-sm, 4px);
|
|
358
|
+
font-family: inherit;
|
|
359
|
+
font-weight: 500;
|
|
360
|
+
line-height: 1.2;
|
|
361
|
+
border-radius: var(--iris-radius-md, 6px);
|
|
362
|
+
white-space: nowrap;
|
|
363
|
+
user-select: none;
|
|
364
|
+
position: relative;
|
|
365
|
+
transition:
|
|
366
|
+
background-color 120ms ease,
|
|
367
|
+
border-color 120ms ease,
|
|
368
|
+
color 120ms ease,
|
|
369
|
+
filter 120ms ease;
|
|
370
|
+
}
|
|
371
|
+
.iris-button:focus-visible {
|
|
372
|
+
outline: 2px solid var(--iris-primary);
|
|
373
|
+
outline-offset: 2px;
|
|
374
|
+
}
|
|
375
|
+
.iris-button[disabled],
|
|
376
|
+
.iris-button[aria-busy="true"] {
|
|
377
|
+
cursor: not-allowed;
|
|
378
|
+
opacity: 0.6;
|
|
379
|
+
}
|
|
380
|
+
.iris-button[data-iris-button-variant="solid"]:not([disabled]):not([aria-busy="true"]):hover {
|
|
381
|
+
filter: brightness(1.08);
|
|
382
|
+
}
|
|
383
|
+
.iris-button[data-iris-button-variant="outline"]:not([disabled]):not([aria-busy="true"]):hover,
|
|
384
|
+
.iris-button[data-iris-button-variant="ghost"]:not([disabled]):not([aria-busy="true"]):hover {
|
|
385
|
+
background-color: var(--iris-surface-hover);
|
|
386
|
+
}
|
|
387
|
+
.iris-button[data-iris-button-variant="link"]:not([disabled]):not([aria-busy="true"]):hover {
|
|
388
|
+
text-decoration: underline;
|
|
389
|
+
}
|
|
390
|
+
.iris-button-leading {
|
|
391
|
+
display: inline-flex;
|
|
392
|
+
align-items: center;
|
|
393
|
+
}
|
|
394
|
+
.iris-button-spinner {
|
|
395
|
+
width: 1em;
|
|
396
|
+
height: 1em;
|
|
397
|
+
display: inline-block;
|
|
398
|
+
animation: iris-button-spin 0.7s linear infinite;
|
|
399
|
+
}
|
|
400
|
+
@keyframes iris-button-spin {
|
|
401
|
+
to { transform: rotate(360deg); }
|
|
402
|
+
}
|
|
403
|
+
`;
|
|
404
|
+
var installed = false;
|
|
405
|
+
function installButtonStyles() {
|
|
406
|
+
if (installed) return;
|
|
407
|
+
if (typeof document === "undefined") return;
|
|
408
|
+
if (document.getElementById(STYLE_ID)) {
|
|
409
|
+
installed = true;
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const style = document.createElement("style");
|
|
413
|
+
style.id = STYLE_ID;
|
|
414
|
+
style.textContent = CSS;
|
|
415
|
+
document.head.appendChild(style);
|
|
416
|
+
installed = true;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/primitives/button/Button.ts
|
|
420
|
+
var SIZE_STYLES = {
|
|
421
|
+
sm: {
|
|
422
|
+
padding: "var(--iris-padding-sm) var(--iris-padding-md)",
|
|
423
|
+
fontSize: "12px"
|
|
424
|
+
},
|
|
425
|
+
md: {
|
|
426
|
+
padding: "var(--iris-padding-sm) var(--iris-padding-lg)",
|
|
427
|
+
fontSize: "14px"
|
|
428
|
+
},
|
|
429
|
+
lg: {
|
|
430
|
+
padding: "var(--iris-padding-md) var(--iris-padding-lg)",
|
|
431
|
+
fontSize: "16px"
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
var VARIANT_STYLES = {
|
|
435
|
+
solid: {
|
|
436
|
+
background: "var(--iris-primary)",
|
|
437
|
+
color: "var(--iris-primary-foreground)",
|
|
438
|
+
border: "1px solid var(--iris-primary)"
|
|
439
|
+
},
|
|
440
|
+
outline: {
|
|
441
|
+
background: "transparent",
|
|
442
|
+
color: "var(--iris-primary)",
|
|
443
|
+
border: "1px solid var(--iris-border)"
|
|
444
|
+
},
|
|
445
|
+
ghost: {
|
|
446
|
+
background: "transparent",
|
|
447
|
+
color: "var(--iris-foreground)",
|
|
448
|
+
border: "1px solid transparent"
|
|
449
|
+
},
|
|
450
|
+
link: {
|
|
451
|
+
background: "transparent",
|
|
452
|
+
color: "var(--iris-primary)",
|
|
453
|
+
border: "1px solid transparent",
|
|
454
|
+
textDecoration: "none"
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
function buildInlineStyle(variant, size) {
|
|
458
|
+
const base = { ...SIZE_STYLES[size], ...VARIANT_STYLES[variant] };
|
|
459
|
+
if (variant === "link") {
|
|
460
|
+
base.padding = "0";
|
|
461
|
+
}
|
|
462
|
+
return base;
|
|
463
|
+
}
|
|
464
|
+
function renderSpinner() {
|
|
465
|
+
return h(
|
|
466
|
+
"svg",
|
|
467
|
+
{
|
|
468
|
+
class: "iris-button-spinner",
|
|
469
|
+
viewBox: "0 0 24 24",
|
|
470
|
+
fill: "none",
|
|
471
|
+
"aria-hidden": "true"
|
|
472
|
+
},
|
|
473
|
+
[
|
|
474
|
+
h("circle", {
|
|
475
|
+
cx: "12",
|
|
476
|
+
cy: "12",
|
|
477
|
+
r: "10",
|
|
478
|
+
stroke: "currentColor",
|
|
479
|
+
"stroke-opacity": "0.25",
|
|
480
|
+
"stroke-width": "3"
|
|
481
|
+
}),
|
|
482
|
+
h("path", {
|
|
483
|
+
d: "M22 12a10 10 0 0 1-10 10",
|
|
484
|
+
stroke: "currentColor",
|
|
485
|
+
"stroke-width": "3",
|
|
486
|
+
"stroke-linecap": "round"
|
|
487
|
+
})
|
|
488
|
+
]
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
var IrisButton = defineComponent({
|
|
492
|
+
name: "IrisButton",
|
|
493
|
+
props: {
|
|
494
|
+
variant: { type: String, default: "solid" },
|
|
495
|
+
size: { type: String, default: "md" },
|
|
496
|
+
disabled: { type: Boolean, default: false },
|
|
497
|
+
loading: { type: Boolean, default: false },
|
|
498
|
+
type: { type: String, default: "button" },
|
|
499
|
+
asChild: { type: Boolean, default: false }
|
|
500
|
+
},
|
|
501
|
+
emits: {
|
|
502
|
+
click: (_event) => true
|
|
503
|
+
},
|
|
504
|
+
setup(props, { slots, emit }) {
|
|
505
|
+
installButtonStyles();
|
|
506
|
+
const isInteractive = computed(() => !props.disabled && !props.loading);
|
|
507
|
+
const inlineStyle = computed(() => buildInlineStyle(props.variant, props.size));
|
|
508
|
+
const onClick = (event) => {
|
|
509
|
+
if (!isInteractive.value) {
|
|
510
|
+
event.preventDefault();
|
|
511
|
+
event.stopPropagation();
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
emit("click", event);
|
|
515
|
+
};
|
|
516
|
+
return () => {
|
|
517
|
+
const baseProps = {
|
|
518
|
+
class: "iris-button",
|
|
519
|
+
"data-iris-button-variant": props.variant,
|
|
520
|
+
"data-iris-button-size": props.size,
|
|
521
|
+
"aria-disabled": props.disabled ? "true" : void 0,
|
|
522
|
+
"aria-busy": props.loading ? "true" : void 0,
|
|
523
|
+
style: inlineStyle.value,
|
|
524
|
+
onClick
|
|
525
|
+
};
|
|
526
|
+
if (props.asChild) {
|
|
527
|
+
const root = findFirstElement(slots.default?.());
|
|
528
|
+
if (!root) {
|
|
529
|
+
if (typeof process === "undefined" || process.env?.NODE_ENV !== "production") {
|
|
530
|
+
console.warn("[iris-ui] IrisButton: as-child requires a single child element");
|
|
531
|
+
}
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
const parentProps = {
|
|
535
|
+
...baseProps,
|
|
536
|
+
disabled: isInteractive.value ? void 0 : true
|
|
537
|
+
};
|
|
538
|
+
const merged = mergeSlotProps(parentProps, root.props ?? {});
|
|
539
|
+
return h(root.type, merged, root.children);
|
|
540
|
+
}
|
|
541
|
+
const leadingContent = props.loading ? renderSpinner() : slots.leading?.();
|
|
542
|
+
const children = [];
|
|
543
|
+
if (leadingContent) {
|
|
544
|
+
children.push(h("span", { class: "iris-button-leading" }, leadingContent));
|
|
545
|
+
}
|
|
546
|
+
const defaultSlot = slots.default?.();
|
|
547
|
+
if (defaultSlot) children.push(defaultSlot);
|
|
548
|
+
return h(
|
|
549
|
+
"button",
|
|
550
|
+
{
|
|
551
|
+
...baseProps,
|
|
552
|
+
type: props.type,
|
|
553
|
+
disabled: isInteractive.value ? void 0 : true
|
|
554
|
+
},
|
|
555
|
+
children
|
|
556
|
+
);
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
var IrisFormField = defineComponent({
|
|
561
|
+
name: "IrisFormField",
|
|
562
|
+
inheritAttrs: false,
|
|
563
|
+
props: {
|
|
564
|
+
label: { type: String, default: "" },
|
|
565
|
+
hint: { type: String, default: "" },
|
|
566
|
+
error: { type: String, default: "" },
|
|
567
|
+
required: { type: Boolean, default: false },
|
|
568
|
+
/** Override the auto-generated control id. */
|
|
569
|
+
labelFor: { type: String, default: "" },
|
|
570
|
+
/** Visual size of the label. */
|
|
571
|
+
size: { type: String, default: "md" }
|
|
572
|
+
},
|
|
573
|
+
setup(props, { slots, attrs }) {
|
|
574
|
+
const baseId = useId();
|
|
575
|
+
const controlId = computed(() => props.labelFor || `${baseId}-control`);
|
|
576
|
+
const hintId = `${baseId}-hint`;
|
|
577
|
+
const errorId = `${baseId}-error`;
|
|
578
|
+
const describedBy = computed(() => {
|
|
579
|
+
const ids = [];
|
|
580
|
+
if (props.hint) ids.push(hintId);
|
|
581
|
+
if (props.error) ids.push(errorId);
|
|
582
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
583
|
+
});
|
|
584
|
+
const labelStyle = computed(() => ({
|
|
585
|
+
fontSize: props.size === "sm" ? "12px" : "14px",
|
|
586
|
+
fontWeight: "500",
|
|
587
|
+
color: props.error ? "var(--iris-danger)" : "var(--iris-foreground)",
|
|
588
|
+
display: "inline-flex",
|
|
589
|
+
alignItems: "center",
|
|
590
|
+
gap: "4px"
|
|
591
|
+
}));
|
|
592
|
+
return () => {
|
|
593
|
+
const children = slots.default?.() ?? [];
|
|
594
|
+
let injected = null;
|
|
595
|
+
const restChildren = [];
|
|
596
|
+
let foundFirst = false;
|
|
597
|
+
children.forEach((child) => {
|
|
598
|
+
if (!foundFirst && typeof child.type !== "symbol" && typeof child.type !== "string") {
|
|
599
|
+
injected = cloneVNode(child, {
|
|
600
|
+
id: controlId.value,
|
|
601
|
+
invalid: props.error ? true : void 0,
|
|
602
|
+
ariaDescribedby: describedBy.value
|
|
603
|
+
});
|
|
604
|
+
foundFirst = true;
|
|
605
|
+
} else {
|
|
606
|
+
restChildren.push(child);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
return h(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
...attrs,
|
|
613
|
+
"data-iris-form-field": "",
|
|
614
|
+
"data-iris-form-field-state": props.error ? "invalid" : "valid",
|
|
615
|
+
style: {
|
|
616
|
+
display: "flex",
|
|
617
|
+
flexDirection: "column",
|
|
618
|
+
gap: "4px",
|
|
619
|
+
...attrs.style ?? {}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
[
|
|
623
|
+
props.label ? h(
|
|
624
|
+
"label",
|
|
625
|
+
{
|
|
626
|
+
for: controlId.value,
|
|
627
|
+
"data-iris-form-field-label": "",
|
|
628
|
+
style: labelStyle.value
|
|
629
|
+
},
|
|
630
|
+
[
|
|
631
|
+
props.label,
|
|
632
|
+
props.required ? h(
|
|
633
|
+
"span",
|
|
634
|
+
{
|
|
635
|
+
"aria-hidden": "true",
|
|
636
|
+
"data-iris-form-field-required": "",
|
|
637
|
+
style: { color: "var(--iris-danger)" }
|
|
638
|
+
},
|
|
639
|
+
"*"
|
|
640
|
+
) : null
|
|
641
|
+
]
|
|
642
|
+
) : null,
|
|
643
|
+
// The wrapped control + any trailing siblings.
|
|
644
|
+
h(Fragment, null, [injected, ...restChildren]),
|
|
645
|
+
props.hint && !props.error ? h(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
id: hintId,
|
|
649
|
+
"data-iris-form-field-hint": "",
|
|
650
|
+
style: { fontSize: "12px", color: "var(--iris-muted)" }
|
|
651
|
+
},
|
|
652
|
+
props.hint
|
|
653
|
+
) : null,
|
|
654
|
+
props.error ? h(
|
|
655
|
+
"div",
|
|
656
|
+
{
|
|
657
|
+
id: errorId,
|
|
658
|
+
"data-iris-form-field-error": "",
|
|
659
|
+
role: "alert",
|
|
660
|
+
style: { fontSize: "12px", color: "var(--iris-danger)" }
|
|
661
|
+
},
|
|
662
|
+
props.error
|
|
663
|
+
) : null
|
|
664
|
+
]
|
|
665
|
+
);
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
var TONE_TO_VAR = {
|
|
670
|
+
info: "--iris-primary",
|
|
671
|
+
success: "--iris-success",
|
|
672
|
+
warning: "--iris-warning",
|
|
673
|
+
danger: "--iris-danger"
|
|
674
|
+
};
|
|
675
|
+
var IrisAlert = defineComponent({
|
|
676
|
+
name: "IrisAlert",
|
|
677
|
+
inheritAttrs: false,
|
|
678
|
+
props: {
|
|
679
|
+
tone: { type: String, default: "info" },
|
|
680
|
+
title: { type: String, default: "" },
|
|
681
|
+
/** When true, a close button is rendered. */
|
|
682
|
+
closable: { type: Boolean, default: false },
|
|
683
|
+
/** Controlled visibility. Omit for uncontrolled (defaults to visible). */
|
|
684
|
+
open: { type: Boolean, default: void 0 }
|
|
685
|
+
},
|
|
686
|
+
emits: {
|
|
687
|
+
"update:open": (_value) => true,
|
|
688
|
+
close: () => true
|
|
689
|
+
},
|
|
690
|
+
setup(props, { slots, attrs, emit }) {
|
|
691
|
+
const { t } = useI18n();
|
|
692
|
+
const internalOpen = ref(true);
|
|
693
|
+
watch(
|
|
694
|
+
() => props.open,
|
|
695
|
+
(value) => {
|
|
696
|
+
if (value !== void 0) internalOpen.value = value;
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
const isOpen = computed(() => props.open !== void 0 ? props.open : internalOpen.value);
|
|
700
|
+
const onClose = () => {
|
|
701
|
+
if (props.open === void 0) internalOpen.value = false;
|
|
702
|
+
emit("update:open", false);
|
|
703
|
+
emit("close");
|
|
704
|
+
};
|
|
705
|
+
const tonalVar = computed(() => `var(${TONE_TO_VAR[props.tone]})`);
|
|
706
|
+
const containerStyle = computed(() => ({
|
|
707
|
+
display: "flex",
|
|
708
|
+
gap: "var(--iris-gap-md, 12px)",
|
|
709
|
+
padding: "var(--iris-padding-md, 12px)",
|
|
710
|
+
borderRadius: "var(--iris-radius-md, 6px)",
|
|
711
|
+
border: `1px solid ${tonalVar.value}`,
|
|
712
|
+
// `backgroundColor` is the precomputed fallback under color-mix (engines
|
|
713
|
+
// without it); the `background` shorthand overrides with the exact mix.
|
|
714
|
+
backgroundColor: `var(${TONE_TO_VAR[props.tone]}-subtle)`,
|
|
715
|
+
background: `color-mix(in srgb, ${tonalVar.value} 10%, var(--iris-background))`,
|
|
716
|
+
color: "var(--iris-foreground)",
|
|
717
|
+
alignItems: "flex-start"
|
|
718
|
+
}));
|
|
719
|
+
return () => {
|
|
720
|
+
if (!isOpen.value) return null;
|
|
721
|
+
return h(
|
|
722
|
+
"div",
|
|
723
|
+
{
|
|
724
|
+
...attrs,
|
|
725
|
+
role: props.tone === "danger" || props.tone === "warning" ? "alert" : "status",
|
|
726
|
+
"data-iris-alert": "",
|
|
727
|
+
"data-iris-alert-tone": props.tone,
|
|
728
|
+
style: { ...containerStyle.value, ...attrs.style ?? {} }
|
|
729
|
+
},
|
|
730
|
+
[
|
|
731
|
+
slots.icon ? h(
|
|
732
|
+
"span",
|
|
733
|
+
{
|
|
734
|
+
"data-iris-alert-icon": "",
|
|
735
|
+
style: { color: tonalVar.value, flexShrink: "0", display: "inline-flex" }
|
|
736
|
+
},
|
|
737
|
+
slots.icon()
|
|
738
|
+
) : null,
|
|
739
|
+
h("div", { "data-iris-alert-body": "", style: { flex: "1", minWidth: "0" } }, [
|
|
740
|
+
props.title || slots.title ? h(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
"data-iris-alert-title": "",
|
|
744
|
+
style: { fontWeight: "600", marginBottom: "4px", color: tonalVar.value }
|
|
745
|
+
},
|
|
746
|
+
slots.title?.() ?? props.title
|
|
747
|
+
) : null,
|
|
748
|
+
h("div", { "data-iris-alert-content": "" }, slots.default?.())
|
|
749
|
+
]),
|
|
750
|
+
props.closable ? h(
|
|
751
|
+
"button",
|
|
752
|
+
{
|
|
753
|
+
type: "button",
|
|
754
|
+
"data-iris-alert-close": "",
|
|
755
|
+
"aria-label": t("alert.close"),
|
|
756
|
+
onClick: onClose,
|
|
757
|
+
style: {
|
|
758
|
+
background: "transparent",
|
|
759
|
+
border: "none",
|
|
760
|
+
cursor: "pointer",
|
|
761
|
+
color: "var(--iris-muted)",
|
|
762
|
+
fontSize: "16px",
|
|
763
|
+
padding: "0",
|
|
764
|
+
lineHeight: "1",
|
|
765
|
+
flexShrink: "0"
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
"\u2715"
|
|
769
|
+
) : null
|
|
770
|
+
]
|
|
771
|
+
);
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
var SPACING_MAP = {
|
|
776
|
+
sm: "8px",
|
|
777
|
+
md: "16px",
|
|
778
|
+
lg: "24px"
|
|
779
|
+
};
|
|
780
|
+
var IrisDivider = defineComponent({
|
|
781
|
+
name: "IrisDivider",
|
|
782
|
+
inheritAttrs: false,
|
|
783
|
+
props: {
|
|
784
|
+
orientation: { type: String, default: "horizontal" },
|
|
785
|
+
label: { type: String, default: "" },
|
|
786
|
+
spacing: { type: String, default: "md" }
|
|
787
|
+
},
|
|
788
|
+
setup(props, { slots, attrs }) {
|
|
789
|
+
const isHorizontal = computed(() => props.orientation === "horizontal");
|
|
790
|
+
const hasLabel = computed(() => Boolean(props.label || slots.default));
|
|
791
|
+
return () => {
|
|
792
|
+
if (isHorizontal.value && !hasLabel.value) {
|
|
793
|
+
return h("hr", {
|
|
794
|
+
...attrs,
|
|
795
|
+
"data-iris-divider": "",
|
|
796
|
+
"data-iris-divider-orientation": "horizontal",
|
|
797
|
+
style: {
|
|
798
|
+
border: "none",
|
|
799
|
+
borderTop: "1px solid var(--iris-border)",
|
|
800
|
+
margin: `${SPACING_MAP[props.spacing]} 0`,
|
|
801
|
+
width: "100%",
|
|
802
|
+
...attrs.style ?? {}
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
if (!isHorizontal.value) {
|
|
807
|
+
return h("div", {
|
|
808
|
+
...attrs,
|
|
809
|
+
role: "separator",
|
|
810
|
+
"aria-orientation": "vertical",
|
|
811
|
+
"data-iris-divider": "",
|
|
812
|
+
"data-iris-divider-orientation": "vertical",
|
|
813
|
+
style: {
|
|
814
|
+
display: "inline-block",
|
|
815
|
+
width: "1px",
|
|
816
|
+
alignSelf: "stretch",
|
|
817
|
+
background: "var(--iris-border)",
|
|
818
|
+
margin: `0 ${SPACING_MAP[props.spacing]}`,
|
|
819
|
+
...attrs.style ?? {}
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
return h(
|
|
824
|
+
"div",
|
|
825
|
+
{
|
|
826
|
+
...attrs,
|
|
827
|
+
role: "separator",
|
|
828
|
+
"aria-orientation": "horizontal",
|
|
829
|
+
"data-iris-divider": "",
|
|
830
|
+
"data-iris-divider-orientation": "horizontal",
|
|
831
|
+
"data-iris-divider-has-label": "true",
|
|
832
|
+
style: {
|
|
833
|
+
display: "flex",
|
|
834
|
+
alignItems: "center",
|
|
835
|
+
gap: "8px",
|
|
836
|
+
margin: `${SPACING_MAP[props.spacing]} 0`,
|
|
837
|
+
color: "var(--iris-muted)",
|
|
838
|
+
fontSize: "12px",
|
|
839
|
+
textTransform: "uppercase",
|
|
840
|
+
letterSpacing: "0.04em",
|
|
841
|
+
...attrs.style ?? {}
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
[
|
|
845
|
+
h("span", { "data-iris-divider-line": "before", style: lineStyle() }),
|
|
846
|
+
h("span", { "data-iris-divider-label": "" }, slots.default?.() ?? props.label),
|
|
847
|
+
h("span", { "data-iris-divider-line": "after", style: lineStyle() })
|
|
848
|
+
]
|
|
849
|
+
);
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
function lineStyle() {
|
|
854
|
+
return {
|
|
855
|
+
flex: "1",
|
|
856
|
+
height: "1px",
|
|
857
|
+
background: "var(--iris-border)"
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// src/skeletons/LoginTemplate.ts
|
|
862
|
+
var IrisLoginTemplate = defineComponent({
|
|
863
|
+
name: "IrisLoginTemplate",
|
|
864
|
+
inheritAttrs: false,
|
|
865
|
+
props: {
|
|
866
|
+
title: { type: String, default: "Sign in" },
|
|
867
|
+
description: { type: String, default: "" },
|
|
868
|
+
/** Show "Remember me" checkbox. */
|
|
869
|
+
showRemember: { type: Boolean, default: true },
|
|
870
|
+
/** Error message shown above the form. */
|
|
871
|
+
error: { type: String, default: "" },
|
|
872
|
+
submitLabel: { type: String, default: "Sign in" },
|
|
873
|
+
/** Disable the entire form (e.g. while a request is pending). */
|
|
874
|
+
loading: { type: Boolean, default: false }
|
|
875
|
+
},
|
|
876
|
+
emits: {
|
|
877
|
+
submit: (_payload) => true
|
|
878
|
+
},
|
|
879
|
+
setup(props, { attrs, slots, emit }) {
|
|
880
|
+
const email = ref("");
|
|
881
|
+
const password = ref("");
|
|
882
|
+
const remember = ref(false);
|
|
883
|
+
const onSubmit = (event) => {
|
|
884
|
+
event.preventDefault();
|
|
885
|
+
emit("submit", {
|
|
886
|
+
email: email.value,
|
|
887
|
+
password: password.value,
|
|
888
|
+
remember: remember.value
|
|
889
|
+
});
|
|
890
|
+
};
|
|
891
|
+
return () => h(
|
|
892
|
+
"div",
|
|
893
|
+
{
|
|
894
|
+
...attrs,
|
|
895
|
+
"data-iris-login-template": "",
|
|
896
|
+
style: {
|
|
897
|
+
minHeight: "100vh",
|
|
898
|
+
display: "flex",
|
|
899
|
+
alignItems: "center",
|
|
900
|
+
justifyContent: "center",
|
|
901
|
+
background: "var(--iris-background)",
|
|
902
|
+
color: "var(--iris-foreground)",
|
|
903
|
+
padding: "24px",
|
|
904
|
+
...attrs.style ?? {}
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
h(IrisContainer, { maxWidth: "420px", padding: 0 }, () => [
|
|
908
|
+
h(
|
|
909
|
+
"form",
|
|
910
|
+
{
|
|
911
|
+
onSubmit,
|
|
912
|
+
"data-iris-login-form": "",
|
|
913
|
+
style: {
|
|
914
|
+
background: "var(--iris-surface)",
|
|
915
|
+
border: "1px solid var(--iris-border)",
|
|
916
|
+
borderRadius: "var(--iris-radius-lg, 8px)",
|
|
917
|
+
padding: "32px",
|
|
918
|
+
boxShadow: "0 6px 20px -8px rgba(0, 0, 0, 0.16)"
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
[
|
|
922
|
+
h(IrisStack, { spacing: "lg" }, () => [
|
|
923
|
+
slots.header ? slots.header() : h("div", { style: { textAlign: "center" } }, [
|
|
924
|
+
h(
|
|
925
|
+
"h1",
|
|
926
|
+
{
|
|
927
|
+
style: {
|
|
928
|
+
margin: "0 0 4px 0",
|
|
929
|
+
fontSize: "22px",
|
|
930
|
+
fontWeight: "700"
|
|
931
|
+
}
|
|
932
|
+
},
|
|
933
|
+
props.title
|
|
934
|
+
),
|
|
935
|
+
props.description ? h(
|
|
936
|
+
"p",
|
|
937
|
+
{
|
|
938
|
+
style: {
|
|
939
|
+
margin: "0",
|
|
940
|
+
color: "var(--iris-muted)",
|
|
941
|
+
fontSize: "14px"
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
props.description
|
|
945
|
+
) : null
|
|
946
|
+
]),
|
|
947
|
+
props.error ? h(IrisAlert, { tone: "danger", title: props.error }) : null,
|
|
948
|
+
h(
|
|
949
|
+
IrisFormField,
|
|
950
|
+
{ label: "Email", required: true },
|
|
951
|
+
() => h(IrisInput, {
|
|
952
|
+
type: "email",
|
|
953
|
+
modelValue: email.value,
|
|
954
|
+
"onUpdate:modelValue": (v) => email.value = v,
|
|
955
|
+
placeholder: "you@example.com",
|
|
956
|
+
disabled: props.loading,
|
|
957
|
+
autocomplete: "email"
|
|
958
|
+
})
|
|
959
|
+
),
|
|
960
|
+
h(
|
|
961
|
+
IrisFormField,
|
|
962
|
+
{ label: "Password", required: true },
|
|
963
|
+
() => h(IrisPasswordInput, {
|
|
964
|
+
modelValue: password.value,
|
|
965
|
+
"onUpdate:modelValue": (v) => password.value = v,
|
|
966
|
+
placeholder: "Enter your password",
|
|
967
|
+
disabled: props.loading,
|
|
968
|
+
autocomplete: "current-password"
|
|
969
|
+
})
|
|
970
|
+
),
|
|
971
|
+
props.showRemember ? h(
|
|
972
|
+
"div",
|
|
973
|
+
{
|
|
974
|
+
style: {
|
|
975
|
+
display: "flex",
|
|
976
|
+
alignItems: "center",
|
|
977
|
+
justifyContent: "space-between"
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
[
|
|
981
|
+
h(
|
|
982
|
+
IrisCheckbox,
|
|
983
|
+
{
|
|
984
|
+
modelValue: remember.value,
|
|
985
|
+
"onUpdate:modelValue": (v) => {
|
|
986
|
+
remember.value = v === true;
|
|
987
|
+
},
|
|
988
|
+
disabled: props.loading
|
|
989
|
+
},
|
|
990
|
+
() => "Remember me"
|
|
991
|
+
),
|
|
992
|
+
slots.forgot ? slots.forgot() : null
|
|
993
|
+
]
|
|
994
|
+
) : null,
|
|
995
|
+
h(
|
|
996
|
+
IrisButton,
|
|
997
|
+
{
|
|
998
|
+
type: "submit",
|
|
999
|
+
variant: "solid",
|
|
1000
|
+
loading: props.loading,
|
|
1001
|
+
style: { width: "100%" }
|
|
1002
|
+
},
|
|
1003
|
+
() => props.submitLabel
|
|
1004
|
+
),
|
|
1005
|
+
slots.footer ? h("div", null, [h(IrisDivider, { spacing: "md", label: "or" }), slots.footer()]) : null
|
|
1006
|
+
])
|
|
1007
|
+
]
|
|
1008
|
+
)
|
|
1009
|
+
])
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
var IrisDashboardTemplate = defineComponent({
|
|
1014
|
+
name: "IrisDashboardTemplate",
|
|
1015
|
+
inheritAttrs: false,
|
|
1016
|
+
props: {
|
|
1017
|
+
title: { type: String, default: "Dashboard" },
|
|
1018
|
+
sidebarTitle: { type: String, default: "" },
|
|
1019
|
+
nav: { type: Array, default: () => [] },
|
|
1020
|
+
/** Currently active nav item id. */
|
|
1021
|
+
activeId: { type: String, default: "" },
|
|
1022
|
+
/** Cards to render in the main grid. Skip to use the `default` slot only. */
|
|
1023
|
+
cards: { type: Array, default: () => [] },
|
|
1024
|
+
defaultCollapsed: { type: Boolean, default: false }
|
|
1025
|
+
},
|
|
1026
|
+
emits: {
|
|
1027
|
+
"update:activeId": (_id) => true,
|
|
1028
|
+
"update:collapsed": (_value) => true
|
|
1029
|
+
},
|
|
1030
|
+
setup(props, { attrs, slots, emit }) {
|
|
1031
|
+
const collapsed = ref(props.defaultCollapsed);
|
|
1032
|
+
const onSelectNav = (id) => {
|
|
1033
|
+
emit("update:activeId", id);
|
|
1034
|
+
};
|
|
1035
|
+
return () => h(
|
|
1036
|
+
"div",
|
|
1037
|
+
{
|
|
1038
|
+
...attrs,
|
|
1039
|
+
"data-iris-dashboard-template": "",
|
|
1040
|
+
style: {
|
|
1041
|
+
width: "100%",
|
|
1042
|
+
height: "100vh",
|
|
1043
|
+
background: "var(--iris-background)",
|
|
1044
|
+
color: "var(--iris-foreground)",
|
|
1045
|
+
...attrs.style ?? {}
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
h(
|
|
1049
|
+
IrisSidebarLayout,
|
|
1050
|
+
{
|
|
1051
|
+
collapsed: collapsed.value,
|
|
1052
|
+
"onUpdate:collapsed": (v) => {
|
|
1053
|
+
collapsed.value = v;
|
|
1054
|
+
emit("update:collapsed", v);
|
|
1055
|
+
},
|
|
1056
|
+
width: 240,
|
|
1057
|
+
collapsedWidth: 64
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
sidebar: (state) => h(IrisStack, { spacing: "sm", style: { padding: "12px" } }, () => [
|
|
1061
|
+
slots["sidebar-header"] ? slots["sidebar-header"](state) : props.sidebarTitle ? h(
|
|
1062
|
+
"div",
|
|
1063
|
+
{
|
|
1064
|
+
style: {
|
|
1065
|
+
padding: "8px 12px",
|
|
1066
|
+
fontSize: "14px",
|
|
1067
|
+
fontWeight: "600",
|
|
1068
|
+
color: "var(--iris-foreground)",
|
|
1069
|
+
opacity: state.collapsed ? 0 : 1,
|
|
1070
|
+
transition: "opacity 120ms ease",
|
|
1071
|
+
whiteSpace: "nowrap",
|
|
1072
|
+
overflow: "hidden"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
props.sidebarTitle
|
|
1076
|
+
) : null,
|
|
1077
|
+
h(
|
|
1078
|
+
"nav",
|
|
1079
|
+
{
|
|
1080
|
+
"aria-label": "Primary",
|
|
1081
|
+
style: { display: "flex", flexDirection: "column", gap: "2px" }
|
|
1082
|
+
},
|
|
1083
|
+
props.nav.map((item) => {
|
|
1084
|
+
const isActive = item.id === props.activeId;
|
|
1085
|
+
return h(
|
|
1086
|
+
"button",
|
|
1087
|
+
{
|
|
1088
|
+
key: item.id,
|
|
1089
|
+
type: "button",
|
|
1090
|
+
"data-iris-dashboard-nav-item": item.id,
|
|
1091
|
+
"data-iris-dashboard-nav-active": isActive ? "true" : void 0,
|
|
1092
|
+
onClick: () => onSelectNav(item.id),
|
|
1093
|
+
style: {
|
|
1094
|
+
display: "flex",
|
|
1095
|
+
alignItems: "center",
|
|
1096
|
+
gap: "10px",
|
|
1097
|
+
padding: "8px 12px",
|
|
1098
|
+
background: isActive ? "var(--iris-primary)" : "transparent",
|
|
1099
|
+
color: isActive ? "var(--iris-primary-foreground, #fff)" : "var(--iris-foreground)",
|
|
1100
|
+
border: "none",
|
|
1101
|
+
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
1102
|
+
cursor: "pointer",
|
|
1103
|
+
fontSize: "14px",
|
|
1104
|
+
fontFamily: "inherit",
|
|
1105
|
+
textAlign: "start",
|
|
1106
|
+
outline: "none"
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
[
|
|
1110
|
+
item.icon ? h(
|
|
1111
|
+
"span",
|
|
1112
|
+
{
|
|
1113
|
+
"aria-hidden": "true",
|
|
1114
|
+
style: {
|
|
1115
|
+
width: "16px",
|
|
1116
|
+
display: "inline-flex",
|
|
1117
|
+
justifyContent: "center"
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
item.icon
|
|
1121
|
+
) : null,
|
|
1122
|
+
h(
|
|
1123
|
+
"span",
|
|
1124
|
+
{
|
|
1125
|
+
style: {
|
|
1126
|
+
opacity: state.collapsed ? 0 : 1,
|
|
1127
|
+
transition: "opacity 120ms ease",
|
|
1128
|
+
whiteSpace: "nowrap"
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
item.label
|
|
1132
|
+
)
|
|
1133
|
+
]
|
|
1134
|
+
);
|
|
1135
|
+
})
|
|
1136
|
+
)
|
|
1137
|
+
]),
|
|
1138
|
+
default: () => h(IrisHeaderLayout, {}, {
|
|
1139
|
+
header: () => slots.header ? slots.header() : h(
|
|
1140
|
+
"div",
|
|
1141
|
+
{
|
|
1142
|
+
style: {
|
|
1143
|
+
padding: "12px 20px",
|
|
1144
|
+
fontSize: "16px",
|
|
1145
|
+
fontWeight: "600"
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
props.title
|
|
1149
|
+
),
|
|
1150
|
+
default: () => slots.default ? slots.default() : h(
|
|
1151
|
+
"div",
|
|
1152
|
+
{ style: { padding: "20px" } },
|
|
1153
|
+
h(
|
|
1154
|
+
IrisDashboardGrid,
|
|
1155
|
+
{ columns: 12, gap: 16 },
|
|
1156
|
+
() => props.cards.map(
|
|
1157
|
+
(card) => h(
|
|
1158
|
+
IrisDashboardCard,
|
|
1159
|
+
{
|
|
1160
|
+
key: card.id,
|
|
1161
|
+
colSpan: card.colSpan ?? 4,
|
|
1162
|
+
rowSpan: card.rowSpan ?? 1,
|
|
1163
|
+
"data-iris-dashboard-card-id": card.id
|
|
1164
|
+
},
|
|
1165
|
+
() => [
|
|
1166
|
+
h(
|
|
1167
|
+
"h3",
|
|
1168
|
+
{
|
|
1169
|
+
style: {
|
|
1170
|
+
margin: "0 0 8px 0",
|
|
1171
|
+
fontSize: "14px",
|
|
1172
|
+
fontWeight: "600",
|
|
1173
|
+
color: "var(--iris-foreground)"
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
card.title
|
|
1177
|
+
),
|
|
1178
|
+
slots[`card.${card.id}`] ? slots[`card.${card.id}`]() : card.body ? h(
|
|
1179
|
+
"div",
|
|
1180
|
+
{ style: { fontSize: "13px", color: "var(--iris-muted)" } },
|
|
1181
|
+
card.body
|
|
1182
|
+
) : null
|
|
1183
|
+
]
|
|
1184
|
+
)
|
|
1185
|
+
)
|
|
1186
|
+
)
|
|
1187
|
+
)
|
|
1188
|
+
})
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
export { IrisAlert, IrisButton, IrisCheckbox, IrisDashboardTemplate, IrisDivider, IrisFormField, IrisInput, IrisLoginTemplate, IrisPasswordInput };
|
|
1196
|
+
//# sourceMappingURL=chunk-QLUIKEMJ.js.map
|
|
1197
|
+
//# sourceMappingURL=chunk-QLUIKEMJ.js.map
|