@ulu/frontend-vue 0.1.0-beta.2 → 0.1.0-beta.21

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.
Files changed (148) hide show
  1. package/README.md +113 -2
  2. package/dist/{breakpoints-ClT9bfZm.js → breakpoints-DOXmgVoG.js} +1 -1
  3. package/dist/frontend-vue.css +1 -1
  4. package/dist/frontend-vue.js +75 -73
  5. package/dist/index-BpmkfeZb.js +6671 -0
  6. package/lib/components/collapsible/UluAccordion.vue +1 -1
  7. package/lib/components/collapsible/UluModal.vue +4 -5
  8. package/lib/components/collapsible/UluOverflowPopover.vue +1 -1
  9. package/lib/components/elements/UluAlert.vue +1 -2
  10. package/lib/components/elements/UluBadge.vue +27 -28
  11. package/lib/components/elements/UluBadgeStack.vue +8 -13
  12. package/lib/components/elements/UluButton.vue +2 -2
  13. package/lib/components/elements/UluButtonVerbose.vue +119 -0
  14. package/lib/components/elements/UluCard.vue +1 -1
  15. package/lib/components/elements/UluDefinitionList.vue +14 -17
  16. package/lib/components/elements/UluExternalLink.vue +22 -29
  17. package/lib/components/elements/UluIcon.vue +22 -17
  18. package/lib/components/elements/UluList.vue +53 -55
  19. package/lib/components/elements/UluSpokeSpinner.vue +12 -18
  20. package/lib/components/elements/UluTag.vue +35 -35
  21. package/lib/components/forms/UluCheckboxMenu.vue +32 -31
  22. package/lib/components/forms/UluFileDisplay.vue +40 -31
  23. package/lib/components/forms/UluFormFile.vue +22 -24
  24. package/lib/components/forms/UluFormMessage.vue +7 -10
  25. package/lib/components/forms/UluFormSelect.vue +16 -16
  26. package/lib/components/forms/UluFormText.vue +15 -15
  27. package/lib/components/forms/UluSearchForm.vue +8 -10
  28. package/lib/components/index.js +1 -1
  29. package/lib/components/layout/UluAdaptiveLayout.vue +3 -5
  30. package/lib/components/layout/UluTitleRail.vue +9 -5
  31. package/lib/components/layout/UluWhenBreakpoint.vue +71 -77
  32. package/lib/components/navigation/UluBreadcrumb.vue +1 -2
  33. package/lib/components/navigation/UluMenu.vue +3 -3
  34. package/lib/components/navigation/UluPager.vue +102 -0
  35. package/lib/components/systems/facets/ExampleFacetsWithPagination.vue +119 -0
  36. package/lib/components/systems/facets/UluFacetsFilters.vue +73 -0
  37. package/lib/components/systems/facets/UluFacetsList.vue +13 -14
  38. package/lib/components/systems/facets/UluFacetsResults.vue +57 -0
  39. package/lib/components/systems/facets/UluFacetsSearch.vue +26 -49
  40. package/lib/components/systems/facets/UluFacetsSidebarLayout.vue +31 -0
  41. package/lib/components/systems/facets/UluFacetsSort.vue +45 -0
  42. package/lib/components/systems/facets/_facets.scss +2 -3
  43. package/lib/components/systems/facets/_mock-data.js +40 -0
  44. package/lib/components/systems/facets/useFacets.js +221 -0
  45. package/lib/components/systems/index.js +10 -2
  46. package/lib/components/systems/scroll-anchors/UluScrollAnchors.vue +2 -1
  47. package/lib/components/systems/skeleton/UluShowSkeleton.vue +9 -8
  48. package/lib/components/systems/skeleton/UluSkeletonContent.vue +39 -43
  49. package/lib/components/systems/skeleton/UluSkeletonMedia.vue +4 -6
  50. package/lib/components/systems/skeleton/UluSkeletonText.vue +27 -0
  51. package/lib/components/systems/slider/UluImageSlideShow.vue +1 -1
  52. package/lib/components/systems/slider/UluSlideShow.vue +8 -3
  53. package/lib/components/systems/table-sticky/UluTableSticky.vue +8 -8
  54. package/lib/components/systems/table-sticky/UluTableStickyTable.vue +3 -3
  55. package/lib/composables/index.js +3 -1
  56. package/lib/composables/useDocumentTitle.js +47 -0
  57. package/lib/composables/usePageTitle.js +37 -0
  58. package/lib/composables/usePagination.js +122 -0
  59. package/lib/composables/useRequiredInject.js +26 -0
  60. package/lib/index.js +1 -1
  61. package/lib/meta.js +14 -0
  62. package/lib/plugins/core/index.js +91 -0
  63. package/lib/plugins/index.js +1 -0
  64. package/lib/plugins/toast/UluToast.vue +2 -2
  65. package/lib/utils/index.js +2 -0
  66. package/lib/utils/{vue-router.js → router.js} +106 -11
  67. package/package.json +37 -14
  68. package/types/components/index.d.ts +2 -0
  69. package/types/components/index.d.ts.map +1 -0
  70. package/types/components/systems/facets/_mock-data.d.ts +18 -0
  71. package/types/components/systems/facets/_mock-data.d.ts.map +1 -0
  72. package/types/components/systems/facets/useFacets.d.ts +39 -0
  73. package/types/components/systems/facets/useFacets.d.ts.map +1 -0
  74. package/types/components/systems/index.d.ts +2 -0
  75. package/types/components/systems/index.d.ts.map +1 -0
  76. package/types/components/systems/scroll-anchors/symbols.d.ts +7 -0
  77. package/types/components/systems/scroll-anchors/symbols.d.ts.map +1 -0
  78. package/types/composables/index.d.ts +7 -0
  79. package/types/composables/index.d.ts.map +1 -0
  80. package/types/composables/useBreakpointManager.d.ts +8 -0
  81. package/types/composables/useBreakpointManager.d.ts.map +1 -0
  82. package/types/composables/useDocumentTitle.d.ts +18 -0
  83. package/types/composables/useDocumentTitle.d.ts.map +1 -0
  84. package/types/composables/useIcon.d.ts +6 -0
  85. package/types/composables/useIcon.d.ts.map +1 -0
  86. package/types/composables/useModifiers.d.ts +69 -0
  87. package/types/composables/useModifiers.d.ts.map +1 -0
  88. package/types/composables/usePageTitle.d.ts +19 -0
  89. package/types/composables/usePageTitle.d.ts.map +1 -0
  90. package/types/composables/usePagination.d.ts +25 -0
  91. package/types/composables/usePagination.d.ts.map +1 -0
  92. package/types/composables/useRequiredInject.d.ts +8 -0
  93. package/types/composables/useRequiredInject.d.ts.map +1 -0
  94. package/types/composables/useWindowResize.d.ts +6 -0
  95. package/types/composables/useWindowResize.d.ts.map +1 -0
  96. package/types/index.d.ts +5 -0
  97. package/types/index.d.ts.map +1 -0
  98. package/types/meta.d.ts +10 -0
  99. package/types/meta.d.ts.map +1 -0
  100. package/types/plugins/breakpoints/index.d.ts +2 -0
  101. package/types/plugins/breakpoints/index.d.ts.map +1 -0
  102. package/types/plugins/core/index.d.ts +3 -0
  103. package/types/plugins/core/index.d.ts.map +1 -0
  104. package/types/plugins/index.d.ts +6 -0
  105. package/types/plugins/index.d.ts.map +1 -0
  106. package/types/plugins/modals/api.d.ts +34 -0
  107. package/types/plugins/modals/api.d.ts.map +1 -0
  108. package/types/plugins/modals/index.d.ts +28 -0
  109. package/types/plugins/modals/index.d.ts.map +1 -0
  110. package/types/plugins/modals/useModals.d.ts +2 -0
  111. package/types/plugins/modals/useModals.d.ts.map +1 -0
  112. package/types/plugins/popovers/defaults.d.ts +14 -0
  113. package/types/plugins/popovers/defaults.d.ts.map +1 -0
  114. package/types/plugins/popovers/directive.d.ts +8 -0
  115. package/types/plugins/popovers/directive.d.ts.map +1 -0
  116. package/types/plugins/popovers/index.d.ts +7 -0
  117. package/types/plugins/popovers/index.d.ts.map +1 -0
  118. package/types/plugins/popovers/manager.d.ts +52 -0
  119. package/types/plugins/popovers/manager.d.ts.map +1 -0
  120. package/types/plugins/popovers/useFollow.d.ts +31 -0
  121. package/types/plugins/popovers/useFollow.d.ts.map +1 -0
  122. package/types/plugins/popovers/utils.d.ts +2 -0
  123. package/types/plugins/popovers/utils.d.ts.map +1 -0
  124. package/types/plugins/toast/defaults.d.ts +15 -0
  125. package/types/plugins/toast/defaults.d.ts.map +1 -0
  126. package/types/plugins/toast/index.d.ts +5 -0
  127. package/types/plugins/toast/index.d.ts.map +1 -0
  128. package/types/plugins/toast/store.d.ts +22 -0
  129. package/types/plugins/toast/store.d.ts.map +1 -0
  130. package/types/plugins/toast/useToast.d.ts +2 -0
  131. package/types/plugins/toast/useToast.d.ts.map +1 -0
  132. package/types/utils/dom.d.ts +8 -0
  133. package/types/utils/dom.d.ts.map +1 -0
  134. package/types/utils/index.d.ts +3 -0
  135. package/types/utils/index.d.ts.map +1 -0
  136. package/types/utils/placeholder.d.ts +8 -0
  137. package/types/utils/placeholder.d.ts.map +1 -0
  138. package/types/utils/router.d.ts +141 -0
  139. package/types/utils/router.d.ts.map +1 -0
  140. package/types/utils/vue-router.d.ts +122 -0
  141. package/types/utils/vue-router.d.ts.map +1 -0
  142. package/dist/frontend-vue.umd.cjs +0 -561
  143. package/dist/index-P5Rwl_Dl.js +0 -7263
  144. package/lib/components/forms/UluFormDropzone.vue +0 -62
  145. package/lib/components/systems/facets/UluFacets.vue +0 -380
  146. package/lib/components/systems/skeleton/UluSkeletonTextInline.vue +0 -9
  147. package/lib/settings.js +0 -119
  148. package/lib/utils/placeholder.js +0 -6
