@frollo/frollo-web-ui 9.0.9 → 9.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.
- package/cjs/index.js +2175 -2079
- package/esm/{fw-input-Bo2gQcvM.js → fw-input-HqJer3qu.js} +111 -21
- package/esm/fw-input.js +5 -1
- package/esm/fw-provider-list.js +2 -2
- package/esm/fw-tag.js +205 -6
- package/esm/index.js +2 -3
- package/frollo-web-ui.esm.js +2229 -2133
- package/index.d.ts +50 -2
- package/package.json +1 -1
- package/types/components/fw-input/fw-input.vue.d.ts +31 -2
- package/types/components/fw-input/index.types.d.ts +4 -0
- package/types/components/fw-tag/fw-tag.vue.d.ts +15 -0
- package/web-components/index.js +2269 -2173
- package/esm/fw-tag-B0fVslEZ.js +0 -199
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, useCssVars, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, renderSlot, mergeProps, Transition } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, useCssVars, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, createBlock, mergeProps, Transition } from 'vue';
|
|
2
2
|
import { a as Field } from './vee-validate-0dtT5GSQ.js';
|
|
3
3
|
import { u as useColours } from './get-root-colours-DCCAnRF4.js';
|
|
4
|
+
import { FwTag as __default__$1 } from './fw-tag.js';
|
|
4
5
|
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
5
6
|
|
|
6
7
|
var __default__ = defineComponent({
|
|
7
8
|
name: 'FwInput',
|
|
8
9
|
components: {
|
|
9
|
-
InputField: Field
|
|
10
|
+
InputField: Field,
|
|
11
|
+
FwTag: __default__$1
|
|
10
12
|
},
|
|
11
13
|
props: {
|
|
12
14
|
/**
|
|
@@ -136,11 +138,24 @@ var __default__ = defineComponent({
|
|
|
136
138
|
invalidate: {
|
|
137
139
|
type: Boolean,
|
|
138
140
|
required: false
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Enable tags within the input borders
|
|
144
|
+
* Defaults to false
|
|
145
|
+
*/
|
|
146
|
+
enableTags: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
"default": false
|
|
149
|
+
},
|
|
150
|
+
tags: {
|
|
151
|
+
type: Array,
|
|
152
|
+
required: false
|
|
139
153
|
}
|
|
140
154
|
},
|
|
141
155
|
emits: ['update:modelValue', /** Fired on native focus in */
|
|
142
156
|
'focus', /** Fired on native input blur */
|
|
143
|
-
'blur'
|
|
157
|
+
'blur', /** v-model bindings for tags */
|
|
158
|
+
'update:tags'],
|
|
144
159
|
setup: function setup(props, ctx) {
|
|
145
160
|
var inputBaseClass = ref("text-p text-body placeholder:text-p placeholder:text-grey-100 border outline-none block w-full px-2.5 py-3");
|
|
146
161
|
var inputValue = computed({
|
|
@@ -151,6 +166,20 @@ var __default__ = defineComponent({
|
|
|
151
166
|
return ctx.emit('update:modelValue', state);
|
|
152
167
|
}
|
|
153
168
|
});
|
|
169
|
+
var tagsValue = computed({
|
|
170
|
+
get: function get() {
|
|
171
|
+
return props.tags;
|
|
172
|
+
},
|
|
173
|
+
set: function set(state) {
|
|
174
|
+
return ctx.emit('update:tags', state);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
var handleTagDismiss = function handleTagDismiss(id) {
|
|
178
|
+
var _tagsValue$value;
|
|
179
|
+
tagsValue.value = (_tagsValue$value = tagsValue.value) === null || _tagsValue$value === void 0 ? void 0 : _tagsValue$value.filter(function (tag) {
|
|
180
|
+
return tag.id !== id;
|
|
181
|
+
});
|
|
182
|
+
};
|
|
154
183
|
var onFocus = function onFocus(e) {
|
|
155
184
|
return ctx.emit('focus', e);
|
|
156
185
|
};
|
|
@@ -163,18 +192,20 @@ var __default__ = defineComponent({
|
|
|
163
192
|
return {
|
|
164
193
|
inputBaseClass: inputBaseClass,
|
|
165
194
|
inputValue: inputValue,
|
|
195
|
+
tagsValue: tagsValue,
|
|
166
196
|
onFocus: onFocus,
|
|
167
197
|
onBlur: onBlur,
|
|
168
198
|
primaryFade5: primaryFade5,
|
|
169
|
-
colorErrorTextFade5: colorErrorTextFade5
|
|
199
|
+
colorErrorTextFade5: colorErrorTextFade5,
|
|
200
|
+
handleTagDismiss: handleTagDismiss
|
|
170
201
|
};
|
|
171
202
|
}
|
|
172
203
|
});
|
|
173
204
|
var __injectCSSVars__ = function __injectCSSVars__() {
|
|
174
205
|
useCssVars(function (_ctx) {
|
|
175
206
|
return {
|
|
176
|
-
"
|
|
177
|
-
"
|
|
207
|
+
"v027ca7bd": _ctx.primaryFade5,
|
|
208
|
+
"v6423b1fe": _ctx.colorErrorTextFade5
|
|
178
209
|
};
|
|
179
210
|
});
|
|
180
211
|
};
|
|
@@ -208,30 +239,47 @@ var _hoisted_8 = {
|
|
|
208
239
|
key: 0,
|
|
209
240
|
"class": "flex text-body absolute w-9 h-full inset-y-0 left-0 items-center pl-3 pointer-events-none"
|
|
210
241
|
};
|
|
211
|
-
var _hoisted_9 =
|
|
212
|
-
|
|
242
|
+
var _hoisted_9 = {
|
|
243
|
+
"class": "flex flex-row items-center flex-wrap"
|
|
244
|
+
};
|
|
245
|
+
var _hoisted_10 = ["id", "name", "type", "readonly", "tabindex", "disabled", "autocomplete", "placeholder", "maxlength"];
|
|
246
|
+
var _hoisted_11 = {
|
|
213
247
|
key: 1,
|
|
214
248
|
"class": "flex text-black absolute w-10 h-full inset-y-0 right-0 items-center pr-3"
|
|
215
249
|
};
|
|
216
|
-
var
|
|
250
|
+
var _hoisted_12 = {
|
|
251
|
+
key: 0,
|
|
252
|
+
"class": "flex text-body absolute w-9 h-full inset-y-0 left-0 items-center pl-3 pointer-events-none"
|
|
253
|
+
};
|
|
254
|
+
var _hoisted_13 = ["id", "name", "placeholder", "type", "readonly", "tabindex", "disabled", "autocomplete", "maxlength"];
|
|
255
|
+
var _hoisted_14 = {
|
|
256
|
+
key: 1,
|
|
257
|
+
"class": "flex text-black absolute w-10 h-full inset-y-0 right-0 items-center pr-3"
|
|
258
|
+
};
|
|
259
|
+
var _hoisted_15 = {
|
|
217
260
|
key: 0,
|
|
218
261
|
"class": "text-left text-p-small mt-2 min-h-[21px]"
|
|
219
262
|
};
|
|
220
|
-
var
|
|
263
|
+
var _hoisted_16 = {
|
|
221
264
|
key: 0,
|
|
222
265
|
"class": "text-brand-error-text"
|
|
223
266
|
};
|
|
224
|
-
var
|
|
267
|
+
var _hoisted_17 = {
|
|
225
268
|
key: 1,
|
|
226
269
|
"class": "text-brand-text2"
|
|
227
270
|
};
|
|
228
271
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
272
|
+
var _component_FwTag = resolveComponent("FwTag");
|
|
229
273
|
var _component_InputField = resolveComponent("InputField");
|
|
230
274
|
return openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_InputField, {
|
|
231
275
|
modelValue: _ctx.inputValue,
|
|
232
|
-
"onUpdate:modelValue": _cache[
|
|
276
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) {
|
|
233
277
|
return _ctx.inputValue = $event;
|
|
234
278
|
}),
|
|
279
|
+
tags: _ctx.tagsValue,
|
|
280
|
+
"onUpdate:tags": _cache[5] || (_cache[5] = function ($event) {
|
|
281
|
+
return _ctx.tagsValue = $event;
|
|
282
|
+
}),
|
|
235
283
|
name: _ctx.name,
|
|
236
284
|
rules: _ctx.rules,
|
|
237
285
|
"validate-on-input": true
|
|
@@ -245,7 +293,49 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
245
293
|
key: 0,
|
|
246
294
|
"for": _ctx.inputId || "fw-input-".concat(_ctx.name),
|
|
247
295
|
"class": normalizeClass([[(errorMessage || errors[0]) && meta.touched || _ctx.invalidate ? 'text-brand-error-text' : 'text-brand-text2'], "block mb-2 text-base"])
|
|
248
|
-
}, [createTextVNode(toDisplayString(_ctx.label) + " ", 1), _ctx.required ? (openBlock(), createElementBlock("span", _hoisted_5, "*")) : createCommentVNode("", true)], 10, _hoisted_4)) : createCommentVNode("", true), _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "action")])) : createCommentVNode("", true)]), createElementVNode("div", _hoisted_7, [_ctx
|
|
296
|
+
}, [createTextVNode(toDisplayString(_ctx.label) + " ", 1), _ctx.required ? (openBlock(), createElementBlock("span", _hoisted_5, "*")) : createCommentVNode("", true)], 10, _hoisted_4)) : createCommentVNode("", true), _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "action")])) : createCommentVNode("", true)]), createElementVNode("div", _hoisted_7, [_ctx.enableTags && _ctx.tags ? (openBlock(), createElementBlock("div", {
|
|
297
|
+
key: 0,
|
|
298
|
+
"class": normalizeClass([{
|
|
299
|
+
'pl-10': !!_ctx.$slots.prefix,
|
|
300
|
+
'pr-20': !!_ctx.$slots.suffix
|
|
301
|
+
}, (errorMessage || errors[0]) && meta.touched || _ctx.invalidate ? 'input--error-state border-brand-error-text caret-brand-error-text' : 'caret-primary bg-white border-grey-100 hover:border-brand-text3 focus:border-brand-text3', _ctx.inputBaseClass, _ctx.rounded ? 'rounded-full' : 'rounded-lg', _ctx.inputClass, 'fw-input__tagged'])
|
|
302
|
+
}, [_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_8, [renderSlot(_ctx.$slots, "prefix", {
|
|
303
|
+
"class": "h-full"
|
|
304
|
+
})])) : createCommentVNode("", true), createElementVNode("div", _hoisted_9, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tags, function (tag) {
|
|
305
|
+
return openBlock(), createBlock(_component_FwTag, {
|
|
306
|
+
key: tag.id,
|
|
307
|
+
label: tag.name,
|
|
308
|
+
dismissable: true,
|
|
309
|
+
rounded: false,
|
|
310
|
+
size: "md",
|
|
311
|
+
"class": "m-1",
|
|
312
|
+
variant: "secondary",
|
|
313
|
+
onDismissed: function onDismissed($event) {
|
|
314
|
+
return _ctx.handleTagDismiss(tag.id);
|
|
315
|
+
}
|
|
316
|
+
}, null, 8, ["label", "onDismissed"]);
|
|
317
|
+
}), 128)), createElementVNode("input", mergeProps(field, {
|
|
318
|
+
id: _ctx.inputId || "fw-input-".concat(_ctx.name),
|
|
319
|
+
name: _ctx.disableNamePrefix ? _ctx.name : "fw-input-".concat(_ctx.name),
|
|
320
|
+
type: _ctx.type,
|
|
321
|
+
readonly: _ctx.readonly,
|
|
322
|
+
tabindex: _ctx.tabindex,
|
|
323
|
+
disabled: _ctx.readonly,
|
|
324
|
+
autocomplete: _ctx.autocomplete,
|
|
325
|
+
placeholder: _ctx.placeholder,
|
|
326
|
+
maxlength: _ctx.maxLength,
|
|
327
|
+
"class": "border-none outline-none !bg-transparent flex-grow pl-1",
|
|
328
|
+
onFocus: _cache[0] || (_cache[0] = function () {
|
|
329
|
+
return _ctx.onFocus && _ctx.onFocus.apply(_ctx, arguments);
|
|
330
|
+
}),
|
|
331
|
+
onBlur: _cache[1] || (_cache[1] = function () {
|
|
332
|
+
return _ctx.onBlur && _ctx.onBlur.apply(_ctx, arguments);
|
|
333
|
+
})
|
|
334
|
+
}), null, 16, _hoisted_10)]), _ctx.$slots.suffix ? (openBlock(), createElementBlock("div", _hoisted_11, [renderSlot(_ctx.$slots, "suffix", {
|
|
335
|
+
"class": "h-full"
|
|
336
|
+
})])) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), !_ctx.enableTags ? (openBlock(), createElementBlock(Fragment, {
|
|
337
|
+
key: 1
|
|
338
|
+
}, [_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_12, [renderSlot(_ctx.$slots, "prefix", {
|
|
249
339
|
"class": "h-full"
|
|
250
340
|
})])) : createCommentVNode("", true), createElementVNode("input", mergeProps(field, {
|
|
251
341
|
id: _ctx.inputId || "fw-input-".concat(_ctx.name),
|
|
@@ -261,30 +351,30 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
261
351
|
'pl-10': !!_ctx.$slots.prefix,
|
|
262
352
|
'pr-20': !!_ctx.$slots.suffix
|
|
263
353
|
}, (errorMessage || errors[0]) && meta.touched || _ctx.invalidate ? 'input--error-state border-brand-error-text caret-brand-error-text' : 'caret-primary bg-white border-grey-100 hover:border-brand-text3 focus:border-brand-text3', _ctx.inputBaseClass, _ctx.rounded ? 'rounded-full' : 'rounded-lg', _ctx.inputClass],
|
|
264
|
-
onFocus: _cache[
|
|
354
|
+
onFocus: _cache[2] || (_cache[2] = function () {
|
|
265
355
|
return _ctx.onFocus && _ctx.onFocus.apply(_ctx, arguments);
|
|
266
356
|
}),
|
|
267
|
-
onBlur: _cache[
|
|
357
|
+
onBlur: _cache[3] || (_cache[3] = function () {
|
|
268
358
|
return _ctx.onBlur && _ctx.onBlur.apply(_ctx, arguments);
|
|
269
359
|
})
|
|
270
|
-
}), null, 16,
|
|
360
|
+
}), null, 16, _hoisted_13), _ctx.$slots.suffix ? (openBlock(), createElementBlock("div", _hoisted_14, [renderSlot(_ctx.$slots, "suffix", {
|
|
271
361
|
"class": "h-full"
|
|
272
|
-
})])) : createCommentVNode("", true)]), _ctx.enableErrors ? (openBlock(), createElementBlock("div",
|
|
362
|
+
})])) : createCommentVNode("", true)], 64)) : createCommentVNode("", true)]), _ctx.enableErrors ? (openBlock(), createElementBlock("div", _hoisted_15, [createVNode(Transition, {
|
|
273
363
|
name: "fwFadeIn",
|
|
274
364
|
mode: "out-in"
|
|
275
365
|
}, {
|
|
276
366
|
"default": withCtx(function () {
|
|
277
|
-
return [(errorMessage || errors[0]) && meta.touched ? (openBlock(), createElementBlock("span",
|
|
367
|
+
return [(errorMessage || errors[0]) && meta.touched ? (openBlock(), createElementBlock("span", _hoisted_16, toDisplayString(errorMessage || errors[0]), 1)) : _ctx.hint ? (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(_ctx.hint), 1)) : createCommentVNode("", true)];
|
|
278
368
|
}),
|
|
279
369
|
_: 2
|
|
280
370
|
}, 1024)])) : createCommentVNode("", true)])];
|
|
281
371
|
}),
|
|
282
372
|
_: 3
|
|
283
|
-
}, 8, ["modelValue", "name", "rules"])]);
|
|
373
|
+
}, 8, ["modelValue", "tags", "name", "rules"])]);
|
|
284
374
|
}
|
|
285
375
|
|
|
286
|
-
var css_248z = ".fwFadeIn-enter-active,.fwFadeIn-leave-active{-webkit-transition:opacity .12s ease,-webkit-transform .12s ease;transition:opacity .12s ease,-webkit-transform .12s ease;-moz-transition:opacity .12s ease,transform .12s ease,-moz-transform .12s ease;transition:opacity .12s ease,transform .12s ease;transition:opacity .12s ease,transform .12s ease,-webkit-transform .12s ease,-moz-transform .12s ease;will-change:opacity,transform}.fwFadeIn-enter-from,.fwFadeIn-leave-to{opacity:0;-webkit-transform:translateY(-2px);-moz-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}.fw-input input:focus{background-color:var(--
|
|
287
|
-
var stylesheet = ".fwFadeIn-enter-active,.fwFadeIn-leave-active{-webkit-transition:opacity .12s ease,-webkit-transform .12s ease;transition:opacity .12s ease,-webkit-transform .12s ease;-moz-transition:opacity .12s ease,transform .12s ease,-moz-transform .12s ease;transition:opacity .12s ease,transform .12s ease;transition:opacity .12s ease,transform .12s ease,-webkit-transform .12s ease,-moz-transform .12s ease;will-change:opacity,transform}.fwFadeIn-enter-from,.fwFadeIn-leave-to{opacity:0;-webkit-transform:translateY(-2px);-moz-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}.fw-input input:focus{background-color:var(--
|
|
376
|
+
var css_248z = ".fwFadeIn-enter-active,.fwFadeIn-leave-active{-webkit-transition:opacity .12s ease,-webkit-transform .12s ease;transition:opacity .12s ease,-webkit-transform .12s ease;-moz-transition:opacity .12s ease,transform .12s ease,-moz-transform .12s ease;transition:opacity .12s ease,transform .12s ease;transition:opacity .12s ease,transform .12s ease,-webkit-transform .12s ease,-moz-transform .12s ease;will-change:opacity,transform}.fwFadeIn-enter-from,.fwFadeIn-leave-to{opacity:0;-webkit-transform:translateY(-2px);-moz-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}.fw-input input:focus{background-color:var(--v027ca7bd)}.fw-input input.input--error-state{background-color:var(--v6423b1fe)}.fw-input__tagged:focus-within{background-color:var(--v027ca7bd)}.fw-input__tagged.input--error-state{background-color:var(--v6423b1fe)}";
|
|
377
|
+
var stylesheet = ".fwFadeIn-enter-active,.fwFadeIn-leave-active{-webkit-transition:opacity .12s ease,-webkit-transform .12s ease;transition:opacity .12s ease,-webkit-transform .12s ease;-moz-transition:opacity .12s ease,transform .12s ease,-moz-transform .12s ease;transition:opacity .12s ease,transform .12s ease;transition:opacity .12s ease,transform .12s ease,-webkit-transform .12s ease,-moz-transform .12s ease;will-change:opacity,transform}.fwFadeIn-enter-from,.fwFadeIn-leave-to{opacity:0;-webkit-transform:translateY(-2px);-moz-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}.fw-input input:focus{background-color:var(--v027ca7bd)}.fw-input input.input--error-state{background-color:var(--v6423b1fe)}.fw-input__tagged:focus-within{background-color:var(--v027ca7bd)}.fw-input__tagged.input--error-state{background-color:var(--v6423b1fe)}";
|
|
288
378
|
styleInject(css_248z);
|
|
289
379
|
|
|
290
380
|
__default__.render = render;
|
package/esm/fw-input.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { _ as FwInput } from './fw-input-
|
|
1
|
+
export { _ as FwInput } from './fw-input-HqJer3qu.js';
|
|
2
2
|
import 'vue';
|
|
3
3
|
import './vee-validate-0dtT5GSQ.js';
|
|
4
4
|
import './get-root-colours-DCCAnRF4.js';
|
|
5
|
+
import './fw-tag.js';
|
|
6
|
+
import './fw-button.js';
|
|
7
|
+
import './fw-button-ChYejNWD.js';
|
|
8
|
+
import './index-v1DX6R2G.js';
|
|
5
9
|
import './style-inject.es-tgCJW-Cu.js';
|
package/esm/fw-provider-list.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as _createForOfIteratorHelper, e as _defineProperty, b as _toConsumableArray } from './_rollupPluginBabelHelpers-BKlDnZ7n.js';
|
|
2
2
|
import { ref, watch, defineComponent, shallowRef, computed, useCssVars, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createBlock, createCommentVNode, createTextVNode } from 'vue';
|
|
3
3
|
import { a as script, s as script$1, _ as __default__$4 } from './fw-table-row-Be4_T3Ai.js';
|
|
4
|
-
import { _ as __default__$3 } from './fw-input-
|
|
5
|
-
import {
|
|
4
|
+
import { _ as __default__$3 } from './fw-input-HqJer3qu.js';
|
|
5
|
+
import { FwTag as __default__$1 } from './fw-tag.js';
|
|
6
6
|
import { s as script$2 } from './fw-button-ChYejNWD.js';
|
|
7
7
|
import { _ as __default__$2 } from './fw-dropdown-UJDWtWjF.js';
|
|
8
8
|
import { l as render$1, m as render$2, n as render$3 } from './index-v1DX6R2G.js';
|
package/esm/fw-tag.js
CHANGED
|
@@ -1,7 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
import 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, useCssVars, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, createElementBlock, toDisplayString, renderSlot, createVNode, createCommentVNode, vShow } from 'vue';
|
|
3
2
|
import './fw-button.js';
|
|
4
|
-
import './
|
|
5
|
-
import './
|
|
6
|
-
import './
|
|
7
|
-
import './
|
|
3
|
+
import { d as render$1 } from './index-v1DX6R2G.js';
|
|
4
|
+
import { u as useColours } from './get-root-colours-DCCAnRF4.js';
|
|
5
|
+
import { s as script } from './fw-button-ChYejNWD.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
7
|
+
|
|
8
|
+
var TAG_CLASSES = {
|
|
9
|
+
primary: {
|
|
10
|
+
text: 'text-button-primary-text',
|
|
11
|
+
background: 'bg-button-primary-bg',
|
|
12
|
+
iconButtonType: 'primary'
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
text: 'text-primary',
|
|
16
|
+
background: 'fw-tag--secondary-bg',
|
|
17
|
+
iconButtonType: 'tertiary'
|
|
18
|
+
},
|
|
19
|
+
tertiary: {
|
|
20
|
+
text: 'text-body',
|
|
21
|
+
background: 'bg-brand-bg4',
|
|
22
|
+
iconButtonType: 'tertiary'
|
|
23
|
+
},
|
|
24
|
+
quaternary: {
|
|
25
|
+
text: 'text-body',
|
|
26
|
+
background: 'bg-brand-bg3',
|
|
27
|
+
iconButtonType: 'tertiary'
|
|
28
|
+
},
|
|
29
|
+
alert: {
|
|
30
|
+
text: 'text-white',
|
|
31
|
+
background: 'bg-brand-warning-bg',
|
|
32
|
+
iconButtonType: 'error'
|
|
33
|
+
},
|
|
34
|
+
success: {
|
|
35
|
+
text: 'text-secondary',
|
|
36
|
+
background: 'bg-brand-success-new',
|
|
37
|
+
iconButtonType: 'success'
|
|
38
|
+
},
|
|
39
|
+
error: {
|
|
40
|
+
text: 'text-white',
|
|
41
|
+
background: 'bg-brand-error-text',
|
|
42
|
+
iconButtonType: 'error'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var SIZES = {
|
|
46
|
+
xs: 'px-2 py-px text-xs',
|
|
47
|
+
sm: 'px-4 py-1 text-sm',
|
|
48
|
+
md: 'px-4 py-3 h-6 text-md'
|
|
49
|
+
};
|
|
50
|
+
var ICON_SIZES = {
|
|
51
|
+
xs: 'w-4 h-4',
|
|
52
|
+
sm: 'w-5 h-5',
|
|
53
|
+
md: 'w-5 h-5'
|
|
54
|
+
};
|
|
55
|
+
var baseClass = 'inline-flex items-center justify-center text-center whitespace-nowrap';
|
|
56
|
+
var __default__ = defineComponent({
|
|
57
|
+
name: 'FwTag',
|
|
58
|
+
components: {
|
|
59
|
+
FwButton: script,
|
|
60
|
+
XMarkSvg: render$1
|
|
61
|
+
},
|
|
62
|
+
props: {
|
|
63
|
+
/**
|
|
64
|
+
* The label text of the tag.
|
|
65
|
+
* Overrides the default slot content.
|
|
66
|
+
*/
|
|
67
|
+
label: {
|
|
68
|
+
type: String
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* The size of the tag. Accepts: 'xs', 'sm' & 'md'
|
|
72
|
+
*/
|
|
73
|
+
size: {
|
|
74
|
+
type: String,
|
|
75
|
+
"default": 'xs',
|
|
76
|
+
validator: function validator(value) {
|
|
77
|
+
return ['xs', 'sm', 'md'].includes(value);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* The colour variant of the tag. Accepts 'primary', 'secondary', 'alert', 'error', 'success'
|
|
82
|
+
*/
|
|
83
|
+
variant: {
|
|
84
|
+
type: String,
|
|
85
|
+
"default": 'primary',
|
|
86
|
+
validator: function validator(value) {
|
|
87
|
+
return ['primary', 'secondary', 'tertiary', 'quaternary', 'alert', 'error', 'success'].includes(value);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Whether the tag can be dismissed or closed.
|
|
92
|
+
*/
|
|
93
|
+
dismissable: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
"default": false
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Whether the tag has round borders or not.
|
|
99
|
+
*/
|
|
100
|
+
rounded: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
"default": true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
emits: [/** Fires when the tag is dismissed. */
|
|
106
|
+
'dismissed'],
|
|
107
|
+
setup: function setup(props, ctx) {
|
|
108
|
+
var visible = ref(true);
|
|
109
|
+
var variantDef = computed(function () {
|
|
110
|
+
return TAG_CLASSES[props.variant];
|
|
111
|
+
});
|
|
112
|
+
var _useColours = useColours(),
|
|
113
|
+
primaryFade5 = _useColours.primaryFade5;
|
|
114
|
+
var textColorClass = computed(function () {
|
|
115
|
+
return variantDef.value.text;
|
|
116
|
+
});
|
|
117
|
+
var bgColorClass = computed(function () {
|
|
118
|
+
return variantDef.value.background;
|
|
119
|
+
});
|
|
120
|
+
var iconButtonType = computed(function () {
|
|
121
|
+
return variantDef.value.iconButtonType;
|
|
122
|
+
});
|
|
123
|
+
var sizeClass = computed(function () {
|
|
124
|
+
return SIZES[props.size];
|
|
125
|
+
});
|
|
126
|
+
var iconSizeClass = computed(function () {
|
|
127
|
+
return ICON_SIZES[props.size];
|
|
128
|
+
});
|
|
129
|
+
var rootClasses = computed(function () {
|
|
130
|
+
return [baseClass, textColorClass.value, bgColorClass.value, sizeClass.value, props.dismissable ? 'shadow font-semibold' : 'font-normal', props.rounded ? 'rounded-full' : ''];
|
|
131
|
+
});
|
|
132
|
+
var onDismiss = function onDismiss() {
|
|
133
|
+
visible.value = false;
|
|
134
|
+
ctx.emit('dismissed');
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
visible: visible,
|
|
138
|
+
baseClass: baseClass,
|
|
139
|
+
textColorClass: textColorClass,
|
|
140
|
+
bgColorClass: bgColorClass,
|
|
141
|
+
sizeClass: sizeClass,
|
|
142
|
+
iconSizeClass: iconSizeClass,
|
|
143
|
+
iconButtonType: iconButtonType,
|
|
144
|
+
primaryFade5: primaryFade5,
|
|
145
|
+
onDismiss: onDismiss,
|
|
146
|
+
rootClasses: rootClasses
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
var __injectCSSVars__ = function __injectCSSVars__() {
|
|
151
|
+
useCssVars(function (_ctx) {
|
|
152
|
+
return {
|
|
153
|
+
"d012dfb6": _ctx.primaryFade5
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
var __setup__ = __default__.setup;
|
|
158
|
+
__default__.setup = __setup__ ? function (props, ctx) {
|
|
159
|
+
__injectCSSVars__();
|
|
160
|
+
return __setup__(props, ctx);
|
|
161
|
+
} : __injectCSSVars__;
|
|
162
|
+
|
|
163
|
+
var _hoisted_1 = {
|
|
164
|
+
key: 0
|
|
165
|
+
};
|
|
166
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
167
|
+
var _component_XMarkSvg = resolveComponent("XMarkSvg");
|
|
168
|
+
var _component_FwButton = resolveComponent("FwButton");
|
|
169
|
+
return openBlock(), createBlock(Transition, {
|
|
170
|
+
name: "fw-tag-fade-scale",
|
|
171
|
+
appear: ""
|
|
172
|
+
}, {
|
|
173
|
+
"default": withCtx(function () {
|
|
174
|
+
return [withDirectives(createElementVNode("span", {
|
|
175
|
+
"class": normalizeClass(["fw-tag", _ctx.rootClasses]),
|
|
176
|
+
role: "status"
|
|
177
|
+
}, [_ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.label), 1)) : renderSlot(_ctx.$slots, "default", {
|
|
178
|
+
key: 1
|
|
179
|
+
}), _ctx.dismissable ? (openBlock(), createBlock(_component_FwButton, {
|
|
180
|
+
key: 2,
|
|
181
|
+
variant: _ctx.iconButtonType,
|
|
182
|
+
"class": normalizeClass([_ctx.iconSizeClass, "ml-1 !p-0 flex items-center justify-center border-none rounded-full"]),
|
|
183
|
+
tabindex: "0",
|
|
184
|
+
title: "Dismiss filter",
|
|
185
|
+
"aria-label": "Dismiss",
|
|
186
|
+
onClick: _ctx.onDismiss
|
|
187
|
+
}, {
|
|
188
|
+
"default": withCtx(function () {
|
|
189
|
+
return [createVNode(_component_XMarkSvg, {
|
|
190
|
+
"class": "w-3 h-3 font-semibold m-0"
|
|
191
|
+
})];
|
|
192
|
+
}),
|
|
193
|
+
_: 1
|
|
194
|
+
}, 8, ["variant", "class", "onClick"])) : createCommentVNode("", true)], 2), [[vShow, _ctx.visible]])];
|
|
195
|
+
}),
|
|
196
|
+
_: 3
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var css_248z = ".fw-tag{line-height:normal;-webkit-transition:opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease;transition:opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease;-moz-transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease,-moz-transform .18s ease;transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease;transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease,-moz-transform .18s ease;will-change:transform,opacity}.fw-tag--secondary-bg{background:var(--d012dfb6)}.fw-tag-fade-scale-enter-active,.fw-tag-fade-scale-leave-active{-webkit-transition:opacity .18s ease,-webkit-transform .18s ease;transition:opacity .18s ease,-webkit-transform .18s ease;-moz-transition:transform .18s ease,opacity .18s ease,-moz-transform .18s ease;transition:transform .18s ease,opacity .18s ease;transition:transform .18s ease,opacity .18s ease,-webkit-transform .18s ease,-moz-transform .18s ease}.fw-tag-fade-scale-enter-from,.fw-tag-fade-scale-leave-to{opacity:0;-webkit-transform:scale(.96);-moz-transform:scale(.96);-ms-transform:scale(.96);transform:scale(.96)}";
|
|
201
|
+
var stylesheet = ".fw-tag{line-height:normal;-webkit-transition:opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease;transition:opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease;-moz-transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease,-moz-transform .18s ease;transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease;transition:transform .18s ease,opacity .18s ease,xw background-color .18s ease,color .18s ease,-webkit-transform .18s ease,-moz-transform .18s ease;will-change:transform,opacity}.fw-tag--secondary-bg{background:var(--d012dfb6)}.fw-tag-fade-scale-enter-active,.fw-tag-fade-scale-leave-active{-webkit-transition:opacity .18s ease,-webkit-transform .18s ease;transition:opacity .18s ease,-webkit-transform .18s ease;-moz-transition:transform .18s ease,opacity .18s ease,-moz-transform .18s ease;transition:transform .18s ease,opacity .18s ease;transition:transform .18s ease,opacity .18s ease,-webkit-transform .18s ease,-moz-transform .18s ease}.fw-tag-fade-scale-enter-from,.fw-tag-fade-scale-leave-to{opacity:0;-webkit-transform:scale(.96);-moz-transform:scale(.96);-ms-transform:scale(.96);transform:scale(.96)}";
|
|
202
|
+
styleInject(css_248z);
|
|
203
|
+
|
|
204
|
+
__default__.render = render;
|
|
205
|
+
|
|
206
|
+
export { __default__ as FwTag };
|
package/esm/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { FwNavigationMenu as script$8 } from './fw-navigation-menu.js';
|
|
|
11
11
|
import { FwTab as script$e, FwTabs as script$h } from './fw-tabs.js';
|
|
12
12
|
import { FwModal as __default__$8 } from './fw-modal.js';
|
|
13
13
|
import { FwProgressBar as script$9 } from './fw-progress-bar.js';
|
|
14
|
-
import './fw-tag.js';
|
|
14
|
+
import { FwTag as __default__$c } from './fw-tag.js';
|
|
15
15
|
import './fw-table.js';
|
|
16
16
|
import { FwAccordion as __default__ } from './fw-accordion.js';
|
|
17
17
|
import './fw-image.js';
|
|
@@ -33,11 +33,10 @@ import { _ as __default__$1 } from './fw-card-DJXjRPUR.js';
|
|
|
33
33
|
import { _ as __default__$5 } from './fw-dropdown-UJDWtWjF.js';
|
|
34
34
|
import { F as Form } from './vee-validate-0dtT5GSQ.js';
|
|
35
35
|
import { _ as __default__$6 } from './fw-image-fzUvzmLv.js';
|
|
36
|
-
import { _ as __default__$7 } from './fw-input-
|
|
36
|
+
import { _ as __default__$7 } from './fw-input-HqJer3qu.js';
|
|
37
37
|
import { s as script$3 } from './fw-loading-bar-CPzE92BH.js';
|
|
38
38
|
import { _ as __default__$9 } from './fw-popover-BFiv7Ich.js';
|
|
39
39
|
import { _ as __default__$b, s as script$f, a as script$g } from './fw-table-row-Be4_T3Ai.js';
|
|
40
|
-
import { _ as __default__$c } from './fw-tag-B0fVslEZ.js';
|
|
41
40
|
import { reactive, createApp, h } from 'vue';
|
|
42
41
|
export { g as getHexWithOpacity, u as useColours } from './get-root-colours-DCCAnRF4.js';
|
|
43
42
|
import './uniqueId-DK6xzFd8.js';
|