@citruslime/ui 2.0.0-beta.2 → 2.0.0-beta.20

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 (137) hide show
  1. package/README.md +5 -4
  2. package/dist/citrus-lime-ui.es.js +4446 -0
  3. package/dist/citrus-lime-ui.umd.js +2 -0
  4. package/dist/components/accordion/cl-ui-accordion.vue.d.ts +26 -0
  5. package/dist/components/accordion/index.d.ts +4 -0
  6. package/dist/components/accordion/item/cl-ui-accordion-item.vue.d.ts +35 -0
  7. package/dist/{@types/components/accordion/item.d.ts → components/accordion/types.d.ts} +0 -0
  8. package/dist/components/app/cl-ui-app.vue.d.ts +51 -0
  9. package/dist/components/app/index.d.ts +1 -0
  10. package/dist/components/button/cl-ui-button.vue.d.ts +51 -0
  11. package/dist/components/button/index.d.ts +2 -0
  12. package/dist/components/button/types.d.ts +4 -0
  13. package/dist/components/calendar/cl-ui-calendar.vue.d.ts +2 -0
  14. package/dist/components/calendar/index.d.ts +2 -0
  15. package/dist/components/calendar/types.d.ts +2 -0
  16. package/dist/components/calendar/utils.d.ts +38 -0
  17. package/dist/components/card/cl-ui-card.vue.d.ts +27 -0
  18. package/dist/components/card/index.d.ts +2 -0
  19. package/dist/components/card/types.d.ts +2 -0
  20. package/dist/components/combo-box/cl-ui-combo-box.vue.d.ts +583 -0
  21. package/dist/components/combo-box/index.d.ts +2 -0
  22. package/dist/components/combo-box/search-container/cl-ui-combo-box-search.vue.d.ts +276 -0
  23. package/dist/components/combo-box/search-container/header/cl-ui-combo-box-header.vue.d.ts +42 -0
  24. package/dist/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue.d.ts +81 -0
  25. package/dist/{@types/components/combo-box/item.d.ts → components/combo-box/types.d.ts} +0 -0
  26. package/dist/components/footer/index.d.ts +1 -0
  27. package/dist/components/grid/cell/cl-ui-grid-cell.vue.d.ts +72 -0
  28. package/dist/components/grid/cl-ui-grid.vue.d.ts +550 -0
  29. package/dist/components/grid/filter/cl-ui-grid-filter.vue.d.ts +72 -0
  30. package/dist/components/grid/filter/filter-methods.d.ts +5 -0
  31. package/dist/components/grid/footer/cl-ui-grid-footer.vue.d.ts +63 -0
  32. package/dist/components/grid/header/cl-ui-grid-header.vue.d.ts +207 -0
  33. package/dist/components/grid/index.d.ts +2 -0
  34. package/dist/components/grid/types.d.ts +92 -0
  35. package/dist/components/grid/view-manager/cl-ui-grid-view-manager.vue.d.ts +88 -0
  36. package/dist/components/header/index.d.ts +2 -0
  37. package/dist/components/header/menu/cl-ui-header-menu.vue.d.ts +40 -0
  38. package/dist/components/header/menu/index.d.ts +1 -0
  39. package/dist/components/index.d.ts +15 -17
  40. package/dist/components/input/cl-ui-input.vue.d.ts +2 -0
  41. package/dist/components/input/index.d.ts +2 -0
  42. package/dist/components/input/types.d.ts +6 -0
  43. package/dist/components/input/utils.d.ts +44 -0
  44. package/dist/components/language-switcher/cl-ui-language-switcher.vue.d.ts +37 -0
  45. package/dist/components/language-switcher/index.d.ts +2 -0
  46. package/dist/{@types/language.d.ts → components/language-switcher/types.d.ts} +0 -1
  47. package/dist/components/loading-spinner/index.d.ts +1 -0
  48. package/dist/components/login/cl-ui-login.vue.d.ts +106 -0
  49. package/dist/components/login/index.d.ts +2 -0
  50. package/dist/{@types/components/login/authentication.d.ts → components/login/types.d.ts} +0 -0
  51. package/dist/components/modal/cl-ui-modal.vue.d.ts +49 -0
  52. package/dist/components/modal/index.d.ts +2 -0
  53. package/dist/components/modal/types.d.ts +4 -0
  54. package/dist/components/navigation/cl-ui-navigation.vue.d.ts +11 -0
  55. package/dist/components/navigation/group/cl-ui-navigation-group.vue.d.ts +12 -0
  56. package/dist/components/navigation/icon/cl-ui-navigation-icon.vue.d.ts +20 -0
  57. package/dist/components/navigation/index.d.ts +5 -0
  58. package/dist/components/notification/cl-ui-notification.vue.d.ts +36 -0
  59. package/dist/components/notification/index.d.ts +1 -0
  60. package/dist/components/notification/types.d.ts +9 -0
  61. package/dist/components/slider/cl-ui-slider.vue.d.ts +114 -0
  62. package/dist/components/slider/index.d.ts +1 -0
  63. package/dist/composables/notification.d.ts +1 -1
  64. package/dist/main.d.ts +2 -4
  65. package/dist/style.css +1 -1
  66. package/dist/utils/i18n/config.d.ts +33 -0
  67. package/dist/utils/i18n/defaults.d.ts +4 -0
  68. package/dist/utils/i18n/index.d.ts +3 -0
  69. package/dist/utils/i18n/types.d.ts +97 -0
  70. package/dist/utils/index.d.ts +2 -6
  71. package/dist/utils/validation.d.ts +37 -0
  72. package/package.json +27 -14
  73. package/dist/.eslintrc.js +0 -453
  74. package/dist/.stylelintrc.js +0 -119
  75. package/dist/@types/appUser.d.ts +0 -11
  76. package/dist/@types/components/accordion/index.d.ts +0 -1
  77. package/dist/@types/components/combo-box/index.d.ts +0 -2
  78. package/dist/@types/components/combo-box/localisations.d.ts +0 -19
  79. package/dist/@types/components/grid/column.d.ts +0 -46
  80. package/dist/@types/components/grid/index.d.ts +0 -4
  81. package/dist/@types/components/grid/localisations.d.ts +0 -47
  82. package/dist/@types/components/grid/request.d.ts +0 -49
  83. package/dist/@types/components/grid/update.d.ts +0 -4
  84. package/dist/@types/components/header/index.d.ts +0 -1
  85. package/dist/@types/components/header/localisations.d.ts +0 -8
  86. package/dist/@types/components/login/index.d.ts +0 -2
  87. package/dist/@types/components/login/localisations.d.ts +0 -7
  88. package/dist/@types/components/navigation/index.d.ts +0 -18
  89. package/dist/@types/components/notification/index.d.ts +0 -1
  90. package/dist/@types/components/notification/item.d.ts +0 -7
  91. package/dist/@types/components/slider/index.d.ts +0 -1
  92. package/dist/@types/components/slider/localisations.d.ts +0 -3
  93. package/dist/@types/date-format.d.ts +0 -8
  94. package/dist/@types/debouncer.d.ts +0 -6
  95. package/dist/@types/index.d.ts +0 -16
  96. package/dist/@types/locale.d.ts +0 -10
  97. package/dist/@types/number-format.d.ts +0 -7
  98. package/dist/@types/string-format.d.ts +0 -3
  99. package/dist/@types/string.d.ts +0 -47
  100. package/dist/theme.js +0 -120
  101. package/dist/ui.es.js +0 -1
  102. package/dist/ui.umd.js +0 -1
  103. package/dist/utils/copy.d.ts +0 -8
  104. package/dist/utils/debouncer.d.ts +0 -8
  105. package/dist/utils/extensions/string-utilities.d.ts +0 -83
  106. package/dist/utils/extensions/string.d.ts +0 -1
  107. package/dist/utils/i18n/datetime-formats.d.ts +0 -3
  108. package/dist/utils/i18n/number-formats.d.ts +0 -3
  109. package/dist/utils/id.d.ts +0 -6
  110. package/dist/utils/name-of.d.ts +0 -7
  111. package/dist/utils/sort.d.ts +0 -9
  112. package/dist/utils/url-params.d.ts +0 -8
  113. package/src/components/accordion/cl-ui-accordion.vue +0 -89
  114. package/src/components/app/cl-ui-app.vue +0 -26
  115. package/src/components/button/cl-ui-button.vue +0 -48
  116. package/src/components/calendar/cl-ui-calendar.vue +0 -277
  117. package/src/components/card/cl-ui-card.vue +0 -70
  118. package/src/components/combo-box/cl-ui-combo-box.vue +0 -357
  119. package/src/components/combo-box/search-container/cl-ui-combo-box-search.vue +0 -279
  120. package/src/components/combo-box/search-container/header/cl-ui-combo-box-header.vue +0 -36
  121. package/src/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue +0 -99
  122. package/src/components/footer/cl-ui-footer.vue +0 -31
  123. package/src/components/grid/cell/cl-ui-grid-cell.vue +0 -153
  124. package/src/components/grid/cl-ui-grid.vue +0 -477
  125. package/src/components/grid/filter/cl-ui-grid-filter.vue +0 -270
  126. package/src/components/grid/footer/cl-ui-grid-footer.vue +0 -186
  127. package/src/components/grid/header/cl-ui-grid-header.vue +0 -76
  128. package/src/components/grid/view-manager/cl-ui-grid-view-manager.vue +0 -145
  129. package/src/components/header/cl-ui-header.vue +0 -11
  130. package/src/components/header-helper/cl-ui-header-helper.vue +0 -50
  131. package/src/components/language-switcher/cl-ui-language-switcher.vue +0 -82
  132. package/src/components/loading-spinner/cl-ui-loading-spinner.vue +0 -16
  133. package/src/components/login/cl-ui-login.vue +0 -183
  134. package/src/components/modal/cl-ui-modal.vue +0 -120
  135. package/src/components/navigation/cl-ui-navigation.vue +0 -124
  136. package/src/components/notification/cl-ui-notification.vue +0 -55
  137. package/src/components/slider/cl-ui-slider.vue +0 -145
