@pequity/squirrel 5.4.7 → 5.4.9
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/README.md +1 -1
- package/dist/cjs/chunks/p-date-picker.js +143 -85
- package/dist/cjs/chunks/p-dropdown-select.js +4 -4
- package/dist/cjs/chunks/p-inline-date-picker.js +117 -67
- package/dist/cjs/chunks/p-link.js +1 -1
- package/dist/cjs/chunks/p-select.js +1 -1
- package/dist/cjs/index.js +37 -37
- package/dist/cjs/p-btn.js +2 -2
- package/dist/cjs/p-checkbox.js +1 -1
- package/dist/cjs/p-chips.js +2 -2
- package/dist/cjs/p-input-number.js +3 -3
- package/dist/cjs/p-input-search.js +1 -1
- package/dist/cjs/p-loading.js +2 -2
- package/dist/cjs/p-modal.js +2 -2
- package/dist/cjs/p-skeleton-loader.js +1 -1
- package/dist/cjs/p-table-td.js +1 -1
- package/dist/cjs/p-toggle.js +1 -1
- package/dist/cjs/tailwind.js +2 -2
- package/dist/cjs/usePTableRowVirtualizer.js +1 -1
- package/dist/cjs/useSelectList.js +3 -3
- package/dist/es/chunks/p-date-picker.js +144 -86
- package/dist/es/chunks/p-dropdown-select.js +4 -4
- package/dist/es/chunks/p-inline-date-picker.js +118 -68
- package/dist/es/chunks/p-link.js +1 -1
- package/dist/es/chunks/p-select.js +1 -1
- package/dist/es/index.js +35 -35
- package/dist/es/p-btn.js +2 -2
- package/dist/es/p-checkbox.js +1 -1
- package/dist/es/p-chips.js +2 -2
- package/dist/es/p-input-number.js +3 -3
- package/dist/es/p-input-search.js +1 -1
- package/dist/es/p-loading.js +2 -2
- package/dist/es/p-modal.js +2 -2
- package/dist/es/p-skeleton-loader.js +1 -1
- package/dist/es/p-table-td.js +1 -1
- package/dist/es/p-toggle.js +1 -1
- package/dist/es/tailwind.js +2 -2
- package/dist/es/usePTableRowVirtualizer.js +1 -1
- package/dist/es/useSelectList.js +3 -3
- package/dist/squirrel/components/index.d.ts +13 -13
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +2 -2
- package/dist/squirrel/components/p-card/p-card.vue.d.ts +3 -2
- package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +2 -1
- package/dist/squirrel/components/p-close-btn/p-close-btn.vue.d.ts +1 -1
- package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +27 -30
- package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +3 -3
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +8 -7
- package/dist/squirrel/components/p-file-upload/p-file-upload.vue.d.ts +1 -1
- package/dist/squirrel/components/p-icon/p-icon.vue.d.ts +2 -2
- package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +2 -1
- package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +46 -0
- package/dist/squirrel/components/p-input/p-input.vue.d.ts +1 -1
- package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +1 -1
- package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +1 -1
- package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +2 -2
- package/dist/squirrel/components/p-link/p-link.vue.d.ts +2 -1
- package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +5 -4
- package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +2 -1
- package/dist/squirrel/components/p-ring-loader/p-ring-loader.vue.d.ts +1 -1
- package/dist/squirrel/components/p-select/p-select.vue.d.ts +3 -2
- package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +3 -2
- package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +6 -5
- package/dist/squirrel/components/p-select-pill/p-select-pill.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table/p-table.vue.d.ts +3 -2
- package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table-td/p-table-td.vue.d.ts +2 -1
- package/dist/squirrel/components/p-tabs/p-tabs.vue.d.ts +2 -2
- package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +1 -1
- package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +1 -1
- package/dist/squirrel/index.d.ts +1 -1
- package/dist/squirrel/utils/index.d.ts +8 -8
- package/dist/squirrel/utils/inputClassesMixin.d.ts +1 -1
- package/dist/style.css +98 -989
- package/package.json +30 -32
- package/squirrel/assets/squirrel.css +45 -6
- package/squirrel/components/index.ts +37 -37
- package/squirrel/components/p-action-bar/p-action-bar.spec.ts +1 -1
- package/squirrel/components/p-action-bar/p-action-bar.stories.js +2 -2
- package/squirrel/components/p-action-bar/p-action-bar.vue +1 -1
- package/squirrel/components/p-alert/p-alert.vue +1 -1
- package/squirrel/components/p-btn/p-btn.spec.js +2 -2
- package/squirrel/components/p-btn/p-btn.vue +4 -4
- package/squirrel/components/p-checkbox/p-checkbox.vue +1 -1
- package/squirrel/components/p-chips/p-chips.vue +1 -1
- package/squirrel/components/p-date-picker/p-date-picker.spec.js +292 -0
- package/squirrel/components/p-date-picker/p-date-picker.stories.js +3 -3
- package/squirrel/components/p-date-picker/p-date-picker.vue +45 -90
- package/squirrel/components/p-dropdown/p-dropdown.spec.js +1 -1
- package/squirrel/components/p-dropdown/p-dropdown.vue +1 -1
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +4 -4
- package/squirrel/components/p-dropdown-select/p-dropdown-select.stories.js +2 -2
- package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +8 -8
- package/squirrel/components/p-file-upload/p-file-upload.vue +2 -2
- package/squirrel/components/p-icon/p-icon.spec.js +1 -1
- package/squirrel/components/p-icon/p-icon.stories.js +1 -1
- package/squirrel/components/p-icon/p-icon.vue +2 -2
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +21 -45
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.stories.js +3 -3
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +16 -85
- package/squirrel/components/p-input/p-input.stories.js +1 -1
- package/squirrel/components/p-input/p-input.vue +1 -1
- package/squirrel/components/p-input-number/p-input-number.stories.js +1 -1
- package/squirrel/components/p-input-number/p-input-number.vue +3 -3
- package/squirrel/components/p-input-percent/p-input-percent.stories.js +1 -1
- package/squirrel/components/p-input-percent/p-input-percent.vue +1 -1
- package/squirrel/components/p-input-search/p-input-search.stories.js +1 -1
- package/squirrel/components/p-input-search/p-input-search.vue +1 -1
- package/squirrel/components/p-link/p-link.spec.js +1 -1
- package/squirrel/components/p-link/p-link.vue +1 -1
- package/squirrel/components/p-loading/p-loading.spec.js +2 -2
- package/squirrel/components/p-loading/p-loading.stories.js +2 -2
- package/squirrel/components/p-loading/p-loading.vue +1 -1
- package/squirrel/components/p-loading/usePLoading.ts +1 -1
- package/squirrel/components/p-modal/p-modal-basic.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal-events.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal-features.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal.vue +3 -3
- package/squirrel/components/p-pagination/p-pagination.vue +1 -1
- package/squirrel/components/p-progress-bar/p-progess-bar.spec.js +1 -1
- package/squirrel/components/p-progress-bar/p-progress-bar.vue +1 -1
- package/squirrel/components/p-select/p-select.spec.js +1 -1
- package/squirrel/components/p-select/p-select.stories.js +1 -1
- package/squirrel/components/p-select/p-select.vue +1 -1
- package/squirrel/components/p-select-btn/p-select-btn.spec.js +1 -1
- package/squirrel/components/p-select-btn/p-select-btn.stories.js +1 -1
- package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
- package/squirrel/components/p-select-list/p-select-list.spec.js +4 -4
- package/squirrel/components/p-select-list/p-select-list.vue +5 -5
- package/squirrel/components/p-select-list/useSelectList.ts +3 -3
- package/squirrel/components/p-select-pill/p-select-pill.spec.js +1 -1
- package/squirrel/components/p-select-pill/p-select-pill.stories.js +2 -2
- package/squirrel/components/p-select-pill/p-select-pill.vue +1 -1
- package/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue +1 -1
- package/squirrel/components/p-table/p-table.spec.js +2 -2
- package/squirrel/components/p-table/p-table.vue +4 -4
- package/squirrel/components/p-table/usePTableColResize.spec.js +1 -1
- package/squirrel/components/p-table/usePTableColResize.ts +1 -1
- package/squirrel/components/p-table/usePTableRowVirtualizer.ts +1 -1
- package/squirrel/components/p-table-sort/p-table-sort.spec.js +1 -1
- package/squirrel/components/p-table-sort/p-table-sort.stories.js +1 -1
- package/squirrel/components/p-table-sort/p-table-sort.vue +1 -1
- package/squirrel/components/p-table-td/p-table-td.spec.js +3 -3
- package/squirrel/components/p-table-td/p-table-td.stories.js +1 -1
- package/squirrel/components/p-table-td/p-table-td.vue +2 -2
- package/squirrel/components/p-tabs/p-tabs.vue +1 -1
- package/squirrel/components/p-textarea/p-textarea.stories.js +1 -1
- package/squirrel/components/p-textarea/p-textarea.vue +1 -1
- package/squirrel/components/p-toggle/p-toggle.stories.js +1 -1
- package/squirrel/components/p-toggle/p-toggle.vue +1 -1
- package/squirrel/composables/useInputClasses.spec.js +1 -1
- package/squirrel/index.ts +1 -1
- package/squirrel/utils/component.ts +1 -1
- package/squirrel/utils/index.ts +18 -18
- package/squirrel/utils/inputClassesMixin.ts +1 -1
- package/squirrel/utils/pagination.spec.js +2 -2
- package/squirrel/utils/sanitization.spec.js +1 -1
- package/squirrel/utils/tailwind.ts +3 -2
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
type ModelValue,
|
|
5
5
|
type Size,
|
|
6
6
|
} from '@squirrel/components/p-select-list/p-select-list.types';
|
|
7
|
-
import {
|
|
7
|
+
import { createInternalItems, createInternalValue } from '@squirrel/components/p-select-list/p-select-list.utils';
|
|
8
8
|
import {
|
|
9
9
|
type ListKeyboardNavigationInstance,
|
|
10
10
|
setupListKeyboardNavigation,
|
|
11
11
|
} from '@squirrel/utils/listKeyboardNavigation';
|
|
12
|
-
import { cloneDeep, uniqBy } from 'lodash-es';
|
|
13
|
-
import { createInternalItems, createInternalValue } from '@squirrel/components/p-select-list/p-select-list.utils';
|
|
14
12
|
import { toString } from '@squirrel/utils/string';
|
|
15
13
|
import { useVirtualizer } from '@tanstack/vue-virtual';
|
|
14
|
+
import { cloneDeep, uniqBy } from 'lodash-es';
|
|
15
|
+
import { type ComponentPublicInstance, computed, nextTick, onUnmounted, type Ref, ref, watch } from 'vue';
|
|
16
16
|
|
|
17
17
|
type Emits = {
|
|
18
18
|
(e: 'update:modelValue', modelValue: ModelValue): void;
|
|
@@ -106,7 +106,7 @@ describe('PSelectPill.vue', () => {
|
|
|
106
106
|
['sm', ['h-7', 'px-4', 'text-xs']],
|
|
107
107
|
['md', ['h-9', 'px-5', 'text-sm']],
|
|
108
108
|
['lg', ['h-11', 'px-7', 'text-base']],
|
|
109
|
-
])(`supports %s size
|
|
109
|
+
])(`supports %s size`, async (size, classes) => {
|
|
110
110
|
const wrapper = createWrapperFor(PSelectPill, {
|
|
111
111
|
props: {
|
|
112
112
|
items: selectItems,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import PSelectPill from '@squirrel/components/p-select-pill/p-select-pill.vue';
|
|
2
|
-
import { expect, userEvent, within } from '@storybook/test';
|
|
3
1
|
import { fieldArgTypes } from '@root/stories/common/field';
|
|
4
2
|
import { getCSSTransitionDuration, sleep } from '@root/stories/common/helpers';
|
|
3
|
+
import PSelectPill from '@squirrel/components/p-select-pill/p-select-pill.vue';
|
|
4
|
+
import { expect, userEvent, within } from '@storybook/test';
|
|
5
5
|
|
|
6
6
|
const ACTIVE_CLASS = 'text-p-purple-60';
|
|
7
7
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import PTable from '@squirrel/components/p-table/p-table.vue';
|
|
2
|
-
import { cloneDeep } from 'lodash-es';
|
|
3
1
|
import {
|
|
4
2
|
colsInjectionKey,
|
|
5
3
|
isFirstColFixedInjectionKey,
|
|
6
4
|
isLastColFixedInjectionKey,
|
|
7
5
|
} from '@squirrel/components/p-table/p-table.types';
|
|
6
|
+
import PTable from '@squirrel/components/p-table/p-table.vue';
|
|
8
7
|
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
8
|
+
import { cloneDeep } from 'lodash-es';
|
|
9
9
|
import { defineComponent, h, inject } from 'vue';
|
|
10
10
|
|
|
11
11
|
const columns = [
|
|
@@ -79,17 +79,17 @@
|
|
|
79
79
|
</template>
|
|
80
80
|
|
|
81
81
|
<script setup lang="ts">
|
|
82
|
-
import PTableHeaderCell from '@squirrel/components/p-table-header-cell/p-table-header-cell.vue';
|
|
83
82
|
import {
|
|
84
|
-
type TableCol,
|
|
85
83
|
colsInjectionKey,
|
|
86
84
|
isColsResizableInjectionKey,
|
|
87
85
|
isFirstColFixedInjectionKey,
|
|
88
86
|
isLastColFixedInjectionKey,
|
|
87
|
+
type TableCol,
|
|
89
88
|
} from '@squirrel/components/p-table/p-table.types';
|
|
90
|
-
import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue';
|
|
91
|
-
import { kebabCase } from 'lodash-es';
|
|
92
89
|
import { usePTableColResize } from '@squirrel/components/p-table/usePTableColResize';
|
|
90
|
+
import PTableHeaderCell from '@squirrel/components/p-table-header-cell/p-table-header-cell.vue';
|
|
91
|
+
import { kebabCase } from 'lodash-es';
|
|
92
|
+
import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue';
|
|
93
93
|
|
|
94
94
|
type Props = {
|
|
95
95
|
cols: TableCol[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MIN_WIDTH_COL_RESIZE } from '@squirrel/components/p-table/p-table.types';
|
|
2
|
-
import {
|
|
2
|
+
import { nextTick, onBeforeUnmount, onMounted, type Ref, ref, watch } from 'vue';
|
|
3
3
|
|
|
4
4
|
type Options = {
|
|
5
5
|
enabled: Ref<boolean>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ComponentPublicInstance, type ComputedRef, type Ref, computed, isRef, nextTick, ref, unref } from 'vue';
|
|
2
1
|
import { useVirtualizer } from '@tanstack/vue-virtual';
|
|
2
|
+
import { type ComponentPublicInstance, computed, type ComputedRef, isRef, nextTick, type Ref, ref, unref } from 'vue';
|
|
3
3
|
|
|
4
4
|
type Options = ComputedRef<{
|
|
5
5
|
count: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PTableSort from '@squirrel/components/p-table-sort/p-table-sort.vue';
|
|
2
1
|
import { SORTING_TYPES } from '@squirrel/components/p-table-sort/p-table-sort.config';
|
|
2
|
+
import PTableSort from '@squirrel/components/p-table-sort/p-table-sort.vue';
|
|
3
3
|
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
4
4
|
|
|
5
5
|
describe('PTableSort.vue', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PTableSort from '@squirrel/components/p-table-sort/p-table-sort.vue';
|
|
2
1
|
import { SORTING_TYPES } from '@squirrel/components/p-table-sort/p-table-sort.config';
|
|
2
|
+
import PTableSort from '@squirrel/components/p-table-sort/p-table-sort.vue';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Components/PTableSort',
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script lang="ts">
|
|
59
|
-
import { type PropType, defineComponent } from 'vue';
|
|
60
59
|
import { SORTING_TYPES, type SortingType } from '@squirrel/components/p-table-sort/p-table-sort.config';
|
|
60
|
+
import { defineComponent, type PropType } from 'vue';
|
|
61
61
|
|
|
62
62
|
export default defineComponent({
|
|
63
63
|
name: 'PTableSort',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import PTableTd from '@squirrel/components/p-table-td/p-table-td.vue';
|
|
2
1
|
import {
|
|
3
2
|
colsInjectionKey,
|
|
4
3
|
isColsResizableInjectionKey,
|
|
5
4
|
isFirstColFixedInjectionKey,
|
|
6
5
|
isLastColFixedInjectionKey,
|
|
7
6
|
} from '@squirrel/components/p-table/p-table.types';
|
|
7
|
+
import PTableTd from '@squirrel/components/p-table-td/p-table-td.vue';
|
|
8
8
|
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
9
9
|
import { ref } from 'vue';
|
|
10
10
|
|
|
@@ -123,7 +123,7 @@ describe('PTableTd.vue', () => {
|
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
it('
|
|
126
|
+
it('applies spacing on the first non-sticky column', async () => {
|
|
127
127
|
const wrapper = createWrapperFor(PTableTd, {
|
|
128
128
|
props: { colIndex: 1 },
|
|
129
129
|
slots: { default: `Cell content` },
|
|
@@ -140,7 +140,7 @@ describe('PTableTd.vue', () => {
|
|
|
140
140
|
expect([...innerDiv.classes()].sort()).toEqual(['w-max', 'pl-4', 'pr-2'].sort());
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
it('
|
|
143
|
+
it('applies spacing on the last non-sticky column', async () => {
|
|
144
144
|
const wrapper = createWrapperFor(PTableTd, {
|
|
145
145
|
props: { colIndex: 1 },
|
|
146
146
|
slots: { default: `Cell content` },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PTableTd from '@squirrel/components/p-table-td/p-table-td.vue';
|
|
2
1
|
import { colsInjectionKey } from '@squirrel/components/p-table/p-table.types';
|
|
2
|
+
import PTableTd from '@squirrel/components/p-table-td/p-table-td.vue';
|
|
3
3
|
import { defineComponent, h, provide } from 'vue';
|
|
4
4
|
|
|
5
5
|
const columns = [{ id: 1 }, { id: 2 }];
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { type Ref, computed, inject, ref } from 'vue';
|
|
17
16
|
import {
|
|
18
|
-
type TableCol,
|
|
19
17
|
colsInjectionKey,
|
|
20
18
|
isColsResizableInjectionKey,
|
|
21
19
|
isFirstColFixedInjectionKey,
|
|
22
20
|
isLastColFixedInjectionKey,
|
|
21
|
+
type TableCol,
|
|
23
22
|
} from '@squirrel/components/p-table/p-table.types';
|
|
23
|
+
import { computed, inject, type Ref, ref } from 'vue';
|
|
24
24
|
|
|
25
25
|
defineOptions({ name: 'PTableTd', inheritAttrs: false });
|
|
26
26
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
|
|
15
|
-
import { type StyleValue
|
|
15
|
+
import { defineComponent, type StyleValue } from 'vue';
|
|
16
16
|
|
|
17
17
|
export default defineComponent({
|
|
18
18
|
name: 'PTextarea',
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script lang="ts">
|
|
28
28
|
import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
|
|
29
|
-
import { type StyleValue
|
|
29
|
+
import { defineComponent, type StyleValue } from 'vue';
|
|
30
30
|
|
|
31
31
|
const TOGGLE_SIZES = {
|
|
32
32
|
sm: `w-7 h-4 after:top-[2px] after:left-[2px] after:h-3 after:w-3`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useInputClasses } from '@squirrel/composables/useInputClasses';
|
|
1
2
|
import { SPACING_LEFT, SPACING_PREFIX, SPACING_RIGHT, SPACING_SUFFIX } from '@squirrel/utils/inputClassesShared';
|
|
2
3
|
import { reactive } from 'vue';
|
|
3
|
-
import { useInputClasses } from '@squirrel/composables/useInputClasses';
|
|
4
4
|
|
|
5
5
|
const baseInputClasses = () =>
|
|
6
6
|
[
|
package/squirrel/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Component } from 'vue';
|
|
2
1
|
import { isPlainObject } from 'lodash-es';
|
|
2
|
+
import { type Component } from 'vue';
|
|
3
3
|
|
|
4
4
|
// Vue produces a different type of object in dev and prod mode, so we cannot check for e.g `typeof val.render === 'function`
|
|
5
5
|
export const isComponent = (val: unknown): val is Component => isPlainObject(val);
|
package/squirrel/utils/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
|
|
2
1
|
import { CURRENCY_INPUT_DEFAULTS } from '@squirrel/utils/currency';
|
|
3
|
-
import {
|
|
2
|
+
import { getNextActiveElement, isElement, isVisible } from '@squirrel/utils/dom';
|
|
3
|
+
import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
|
|
4
4
|
import {
|
|
5
5
|
ERROR_MSG,
|
|
6
6
|
INPUT_BASE,
|
|
@@ -20,47 +20,47 @@ import {
|
|
|
20
20
|
SPACING_SUFFIX,
|
|
21
21
|
TEXTAREA_BASE,
|
|
22
22
|
} from '@squirrel/utils/inputClassesShared';
|
|
23
|
-
import { createPagingRange } from '@squirrel/utils/pagination';
|
|
24
|
-
import { getNextActiveElement, isElement, isVisible } from '@squirrel/utils/dom';
|
|
25
|
-
import { isObject } from '@squirrel/utils/object';
|
|
26
|
-
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
27
23
|
import { setupListKeyboardNavigation } from '@squirrel/utils/listKeyboardNavigation';
|
|
28
|
-
import { splitStringForHighlight } from '@squirrel/utils/text';
|
|
29
24
|
import { toNumberOrNull } from '@squirrel/utils/number';
|
|
25
|
+
import { isObject } from '@squirrel/utils/object';
|
|
26
|
+
import { createPagingRange } from '@squirrel/utils/pagination';
|
|
27
|
+
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
30
28
|
import { toString } from '@squirrel/utils/string';
|
|
29
|
+
import { type Color, getColor, getColorDeep, getScreen } from '@squirrel/utils/tailwind';
|
|
30
|
+
import { splitStringForHighlight } from '@squirrel/utils/text';
|
|
31
31
|
|
|
32
32
|
export {
|
|
33
|
-
inputClassesMixin,
|
|
34
|
-
CURRENCY_INPUT_DEFAULTS,
|
|
35
33
|
Color,
|
|
34
|
+
createPagingRange,
|
|
35
|
+
CURRENCY_INPUT_DEFAULTS,
|
|
36
|
+
ERROR_MSG,
|
|
36
37
|
getColor,
|
|
37
38
|
getColorDeep,
|
|
39
|
+
getNextActiveElement,
|
|
38
40
|
getScreen,
|
|
39
|
-
ERROR_MSG,
|
|
40
41
|
INPUT_BASE,
|
|
41
42
|
INPUT_ERROR,
|
|
42
43
|
INPUT_NORMAL,
|
|
43
44
|
INPUT_SIZES,
|
|
45
|
+
inputClassesMixin,
|
|
44
46
|
InputSize,
|
|
47
|
+
isElement,
|
|
48
|
+
isObject,
|
|
49
|
+
isVisible,
|
|
45
50
|
LABEL_BASE,
|
|
46
51
|
LABEL_REQUIRED,
|
|
47
52
|
LABEL_SIZES,
|
|
53
|
+
sanitizeUrl,
|
|
48
54
|
SELECT_ARROW,
|
|
49
55
|
SELECT_BASE,
|
|
50
56
|
SELECT_SIZES,
|
|
57
|
+
setupListKeyboardNavigation,
|
|
51
58
|
SPACING_LEFT,
|
|
52
59
|
SPACING_PREFIX,
|
|
53
60
|
SPACING_RIGHT,
|
|
54
61
|
SPACING_SUFFIX,
|
|
55
|
-
TEXTAREA_BASE,
|
|
56
|
-
createPagingRange,
|
|
57
|
-
getNextActiveElement,
|
|
58
|
-
isElement,
|
|
59
|
-
isVisible,
|
|
60
|
-
isObject,
|
|
61
|
-
sanitizeUrl,
|
|
62
|
-
setupListKeyboardNavigation,
|
|
63
62
|
splitStringForHighlight,
|
|
63
|
+
TEXTAREA_BASE,
|
|
64
64
|
toNumberOrNull,
|
|
65
65
|
toString,
|
|
66
66
|
};
|
|
@@ -22,7 +22,7 @@ describe('pagination', () => {
|
|
|
22
22
|
[18, [1, '...', 17, 18, 19, 20]],
|
|
23
23
|
[19, [1, '...', 17, 18, 19, 20]],
|
|
24
24
|
[20, [1, '...', 18, 19, 20]],
|
|
25
|
-
])('
|
|
25
|
+
])('creates paging range (%i, 20)', (currentPage, res) => {
|
|
26
26
|
expect(createPagingRange(currentPage, 20)).toStrictEqual(res);
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -47,7 +47,7 @@ describe('pagination', () => {
|
|
|
47
47
|
[18, [1, '...', 15, 16, 17, 18, 19, 20]],
|
|
48
48
|
[19, [1, '...', 16, 17, 18, 19, 20]],
|
|
49
49
|
[20, [1, '...', 17, 18, 19, 20]],
|
|
50
|
-
])('
|
|
50
|
+
])('creates paging range (%i, 20) with the offset set to 3', (currentPage, res) => {
|
|
51
51
|
expect(createPagingRange(currentPage, 20, 3)).toStrictEqual(res);
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -51,7 +51,7 @@ describe('sanitizeUrl', () => {
|
|
|
51
51
|
'javascript:',
|
|
52
52
|
'jav	ascript:alert();',
|
|
53
53
|
'jav\u0000ascript:alert();',
|
|
54
|
-
])('
|
|
54
|
+
])('adds an "unsafe:" prefix if the URL is invalid (%s)', (urlVal) => {
|
|
55
55
|
expect(sanitizeUrl(urlVal)).toMatch(/^unsafe:/);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { config as squirrelTailwindConfig } from '@squirrel/tailwind/config';
|
|
2
2
|
// Relative import is used here because of
|
|
3
3
|
// "Module source URI is not allowed in this document: “http://tailwind.config/”" error
|
|
4
4
|
import { get } from 'lodash-es';
|
|
5
|
-
import { config as squirrelTailwindConfig } from '@squirrel/tailwind/config';
|
|
6
5
|
import type { Config } from 'tailwindcss';
|
|
6
|
+
import resolveConfig from 'tailwindcss/resolveConfig';
|
|
7
7
|
|
|
8
8
|
const config = resolveConfig(squirrelTailwindConfig);
|
|
9
9
|
const theme = config.theme as Config['theme'];
|
|
10
10
|
const colors = theme?.colors;
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
12
|
const extendedColors = theme?.extend?.colors;
|
|
12
13
|
const screens = theme?.screens;
|
|
13
14
|
|