ablok-components 0.3.143 → 0.3.145

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,19 +1,21 @@
1
1
  import { uniqueId as e } from "../../../utilities/helpers.js";
2
2
  import t from "../../atoms/base-button/base-button.js";
3
3
  import n from "../input-color/input-color.js";
4
- import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, openBlock as f, renderList as p, renderSlot as m, resolveComponent as h, vModelText as g, withCtx as _, withDirectives as v } from "vue";
4
+ import r from "../input-dropdown/input-dropdown.js";
5
+ import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, openBlock as p, renderList as m, renderSlot as h, resolveComponent as g, vModelText as _, withCtx as v, withDirectives as y } from "vue";
5
6
  //#region src/components/molecules/input-gradient/input-gradient.vue?vue&type=script&setup=true&lang.ts
6
- var y = ["id"], b = ["for", "innerHTML"], x = { class: "dropdown" }, S = ["title"], C = { class: "input-gradient__toggle-icon position-absolute end-0 height-100 d-flex justify-content-center align-items-center bg-white bg-opacity-50 input-gradient__toggle-icon" }, w = { class: "dropdown-menu input-gradient__menu" }, T = { class: "dropdown-item input-gradient__stop d-flex align-items-center" }, E = [
7
- "onUpdate:modelValue",
7
+ var b = ["id"], x = ["for", "innerHTML"], S = { class: "dropdown" }, C = ["title"], w = { class: "input-gradient__toggle-icon position-absolute end-0 height-100 d-flex justify-content-center align-items-center bg-white bg-opacity-50 input-gradient__toggle-icon" }, T = { class: "dropdown-menu input-gradient__menu" }, E = { class: "input-gradient__stop d-flex align-items-center px-3 py-2" }, D = { class: "col-7" }, O = { class: "col" }, k = [
8
+ "value",
8
9
  "name",
9
10
  "id",
10
11
  "aria-label",
11
- "disabled"
12
- ], D = { class: "dropdown-item input-gradient__footer" }, O = [
12
+ "disabled",
13
+ "onInput"
14
+ ], A = { class: "col-auto" }, j = { class: "input-gradient__footer px-3 py-2" }, M = { class: "col-7" }, N = { class: "col" }, P = [
13
15
  "name",
14
16
  "id",
15
17
  "disabled"
16
- ], k = "plus", A = /*@__PURE__*/ l({
18
+ ], F = { class: "col-auto" }, I = "plus", L = /*@__PURE__*/ u({
17
19
  __name: "input-gradient",
18
20
  props: {
19
21
  modelValue: {
@@ -72,70 +74,89 @@ var y = ["id"], b = ["for", "innerHTML"], x = { class: "dropdown" }, S = ["title
72
74
  }
73
75
  },
74
76
  emits: ["update:modelValue"],
75
- setup(e, { emit: l }) {
76
- let A = e, j = l, M = i(() => A.modelValue?.stops ?? []), N = i({
77
+ setup(e, { emit: u }) {
78
+ let L = e, R = u, z = [{
79
+ text: "Linear",
80
+ value: "linear"
81
+ }, {
82
+ text: "Radial",
83
+ value: "radial"
84
+ }], B = a({
85
+ get() {
86
+ return L.modelValue?.type ?? "linear";
87
+ },
88
+ set(e) {
89
+ K({ type: e });
90
+ }
91
+ }), V = a(() => L.modelValue?.stops ?? []), H = a({
77
92
  get() {
78
- return A.modelValue?.angle ?? 180;
93
+ return L.modelValue?.angle ?? 180;
79
94
  },
80
95
  set(e) {
81
- I({ angle: z(Number(e) || 0, 0, 360) });
96
+ K({ angle: Y(Number(e) || 0, 0, 360) });
82
97
  }
83
- }), P = i(() => {
84
- let e = M.value;
98
+ }), U = a(() => {
99
+ let e = V.value;
85
100
  if (!e.length) return "transparent";
86
- let t = e.length > 1 ? N.value : 180, n = e.slice().sort((e, t) => e.pct - t.pct).map((e) => `${e.color} ${z(e.pct, 0, 100)}%`);
87
- return `linear-gradient(${t}deg, ${e.length > 1 ? n.join(", ") : n.join(", ") || "transparent, transparent"})`;
101
+ let t = e.length > 1 ? H.value : 180, n = e.slice().sort((e, t) => e.pct - t.pct).map((e) => `${e.color} ${Y(e.pct, 0, 100)}%`);
102
+ return `${B.value === "radial" ? "radial-gradient" : B.value === "conic" ? "conic-gradient" : "linear-gradient"}(${B.value === "radial" ? "circle at center" : B.value === "conic" ? `from ${t}deg` : `${t}deg`}, ${e.length > 1 ? n.join(", ") : n.join(", ") || "transparent, transparent"})`;
88
103
  });
89
- function F(e) {
90
- return A.lockFirstStop && e === 0;
104
+ function W(e) {
105
+ return L.lockFirstStop && e === 0;
106
+ }
107
+ function G(e, t) {
108
+ W(e) || K({ stops: V.value.map((n, r) => r === e ? {
109
+ ...n,
110
+ ...t
111
+ } : { ...n }) });
91
112
  }
92
- function I(e = {}) {
93
- j("update:modelValue", {
94
- ...A.modelValue,
113
+ function K(e = {}) {
114
+ R("update:modelValue", {
115
+ ...L.modelValue,
95
116
  ...e,
96
- stops: (e.stops ?? M.value).map((e) => ({ ...e }))
117
+ stops: (e.stops ?? V.value).map((e) => ({ ...e }))
97
118
  });
98
119
  }
99
- function L() {
100
- if (M.value.length >= A.maxStops) return;
101
- let e = M.value.map((e) => ({ ...e })), t = e[e.length - 1], n = t ? z(t.pct + 10, 0, 100) : 100;
120
+ function q() {
121
+ if (V.value.length >= L.maxStops) return;
122
+ let e = V.value.map((e) => ({ ...e })), t = e[e.length - 1], n = t ? Y(t.pct + 10, 0, 100) : 100;
102
123
  e.push({
103
124
  color: "#000000ff",
104
125
  pct: n
105
- }), I({ stops: e });
126
+ }), K({ stops: e });
106
127
  }
107
- function R(e) {
108
- F(e) || M.value.length < 2 || I({ stops: M.value.filter((t, n) => n !== e).map((e) => ({ ...e })) });
128
+ function J(e) {
129
+ W(e) || V.value.length < 2 || K({ stops: V.value.filter((t, n) => n !== e).map((e) => ({ ...e })) });
109
130
  }
110
- function z(e, t, n) {
131
+ function Y(e, t, n) {
111
132
  return Math.min(n, Math.max(t, e));
112
133
  }
113
- return (i, l) => {
114
- let A = h("svg-icon");
115
- return f(), o("div", {
134
+ return (a, u) => {
135
+ let L = g("svg-icon");
136
+ return p(), s("div", {
116
137
  class: "input-gradient",
117
138
  id: e.id || e.name
118
- }, [m(i.$slots, "label", {}, () => [e.label ? (f(), o("label", {
139
+ }, [h(a.$slots, "label", {}, () => [e.label ? (p(), s("label", {
119
140
  key: 0,
120
141
  for: `${e.id || e.name}--dropdown-toggle`,
121
142
  class: "input__label",
122
143
  innerHTML: `${e.label}${e.required ? " *" : ""}`
123
- }, null, 8, b)) : a("", !0)]), s("div", x, [c(t, {
144
+ }, null, 8, x)) : o("", !0)]), c("div", S, [l(t, {
124
145
  id: `${e.id || e.name}--dropdown-toggle`,
125
146
  "data-bs-toggle": "dropdown",
126
147
  "data-bs-auto-close": "outside",
127
148
  role: "button",
128
149
  type: "button",
129
- class: u(["btn input-gradient__toggle", { [`btn-${e.variant}`]: e.variant }]),
150
+ class: d(["btn input-gradient__toggle", { [`btn-${e.variant}`]: e.variant }]),
130
151
  color: e.color,
131
152
  disabled: e.disabled,
132
153
  "aria-label": e.label || "Gradient"
133
154
  }, {
134
- default: _(() => [s("span", {
155
+ default: v(() => [c("span", {
135
156
  class: "input-gradient__preview",
136
- style: d({ background: P.value }),
137
- title: P.value
138
- }, null, 12, S), s("span", C, [c(A, { symbol: "chevron-down" })])]),
157
+ style: f({ background: U.value }),
158
+ title: U.value
159
+ }, null, 12, C), c("span", w, [l(L, { symbol: "chevron-down" })])]),
139
160
  _: 1
140
161
  }, 8, [
141
162
  "id",
@@ -143,80 +164,94 @@ var y = ["id"], b = ["for", "innerHTML"], x = { class: "dropdown" }, S = ["title
143
164
  "color",
144
165
  "disabled",
145
166
  "aria-label"
146
- ]), s("ul", w, [(f(!0), o(r, null, p(M.value, (r, i) => (f(), o("li", { key: `${e.name}-stop-${i}` }, [s("div", T, [
147
- c(n, {
148
- modelValue: r.color,
149
- "onUpdate:modelValue": (e) => r.color = e,
167
+ ]), c("ul", T, [(p(!0), s(i, null, m(V.value, (r, i) => (p(), s("li", { key: `${e.name}-stop-${i}` }, [c("div", E, [
168
+ c("div", D, [l(n, {
169
+ "model-value": r.color,
150
170
  name: `${e.name}-stop-${i}-color`,
151
171
  id: `${e.name}-stop-${i}-color`,
152
- disabled: e.disabled || F(i),
153
- class: "input-gradient__stop-color"
172
+ disabled: e.disabled || W(i),
173
+ class: "input-gradient__stop-color",
174
+ "onUpdate:modelValue": (e) => G(i, { color: e })
154
175
  }, null, 8, [
155
- "modelValue",
156
- "onUpdate:modelValue",
176
+ "model-value",
157
177
  "name",
158
178
  "id",
159
- "disabled"
160
- ]),
161
- v(s("input", {
162
- "onUpdate:modelValue": (e) => r.pct = e,
179
+ "disabled",
180
+ "onUpdate:modelValue"
181
+ ])]),
182
+ c("div", O, [c("input", {
183
+ value: r.pct,
163
184
  type: "number",
164
185
  min: "0",
165
186
  max: "100",
166
187
  name: `${e.name}-stop-${i}-pct`,
167
188
  id: `${e.name}-stop-${i}-pct`,
168
189
  "aria-label": `Stop ${i + 1} position`,
169
- disabled: e.disabled || F(i),
170
- class: "form-control input-gradient__stop-pct"
171
- }, null, 8, E), [[
172
- g,
173
- r.pct,
174
- void 0,
175
- { number: !0 }
176
- ]]),
177
- c(t, {
190
+ disabled: e.disabled || W(i),
191
+ class: "form-control input-gradient__stop-pct",
192
+ onInput: (e) => G(i, { pct: Y(Number(e.target.value) || 0, 0, 100) })
193
+ }, null, 40, k)]),
194
+ c("div", A, [l(t, {
178
195
  type: "button",
179
196
  icon: "x",
180
197
  color: "light",
181
- disabled: e.disabled || F(i) || M.value.length < 2,
198
+ disabled: e.disabled || W(i) || V.value.length < 2,
182
199
  "aria-label": `Remove stop ${i + 1}`,
183
200
  title: `Remove stop ${i + 1}`,
184
201
  class: "input-gradient__stop-remove btn btn-sm rounded-circle",
185
- onClick: (e) => R(i)
202
+ onClick: (e) => J(i)
186
203
  }, null, 8, [
187
204
  "disabled",
188
205
  "aria-label",
189
206
  "title",
190
207
  "onClick"
191
- ])
192
- ])]))), 128)), s("li", null, [s("div", D, [v(s("input", {
193
- "onUpdate:modelValue": l[0] ||= (e) => N.value = e,
194
- type: "number",
195
- min: "0",
196
- max: "360",
197
- name: `${e.name}-angle`,
198
- id: `${e.name}-angle`,
199
- "aria-label": "Gradient angle",
200
- disabled: e.disabled || M.value.length < 2,
201
- class: "form-control input-gradient__angle"
202
- }, null, 8, O), [[
203
- g,
204
- N.value,
205
- void 0,
206
- { number: !0 }
207
- ]]), c(t, {
208
- type: "button",
209
- size: "small",
210
- color: "light",
211
- icon: k,
212
- disabled: e.disabled || M.value.length >= e.maxStops,
213
- "aria-label": "Add color stop",
214
- title: "Add color stop",
215
- class: "input-gradient__add btn btn-sm rounded-circle",
216
- onClick: L
217
- }, null, 8, ["disabled"])])])])])], 8, y);
208
+ ])])
209
+ ])]))), 128)), c("li", null, [c("div", j, [
210
+ c("div", M, [l(r, {
211
+ modelValue: B.value,
212
+ "onUpdate:modelValue": u[0] ||= (e) => B.value = e,
213
+ options: z,
214
+ name: `${e.name}-type`,
215
+ id: `${e.name}-type`,
216
+ "aria-label": "Gradient type",
217
+ disabled: e.disabled || V.value.length < 2,
218
+ class: "input-gradient__type"
219
+ }, null, 8, [
220
+ "modelValue",
221
+ "name",
222
+ "id",
223
+ "disabled"
224
+ ])]),
225
+ c("div", N, [y(c("input", {
226
+ "onUpdate:modelValue": u[1] ||= (e) => H.value = e,
227
+ type: "number",
228
+ min: "0",
229
+ max: "360",
230
+ name: `${e.name}-angle`,
231
+ id: `${e.name}-angle`,
232
+ "aria-label": "Gradient angle",
233
+ disabled: e.disabled || V.value.length < 2 || B.value !== "linear",
234
+ class: "form-control input-gradient__angle"
235
+ }, null, 8, P), [[
236
+ _,
237
+ H.value,
238
+ void 0,
239
+ { number: !0 }
240
+ ]])]),
241
+ c("div", F, [l(t, {
242
+ type: "button",
243
+ size: "small",
244
+ color: "light",
245
+ icon: I,
246
+ disabled: e.disabled || V.value.length >= e.maxStops,
247
+ "aria-label": "Add color stop",
248
+ title: "Add color stop",
249
+ class: "input-gradient__add btn btn-sm rounded-circle",
250
+ onClick: q
251
+ }, null, 8, ["disabled"])])
252
+ ])])])])], 8, b);
218
253
  };
219
254
  }
220
255
  });
221
256
  //#endregion
222
- export { A as default };
257
+ export { L as default };
@@ -247,6 +247,7 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
247
247
  name: string;
248
248
  disabled: boolean;
249
249
  maxFileSize: number;
250
+ typeOptions: string[];
250
251
  endpoint: string;
251
252
  authToken: string;
252
253
  baseResponsePath: string;
@@ -255,5 +256,4 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
255
256
  useImageUpload: boolean;
256
257
  mediaTypeMap: Record<string, any>;
257
258
  showTypeDropdown: boolean;
258
- typeOptions: string[];
259
259
  }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>;
@@ -244,6 +244,7 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
244
244
  name: string;
245
245
  disabled: boolean;
246
246
  maxFileSize: number;
247
+ typeOptions: string[];
247
248
  endpoint: string;
248
249
  authToken: string;
249
250
  baseResponsePath: string;
@@ -252,7 +253,6 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
252
253
  useImageUpload: boolean;
253
254
  mediaTypeMap: Record<string, any>;
254
255
  showTypeDropdown: boolean;
255
- typeOptions: string[];
256
256
  }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>;
257
257
  declare const _default: typeof __VLS_export;
258
258
  export default _default;
package/dist/index.js CHANGED
@@ -21,9 +21,9 @@ import y from "./components/atoms/custom-html/custom-html.js";
21
21
  import b from "./components/molecules/select-media/select-media.js";
22
22
  import x from "./components/molecules/rte-editor/rte-editor.js";
23
23
  import S from "./components/molecules/input-color/input-color.js";
24
- import C from "./components/molecules/input-gradient/input-gradient.js";
25
- import w from "./components/molecules/color-palette/color-palette.js";
26
- import T from "./components/molecules/input-dropdown/input-dropdown.js";
24
+ import C from "./components/molecules/input-dropdown/input-dropdown.js";
25
+ import w from "./components/molecules/input-gradient/input-gradient.js";
26
+ import T from "./components/molecules/color-palette/color-palette.js";
27
27
  import E from "./components/molecules/auto-suggest/auto-suggest.js";
28
28
  import D from "./components/molecules/base-camera/base-camera.js";
29
29
  import O from "./components/molecules/base-map/base-map.js";
@@ -58,4 +58,4 @@ import ne from "./components/templates/touch-wrapper/touch-wrapper.js";
58
58
  import re from "./components/atoms/canvas-confetti/canvas-confetti.js";
59
59
  import ie from "./components/molecules/image-zoom/image-zoom.js";
60
60
  import { useCameraFilter as ae } from "./composables/useCameraFilter.js";
61
- export { o as Accordion, a as AccordionItem, z as AssetUploader, E as AutoSuggest, s as BaseButton, D as BaseCamera, K as BaseCarousel, te as BaseForm, r as BaseHeadline, n as BaseImage, c as BaseInput, O as BaseMap, i as BaseParagraph, j as BulkUpload, re as CanvasConfetti, h as CheckGroup, w as ColorPalette, y as CustomHtml, Q as DomRenderer, A as FileUpload, Y as HintSystem, P as ImageCrop, F as ImageCropResize, N as ImageResize, L as ImageUpload, ie as ImageZoom, u as InputCheckbox, S as InputColor, f as InputDatepicker, d as InputDatetime, T as InputDropdown, v as InputFile, C as InputGradient, m as InputPasscode, p as InputPassword, l as InputTextarea, ee as LinkSharing, t as LoadingSpinner, G as LocationFinder, k as LocationList, q as MediaThumbnails, I as ModalDialog, B as PopoverDialog, Z as PopoverNotifications, X as PopoverTooltip, V as PresetUploader, J as ProgressSteps, $ as QrCode, _ as RadioButtons, g as RadioGroup, x as RteEditor, b as SelectMedia, M as SortableList, e as SvgIcon, ne as TouchWrapper, R as UploadGroup, ae as useCameraFilter, H as useDirections, U as useGeocoding, W as useGeolocation };
61
+ export { o as Accordion, a as AccordionItem, z as AssetUploader, E as AutoSuggest, s as BaseButton, D as BaseCamera, K as BaseCarousel, te as BaseForm, r as BaseHeadline, n as BaseImage, c as BaseInput, O as BaseMap, i as BaseParagraph, j as BulkUpload, re as CanvasConfetti, h as CheckGroup, T as ColorPalette, y as CustomHtml, Q as DomRenderer, A as FileUpload, Y as HintSystem, P as ImageCrop, F as ImageCropResize, N as ImageResize, L as ImageUpload, ie as ImageZoom, u as InputCheckbox, S as InputColor, f as InputDatepicker, d as InputDatetime, C as InputDropdown, v as InputFile, w as InputGradient, m as InputPasscode, p as InputPassword, l as InputTextarea, ee as LinkSharing, t as LoadingSpinner, G as LocationFinder, k as LocationList, q as MediaThumbnails, I as ModalDialog, B as PopoverDialog, Z as PopoverNotifications, X as PopoverTooltip, V as PresetUploader, J as ProgressSteps, $ as QrCode, _ as RadioButtons, g as RadioGroup, x as RteEditor, b as SelectMedia, M as SortableList, e as SvgIcon, ne as TouchWrapper, R as UploadGroup, ae as useCameraFilter, H as useDirections, U as useGeocoding, W as useGeolocation };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.143",
4
+ "version": "0.3.145",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@tiptap/core": "^3.30.0",