@@ -1,48 +0,0 @@
1
- <script lang="ts">
2
- export default {
3
- inheritAttrs: false
4
- };
5
- </script>
6
-
7
- <script setup lang="ts">
8
- import ClUiLoadingSpinner from '../loading-spinner/cl-ui-loading-spinner.vue';
9
-
10
- type ButtonColour = 'default' | 'primary' | 'secondary' | 'danger' | 'blue';
11
- type ButtonSize = 'small' | 'medium' | 'large';
12
-
13
- withDefaults(defineProps<{
14
- colour?: ButtonColour;
15
- size?: ButtonSize;
16
- loading?: boolean;
17
- disabled?: boolean;
18
- }>(), {
19
- colour: 'default',
20
- size: 'medium',
21
- loading: false,
22
- disabled: false
23
- });
24
- </script>
25
-
26
- <template>
27
- <cl-ui-loading-spinner v-show="loading"
28
- class="absolute" />
29
-
30
- <button v-show="!loading"
31
- v-bind="$attrs"
32
- class="align-middle border focus:outline-none font-semibold inline-block overflow-visible rounded shadow text-center"
33
- :class="{
34
- 'leading-8 px-4 text-sm': size === 'small',
35
- 'leading-10 px-8 text-sm': size === 'medium',
36
- 'leading-10 px-10 py-2': size === 'large',
37
-
38
- 'bg-white border-grey-0 hover:border-grey-2 text-secondary': colour === 'default',
39
- 'border-primary-default bg-primary-default text-white hover:bg-primary-light hover:border-primary-light': colour === 'primary',
40
- 'border-secondary-default bg-secondary-default text-white hover:bg-secondary-light hover:border-secondary-light': colour === 'secondary',
41
- 'border-danger-default bg-danger-default text-white hover:bg-danger-dark hover:border-danger-dark': colour === 'danger',
42
- 'border-link-default bg-link-default text-white hover:bg-link-light hover:border-link-light': colour === 'blue',
43
- '!border-grey-3 !bg-grey-3 text-grey-0 hover:!bg-grey-3 hover:!border-grey-3 cursor-default': disabled
44
- }"
45
- :disabled="disabled">
46
- <slot></slot>
47
- </button>
48
- </template>
@@ -1,277 +0,0 @@
1
- <script setup lang="ts">
2
- import Flatpickr from 'flatpickr';
3
- import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
4
- import { useI18n } from 'vue-i18n';
5
-
6
- import { DateFormat } from '../../@types';
7
-
8
- import { generateFixedDate, getLocale, replaceDateWithPlaceholders } from './calendar-utilities';
9
-
10
- type CalendarType = 'date' | 'datetime';
11
-
12
- const props = withDefaults(defineProps<{
13
- date?: Date | null;
14
- currentLocale?: string;
15
- datePlaceholder?: string;
16
- dateTimePlaceholder?: string;
17
- type?: CalendarType;
18
- disabled?: boolean;
19
- }>(), {
20
- date: () => null,
21
- currentLocale: 'en-GB',
22
- datePlaceholder: 'Select date.',
23
- dateTimePlaceholder: 'Select date & time.',
24
- type: 'datetime',
25
- disabled: false
26
- });
27
-
28
- const emit = defineEmits({
29
- 'update:date': null
30
- });
31
-
32
- const { d, getDateTimeFormat } = useI18n();
33
-
34
- const flatpickrInstance = ref<Flatpickr.Instance | null>(null);
35
- const element = ref<Node | null>(null);
36
-
37
- const date = computed<string>(() => d(generateFixedDate(), props.type, props.currentLocale));
38
- const dateFormat = computed(() => getDateTimeFormat(props.currentLocale)[props.type]);
39
- const format = computed<string>(() => {
40
- let hourPlaceholder = 'H';
41
- let yearPlaceholder = 'Y';
42
-
43
- if (dateFormat.value?.hour12 === true) {
44
- hourPlaceholder = 'h';
45
- }
46
-
47
- if (dateFormat.value.year === '2-digit') {
48
- yearPlaceholder = 'y';
49
- }
50
-
51
- const format = replaceDateWithPlaceholders(date.value, hourPlaceholder, yearPlaceholder);
52
-
53
- return format;
54
- });
55
- const options = computed<Flatpickr.Options.Options>(() => {
56
- const config: Flatpickr.Options.Options = {
57
- ...Flatpickr.defaultConfig,
58
- allowInput: true,
59
- dateFormat: format.value,
60
- disableMobile: true,
61
- enableTime: props.type === DateFormat.DATETIME,
62
- locale: getLocale(props.currentLocale),
63
- minuteIncrement: 1,
64
- monthSelectorType: 'static',
65
- // eslint-disable-next-line @typescript-eslint/naming-convention
66
- time_24hr: typeof dateFormat.value.hour12 === 'undefined' || dateFormat.value.hour12 === false
67
- };
68
-
69
- if (props.date !== null) {
70
- config.defaultDate = props.date;
71
- }
72
-
73
- return config;
74
- });
75
-
76
- /**
77
- * Emits an update to the model value, for the value provided from flatpickr.
78
- *
79
- * @param selectedDates List of raw selected values.
80
- * @param _date Formatted selected value.
81
- * @param _instance The current flatpickr instance.
82
- */
83
- function onChange (selectedDates: Date[], _date: string, _instance: Flatpickr.Instance): void {
84
- emit('update:date', selectedDates.length > 0 ? selectedDates[0] : null);
85
- }
86
-
87
- /**
88
- * Emits an update to the model value, to reset it.
89
- */
90
- function clearValue (): void {
91
- emit('update:date', null);
92
- }
93
-
94
- /**
95
- * Reset the value to the current day.
96
- */
97
- function resetValue (): void {
98
- if (flatpickrInstance.value !== null) {
99
- const date = new Date();
100
-
101
- date.setHours(12, 0, 0, 0);
102
-
103
- emit('update:date', date);
104
- }
105
- }
106
-
107
- /**
108
- * Creates a new flatpickr instance and adds an event handler for the OnChange event.
109
- */
110
- function createInstance (): void {
111
- if (flatpickrInstance.value === null && element.value !== null) {
112
- flatpickrInstance.value = Flatpickr(element.value as Node, options.value);
113
-
114
- flatpickrInstance.value.config.onChange.push(onChange);
115
- }
116
- }
117
-
118
- /**
119
- * Updates the current flatpickr instance and re-adds an event handler for the OnChange event.
120
- */
121
- function updateInstance (): void {
122
- if (flatpickrInstance.value !== null) {
123
- flatpickrInstance.value.set(options.value);
124
-
125
- flatpickrInstance.value.config.onChange.push(onChange);
126
- }
127
- }
128
-
129
- /**
130
- * Updates the selected value, in the flatpickr instance.
131
- *
132
- * @param value The new value.
133
- */
134
- function updateInstanceValue (value: Date): void {
135
- if (flatpickrInstance.value !== null) {
136
- flatpickrInstance.value.setDate(value, true);
137
- }
138
- }
139
-
140
- /**
141
- * Removes the selected value, in the flatpickr instance.
142
- */
143
- function clearInstanceValue (): void {
144
- if (flatpickrInstance.value !== null) {
145
- flatpickrInstance.value.clear();
146
- }
147
- }
148
-
149
- /**
150
- * Destroys the current flatpickr instance.
151
- */
152
- function destroyInstance (): void {
153
- if (flatpickrInstance.value !== null) {
154
- flatpickrInstance.value.destroy();
155
-
156
- flatpickrInstance.value = null;
157
- }
158
- }
159
-
160
- watch(() => props.date, (newValue, oldValue) => {
161
- if (newValue !== null && oldValue !== null) {
162
- if (newValue.getTime() !== oldValue.getTime()) {
163
- updateInstanceValue(newValue);
164
- }
165
- }
166
- else if (newValue === null && oldValue !== null) {
167
- clearInstanceValue();
168
- }
169
- }, {
170
- deep: true
171
- });
172
-
173
- watch(() => options.value, updateInstance, {
174
- deep: true
175
- });
176
-
177
- watch(() => props.type, () => {
178
- destroyInstance();
179
-
180
- nextTick(() => createInstance());
181
- }, {
182
- immediate: false
183
- });
184
-
185
- onMounted(() => createInstance());
186
-
187
- onUnmounted(() => destroyInstance());
188
- </script>
189
-
190
- <style lang="postcss">
191
- @import 'flatpickr/dist/flatpickr.css';
192
-
193
- .flatpickr-calendar {
194
- @apply shadow-lg;
195
- }
196
-
197
- .flatpickr-months {
198
- @apply border-b border-grey-1 py-2 px-1;
199
- }
200
-
201
- .flatpickr-prev-month,
202
- .flatpickr-next-month {
203
- @apply mt-2;
204
- }
205
-
206
- .flatpickr-months .flatpickr-next-month:hover svg,
207
- .flatpickr-months .flatpickr-prev-month:hover svg {
208
- @apply text-primary-default fill-current;
209
- }
210
-
211
- .cur-month {
212
- @apply mr-1;
213
- }
214
-
215
- .flatpickr-current-month span.cur-month:hover {
216
- @apply bg-white;
217
- }
218
-
219
- /* stylelint-disable selector-class-pattern */
220
-
221
- .flatpickr-innerContainer {
222
- @apply mb-1;
223
- }
224
-
225
- /* stylelint-enable selector-class-pattern */
226
-
227
- .flatpickr-weekdays {
228
- @apply bg-off-white mb-1 py-2;
229
- }
230
-
231
- .flatpickr-day.selected {
232
- @apply bg-primary-default border-primary-default hover:bg-primary-light hover:border-primary-light;
233
- }
234
-
235
- .flatpickr-day.today {
236
- @apply border-primary-default;
237
- }
238
-
239
- .flatpickr-day.today:hover {
240
- @apply bg-grey-1 text-grey-7;
241
- }
242
- </style>
243
-
244
- <template>
245
- <div v-bind="$attrs"
246
- class="relative">
247
- <input ref="element"
248
- v-bind="$attrs"
249
- class="!text-base !text-sm"
250
- :class="{
251
- '!pr-12': date !== null,
252
- '!pr-8': date === null
253
- }"
254
- type="text"
255
- :placeholder="type === 'date' ? datePlaceholder : dateTimePlaceholder"
256
- :disabled="disabled">
257
-
258
- <icon v-show="date === null || disabled"
259
- class="absolute bg-white right-2 text-grey-4 top-3"
260
- icon="ph:calendar"
261
- weight="light"
262
- :size="18" />
263
-
264
- <div v-show="date !== null && !disabled"
265
- class="absolute bg-white flex right-2 text-grey-4 top-3">
266
- <icon class="cursor-pointer md:mr-1 mr-0.5"
267
- icon="ph:arrow-counter-clockwise"
268
- :size="16"
269
- @click="resetValue" />
270
-
271
- <icon class="cursor-pointer"
272
- icon="ph:x"
273
- :size="16"
274
- @click="clearValue" />
275
- </div>
276
- </div>
277
- </template>
@@ -1,70 +0,0 @@
1
- <script setup lang="ts">
2
- type CardSize = 'small' | 'medium' | 'large';
3
-
4
- withDefaults(defineProps<{
5
- size?: CardSize;
6
- title?: string;
7
- hover?: boolean;
8
- shadowSize?: CardSize;
9
- padImage?: boolean;
10
- }>(), {
11
- size: 'medium',
12
- title: '',
13
- hover: false,
14
- shadowSize: 'medium',
15
- padImage: false
16
- });
17
- </script>
18
-
19
- <template>
20
- <div class="overflow-hidden relative"
21
- :class="{
22
- 'shadow': shadowSize === 'small',
23
- 'shadow-md': shadowSize === 'medium',
24
- 'shadow-lg': shadowSize === 'large',
25
-
26
- 'hover:shadow-md': hover && shadowSize === 'small',
27
- 'hover:shadow-lg': hover && shadowSize === 'medium',
28
- 'hover:shadow-xl': hover && shadowSize === 'large'
29
- }">
30
- <div v-if="$slots.image"
31
- :class="{
32
- 'p-2': size === 'small' && padImage,
33
- 'p-4': size === 'medium' && padImage,
34
- 'p-8': size === 'large' && padImage
35
- }">
36
- <slot name="image"></slot>
37
- </div>
38
-
39
- <div v-if="title !== ''"
40
- class="border-grey-2 font-normal"
41
- :class="{
42
- 'p-2 text-xl leading-8': size === 'small',
43
- 'p-4 text-2xl leading-9': size === 'medium',
44
- 'p-8 text-4xl leading-10': size === 'large',
45
- 'border-t': $slots.image && padImage
46
- }">
47
- {{ title }}
48
- </div>
49
-
50
- <div class="border-grey-2"
51
- :class="{
52
- 'p-2': size === 'small',
53
- 'p-4': size === 'medium',
54
- 'p-8': size === 'large',
55
- 'border-t': ($slots.image && padImage && title === '') || title !== ''
56
- }">
57
- <slot></slot>
58
- </div>
59
-
60
- <div v-if="$slots.footer"
61
- class="border-grey-2 border-t"
62
- :class="{
63
- 'p-2': size === 'small',
64
- 'p-4': size === 'medium',
65
- 'p-8': size === 'large'
66
- }">
67
- <slot name="footer"></slot>
68
- </div>
69
- </div>
70
- </template>