@@ -1,62 +0,0 @@
1
- <!-- Based on https://react-dropzone.js.org/#section-basic-example -->
2
- <template>
3
- <div
4
- class="site-dropzone site-form__item site-form__item--file"
5
- :class="{ 'is-danger' : fileErrors.length }"
6
- >
7
- <div
8
- class="site-dropzone__target"
9
- :class="{
10
- 'site-dropzone__target--dropping' : isDragActive
11
- }"
12
- v-bind="getRootProps()"
13
- >
14
- <input v-bind="getInputProps()" />
15
- <div class="site-dropzone__instructions">
16
- <strong class="type-normal">
17
- Drag 'n' drop files here, or click to select
18
- </strong>
19
- </div>
20
- </div>
21
- <p class="site-form__description">
22
- <em>Only images allowed (.jpg, .png)</em>
23
- </p>
24
- <div v-if="fileErrors.length" class="site-dropzone__errors site-form__description site-form__error">
25
- <ul class="list-unordered">
26
- <li v-for="(fileErr, index) in fileErrors" :key="index">
27
- <strong>{{ fileErr.file.name }}</strong>:
28
- <span>{{ fileErr.errors.map(e => e.message).join() }}</span>
29
- </li>
30
- </ul>
31
- </div>
32
- <div class="site-dropzone__display margin-top" v-if="files.length">
33
- <strong>Files</strong>
34
- <FilesDisplay class="site-dropzone__list" :files="files"/>
35
- </div>
36
- </div>
37
- </template>
38
-
39
- <script setup>
40
- import { ref } from "vue";
41
- import { useDropzone } from "vue3-dropzone";
42
-
43
- const files = ref([]);
44
- const fileErrors = ref([]);
45
-
46
- const $emit = defineEmits(["filesChange"]);
47
-
48
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
49
- onDrop: (acceptFiles, rejectReasons) => {
50
- if (rejectReasons) {
51
- fileErrors.value = rejectReasons.map(err => err);
52
- } else {
53
- fileErrors.value = [];
54
- }
55
- if (acceptFiles.length) {
56
- files.value = acceptFiles.map(file => file);
57
- $emit("filesChange", files.value);
58
- }
59
- },
60
- accept: [".png", ".jpg", ".jpeg"]
61
- });
62
- </script>
@@ -1,380 +0,0 @@
1
- <template>
2
- <div class="UluFacets">
3
- <div class="UluFacets__header" :class="classes.header">
4
- <slot name="header" :count="filteredItems.length"></slot>
5
- <div class="UluFacets__header-actions" :class="classes.headerActions">
6
- <button
7
- @click="toggleFilterVisibility"
8
- :class="classes.buttonFilterToggle"
9
- :aria-controls="filterId"
10
- :aria-expanded="filtersHidden ? 'false' : 'true'"
11
- type="button"
12
- >
13
- <slot name="buttonFilterToggle" :hidden="filtersHidden">
14
- {{ filtersHidden ? 'Show' : 'Hide' }} Filters
15
- </slot>
16
- </button>
17
- <button
18
- v-if="selectedFacets.length"
19
- @click="clearFilters"
20
- :class="classes.buttonClearFilters"
21
- type="button"
22
- >
23
- <slot name="buttonClearFilters">
24
- Clear Filters
25
- </slot>
26
- </button>
27
- <div :class="classes.sortForm">
28
- <label
29
- :for="sortId"
30
- :class="classes.sortFormLabel"
31
- >Sort:</label>
32
- <select
33
- v-model="selectedSort"
34
- :id="sortId"
35
- :class="classes.sortFormSelect"
36
- >
37
- <option v-for="(item, key) in sortTypes" :value="key" :key="key">
38
- {{ item.text }}
39
- </option>
40
- </select>
41
- </div>
42
- </div>
43
- </div>
44
- <div class="UluFacets__body">
45
- <transition name="UluFacetsFade" mode="out-in">
46
- <div
47
- v-show="!filtersHidden"
48
- class="UluFacets__filters"
49
- :id="filterId"
50
- :class="{ 'UluFacets__filters--hidden' : filtersHidden }"
51
- >
52
- <UluFacetsSearch
53
- :classes="classes"
54
- :initialValue="initialSearchValue"
55
- :placeholder="searchPlaceholder"
56
- v-model="searchValue"
57
- />
58
- <UluCollapsibleRegion
59
- class="UluFacets__group"
60
- :class="classes.group"
61
- :classToggle="['UluFacets__group-toggle', classes.groupToggle]"
62
- :classContent="['UluFacets__group-content', classes.groupContent]"
63
- v-for="group in facets"
64
- :key="group.uid"
65
- :group="group"
66
- :startOpen="group.open"
67
- :clickOutsideCloses="false"
68
- :closeOnEscape="false"
69
- :transitionHeight="true"
70
- >
71
- <template #toggle="{ isOpen }">
72
- <slot name="groupToggle" :group="group" :isOpen="isOpen">
73
- {{ group.name }}
74
- </slot>
75
- </template>
76
- <template #default>
77
- <UluFacetsList
78
- :children="group.children.slice(0, maxVisible)"
79
- :groupUid="group.uid"
80
- :classFacet="classes.facet"
81
- />
82
- <UluCollapsibleRegion
83
- v-if="group.children.length > maxVisible"
84
- class="UluFacets__more-facets"
85
- :class="classes.moreFacets"
86
- :clickOutsideCloses="false"
87
- :closeOnEscape="false"
88
- :transitionHeight="true"
89
- >
90
- <template #toggle="{ isOpen }">
91
- {{ isOpen ? "- Less" : "+ More" }}
92
- </template>
93
- <template #default>
94
- <UluFacetsList
95
- :children="group.children.slice(maxVisible)"
96
- :groupUid="group.uid"
97
- :classFacet="classes.facet"
98
- />
99
- </template>
100
- </UluCollapsibleRegion>
101
- </template>
102
- </UluCollapsibleRegion>
103
- </div>
104
- </transition>
105
- <transition name="UluFacetsFade" mode="out-in">
106
- <ul
107
- class="UluFacets__results"
108
- :class="classes.results"
109
- :key="filterIteration"
110
- v-if="resultsVisible && filteredItems.length"
111
- >
112
-
113
- <li
114
- class="UluFacets__results-item"
115
- :class="classes.resultsItem"
116
- v-for="(item, index) in filteredItems"
117
- :key="index"
118
- >
119
- <slot name="item" :item="item" :index="index"></slot>
120
- </li>
121
- </ul>
122
- <div v-else class="UluFacets__empty">
123
- <slot name="empty">
124
- No Results Found
125
- </slot>
126
- </div>
127
- </transition>
128
- <!-- <div class="UluFacets__pagination"></div> -->
129
- </div>
130
- </div>
131
- </template>
132
-
133
- <script>
134
- import Fuse from 'fuse.js';
135
- import UluFacetsList from "./UluFacetsList.vue";
136
- import UluFacetsSearch from "./UluFacetsSearch.vue";
137
- import UluCollapsibleRegion from "../../collapsible/UluCollapsibleRegion.vue";
138
-
139
- let idCounter = 0;
140
- const sortAlpha = items => {
141
- const getTitle = i => (i.title || i.label || "");
142
- return items.sort((a, b) => getTitle(a).localeCompare(getTitle(b)));
143
- }
144
- const defaultSorts = {
145
- az: { text: "A-Z", sort: sortAlpha },
146
- za: { text: "Z-A", sort: items => sortAlpha(items).reverse() },
147
- };
148
- export default {
149
- name: 'UluFacets',
150
- components: {
151
- UluCollapsibleRegion,
152
- UluFacetsList,
153
- UluFacetsSearch
154
- },
155
- props: {
156
- /**
157
- * Options passed to fuse js for search feature
158
- */
159
- searchOptions: {
160
- type: Object,
161
- default: () => ({
162
- // isCaseSensitive: false,
163
- // includeScore: false,
164
- shouldSort: true,
165
- // includeMatches: false,
166
- // findAllMatches: false,
167
- // minMatchCharLength: 1,
168
- // location: 0,
169
- // threshold: 0.6,
170
- // distance: 100,
171
- // useExtendedSearch: false,
172
- // ignoreLocation: false,
173
- // ignoreFieldNorm: false,
174
- // fieldNormWeight: 1,
175
- keys: [
176
- "title",
177
- "label",
178
- "description",
179
- "author"
180
- ]
181
- })
182
- },
183
- initialFiltersHidden: Boolean,
184
- searchPlaceholder: String,
185
- /**
186
- * Array of facet configurations
187
- */
188
- initialFacets: {
189
- required: true,
190
- type: Array
191
- },
192
- initialSearchValue: String,
193
- classes: {
194
- type: Object,
195
- required: false,
196
- default: () => ({})
197
- },
198
- /**
199
- * Maximum facets shown per group before truncating
200
- */
201
- maxVisible: {
202
- type: Number,
203
- default: 5
204
- },
205
- /**
206
- * Array of objects of the items to display
207
- */
208
- items: {
209
- required: true,
210
- type: Array
211
- },
212
- /**
213
- * Provides a way to find categories for each facet
214
- * @param {Object} item An item to lookup the facet/category info for
215
- * @param {String} uid The facet's uid (the categories uid) to return a value, value should be an array of facet (child) keys
216
- */
217
- getItemFacet: {
218
- type: Function,
219
- default: (item, uid) => item[uid]
220
- },
221
- /**
222
- * Return the value for an item to use for sorting alphabetically
223
- */
224
- getItemSortAlpha: {
225
- type: Function,
226
- default: item => (item.title || item.label || "")
227
- },
228
- initialSortType: {
229
- type: String,
230
- default: "az"
231
- },
232
- noDefaultSorts: Boolean,
233
- extraSortTypes: {
234
- type: Object,
235
- default: () => ({})
236
- }
237
- },
238
- data() {
239
- const {
240
- initialFiltersHidden,
241
- initialSearchValue,
242
- noDefaultSorts,
243
- initialSortType,
244
- extraSortTypes
245
- } = this;
246
- return {
247
- filterId: `ulu-facet-filters-${ ++idCounter }`,
248
- sortId: `ulu-facet-sort-${ ++idCounter }`,
249
- selectedSort: initialSortType,
250
- sortTypes: {
251
- ...(noDefaultSorts ? {} : defaultSorts),
252
- ...extraSortTypes
253
- },
254
- facets: this.createFacets(), // Copy of users facet configs
255
- filtersHidden: initialFiltersHidden || false,
256
- searchValue: initialSearchValue || null,
257
- resultsVisible: true,
258
- filterIteration: 0,
259
- }
260
- },
261
- computed: {
262
- /**
263
- * Returns an array of groups with children that are active
264
- */
265
- selectedFacets() {
266
- const selected = [];
267
- this.facets.forEach((group) => {
268
- const { name, uid, children } = group;
269
- let count = 0;
270
- let added = false;
271
- if (children) {
272
- children.forEach(child => {
273
- if (child.selected) {
274
- ++count;
275
- if (!added) {
276
- selected.push({ uid, name, children: [] });
277
- added = true;
278
- }
279
- selected[selected.length - 1].children.push(child);
280
- }
281
- });
282
- }
283
- group.selectedCount = count;
284
- });
285
- return selected;
286
- },
287
- filteredItems() {
288
- this.resultsVisible = false;
289
- const { getItemFacet, selectedFacets, sortTypes, selectedSort } = this;
290
- const sort = sortTypes[selectedSort].sort;
291
-
292
- const filteredItems = this.items.filter(item => {
293
- if (selectedFacets.length) {
294
- return selectedFacets.some(group => {
295
- let matched;
296
- const cats = getItemFacet(item, group.uid);
297
- if (cats && cats.length) {
298
- matched = group.children.some(facet => cats.includes(facet.uid));
299
- }
300
- return matched;
301
- });
302
- // No filters are applied
303
- } else {
304
- return true;
305
- }
306
- });
307
- // Increment counter (used for transitions)
308
- // this.filterIteration = filterIteration + 1;
309
- const newItems = sort(this.search(filteredItems));
310
- // this.resultsVisible = false;
311
- this.$nextTick(() => {
312
- this.resultsVisible = true;
313
- this.filterIteration = this.filterIteration + 1;
314
- // this.$nextTick(() => this.resultsVisible = true);
315
- });
316
- return newItems;
317
- }
318
- },
319
- methods: {
320
- /**
321
- * Resets all active filters to user's initial
322
- */
323
- clearFilters() {
324
- this.facets = this.createFacets();
325
- },
326
- /**
327
- * Maps users initial facets to the local facet array used in this component
328
- */
329
- createFacets() {
330
- return this.initialFacets.map(group => {
331
- const children = group.children.map(facet => ({
332
- ...facet,
333
- selected: facet.selected || false
334
- }));
335
- return {
336
- ...group,
337
- open: group.open || false,
338
- children,
339
- selectedCount: 0
340
- };
341
- })
342
- },
343
- /**
344
- * Search applied to an already filtered batch of items
345
- */
346
- search(items) {
347
- const { searchValue, searchOptions } = this;
348
- if (!searchValue?.length) return items;
349
- const fuse = new Fuse(items, searchOptions);
350
- const results = fuse.search(searchValue);
351
- return results.map(result => result.item);
352
- },
353
- toggleFilterVisibility() {
354
- this.filtersHidden = !this.filtersHidden;
355
- }
356
- }
357
- }
358
- </script>
359
-
360
- <style lang="scss">
361
- .UluFacets__more-facets {
362
- display: flex;
363
- flex-direction: column;
364
- &.UluCollapsibleRegion--open,
365
- &.UluCollapsibleRegion--transitioning {
366
- .UluCollapsibleRegion__content {
367
- order: -1;
368
- }
369
- }
370
- }
371
- .UluFacetsFade-enter-active,
372
- .UluFacetsFade-leave-active {
373
- transition: opacity 0.25s ease;
374
- }
375
-
376
- .UluFacetsFade-enter-from,
377
- .UluFacetsFade-leave-to {
378
- opacity: 0;
379
- }
380
- </style>
@@ -1,9 +0,0 @@
1
- <template>
2
- <span class="skeleton__text skeleton__text--inline"></span>
3
- </template>
4
-
5
- <script>
6
- export default {
7
- name: "SkeletonTextInline",
8
- };
9
- </script>
package/lib/settings.js DELETED
@@ -1,119 +0,0 @@
1
- /**
2
- * @module settings
3
- * @description Manages shared configuration for the library.
4
- */
5
-
6
- import { reactive } from 'vue';
7
-
8
- /**
9
- * Default settings
10
- * @typedef {object} Defaults
11
- * @property {string} fontAwesomeStatic - Whether the default UluIcon should use fontawesome vue or fontawesome CSS classes (static)
12
- */
13
-
14
- /**
15
- * @type {Defaults}
16
- */
17
- const defaults = {
18
- /**
19
- * If set UluIcon will use global css classes instead of Font Awesome vue component
20
- */
21
- fontAwesomeStatic: false,
22
- /**
23
- * Use a different icon component (if using a library other than Font Awesome)
24
- * - Need to have this component map (iconsByType) to it's implementation
25
- * - All components internally use type, so only user defined components change definitions
26
- * - So you should only need to create definitions for the default types to replace this for the library
27
- */
28
- iconComponent: null,
29
- /**
30
- * Which prop in iconComponent should receive the resolved definition
31
- */
32
- iconPropResolver: (definition) => ({ icon: definition }),
33
- /**
34
- * Default icons by type
35
- */
36
- iconsByType: {
37
- danger: "fas fa-triangle-exclamation",
38
- warning: "fas fa-circle-exclamation",
39
- info: "fas fa-circle-info",
40
- success: "fas fa-circle-check",
41
- externalLink: "fas fa-arrow-up-right-from-square",
42
- close: "fas fa-xmark",
43
- expand: "fas fa-plus",
44
- collapse: "fas fa-minus",
45
- resizeHorizontal: "fas fa-grip-lines-vertical",
46
- resizeVertical: "fas fa-grip-lines",
47
- resizeBoth: "fas fa-grip",
48
- ellipsis: "fas fa-ellipsis",
49
- pathSeparator: "fas fa-chevron-right"
50
- }
51
- };
52
-
53
- // Current configuration, initialized with defaults and made reactive
54
- // We wrap `defaults` in `reactive` so `currentSettings` becomes a reactive object.
55
- let currentSettings = reactive({ ...defaults });
56
-
57
- /**
58
- * Retrieves a copy of the default settings.
59
- * @returns {object} A copy of the default settings object.
60
- */
61
- export function getDefaultSettings() {
62
- // Return a non-reactive copy of defaults
63
- return { ...defaults };
64
- }
65
-
66
- /**
67
- * Updates multiple configuration settings.
68
- * @param {object} changes An object containing the settings to update.
69
- */
70
- export function updateSettings(changes) {
71
- Object.assign(currentSettings, changes);
72
- }
73
-
74
- /**
75
- * Retrieves a copy of the current configuration settings.
76
- * @returns {object} A copy of the current settings object (vue reactive object)
77
- */
78
- export function getSettings() {
79
- return currentSettings;
80
- }
81
-
82
- /**
83
- * Retrieves a specific configuration setting by key.
84
- * @param {string} key The key of the setting to retrieve.
85
- * @returns {*} The value of the setting, or undefined if not found.
86
- */
87
- export function getSetting(key) {
88
- if (!currentSettings.hasOwnProperty(key)) {
89
- console.warn(`Attempted to access non-existent setting: ${key}`);
90
- return;
91
- }
92
- return currentSettings[key];
93
- }
94
-
95
- /**
96
- * Updates a specific configuration setting.
97
- * @param {string} key The key of the setting to update.
98
- * @param {*} value The new value for the setting.
99
- */
100
- export function updateSetting(key, value) {
101
- if (typeof key !== "string") {
102
- throw new Error("Expected key to be string");
103
- }
104
- currentSettings[key] = value;
105
- }
106
-
107
- /**
108
- * Retrieves the icon definition by type
109
- * @param {string} type - The type of icon to retrieve (e.g., 'error', 'info').
110
- * @returns {string} The icon definition
111
- * @throws {Error} If the specified icon type is not found
112
- */
113
- export function getIconByType(type) {
114
- const icons = currentSettings.iconsByType;
115
- if (!icons[type]) {
116
- throw new Error(`Icon type "${ type }" not found!`);
117
- }
118
- return icons[type];
119
- }
@@ -1,6 +0,0 @@
1
- export default {
2
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis.",
3
- textSmall: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet.",
4
- paragraph: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis.</p>",
5
- paragraphSmall: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. </p>"
6
- }