@oneb/ui-vue 0.0.9 → 0.0.11

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.
@@ -1,4 +1,4 @@
1
- import { inject as O, computed as i, defineComponent as g, provide as E, openBlock as r, createElementBlock as n, withModifiers as N, renderSlot as B, unref as a, createTextVNode as L, toDisplayString as h, Fragment as F, renderList as $, createCommentVNode as b, createElementVNode as d, ref as C, onMounted as A, normalizeClass as v, createVNode as V, createBlock as k, resolveDynamicComponent as P } from "vue";
1
+ import { inject as O, computed as a, defineComponent as g, provide as E, openBlock as l, createElementBlock as t, withModifiers as A, renderSlot as V, unref as d, createTextVNode as L, toDisplayString as h, Fragment as _, renderList as $, createCommentVNode as b, createElementVNode as i, ref as q, onMounted as P, normalizeClass as v, createVNode as C, createBlock as k, resolveDynamicComponent as x } from "vue";
2
2
  const z = {
3
3
  id: {
4
4
  type: String,
@@ -64,6 +64,10 @@ const z = {
64
64
  type: String,
65
65
  default: "text"
66
66
  },
67
+ inputClass: {
68
+ required: !1,
69
+ type: [Array, String]
70
+ },
67
71
  modelValue: {
68
72
  required: !1,
69
73
  type: [String, Number, Array, Boolean, Object, null]
@@ -105,54 +109,54 @@ const z = {
105
109
  }, I = () => O(
106
110
  "BaseForm",
107
111
  () => ({
108
- formId: i(() => {
112
+ formId: a(() => {
109
113
  }),
110
- validation: i(() => {
114
+ validation: a(() => {
111
115
  })
112
116
  }),
113
117
  !0
114
- ), _ = () => O(
118
+ ), B = () => O(
115
119
  "BaseFormField",
116
120
  () => ({
117
- inputId: i(() => {
121
+ inputId: a(() => {
118
122
  }),
119
- inputName: i(() => {
123
+ inputName: a(() => {
120
124
  }),
121
- hasError: i(() => !1)
125
+ hasError: a(() => !1)
122
126
  }),
123
127
  !0
124
- ), J = ["onSubmit", "id"], be = /* @__PURE__ */ g({
128
+ ), J = ["onSubmit", "id"], ke = /* @__PURE__ */ g({
125
129
  __name: "OneForm",
126
130
  props: z,
127
131
  emits: ["submit"],
128
- setup(u, { emit: l }) {
129
- const o = u;
132
+ setup(u, { emit: n }) {
133
+ const r = u;
130
134
  E("BaseForm", {
131
- formId: i(() => o.id),
132
- validation: i(() => o.validation)
135
+ formId: a(() => r.id),
136
+ validation: a(() => r.validation)
133
137
  });
134
138
  const p = () => {
135
- l("submit");
139
+ n("submit");
136
140
  };
137
- return (s, t) => (r(), n("form", {
138
- onSubmit: N(p, ["prevent"]),
141
+ return (s, o) => (l(), t("form", {
142
+ onSubmit: A(p, ["prevent"]),
139
143
  id: s.id,
140
144
  class: "space-y-3"
141
145
  }, [
142
- B(s.$slots, "default")
146
+ V(s.$slots, "default")
143
147
  ], 40, J));
144
148
  }
145
149
  }), K = ["for"], Q = /* @__PURE__ */ g({
146
150
  __name: "OneFormLabel",
147
151
  props: G,
148
152
  setup(u) {
149
- const { inputId: l } = _();
150
- return (o, p) => (r(), n("label", {
151
- for: a(l),
153
+ const { inputId: n } = B();
154
+ return (r, p) => (l(), t("label", {
155
+ for: d(n),
152
156
  class: "block text-sm font-medium text-primary-content select-none"
153
157
  }, [
154
- B(o.$slots, "default", {}, () => [
155
- L(h(o.label), 1)
158
+ V(r.$slots, "default", {}, () => [
159
+ L(h(r.label), 1)
156
160
  ])
157
161
  ], 8, K));
158
162
  }
@@ -163,14 +167,14 @@ const z = {
163
167
  __name: "OneFormFeedback",
164
168
  props: T,
165
169
  setup(u) {
166
- const l = u, { validation: o } = I(), { inputName: p } = _(), s = i(() => p.value == null && l.name == null ? l.errors ?? [] : o.value == null ? l.errors ?? [] : (o.value ?? {})[l.name || p.value] ?? l.errors ?? []);
167
- return (t, c) => s.value.length > 0 ? (r(), n("div", R, [
168
- (r(!0), n(F, null, $(s.value, (f) => (r(), n("div", { key: f }, h(f), 1))), 128))
170
+ const n = u, { validation: r } = I(), { inputName: p } = B(), s = a(() => p.value == null && n.name == null ? n.errors ?? [] : r.value == null ? n.errors ?? [] : (r.value ?? {})[n.name || p.value] ?? n.errors ?? []);
171
+ return (o, m) => s.value.length > 0 ? (l(), t("div", R, [
172
+ (l(!0), t(_, null, $(s.value, (f) => (l(), t("div", { key: f }, h(f), 1))), 128))
169
173
  ])) : b("", !0);
170
174
  }
171
175
  });
172
- function W(u, l) {
173
- return r(), n("svg", {
176
+ function W(u, n) {
177
+ return l(), t("svg", {
174
178
  xmlns: "http://www.w3.org/2000/svg",
175
179
  fill: "none",
176
180
  viewBox: "0 0 24 24",
@@ -178,20 +182,20 @@ function W(u, l) {
178
182
  stroke: "currentColor",
179
183
  "aria-hidden": "true"
180
184
  }, [
181
- d("path", {
185
+ i("path", {
182
186
  "stroke-linecap": "round",
183
187
  "stroke-linejoin": "round",
184
188
  d: "M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
185
189
  }),
186
- d("path", {
190
+ i("path", {
187
191
  "stroke-linecap": "round",
188
192
  "stroke-linejoin": "round",
189
193
  d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
190
194
  })
191
195
  ]);
192
196
  }
193
- function X(u, l) {
194
- return r(), n("svg", {
197
+ function X(u, n) {
198
+ return l(), t("svg", {
195
199
  xmlns: "http://www.w3.org/2000/svg",
196
200
  fill: "none",
197
201
  viewBox: "0 0 24 24",
@@ -199,15 +203,15 @@ function X(u, l) {
199
203
  stroke: "currentColor",
200
204
  "aria-hidden": "true"
201
205
  }, [
202
- d("path", {
206
+ i("path", {
203
207
  "stroke-linecap": "round",
204
208
  "stroke-linejoin": "round",
205
209
  d: "M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
206
210
  })
207
211
  ]);
208
212
  }
209
- function Y(u, l) {
210
- return r(), n("svg", {
213
+ function Y(u, n) {
214
+ return l(), t("svg", {
211
215
  xmlns: "http://www.w3.org/2000/svg",
212
216
  fill: "none",
213
217
  viewBox: "0 0 24 24",
@@ -215,15 +219,15 @@ function Y(u, l) {
215
219
  stroke: "currentColor",
216
220
  "aria-hidden": "true"
217
221
  }, [
218
- d("path", {
222
+ i("path", {
219
223
  "stroke-linecap": "round",
220
224
  "stroke-linejoin": "round",
221
225
  d: "M6 18L18 6M6 6l12 12"
222
226
  })
223
227
  ]);
224
228
  }
225
- function Z(u, l) {
226
- return r(), n("svg", {
229
+ function Z(u, n) {
230
+ return l(), t("svg", {
227
231
  xmlns: "http://www.w3.org/2000/svg",
228
232
  fill: "none",
229
233
  viewBox: "0 0 24 24",
@@ -231,51 +235,66 @@ function Z(u, l) {
231
235
  stroke: "currentColor",
232
236
  "aria-hidden": "true"
233
237
  }, [
234
- d("path", {
238
+ i("path", {
235
239
  "stroke-linecap": "round",
236
240
  "stroke-linejoin": "round",
237
241
  d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
238
242
  })
239
243
  ]);
240
244
  }
241
- const x = {
245
+ const ee = {
242
246
  key: 0,
243
247
  class: "w-full onebselect relative group"
244
- }, ee = ["id", "disabled"], re = ["selected"], le = ["selected"], ne = { class: "absolute p-2 px-3 rounded-md h-full flex items-center right-1 top-0 select-none pointer-events-none" }, oe = ["name", "id", "value", "placeholder", "disabled", "readonly"], te = {
248
+ }, re = ["id", "disabled"], le = ["selected"], ne = ["selected", "value"], te = { class: "absolute p-2 px-3 rounded-md h-full flex items-center right-1 top-0 select-none pointer-events-none" }, oe = ["name", "id", "value", "placeholder", "disabled", "readonly"], ae = {
245
249
  key: 2,
246
250
  class: "flex w-full space-x-3 items-center"
247
- }, ae = ["type", "name", "id", "disabled", "readonly", "checked"], se = ["for"], de = {
251
+ }, se = ["type", "name", "id", "disabled", "readonly", "checked"], de = ["for"], ie = {
248
252
  key: 3,
249
253
  class: "w-full space-y-1"
250
- }, ie = ["name", "id", "value", "disabled", "readonly", "checked"], ue = ["for"], pe = {
254
+ }, ue = ["name", "id", "value", "disabled", "readonly", "checked"], pe = ["for"], ce = {
251
255
  key: 4,
252
256
  class: "relative"
253
- }, ce = { class: "absolute p-2 px-3 rounded-md h-full flex items-center select-none" }, me = ["type", "name", "id", "value", "placeholder", "disabled", "readonly"], fe = /* @__PURE__ */ g({
257
+ }, me = { class: "absolute p-2 px-3 rounded-md h-full flex items-center select-none" }, fe = ["type", "name", "id", "value", "placeholder", "disabled", "readonly"], ye = /* @__PURE__ */ g({
254
258
  __name: "OneFormInput",
255
259
  props: H,
256
260
  emits: ["update:modelValue"],
257
- setup(u, { emit: l }) {
258
- const o = u, { inputId: p, inputName: s, hasError: t } = _(), c = C(null), f = C(!1);
259
- A(() => {
260
- o.autofocus && c.value && c.value.focus();
261
+ setup(u, { emit: n }) {
262
+ const r = u, { inputId: p, inputName: s, hasError: o } = B(), m = q(null), f = q(!1);
263
+ P(() => {
264
+ r.autofocus && m.value && m.value.focus();
261
265
  });
262
- const j = i(() => o.modelValue != null && o.modelValue !== ""), y = i(() => {
263
- if (o.id)
264
- return o.id;
266
+ const j = a(() => r.modelValue != null && r.modelValue !== ""), y = a(() => {
267
+ if (r.id)
268
+ return r.id;
265
269
  const e = (p == null ? void 0 : p.value) || "";
266
- return o.name ? `${e}-${o.name}` : e || "";
270
+ return r.name ? `${e}-${r.name}` : e || "";
267
271
  }), M = () => {
268
- l("update:modelValue", "");
269
- }, w = (e) => {
270
- o.type === "checkbox" ? l("update:modelValue", e.target.checked) : l("update:modelValue", e.target.value);
272
+ n("update:modelValue", "");
273
+ }, N = a(() => {
274
+ const e = {
275
+ "shadow-sm": r.type !== "range",
276
+ "border-danger-base": o.value || r.invalid,
277
+ "pl-10": r.icon != null,
278
+ "pr-10": r.type === "password",
279
+ "rounded-full": r.rounded,
280
+ "rounded-md": !r.rounded,
281
+ "text-lg": r.large,
282
+ "py-2.5": r.large,
283
+ "py-2": !r.large
284
+ };
285
+ return r.inputClass != null && (typeof r.inputClass == "string" ? e[r.inputClass] = !0 : r.inputClass instanceof Array && r.inputClass.forEach((F) => {
286
+ e[F] = !0;
287
+ })), e;
288
+ }), w = (e) => {
289
+ r.type === "checkbox" ? n("update:modelValue", e.target.checked) : n("update:modelValue", e.target.value);
271
290
  };
272
- return (e, S) => e.type === "select" ? (r(), n("div", x, [
273
- d("select", {
291
+ return (e, F) => e.type === "select" ? (l(), t("div", ee, [
292
+ i("select", {
274
293
  id: y.value,
275
294
  ref_key: "inputElement",
276
- ref: c,
295
+ ref: m,
277
296
  class: v(["border border-primary-stroke px-3 w-full", {
278
- "border-danger-base": a(t) || e.invalid,
297
+ "border-danger-base": d(o) || e.invalid,
279
298
  "text-secondary-content": e.modelValue === "" || e.modelValue == null,
280
299
  "rounded-full": e.rounded,
281
300
  "rounded-md": !e.rounded,
@@ -285,34 +304,35 @@ const x = {
285
304
  }]),
286
305
  disabled: e.disabled
287
306
  }, [
288
- e.placeholder ? (r(), n("option", {
307
+ e.placeholder ? (l(), t("option", {
289
308
  key: 0,
290
309
  selected: e.modelValue === "" || e.modelValue == null,
291
310
  disabled: "",
292
311
  hidden: ""
293
- }, h(e.placeholder), 9, re)) : b("", !0),
294
- (r(!0), n(F, null, $(e.options, (m) => (r(), n("option", {
295
- selected: m.key === e.modelValue,
296
- key: m.key
297
- }, h(m.value), 9, le))), 128))
298
- ], 10, ee),
299
- d("div", ne, [
300
- V(a(Z), {
312
+ }, h(e.placeholder), 9, le)) : b("", !0),
313
+ (l(!0), t(_, null, $(e.options, (c) => (l(), t("option", {
314
+ selected: c.key === e.modelValue,
315
+ key: c.key,
316
+ value: c.key
317
+ }, h(c.value), 9, ne))), 128))
318
+ ], 10, re),
319
+ i("div", te, [
320
+ C(d(Z), {
301
321
  class: v(["w-4 h-4 text-secondary-content", {
302
322
  "group-hover:text-primary-base": !e.disabled,
303
323
  "opacity-50": e.disabled
304
324
  }])
305
325
  }, null, 8, ["class"])
306
326
  ])
307
- ])) : e.type === "textarea" ? (r(), n("textarea", {
327
+ ])) : e.type === "textarea" ? (l(), t("textarea", {
308
328
  key: 1,
309
- name: e.name || a(s),
329
+ name: e.name || d(s),
310
330
  id: y.value,
311
331
  value: e.modelValue,
312
332
  onInput: w,
313
333
  rows: "3",
314
334
  class: v(["border border-primary-stroke px-3 w-full", {
315
- "border-danger-base": a(t),
335
+ "border-danger-base": d(o),
316
336
  "rounded-3xl": e.rounded,
317
337
  "rounded-md": !e.rounded,
318
338
  "text-lg": e.large,
@@ -323,98 +343,88 @@ const x = {
323
343
  disabled: e.disabled,
324
344
  readonly: e.readonly,
325
345
  ref_key: "inputElement",
326
- ref: c
327
- }, null, 42, oe)) : e.type === "checkbox" ? (r(), n("div", te, [
328
- d("input", {
346
+ ref: m
347
+ }, null, 42, oe)) : e.type === "checkbox" ? (l(), t("div", ae, [
348
+ i("input", {
329
349
  type: e.type,
330
- name: e.name || a(s),
350
+ name: e.name || d(s),
331
351
  id: y.value,
332
352
  value: !0,
333
353
  onInput: w,
334
354
  disabled: e.disabled,
335
355
  readonly: e.readonly,
336
356
  class: v(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
337
- "border-danger-base": a(t) || e.invalid
357
+ "border-danger-base": d(o) || e.invalid
338
358
  }]),
339
359
  checked: e.modelValue === !0,
340
360
  ref_key: "inputElement",
341
- ref: c
342
- }, null, 42, ae),
343
- d("label", {
361
+ ref: m
362
+ }, null, 42, se),
363
+ i("label", {
344
364
  for: y.value,
345
365
  class: "text-primary-content select-none"
346
- }, h(e.placeholder), 9, se)
347
- ])) : e.type === "radio" ? (r(), n("div", de, [
348
- (r(!0), n(F, null, $(e.options, (m, q) => (r(), n("div", {
349
- key: m.key,
366
+ }, h(e.placeholder), 9, de)
367
+ ])) : e.type === "radio" ? (l(), t("div", ie, [
368
+ (l(!0), t(_, null, $(e.options, (c, S) => (l(), t("div", {
369
+ key: c.key,
350
370
  class: "flex w-full space-x-3 items-center"
351
371
  }, [
352
- d("input", {
372
+ i("input", {
353
373
  type: "radio",
354
- name: e.name || a(s),
355
- id: `${y.value}-${q}`,
356
- value: m.key,
374
+ name: e.name || d(s),
375
+ id: `${y.value}-${S}`,
376
+ value: c.key,
357
377
  onInput: w,
358
378
  disabled: e.disabled,
359
379
  readonly: e.readonly,
360
380
  class: v(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
361
- "border-danger-base": a(t) || e.invalid
381
+ "border-danger-base": d(o) || e.invalid
362
382
  }]),
363
- checked: m.key === e.modelValue,
383
+ checked: c.key === e.modelValue,
364
384
  ref_for: !0,
365
385
  ref_key: "inputElement",
366
- ref: c
367
- }, null, 42, ie),
368
- d("label", {
369
- for: `${y.value}-${q}`,
386
+ ref: m
387
+ }, null, 42, ue),
388
+ i("label", {
389
+ for: `${y.value}-${S}`,
370
390
  class: "text-primary-content select-none"
371
- }, h(m.value), 9, ue)
391
+ }, h(c.value), 9, pe)
372
392
  ]))), 128))
373
- ])) : (r(), n("div", pe, [
374
- d("div", ce, [
375
- e.icon ? (r(), k(P(e.icon), {
393
+ ])) : (l(), t("div", ce, [
394
+ i("div", me, [
395
+ e.icon ? (l(), k(x(e.icon), {
376
396
  key: 0,
377
397
  class: "w-5 h-5 text-primary-content"
378
398
  })) : b("", !0)
379
399
  ]),
380
- d("input", {
400
+ i("input", {
381
401
  type: f.value ? "text" : e.type,
382
- name: e.name || a(s),
402
+ name: e.name || d(s),
383
403
  id: y.value,
384
404
  value: e.modelValue,
385
405
  onInput: w,
386
406
  placeholder: e.placeholder,
387
407
  disabled: e.disabled,
388
408
  readonly: e.readonly,
389
- class: v(["border border-primary-stroke w-full px-3", {
390
- "shadow-sm": e.type !== "range",
391
- "border-danger-base": a(t) || e.invalid,
392
- "pl-10": e.icon != null,
393
- "pr-10": e.type === "password",
394
- "rounded-full": e.rounded,
395
- "rounded-md": !e.rounded,
396
- "text-lg": e.large,
397
- "py-2.5": e.large,
398
- "py-2": !e.large
399
- }]),
409
+ class: v(["border border-primary-stroke w-full px-3", N.value]),
400
410
  ref_key: "inputElement",
401
- ref: c
402
- }, null, 42, me),
403
- e.clearable && j.value ? (r(), n("div", {
411
+ ref: m
412
+ }, null, 42, fe),
413
+ e.clearable && j.value ? (l(), t("div", {
404
414
  key: 0,
405
415
  onClick: M,
406
416
  class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
407
417
  }, [
408
- V(a(Y), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
409
- ])) : e.type === "password" ? (r(), n("div", {
418
+ C(d(Y), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
419
+ ])) : e.type === "password" ? (l(), t("div", {
410
420
  key: 1,
411
- onClick: S[0] || (S[0] = (m) => f.value = !f.value),
421
+ onClick: F[0] || (F[0] = (c) => f.value = !f.value),
412
422
  class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
413
423
  }, [
414
- f.value ? (r(), k(a(X), {
424
+ f.value ? (l(), k(d(X), {
415
425
  key: 0,
416
426
  class: "w-5 h-5 text-primary-content hover:text-primary-base"
417
- })) : (r(), k(a(W), {
427
+ })) : (l(), k(d(W), {
418
428
  key: 1,
419
429
  class: "w-5 h-5 text-secondary-content hover:text-primary-base"
420
430
  }))
@@ -422,45 +432,45 @@ const x = {
422
432
  ]));
423
433
  }
424
434
  });
425
- const ye = { class: "space-y-1" }, he = {
435
+ const he = { class: "space-y-1" }, ve = {
426
436
  key: 2,
427
437
  class: "text-xs text-secondary-content select-none"
428
- }, ke = /* @__PURE__ */ g({
438
+ }, ge = /* @__PURE__ */ g({
429
439
  __name: "OneFormField",
430
440
  props: D,
431
441
  setup(u) {
432
- const l = u, { formId: o, validation: p } = I(), s = i(
433
- () => l.errors != null && l.errors.length > 0 ? !0 : l.name == null ? !1 : (p.value ?? {})[l.name] != null
442
+ const n = u, { formId: r, validation: p } = I(), s = a(
443
+ () => n.errors != null && n.errors.length > 0 ? !0 : n.name == null ? !1 : (p.value ?? {})[n.name] != null
434
444
  );
435
445
  return E("BaseFormField", {
436
- inputId: i(() => {
437
- const t = o.value || "form";
438
- if (l.id != null)
439
- return `${t}-${l.id}`;
440
- if (l.name != null)
441
- return `${t}-field-${l.name}`;
446
+ inputId: a(() => {
447
+ const o = r.value || "form";
448
+ if (n.id != null)
449
+ return `${o}-${n.id}`;
450
+ if (n.name != null)
451
+ return `${o}-field-${n.name}`;
442
452
  }),
443
- inputName: i(() => l.name),
453
+ inputName: a(() => n.name),
444
454
  hasError: s
445
- }), (t, c) => (r(), n("div", ye, [
446
- t.label ? (r(), k(Q, {
455
+ }), (o, m) => (l(), t("div", he, [
456
+ o.label ? (l(), k(Q, {
447
457
  key: 0,
448
- label: t.label
458
+ label: o.label
449
459
  }, null, 8, ["label"])) : b("", !0),
450
- B(t.$slots, "default", {}, () => [
451
- V(fe)
460
+ V(o.$slots, "default", {}, () => [
461
+ C(ye)
452
462
  ]),
453
- s.value ? (r(), k(U, {
463
+ s.value ? (l(), k(U, {
454
464
  key: 1,
455
- errors: t.errors
456
- }, null, 8, ["errors"])) : t.hint.length > 0 ? (r(), n("p", he, h(t.hint), 1)) : b("", !0)
465
+ errors: o.errors
466
+ }, null, 8, ["errors"])) : o.hint.length > 0 ? (l(), t("p", ve, h(o.hint), 1)) : b("", !0)
457
467
  ]));
458
468
  }
459
469
  });
460
470
  export {
461
- be as OneForm,
471
+ ke as OneForm,
462
472
  U as OneFormFeedback,
463
- ke as OneFormField,
464
- fe as OneFormInput,
473
+ ge as OneFormField,
474
+ ye as OneFormInput,
465
475
  Q as OneFormLabel
466
476
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),n=require("./card/index.cjs"),e=require("./form/index.cjs"),r=require("./dropdown/index.cjs"),O=require("./common/index.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=o.OneButton;exports.OneCard=n.OneCard;exports.OneCardBody=n.OneCardBody;exports.OneCardFooter=n.OneCardFooter;exports.OneCardHeader=n.OneCardHeader;exports.OneForm=e.OneForm;exports.OneFormFeedback=e.OneFormFeedback;exports.OneFormField=e.OneFormField;exports.OneFormInput=e.OneFormInput;exports.OneFormLabel=e.OneFormLabel;exports.OneBrowserMenu=r.OneBrowserMenu;exports.OneDropdown=r.OneDropdown;exports.OneDropdownDivider=r.OneDropdownDivider;exports.OneDropdownItem=r.OneDropdownItem;exports.OneUserMenu=r.OneUserMenu;exports.OneAvatar=O.OneAvatar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),r=require("./card/index.cjs"),e=require("./form/index.cjs"),n=require("./OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs"),O=require("./dropdown/index.cjs"),t=require("./common/index.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=o.OneButton;exports.OneCard=r.OneCard;exports.OneCardBody=r.OneCardBody;exports.OneCardFooter=r.OneCardFooter;exports.OneCardHeader=r.OneCardHeader;exports.OneForm=e.OneForm;exports.OneFormFeedback=e.OneFormFeedback;exports.OneFormField=e.OneFormField;exports.OneFormInput=e.OneFormInput;exports.OneFormLabel=e.OneFormLabel;exports.OneBrowserMenu=n._sfc_main$3;exports.OneDropdown=n._sfc_main;exports.OneDropdownItem=n._sfc_main$1;exports.OneUserMenu=n._sfc_main$2;exports.OneDropdownDivider=O.OneDropdownDivider;exports.OneAvatar=t.OneAvatar;
package/dist/index.js CHANGED
@@ -1,25 +1,26 @@
1
1
  import { OneButton as O } from "./button/index.js";
2
- import { OneCard as t, OneCardBody as d, OneCardFooter as p, OneCardHeader as a } from "./card/index.js";
3
- import { OneForm as f, OneFormFeedback as i, OneFormField as x, OneFormInput as u, OneFormLabel as w } from "./form/index.js";
4
- import { OneBrowserMenu as D, OneDropdown as B, OneDropdownDivider as b, OneDropdownItem as l, OneUserMenu as s } from "./dropdown/index.js";
2
+ import { OneCard as m, OneCardBody as t, OneCardFooter as d, OneCardHeader as p } from "./card/index.js";
3
+ import { OneForm as f, OneFormFeedback as s, OneFormField as x, OneFormInput as i, OneFormLabel as u } from "./form/index.js";
4
+ import { c as C, _ as D, a as b, b as B } from "./OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js";
5
+ import { OneDropdownDivider as l } from "./dropdown/index.js";
5
6
  import { OneAvatar as I } from "./common/index.js";
6
7
  import "vue";
7
8
  import "./_plugin-vue_export-helper-dad06003.js";
8
9
  export {
9
10
  I as OneAvatar,
10
- D as OneBrowserMenu,
11
+ C as OneBrowserMenu,
11
12
  O as OneButton,
12
- t as OneCard,
13
- d as OneCardBody,
14
- p as OneCardFooter,
15
- a as OneCardHeader,
16
- B as OneDropdown,
17
- b as OneDropdownDivider,
18
- l as OneDropdownItem,
13
+ m as OneCard,
14
+ t as OneCardBody,
15
+ d as OneCardFooter,
16
+ p as OneCardHeader,
17
+ D as OneDropdown,
18
+ l as OneDropdownDivider,
19
+ b as OneDropdownItem,
19
20
  f as OneForm,
20
- i as OneFormFeedback,
21
+ s as OneFormFeedback,
21
22
  x as OneFormField,
22
- u as OneFormInput,
23
- w as OneFormLabel,
24
- s as OneUserMenu
23
+ i as OneFormInput,
24
+ u as OneFormLabel,
25
+ B as OneUserMenu
25
26
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs");require("../common/index.cjs");const v={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},k={route:{required:!1,type:[Object,String]},routeName:{required:!1,type:String},handler:{required:!1,type:Function,default(){return()=>{}}},label:{type:String,required:!0},icon:{type:[Function,Object]},exact:{type:Boolean,required:!1,default:!1},slim:{type:Boolean,default:!0}},_={sidebarItems:v.items,logoSrc:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},x=e.defineComponent({__name:"OneSidebarLink",props:k,setup(r){const l=r,n=e.computed(()=>l.route!=null?l.route:l.routeName!=null?{name:l.routeName}:"/");return(o,t)=>{const a=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(a,{to:n.value,class:e.normalizeClass(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content",[o.slim?"w-[44px] h-[44px] justify-center":"h-[44px] justify-start"]]),"active-class":o.exact?"":"bg-primary-10 !text-primary-base","exact-active-class":o.exact?"bg-primary-10 !text-primary-base":"",exact:o.exact},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex flex-nowrap items-center",[o.slim?"w-[24px] h-[24px]":"w-full"]])},[o.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{key:0,class:"w-[24px] h-[24px] flex-shrink-0"})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink",[o.slim?"w-0":"pl-1.5 w-full"]])},e.toDisplayString(o.label),3)],2)]),_:1},8,["to","active-class","exact-active-class","exact","class"])}}}),N={class:""},B={class:"space-y-2 p-2"},y=e.defineComponent({__name:"OneSidebar",props:v,setup(r){return(l,n)=>(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,o=>(e.openBlock(),e.createBlock(x,{key:o.label,icon:o.icon,label:o.label,route:o.route,"route-name":o.routeName,exact:o.exact||!1,slim:l.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function V(r,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})])}const C={class:"min-h-screen relative"},E={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen"},S={class:"p-2 flex-shrink-0"},O={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},j=["src"],L={class:"whitespace-nowrap"},q={class:"text-xs whitespace-nowrap"},$={class:"w-full"},M={class:"w-full flex justify-end pr-2"},z={class:"flex items-center space-x-1"},A={class:"body w-full h-full"},D=e.defineComponent({__name:"OneMainLayout",props:_,setup(r){const l=r,n=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(n,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const o=e.computed(()=>{var t,a;return{name:((t=l.app)==null?void 0:t.workspace)||"",photo_url:((a=l.app)==null?void 0:a.photo_url)||""}});return(t,a)=>{var s,c,i,p,u,d,m,h,f,b;const g=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",E,[e.createElementVNode("div",S,[e.createElementVNode("button",{onClick:a[0]||(a[0]=I=>n.value=!n.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(V),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",O,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,j)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(g,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",L,e.toDisplayString(t.app.name),1),e.createElementVNode("div",q,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",$,[e.createElementVNode("div",M,[e.createElementVNode("div",z,[e.createVNode(w._sfc_main$3,{workspace:o.value,apps:((s=t.app)==null?void 0:s.apps)||[],"change-label":((c=t.labels)==null?void 0:c.change)||"Change","apps-title":((i=t.labels)==null?void 0:i.apps)||"Apps","on-app":(p=t.handlers)==null?void 0:p.onApp,"on-change":(u=t.handlers)==null?void 0:u.onChange,onOpen:(d=t.handlers)==null?void 0:d.onBrowse},null,8,["workspace","apps","change-label","apps-title","on-app","on-change","onOpen"]),e.createVNode(w._sfc_main$2,{user:t.user,"account-label":((m=t.labels)==null?void 0:m.account)||"Account","logout-label":((h=t.labels)==null?void 0:h.logout)||"Logout","on-account":(f=t.handlers)==null?void 0:f.onAccount,"on-logout":(b=t.handlers)==null?void 0:b.onLogout},null,8,["user","account-label","logout-label","on-account","on-logout"])])])])]),e.createElementVNode("div",{class:e.normalizeClass(["sidebar transition-all absolute top-[56px] left-0 h-full",[n.value?"w-[60px]":"w-60"]])},[e.createVNode(y,{slim:n.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",A,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[n.value?"pl-[60px]":"pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneMainLayout=D;exports.OneSidebar=y;
@@ -0,0 +1,2 @@
1
+ export { default as OneSidebar } from './OneSidebar.vue';
2
+ export { default as OneMainLayout } from './OneMainLayout.vue';