@retailcrm/embed-ui-v1-components 0.5.1-alpha.4 → 0.5.1-alpha.6
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/dist/host.cjs +159 -3
- package/dist/host.css +105 -0
- package/dist/host.d.ts +22 -0
- package/dist/host.js +160 -4
- package/dist/remote.cjs +7 -0
- package/dist/remote.d.ts +34 -0
- package/dist/remote.js +7 -0
- package/package.json +1 -1
package/dist/host.cjs
CHANGED
|
@@ -60,7 +60,7 @@ var VARIANT = /* @__PURE__ */ ((VARIANT2) => {
|
|
|
60
60
|
VARIANT2["DANGER"] = "danger";
|
|
61
61
|
return VARIANT2;
|
|
62
62
|
})(VARIANT || {});
|
|
63
|
-
const _sfc_main$
|
|
63
|
+
const _sfc_main$e = vue.defineComponent({
|
|
64
64
|
props: {
|
|
65
65
|
/** Устанавливает тип кнопки */
|
|
66
66
|
type: {
|
|
@@ -156,6 +156,161 @@ const _sfc_main$d = vue.defineComponent({
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
|
+
const _hoisted_1$9 = {
|
|
160
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
161
|
+
viewBox: "0 0 24 24"
|
|
162
|
+
};
|
|
163
|
+
function render$4(_ctx, _cache) {
|
|
164
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [
|
|
165
|
+
vue.createElementVNode("path", {
|
|
166
|
+
fill: "currentColor",
|
|
167
|
+
"fill-rule": "evenodd",
|
|
168
|
+
d: "M19.793 6.965a.77.77 0 0 1-.022 1.075l-9.815 9.607a1.224 1.224 0 0 1-1.714.006l-4.01-3.878a.77.77 0 0 1-.028-1.074l.684-.736a.735.735 0 0 1 1.053-.028l3.15 3.046 8.96-8.771a.735.735 0 0 1 1.054.022z",
|
|
169
|
+
"clip-rule": "evenodd"
|
|
170
|
+
}, null, -1)
|
|
171
|
+
]));
|
|
172
|
+
}
|
|
173
|
+
const IconDone = { render: render$4 };
|
|
174
|
+
const _hoisted_1$8 = ["id", "value", "name", "disabled", "checked"];
|
|
175
|
+
const _hoisted_2$3 = { class: "ui-v1-checkbox__checkmark" };
|
|
176
|
+
let counter$1 = 0;
|
|
177
|
+
const __default__ = {};
|
|
178
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
179
|
+
...__default__,
|
|
180
|
+
__name: "UiCheckbox",
|
|
181
|
+
props: {
|
|
182
|
+
id: {
|
|
183
|
+
type: null,
|
|
184
|
+
validator: (id) => id === void 0 || typeof id === "string" && id.length > 0 && /^[A-Za-z]/.test(id),
|
|
185
|
+
default: void 0
|
|
186
|
+
},
|
|
187
|
+
/** Атрибут name нативного поля ввода */
|
|
188
|
+
name: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: () => "ui-checkbox-" + ++counter$1
|
|
191
|
+
},
|
|
192
|
+
/** Значение модели используемое с директивой v-model */
|
|
193
|
+
model: {
|
|
194
|
+
type: null,
|
|
195
|
+
default: void 0
|
|
196
|
+
},
|
|
197
|
+
/** Значение, добавляемое или удаляемое из модели в зависимости от флага checked, если модель является массивом */
|
|
198
|
+
value: {
|
|
199
|
+
type: null,
|
|
200
|
+
default: void 0
|
|
201
|
+
},
|
|
202
|
+
/** Задает значение, если флаг checked равен true, а модель не является массивом */
|
|
203
|
+
valueOfTruthy: {
|
|
204
|
+
type: null,
|
|
205
|
+
default: true
|
|
206
|
+
},
|
|
207
|
+
/** Задает значение, если флаг checked равен false, а модель не является массивом */
|
|
208
|
+
valueOfFalsy: {
|
|
209
|
+
type: null,
|
|
210
|
+
default: false
|
|
211
|
+
},
|
|
212
|
+
/** Задает "состояние" неопределенности для бокса, чье состояние "включенности" зависит от множества других боксов */
|
|
213
|
+
indeterminate: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: false
|
|
216
|
+
},
|
|
217
|
+
/** Задает стили для бокса уменьшенного размера */
|
|
218
|
+
small: {
|
|
219
|
+
type: Boolean,
|
|
220
|
+
default: false
|
|
221
|
+
},
|
|
222
|
+
/** Заблокированный */
|
|
223
|
+
disabled: {
|
|
224
|
+
type: Boolean,
|
|
225
|
+
default: false
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
emits: [
|
|
229
|
+
/** Переключение чекбокса */
|
|
230
|
+
"change",
|
|
231
|
+
/** Изменение значения модели */
|
|
232
|
+
"update:model"
|
|
233
|
+
],
|
|
234
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
235
|
+
const isArray = Array.isArray;
|
|
236
|
+
const props = __props;
|
|
237
|
+
const root = vue.ref(null);
|
|
238
|
+
const checkbox = vue.ref(null);
|
|
239
|
+
const pick = (attrs, criteria) => {
|
|
240
|
+
return Object.keys(attrs).filter(criteria).reduce((picked, key) => ({
|
|
241
|
+
...picked,
|
|
242
|
+
[key]: attrs[key]
|
|
243
|
+
}), {});
|
|
244
|
+
};
|
|
245
|
+
const click = () => {
|
|
246
|
+
var _a;
|
|
247
|
+
return (_a = checkbox.value) == null ? void 0 : _a.click();
|
|
248
|
+
};
|
|
249
|
+
const focus = () => {
|
|
250
|
+
var _a;
|
|
251
|
+
return (_a = checkbox.value) == null ? void 0 : _a.focus();
|
|
252
|
+
};
|
|
253
|
+
const blur = () => {
|
|
254
|
+
var _a;
|
|
255
|
+
return (_a = checkbox.value) == null ? void 0 : _a.blur();
|
|
256
|
+
};
|
|
257
|
+
__expose({
|
|
258
|
+
click,
|
|
259
|
+
focus,
|
|
260
|
+
blur
|
|
261
|
+
});
|
|
262
|
+
const emit = __emit;
|
|
263
|
+
const contains = (array, value) => array.some((v) => v === value);
|
|
264
|
+
const checked = vue.computed(() => {
|
|
265
|
+
return isArray(props.model) ? contains(props.model, props.value) : props.model === props.valueOfTruthy;
|
|
266
|
+
});
|
|
267
|
+
const calculate = (checked2) => {
|
|
268
|
+
if (isArray(props.model)) {
|
|
269
|
+
return checked2 ? contains(props.model, props.value) ? props.model : [...props.model, props.value] : [...props.model].filter((v) => v !== props.value);
|
|
270
|
+
}
|
|
271
|
+
return checked2 ? props.valueOfTruthy : props.valueOfFalsy;
|
|
272
|
+
};
|
|
273
|
+
const onChange = (event) => {
|
|
274
|
+
const checkbox2 = event.target;
|
|
275
|
+
const value = calculate(checkbox2.checked);
|
|
276
|
+
emit("change", value);
|
|
277
|
+
emit("update:model", value);
|
|
278
|
+
};
|
|
279
|
+
return (_ctx, _cache) => {
|
|
280
|
+
return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps({
|
|
281
|
+
ref_key: "root",
|
|
282
|
+
ref: root,
|
|
283
|
+
class: {
|
|
284
|
+
"ui-v1-checkbox": true,
|
|
285
|
+
"ui-v1-checkbox_small": __props.small,
|
|
286
|
+
"ui-v1-checkbox_checked": checked.value,
|
|
287
|
+
"ui-v1-checkbox_indeterminate": __props.indeterminate,
|
|
288
|
+
"ui-v1-checkbox_disabled": __props.disabled
|
|
289
|
+
}
|
|
290
|
+
}, pick(_ctx.$attrs, (key) => !key.startsWith("aria-") && !key.startsWith("on"))), [
|
|
291
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
292
|
+
id: __props.id,
|
|
293
|
+
ref_key: "checkbox",
|
|
294
|
+
ref: checkbox,
|
|
295
|
+
value: vue.unref(isArray)(__props.model) ? __props.value : void 0,
|
|
296
|
+
name: __props.name,
|
|
297
|
+
disabled: __props.disabled,
|
|
298
|
+
checked: checked.value
|
|
299
|
+
}, pick(_ctx.$attrs, (key) => key.startsWith("aria-") || key.startsWith("on")), {
|
|
300
|
+
type: "checkbox",
|
|
301
|
+
class: "ui-v1-checkbox__input",
|
|
302
|
+
onChange
|
|
303
|
+
}), null, 16, _hoisted_1$8),
|
|
304
|
+
vue.createElementVNode("span", _hoisted_2$3, [
|
|
305
|
+
checked.value && !__props.indeterminate ? (vue.openBlock(), vue.createBlock(vue.unref(IconDone), {
|
|
306
|
+
key: 0,
|
|
307
|
+
class: "ui-v1-checkbox__checkmark-icon"
|
|
308
|
+
})) : vue.createCommentVNode("", true)
|
|
309
|
+
])
|
|
310
|
+
], 16);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
});
|
|
159
314
|
var ALIGN = /* @__PURE__ */ ((ALIGN2) => {
|
|
160
315
|
ALIGN2["LEFT"] = "left";
|
|
161
316
|
ALIGN2["RIGHT"] = "right";
|
|
@@ -2966,7 +3121,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2966
3121
|
return SIZE$4.SM;
|
|
2967
3122
|
});
|
|
2968
3123
|
return (_ctx, _cache) => {
|
|
2969
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3124
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$e, vue.mergeProps({
|
|
2970
3125
|
ref_key: "root",
|
|
2971
3126
|
ref: root,
|
|
2972
3127
|
href: __props.href,
|
|
@@ -3237,7 +3392,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3237
3392
|
});
|
|
3238
3393
|
exports.I18nPlugin = plugin;
|
|
3239
3394
|
exports.ModalPlugin = plugin$1;
|
|
3240
|
-
exports.UiButton = _sfc_main$
|
|
3395
|
+
exports.UiButton = _sfc_main$e;
|
|
3396
|
+
exports.UiCheckbox = _sfc_main$d;
|
|
3241
3397
|
exports.UiError = _sfc_main$c;
|
|
3242
3398
|
exports.UiLink = _sfc_main$b;
|
|
3243
3399
|
exports.UiLoader = _sfc_main$9;
|
package/dist/host.css
CHANGED
|
@@ -316,6 +316,111 @@
|
|
|
316
316
|
.ui-v1-button_xs.ui-v1-button_has-trailing-icon {
|
|
317
317
|
padding-right: 8px;
|
|
318
318
|
}
|
|
319
|
+
.ui-v1-checkbox {
|
|
320
|
+
display: inline-flex;
|
|
321
|
+
align-items: flex-start;
|
|
322
|
+
font-style: normal;
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
margin-bottom: 0;
|
|
325
|
+
position: relative;
|
|
326
|
+
vertical-align: text-bottom;
|
|
327
|
+
}
|
|
328
|
+
.ui-v1-checkbox,
|
|
329
|
+
.ui-v1-checkbox *,
|
|
330
|
+
.ui-v1-checkbox *::before,
|
|
331
|
+
.ui-v1-checkbox *::after {
|
|
332
|
+
box-sizing: border-box;
|
|
333
|
+
}
|
|
334
|
+
.ui-v1-checkbox_disabled {
|
|
335
|
+
cursor: default;
|
|
336
|
+
}
|
|
337
|
+
.ui-v1-checkbox__input {
|
|
338
|
+
width: 100%;
|
|
339
|
+
height: 100%;
|
|
340
|
+
appearance: none;
|
|
341
|
+
cursor: inherit;
|
|
342
|
+
outline: none;
|
|
343
|
+
z-index: 1;
|
|
344
|
+
margin: 0;
|
|
345
|
+
position: absolute;
|
|
346
|
+
left: 0;
|
|
347
|
+
top: 0;
|
|
348
|
+
}
|
|
349
|
+
.ui-v1-checkbox__checkmark {
|
|
350
|
+
display: inline-block;
|
|
351
|
+
width: 20px;
|
|
352
|
+
min-width: 20px;
|
|
353
|
+
height: 20px;
|
|
354
|
+
background: #fff;
|
|
355
|
+
border-radius: 4px;
|
|
356
|
+
border: 2px solid #DEE2E6;
|
|
357
|
+
color: #fff;
|
|
358
|
+
transition: 0.25s ease;
|
|
359
|
+
transition-property: color, box-shadow, background-color, border-color;
|
|
360
|
+
vertical-align: top;
|
|
361
|
+
position: relative;
|
|
362
|
+
}
|
|
363
|
+
.ui-v1-checkbox:not(.ui-v1-checkbox_checked):not(.ui-v1-checkbox_active):not(.ui-v1-checkbox_disabled) .ui-v1-checkbox__input:hover ~ .ui-v1-checkbox__checkmark {
|
|
364
|
+
border-color: #005EEB;
|
|
365
|
+
}
|
|
366
|
+
.ui-v1-checkbox:not(.ui-v1-checkbox_checked):not(.ui-v1-checkbox_active):not(.ui-v1-checkbox_disabled) .ui-v1-checkbox__input:active ~ .ui-v1-checkbox__checkmark {
|
|
367
|
+
background: #EDF4FF;
|
|
368
|
+
}
|
|
369
|
+
.ui-v1-checkbox:not(.ui-v1-checkbox_disabled) .ui-v1-checkbox__input:hover ~ .ui-v1-checkbox__checkmark {
|
|
370
|
+
box-shadow: 0 0 0 4px rgba(0, 94, 235, 0.12);
|
|
371
|
+
}
|
|
372
|
+
.ui-v1-checkbox:not(.ui-v1-checkbox_disabled):active .ui-v1-checkbox__checkmark {
|
|
373
|
+
border-color: #0052CC;
|
|
374
|
+
box-shadow: 0 0 0 4px rgba(0, 94, 235, 0.12) !important;
|
|
375
|
+
}
|
|
376
|
+
.ui-v1-checkbox:not(.ui-v1-checkbox_disabled):not(.ui-v1-checkbox_checked):not(.ui-v1-checkbox_indeterminate):active .ui-v1-checkbox__checkmark {
|
|
377
|
+
background-color: rgba(0, 94, 235, 0.12);
|
|
378
|
+
}
|
|
379
|
+
.ui-v1-checkbox_checked .ui-v1-checkbox__checkmark {
|
|
380
|
+
border-color: #005EEB;
|
|
381
|
+
background: #005EEB;
|
|
382
|
+
}
|
|
383
|
+
.ui-v1-checkbox_disabled:not(.ui-v1-checkbox_checked):not(.ui-v1-checkbox_indeterminate) .ui-v1-checkbox__checkmark {
|
|
384
|
+
background: #EEF1F3;
|
|
385
|
+
border-color: #C7CDD4;
|
|
386
|
+
}
|
|
387
|
+
.ui-v1-checkbox_disabled .ui-v1-checkbox__checkmark {
|
|
388
|
+
border-color: #B8DBFF;
|
|
389
|
+
background: #B8DBFF;
|
|
390
|
+
}
|
|
391
|
+
.ui-v1-checkbox_indeterminate .ui-v1-checkbox__checkmark,
|
|
392
|
+
.ui-v1-checkbox_indeterminate .ui-v1-checkbox__input:hover ~ .ui-v1-checkbox__checkmark,
|
|
393
|
+
.ui-v1-checkbox_indeterminate .ui-v1-checkbox__input:active ~ .ui-v1-checkbox__checkmark {
|
|
394
|
+
border-color: #005EEB;
|
|
395
|
+
background: #005EEB url("data:image/svg+xml,%3csvg width='12' height='4' viewBox='0 0 12 4' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M0.583415 3.04165C0.353296 3.04165 0.166748 2.80846 0.166748 2.52081V1.47915C0.166748 1.1915 0.353296 0.958313 0.583415 0.958313H11.4167C11.6469 0.958313 11.8334 1.1915 11.8334 1.47915V2.52081C11.8334 2.80846 11.6469 3.04165 11.4167 3.04165H0.583415Z' fill='white'/%3e %3c/svg%3e") no-repeat center !important;
|
|
396
|
+
}
|
|
397
|
+
.ui-v1-checkbox_disabled.ui-v1-checkbox_indeterminate .ui-v1-checkbox__checkmark,
|
|
398
|
+
.ui-v1-checkbox_disabled.ui-v1-checkbox_indeterminate .ui-v1-checkbox__input:hover ~ .ui-v1-checkbox__checkmark,
|
|
399
|
+
.ui-v1-checkbox_disabled.ui-v1-checkbox_indeterminate .ui-v1-checkbox__input:active ~ .ui-v1-checkbox__checkmark {
|
|
400
|
+
background-color: #B8DBFF !important;
|
|
401
|
+
border-color: #B8DBFF;
|
|
402
|
+
box-shadow: none;
|
|
403
|
+
}
|
|
404
|
+
.ui-v1-checkbox_small .ui-v1-checkbox__checkmark {
|
|
405
|
+
width: 16px;
|
|
406
|
+
min-width: 16px;
|
|
407
|
+
height: 16px;
|
|
408
|
+
}
|
|
409
|
+
.ui-v1-checkbox_small.ui-v1-checkbox_indeterminate .ui-v1-checkbox__checkmark {
|
|
410
|
+
background-size: 8px 4px !important;
|
|
411
|
+
}
|
|
412
|
+
.ui-v1-checkbox__checkmark-icon {
|
|
413
|
+
width: 22px;
|
|
414
|
+
height: 22px;
|
|
415
|
+
margin-left: -3px;
|
|
416
|
+
margin-top: -3px;
|
|
417
|
+
}
|
|
418
|
+
.ui-v1-checkbox_small .ui-v1-checkbox__checkmark-icon {
|
|
419
|
+
width: 16px;
|
|
420
|
+
height: 16px;
|
|
421
|
+
margin-left: -2px;
|
|
422
|
+
margin-top: -2px;
|
|
423
|
+
}
|
|
319
424
|
.ui-v1-error {
|
|
320
425
|
color: #FF5353;
|
|
321
426
|
font-size: 14px;
|
package/dist/host.d.ts
CHANGED
|
@@ -249,6 +249,8 @@ export declare const ModalPlugin: Plugin_2;
|
|
|
249
249
|
|
|
250
250
|
declare type Numeric = number | string;
|
|
251
251
|
|
|
252
|
+
declare type Primitive = boolean | number | string | null | undefined;
|
|
253
|
+
|
|
252
254
|
declare type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & (Record<string, never> extends E ? Record<string, never> : EmitsToProps<E>);
|
|
253
255
|
|
|
254
256
|
declare enum SCROLLING {
|
|
@@ -318,6 +320,26 @@ declare type UiButtonProperties = {
|
|
|
318
320
|
locked?: boolean;
|
|
319
321
|
};
|
|
320
322
|
|
|
323
|
+
export declare const UiCheckbox: DefineComponent<UiCheckboxProperties, UiCheckboxMethods>;
|
|
324
|
+
|
|
325
|
+
declare type UiCheckboxMethods = {
|
|
326
|
+
click(): void;
|
|
327
|
+
focus(): void;
|
|
328
|
+
blur(): void;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
declare type UiCheckboxProperties = {
|
|
332
|
+
id?: string | undefined;
|
|
333
|
+
name?: string;
|
|
334
|
+
model?: Primitive | Primitive[];
|
|
335
|
+
value?: Primitive;
|
|
336
|
+
indeterminate?: boolean;
|
|
337
|
+
valueOfTruthy?: Primitive;
|
|
338
|
+
valueOfFalsy?: Primitive;
|
|
339
|
+
small?: boolean;
|
|
340
|
+
disabled?: boolean;
|
|
341
|
+
};
|
|
342
|
+
|
|
321
343
|
export declare const UiError: DefineComponent<UiErrorProperties>;
|
|
322
344
|
|
|
323
345
|
declare type UiErrorProperties = {
|
package/dist/host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { Text, Comment, defineComponent, ref, h, openBlock, createElementBlock,
|
|
4
|
+
import { Text, Comment, defineComponent, ref, h, openBlock, createElementBlock, createElementVNode, computed, mergeProps, unref, createBlock, createCommentVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, createVNode, Transition, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps, normalizeStyle, reactive, inject, watch, onMounted, onActivated, onDeactivated, onBeforeUnmount, useAttrs, useSlots, Teleport, withDirectives, vShow, toHandlers, withModifiers, provide, createSlots } from "vue";
|
|
5
5
|
const isURL = (href) => {
|
|
6
6
|
try {
|
|
7
7
|
new URL(href);
|
|
@@ -58,7 +58,7 @@ var VARIANT = /* @__PURE__ */ ((VARIANT2) => {
|
|
|
58
58
|
VARIANT2["DANGER"] = "danger";
|
|
59
59
|
return VARIANT2;
|
|
60
60
|
})(VARIANT || {});
|
|
61
|
-
const _sfc_main$
|
|
61
|
+
const _sfc_main$e = defineComponent({
|
|
62
62
|
props: {
|
|
63
63
|
/** Устанавливает тип кнопки */
|
|
64
64
|
type: {
|
|
@@ -154,6 +154,161 @@ const _sfc_main$d = defineComponent({
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
+
const _hoisted_1$9 = {
|
|
158
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
159
|
+
viewBox: "0 0 24 24"
|
|
160
|
+
};
|
|
161
|
+
function render$4(_ctx, _cache) {
|
|
162
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [
|
|
163
|
+
createElementVNode("path", {
|
|
164
|
+
fill: "currentColor",
|
|
165
|
+
"fill-rule": "evenodd",
|
|
166
|
+
d: "M19.793 6.965a.77.77 0 0 1-.022 1.075l-9.815 9.607a1.224 1.224 0 0 1-1.714.006l-4.01-3.878a.77.77 0 0 1-.028-1.074l.684-.736a.735.735 0 0 1 1.053-.028l3.15 3.046 8.96-8.771a.735.735 0 0 1 1.054.022z",
|
|
167
|
+
"clip-rule": "evenodd"
|
|
168
|
+
}, null, -1)
|
|
169
|
+
]));
|
|
170
|
+
}
|
|
171
|
+
const IconDone = { render: render$4 };
|
|
172
|
+
const _hoisted_1$8 = ["id", "value", "name", "disabled", "checked"];
|
|
173
|
+
const _hoisted_2$3 = { class: "ui-v1-checkbox__checkmark" };
|
|
174
|
+
let counter$1 = 0;
|
|
175
|
+
const __default__ = {};
|
|
176
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
177
|
+
...__default__,
|
|
178
|
+
__name: "UiCheckbox",
|
|
179
|
+
props: {
|
|
180
|
+
id: {
|
|
181
|
+
type: null,
|
|
182
|
+
validator: (id) => id === void 0 || typeof id === "string" && id.length > 0 && /^[A-Za-z]/.test(id),
|
|
183
|
+
default: void 0
|
|
184
|
+
},
|
|
185
|
+
/** Атрибут name нативного поля ввода */
|
|
186
|
+
name: {
|
|
187
|
+
type: String,
|
|
188
|
+
default: () => "ui-checkbox-" + ++counter$1
|
|
189
|
+
},
|
|
190
|
+
/** Значение модели используемое с директивой v-model */
|
|
191
|
+
model: {
|
|
192
|
+
type: null,
|
|
193
|
+
default: void 0
|
|
194
|
+
},
|
|
195
|
+
/** Значение, добавляемое или удаляемое из модели в зависимости от флага checked, если модель является массивом */
|
|
196
|
+
value: {
|
|
197
|
+
type: null,
|
|
198
|
+
default: void 0
|
|
199
|
+
},
|
|
200
|
+
/** Задает значение, если флаг checked равен true, а модель не является массивом */
|
|
201
|
+
valueOfTruthy: {
|
|
202
|
+
type: null,
|
|
203
|
+
default: true
|
|
204
|
+
},
|
|
205
|
+
/** Задает значение, если флаг checked равен false, а модель не является массивом */
|
|
206
|
+
valueOfFalsy: {
|
|
207
|
+
type: null,
|
|
208
|
+
default: false
|
|
209
|
+
},
|
|
210
|
+
/** Задает "состояние" неопределенности для бокса, чье состояние "включенности" зависит от множества других боксов */
|
|
211
|
+
indeterminate: {
|
|
212
|
+
type: Boolean,
|
|
213
|
+
default: false
|
|
214
|
+
},
|
|
215
|
+
/** Задает стили для бокса уменьшенного размера */
|
|
216
|
+
small: {
|
|
217
|
+
type: Boolean,
|
|
218
|
+
default: false
|
|
219
|
+
},
|
|
220
|
+
/** Заблокированный */
|
|
221
|
+
disabled: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
default: false
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
emits: [
|
|
227
|
+
/** Переключение чекбокса */
|
|
228
|
+
"change",
|
|
229
|
+
/** Изменение значения модели */
|
|
230
|
+
"update:model"
|
|
231
|
+
],
|
|
232
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
233
|
+
const isArray = Array.isArray;
|
|
234
|
+
const props = __props;
|
|
235
|
+
const root = ref(null);
|
|
236
|
+
const checkbox = ref(null);
|
|
237
|
+
const pick = (attrs, criteria) => {
|
|
238
|
+
return Object.keys(attrs).filter(criteria).reduce((picked, key) => ({
|
|
239
|
+
...picked,
|
|
240
|
+
[key]: attrs[key]
|
|
241
|
+
}), {});
|
|
242
|
+
};
|
|
243
|
+
const click = () => {
|
|
244
|
+
var _a;
|
|
245
|
+
return (_a = checkbox.value) == null ? void 0 : _a.click();
|
|
246
|
+
};
|
|
247
|
+
const focus = () => {
|
|
248
|
+
var _a;
|
|
249
|
+
return (_a = checkbox.value) == null ? void 0 : _a.focus();
|
|
250
|
+
};
|
|
251
|
+
const blur = () => {
|
|
252
|
+
var _a;
|
|
253
|
+
return (_a = checkbox.value) == null ? void 0 : _a.blur();
|
|
254
|
+
};
|
|
255
|
+
__expose({
|
|
256
|
+
click,
|
|
257
|
+
focus,
|
|
258
|
+
blur
|
|
259
|
+
});
|
|
260
|
+
const emit = __emit;
|
|
261
|
+
const contains = (array, value) => array.some((v) => v === value);
|
|
262
|
+
const checked = computed(() => {
|
|
263
|
+
return isArray(props.model) ? contains(props.model, props.value) : props.model === props.valueOfTruthy;
|
|
264
|
+
});
|
|
265
|
+
const calculate = (checked2) => {
|
|
266
|
+
if (isArray(props.model)) {
|
|
267
|
+
return checked2 ? contains(props.model, props.value) ? props.model : [...props.model, props.value] : [...props.model].filter((v) => v !== props.value);
|
|
268
|
+
}
|
|
269
|
+
return checked2 ? props.valueOfTruthy : props.valueOfFalsy;
|
|
270
|
+
};
|
|
271
|
+
const onChange = (event) => {
|
|
272
|
+
const checkbox2 = event.target;
|
|
273
|
+
const value = calculate(checkbox2.checked);
|
|
274
|
+
emit("change", value);
|
|
275
|
+
emit("update:model", value);
|
|
276
|
+
};
|
|
277
|
+
return (_ctx, _cache) => {
|
|
278
|
+
return openBlock(), createElementBlock("span", mergeProps({
|
|
279
|
+
ref_key: "root",
|
|
280
|
+
ref: root,
|
|
281
|
+
class: {
|
|
282
|
+
"ui-v1-checkbox": true,
|
|
283
|
+
"ui-v1-checkbox_small": __props.small,
|
|
284
|
+
"ui-v1-checkbox_checked": checked.value,
|
|
285
|
+
"ui-v1-checkbox_indeterminate": __props.indeterminate,
|
|
286
|
+
"ui-v1-checkbox_disabled": __props.disabled
|
|
287
|
+
}
|
|
288
|
+
}, pick(_ctx.$attrs, (key) => !key.startsWith("aria-") && !key.startsWith("on"))), [
|
|
289
|
+
createElementVNode("input", mergeProps({
|
|
290
|
+
id: __props.id,
|
|
291
|
+
ref_key: "checkbox",
|
|
292
|
+
ref: checkbox,
|
|
293
|
+
value: unref(isArray)(__props.model) ? __props.value : void 0,
|
|
294
|
+
name: __props.name,
|
|
295
|
+
disabled: __props.disabled,
|
|
296
|
+
checked: checked.value
|
|
297
|
+
}, pick(_ctx.$attrs, (key) => key.startsWith("aria-") || key.startsWith("on")), {
|
|
298
|
+
type: "checkbox",
|
|
299
|
+
class: "ui-v1-checkbox__input",
|
|
300
|
+
onChange
|
|
301
|
+
}), null, 16, _hoisted_1$8),
|
|
302
|
+
createElementVNode("span", _hoisted_2$3, [
|
|
303
|
+
checked.value && !__props.indeterminate ? (openBlock(), createBlock(unref(IconDone), {
|
|
304
|
+
key: 0,
|
|
305
|
+
class: "ui-v1-checkbox__checkmark-icon"
|
|
306
|
+
})) : createCommentVNode("", true)
|
|
307
|
+
])
|
|
308
|
+
], 16);
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
});
|
|
157
312
|
var ALIGN = /* @__PURE__ */ ((ALIGN2) => {
|
|
158
313
|
ALIGN2["LEFT"] = "left";
|
|
159
314
|
ALIGN2["RIGHT"] = "right";
|
|
@@ -2964,7 +3119,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2964
3119
|
return SIZE$4.SM;
|
|
2965
3120
|
});
|
|
2966
3121
|
return (_ctx, _cache) => {
|
|
2967
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3122
|
+
return openBlock(), createBlock(_sfc_main$e, mergeProps({
|
|
2968
3123
|
ref_key: "root",
|
|
2969
3124
|
ref: root,
|
|
2970
3125
|
href: __props.href,
|
|
@@ -3236,7 +3391,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3236
3391
|
export {
|
|
3237
3392
|
plugin as I18nPlugin,
|
|
3238
3393
|
plugin$1 as ModalPlugin,
|
|
3239
|
-
_sfc_main$
|
|
3394
|
+
_sfc_main$e as UiButton,
|
|
3395
|
+
_sfc_main$d as UiCheckbox,
|
|
3240
3396
|
_sfc_main$c as UiError,
|
|
3241
3397
|
_sfc_main$b as UiLink,
|
|
3242
3398
|
_sfc_main$9 as UiLoader,
|
package/dist/remote.cjs
CHANGED
|
@@ -47,6 +47,11 @@ const UiButton = defineRemoteComponent(
|
|
|
47
47
|
UiButtonType,
|
|
48
48
|
["click", "focus", "blur"]
|
|
49
49
|
);
|
|
50
|
+
const UiCheckboxType = "UiCheckbox";
|
|
51
|
+
const UiCheckbox = defineRemoteComponent(
|
|
52
|
+
UiCheckboxType,
|
|
53
|
+
["click", "focus", "blur"]
|
|
54
|
+
);
|
|
50
55
|
const UiErrorType = "UiError";
|
|
51
56
|
const UiError = defineRemoteComponent(
|
|
52
57
|
UiErrorType,
|
|
@@ -160,6 +165,8 @@ const UiYandexMap = defineRemoteComponent(
|
|
|
160
165
|
);
|
|
161
166
|
exports.UiButton = UiButton;
|
|
162
167
|
exports.UiButtonType = UiButtonType;
|
|
168
|
+
exports.UiCheckbox = UiCheckbox;
|
|
169
|
+
exports.UiCheckboxType = UiCheckboxType;
|
|
163
170
|
exports.UiError = UiError;
|
|
164
171
|
exports.UiErrorType = UiErrorType;
|
|
165
172
|
exports.UiLink = UiLink;
|
package/dist/remote.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare enum DIRECTION {
|
|
|
47
47
|
|
|
48
48
|
declare type Numeric = number | string;
|
|
49
49
|
|
|
50
|
+
declare type Primitive = boolean | number | string | null | undefined;
|
|
51
|
+
|
|
50
52
|
declare type RemoteProperties<T> = HTMLAttributes & T & Record<string, never>;
|
|
51
53
|
|
|
52
54
|
declare enum SCROLLING {
|
|
@@ -124,6 +126,38 @@ declare type UiButtonProperties = {
|
|
|
124
126
|
|
|
125
127
|
export declare const UiButtonType: SchemaType<"UiButton", RemoteProperties<UiButtonProperties>, RemoteCallable<UiButtonMethods>>;
|
|
126
128
|
|
|
129
|
+
export declare const UiCheckbox: Component< {
|
|
130
|
+
[x: string]: unknown;
|
|
131
|
+
}, RemoteProperties<UiCheckboxProperties>, {
|
|
132
|
+
[x: string]: never;
|
|
133
|
+
}, {
|
|
134
|
+
[x: string]: never;
|
|
135
|
+
}, MethodOptions, {
|
|
136
|
+
click: (event: SerializedEvent) => boolean;
|
|
137
|
+
focus: (event: SerializedFocusEvent) => boolean;
|
|
138
|
+
blur: (event: SerializedEvent) => boolean;
|
|
139
|
+
}>;
|
|
140
|
+
|
|
141
|
+
declare type UiCheckboxMethods = {
|
|
142
|
+
click(): void;
|
|
143
|
+
focus(): void;
|
|
144
|
+
blur(): void;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
declare type UiCheckboxProperties = {
|
|
148
|
+
id?: string | undefined;
|
|
149
|
+
name?: string;
|
|
150
|
+
model?: Primitive | Primitive[];
|
|
151
|
+
value?: Primitive;
|
|
152
|
+
indeterminate?: boolean;
|
|
153
|
+
valueOfTruthy?: Primitive;
|
|
154
|
+
valueOfFalsy?: Primitive;
|
|
155
|
+
small?: boolean;
|
|
156
|
+
disabled?: boolean;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export declare const UiCheckboxType: SchemaType<"UiCheckbox", RemoteProperties<UiCheckboxProperties>, RemoteCallable<UiCheckboxMethods>>;
|
|
160
|
+
|
|
127
161
|
export declare const UiError: Component< {
|
|
128
162
|
[x: string]: unknown;
|
|
129
163
|
}, RemoteProperties<UiErrorProperties>, {
|
package/dist/remote.js
CHANGED
|
@@ -45,6 +45,11 @@ const UiButton = defineRemoteComponent(
|
|
|
45
45
|
UiButtonType,
|
|
46
46
|
["click", "focus", "blur"]
|
|
47
47
|
);
|
|
48
|
+
const UiCheckboxType = "UiCheckbox";
|
|
49
|
+
const UiCheckbox = defineRemoteComponent(
|
|
50
|
+
UiCheckboxType,
|
|
51
|
+
["click", "focus", "blur"]
|
|
52
|
+
);
|
|
48
53
|
const UiErrorType = "UiError";
|
|
49
54
|
const UiError = defineRemoteComponent(
|
|
50
55
|
UiErrorType,
|
|
@@ -159,6 +164,8 @@ const UiYandexMap = defineRemoteComponent(
|
|
|
159
164
|
export {
|
|
160
165
|
UiButton,
|
|
161
166
|
UiButtonType,
|
|
167
|
+
UiCheckbox,
|
|
168
|
+
UiCheckboxType,
|
|
162
169
|
UiError,
|
|
163
170
|
UiErrorType,
|
|
164
171
|
UiLink,
|
package/package.json
CHANGED