@pequity/squirrel 8.4.5 → 8.5.1
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 +31 -2
- package/dist/cjs/chunks/index.js +530 -179
- package/dist/cjs/chunks/p-alert.js +11 -16
- package/dist/cjs/chunks/p-btn.js +1 -1
- package/dist/cjs/chunks/p-input-percent.js +2 -2
- package/dist/cjs/chunks/p-table-header-cell.js +57 -0
- package/dist/cjs/index.js +41 -33
- package/dist/cjs/inputClasses.js +3 -3
- package/dist/cjs/p-icon.js +2 -1
- package/dist/cjs/p-loading.js +2 -2
- package/dist/cjs/p-modal.js +45 -43
- package/dist/cjs/p-table-header-cell.js +2 -116
- package/dist/cjs/p-table.js +2 -0
- package/dist/cjs/usePTableHeaderWrap.js +38 -0
- package/dist/es/chunks/index.js +530 -179
- package/dist/es/chunks/p-alert.js +11 -16
- package/dist/es/chunks/p-btn.js +2 -2
- package/dist/es/chunks/p-input-percent.js +2 -2
- package/dist/es/chunks/p-table-header-cell.js +58 -0
- package/dist/es/index.js +49 -41
- package/dist/es/inputClasses.js +4 -4
- package/dist/es/p-icon.js +2 -1
- package/dist/es/p-loading.js +2 -2
- package/dist/es/p-modal.js +45 -43
- package/dist/es/p-table-header-cell.js +2 -116
- package/dist/es/p-table.js +2 -0
- package/dist/es/usePTableHeaderWrap.js +38 -0
- package/dist/squirrel/components/index.d.ts +1 -2
- package/dist/squirrel/components/p-action-bar/p-action-bar.vue.d.ts +1 -1
- package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +2 -2
- package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +1 -1
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +3 -3
- package/dist/squirrel/components/p-card/p-card.vue.d.ts +1 -1
- package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +1 -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 +1 -1
- package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +12 -12
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +1 -1
- package/dist/squirrel/components/p-file-upload/p-file-upload.vue.d.ts +1 -1
- package/dist/squirrel/components/p-icon/p-icon.types.d.ts +1 -0
- package/dist/squirrel/components/p-icon/p-icon.vue.d.ts +1 -1
- package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +1 -1
- package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +1 -1
- package/dist/squirrel/components/p-input/p-input.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 +1 -1
- package/dist/squirrel/components/p-link/p-link.vue.d.ts +1 -1
- package/dist/squirrel/components/p-loading/p-loading.vue.d.ts +1 -1
- package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +5 -1
- package/dist/squirrel/components/p-pagination/p-pagination.vue.d.ts +1 -1
- package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +1 -1
- package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +1 -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 +1 -1
- package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +1 -1
- package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +1 -1
- package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table/p-table.types.d.ts +1 -0
- package/dist/squirrel/components/p-table/p-table.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table/usePTableHeaderWrap.d.ts +4 -0
- package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +14 -161
- 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 +1 -1
- package/dist/squirrel/components/p-tabs/p-tabs.vue.d.ts +1 -1
- package/dist/squirrel/components/p-tabs-pills/p-tabs-pills.vue.d.ts +1 -1
- 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.css +22 -33
- package/package.json +23 -21
- package/squirrel/components/index.ts +0 -2
- package/squirrel/components/p-alert/p-alert.spec.js +4 -4
- package/squirrel/components/p-alert/p-alert.stories.js +19 -13
- package/squirrel/components/p-alert/p-alert.vue +9 -11
- package/squirrel/components/p-icon/p-icon.types.ts +1 -0
- package/squirrel/components/p-modal/p-modal-basic.spec.js +29 -3
- package/squirrel/components/p-modal/p-modal.vue +44 -33
- package/squirrel/components/p-table/p-table.spec.js +79 -10
- package/squirrel/components/p-table/p-table.types.ts +2 -0
- package/squirrel/components/p-table/p-table.vue +12 -5
- package/squirrel/components/p-table/usePTableHeaderWrap.spec.js +118 -0
- package/squirrel/components/p-table/usePTableHeaderWrap.ts +45 -0
- package/squirrel/components/p-table-header-cell/p-table-header-cell.spec.js +17 -9
- package/squirrel/components/p-table-header-cell/p-table-header-cell.vue +69 -83
- package/dist/cjs/p-table-filter-icon.js +0 -28
- package/dist/es/p-table-filter-icon.js +0 -29
- package/dist/squirrel/components/p-table-header-cell/p-table-filter-icon.vue.d.ts +0 -20
- package/squirrel/assets/filter-icon-active-hover.svg +0 -4
- package/squirrel/assets/filter-icon-active.svg +0 -4
- package/squirrel/assets/filter-icon-hover.svg +0 -7
- package/squirrel/assets/filter-icon.svg +0 -6
- package/squirrel/components/p-table-header-cell/p-filter-icon.spec.js +0 -20
- package/squirrel/components/p-table-header-cell/p-filter-icon.stories.js +0 -33
- package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +0 -41
|
@@ -4,26 +4,34 @@
|
|
|
4
4
|
:class="[DEFAULT_CLASSES, textClass, textColorClass, { 'mr-auto': !tooltipText }]"
|
|
5
5
|
:style="style"
|
|
6
6
|
:title="text"
|
|
7
|
+
data-p-table-header-text
|
|
7
8
|
>
|
|
8
9
|
{{ text }}
|
|
9
10
|
</div>
|
|
10
11
|
<div v-if="tooltipText" class="relative ml-1 mr-auto h-3 w-3 shrink-0">
|
|
11
|
-
<PInfoIcon
|
|
12
|
+
<PInfoIcon :text="tooltipText" />
|
|
12
13
|
</div>
|
|
13
|
-
<
|
|
14
|
-
:
|
|
15
|
-
:
|
|
14
|
+
<PIcon
|
|
15
|
+
:icon="filterActive ? 'ph:funnel-fill' : 'si:filter-list-alt-duotone'"
|
|
16
|
+
:class="[
|
|
17
|
+
'ml-2 mr-px cursor-pointer rounded-sm',
|
|
18
|
+
{ hidden: !showFilterIcon },
|
|
19
|
+
filterActive
|
|
20
|
+
? 'text-active-blue hover:bg-p-blue-10 hover:text-p-blue-60 hover:ring-1 hover:ring-p-blue-10'
|
|
21
|
+
: 'text-p-gray-60 hover:bg-p-gray-10 hover:text-night hover:ring-1 hover:ring-p-gray-10',
|
|
22
|
+
]"
|
|
23
|
+
height="16"
|
|
16
24
|
@click="$emit('click-filter-icon', $event, filterActive)"
|
|
17
25
|
/>
|
|
18
26
|
</div>
|
|
19
27
|
</template>
|
|
20
28
|
|
|
21
|
-
<script lang="ts">
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import PIcon from '@squirrel/components/p-icon/p-icon.vue';
|
|
22
31
|
import PInfoIcon from '@squirrel/components/p-info-icon/p-info-icon.vue';
|
|
23
|
-
import
|
|
24
|
-
import { defineComponent } from 'vue';
|
|
32
|
+
import { computed } from 'vue';
|
|
25
33
|
|
|
26
|
-
const DEFAULT_CLASSES = `text-xs
|
|
34
|
+
const DEFAULT_CLASSES = `text-xs font-semibold line-clamp-2 break-words hyphens-auto whitespace-normal max-h-10 shrink`;
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* A table header cell component that displays text with optional tooltip and filter icon.
|
|
@@ -32,85 +40,63 @@ const DEFAULT_CLASSES = `text-xs leading-5 font-semibold truncate shrink`;
|
|
|
32
40
|
*
|
|
33
41
|
* @displayName PTableHeaderCell
|
|
34
42
|
*/
|
|
35
|
-
|
|
43
|
+
defineOptions({
|
|
36
44
|
name: 'PTableHeaderCell',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* Custom text color to apply to the header text.
|
|
84
|
-
* Overrides the default text color when provided.
|
|
85
|
-
*/
|
|
86
|
-
textColor: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: '',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
type Props = {
|
|
48
|
+
text?: string;
|
|
49
|
+
textClass?: string;
|
|
50
|
+
filterActive?: boolean;
|
|
51
|
+
showFilterIcon?: boolean;
|
|
52
|
+
tooltipText?: string;
|
|
53
|
+
textColor?: string;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
57
|
+
/**
|
|
58
|
+
* The text content to display in the header cell.
|
|
59
|
+
* Also used as the title attribute for accessibility.
|
|
60
|
+
*/
|
|
61
|
+
text: '',
|
|
62
|
+
/**
|
|
63
|
+
* CSS classes to apply to the text element.
|
|
64
|
+
* Can be a string, object, or array for flexible styling.
|
|
65
|
+
*/
|
|
66
|
+
textClass: 'text-left',
|
|
67
|
+
/**
|
|
68
|
+
* Whether the filter icon is in an active state.
|
|
69
|
+
* Controls the visual appearance of the filter icon and text color.
|
|
70
|
+
*/
|
|
71
|
+
filterActive: false,
|
|
72
|
+
/**
|
|
73
|
+
* Whether to show the filter icon.
|
|
74
|
+
*/
|
|
75
|
+
showFilterIcon: false,
|
|
76
|
+
/**
|
|
77
|
+
* Tooltip text to display when hovering over the info icon.
|
|
78
|
+
* When provided, shows an info icon with the tooltip content.
|
|
79
|
+
*/
|
|
80
|
+
tooltipText: '',
|
|
81
|
+
/**
|
|
82
|
+
* Custom text color to apply to the header text.
|
|
83
|
+
* Overrides the default text color when provided.
|
|
84
|
+
*/
|
|
85
|
+
textColor: '',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
defineEmits<{
|
|
91
89
|
/**
|
|
92
90
|
* Emitted when the filter icon is clicked.
|
|
93
91
|
* @param {Event} event - The click event
|
|
94
92
|
* @param {boolean} filterActive - The current filter active state
|
|
95
93
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return this.filterActive ? 'text-active-blue' : this.textColor ? '' : 'text-p-gray-60';
|
|
105
|
-
},
|
|
106
|
-
style() {
|
|
107
|
-
if (this.filterActive) {
|
|
108
|
-
return {};
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
color: this.textColor,
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
});
|
|
94
|
+
'click-filter-icon': [event: Event, filterActive: boolean];
|
|
95
|
+
}>();
|
|
96
|
+
|
|
97
|
+
const textColorClass = computed(() =>
|
|
98
|
+
props.filterActive ? 'text-active-blue' : props.textColor ? '' : 'text-p-gray-60'
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const style = computed(() => (props.filterActive ? {} : { color: props.textColor }));
|
|
116
102
|
</script>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const vue = require("vue");
|
|
3
|
-
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
4
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
5
|
-
...{
|
|
6
|
-
name: "PTableFilterIcon",
|
|
7
|
-
inheritAttrs: false
|
|
8
|
-
},
|
|
9
|
-
__name: "p-table-filter-icon",
|
|
10
|
-
props: {
|
|
11
|
-
/**
|
|
12
|
-
* Whether the filter icon is active (filtered state).
|
|
13
|
-
*/
|
|
14
|
-
active: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
setup(__props) {
|
|
20
|
-
return (_ctx, _cache) => {
|
|
21
|
-
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
22
|
-
class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: __props.active }]
|
|
23
|
-
}, _ctx.$attrs), null, 16);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const PTableFilterIcon = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-5c047926"]]);
|
|
28
|
-
module.exports = PTableFilterIcon;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineComponent, createElementBlock, openBlock, mergeProps } from "vue";
|
|
2
|
-
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
-
...{
|
|
5
|
-
name: "PTableFilterIcon",
|
|
6
|
-
inheritAttrs: false
|
|
7
|
-
},
|
|
8
|
-
__name: "p-table-filter-icon",
|
|
9
|
-
props: {
|
|
10
|
-
/**
|
|
11
|
-
* Whether the filter icon is active (filtered state).
|
|
12
|
-
*/
|
|
13
|
-
active: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: false
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
setup(__props) {
|
|
19
|
-
return (_ctx, _cache) => {
|
|
20
|
-
return openBlock(), createElementBlock("div", mergeProps({
|
|
21
|
-
class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: __props.active }]
|
|
22
|
-
}, _ctx.$attrs), null, 16);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const PTableFilterIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5c047926"]]);
|
|
27
|
-
export {
|
|
28
|
-
PTableFilterIcon as default
|
|
29
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
-
/**
|
|
3
|
-
* Whether the filter icon is active (filtered state).
|
|
4
|
-
*/
|
|
5
|
-
active: {
|
|
6
|
-
type: BooleanConstructor;
|
|
7
|
-
default: boolean;
|
|
8
|
-
};
|
|
9
|
-
}>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
-
/**
|
|
11
|
-
* Whether the filter icon is active (filtered state).
|
|
12
|
-
*/
|
|
13
|
-
active: {
|
|
14
|
-
type: BooleanConstructor;
|
|
15
|
-
default: boolean;
|
|
16
|
-
};
|
|
17
|
-
}>> & Readonly<{}>, {
|
|
18
|
-
active: boolean;
|
|
19
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
20
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="20" height="20" rx="4" fill="black" fill-opacity="0.05"/>
|
|
3
|
-
<path d="M15.5 6.73001H4.5C4.36739 6.73001 4.24021 6.67733 4.14645 6.58356C4.05268 6.4898 4 6.36262 4 6.23001C4 6.0974 4.05268 5.97023 4.14645 5.87646C4.24021 5.78269 4.36739 5.73001 4.5 5.73001H15.5C15.6326 5.73001 15.7598 5.78269 15.8536 5.87646C15.9473 5.97023 16 6.0974 16 6.23001C16 6.36262 15.9473 6.4898 15.8536 6.58356C15.7598 6.67733 15.6326 6.73001 15.5 6.73001Z" fill="#424E6E"/>
|
|
4
|
-
<path d="M14.33 9.24503H5.67C5.53739 9.24503 5.41021 9.19235 5.31644 9.09858C5.22268 9.00481 5.17 8.87763 5.17 8.74503C5.17 8.61242 5.22268 8.48524 5.31644 8.39147C5.41021 8.2977 5.53739 8.24503 5.67 8.24503H14.33C14.4626 8.24503 14.5898 8.2977 14.6836 8.39147C14.7773 8.48524 14.83 8.61242 14.83 8.74503C14.83 8.87763 14.7773 9.00481 14.6836 9.09858C14.5898 9.19235 14.4626 9.24503 14.33 9.24503Z" fill="#424E6E"/>
|
|
5
|
-
<path d="M11.605 14.27H8.395C8.2624 14.27 8.13522 14.2173 8.04145 14.1236C7.94768 14.0298 7.895 13.9026 7.895 13.77C7.895 13.6374 7.94768 13.5102 8.04145 13.4165C8.13522 13.3227 8.2624 13.27 8.395 13.27H11.605C11.7376 13.27 11.8648 13.3227 11.9586 13.4165C12.0523 13.5102 12.105 13.6374 12.105 13.77C12.105 13.9026 12.0523 14.0298 11.9586 14.1236C11.8648 14.2173 11.7376 14.27 11.605 14.27Z" fill="#424E6E"/>
|
|
6
|
-
<path d="M13.155 11.755H6.845C6.71239 11.755 6.58522 11.7023 6.49145 11.6086C6.39768 11.5148 6.345 11.3876 6.345 11.255C6.345 11.1224 6.39768 10.9952 6.49145 10.9015C6.58522 10.8077 6.71239 10.755 6.845 10.755H13.155C13.2876 10.755 13.4148 10.8077 13.5086 10.9015C13.6023 10.9952 13.655 11.1224 13.655 11.255C13.655 11.3876 13.6023 11.5148 13.5086 11.6086C13.4148 11.7023 13.2876 11.755 13.155 11.755Z" fill="#424E6E"/>
|
|
7
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M15.5 6.73H4.5C4.36739 6.73 4.24021 6.67732 4.14645 6.58355C4.05268 6.48978 4 6.3626 4 6.23C4 6.09739 4.05268 5.97021 4.14645 5.87644C4.24021 5.78267 4.36739 5.73 4.5 5.73H15.5C15.6326 5.73 15.7598 5.78267 15.8536 5.87644C15.9473 5.97021 16 6.09739 16 6.23C16 6.3626 15.9473 6.48978 15.8536 6.58355C15.7598 6.67732 15.6326 6.73 15.5 6.73Z" fill="#424E6E"/>
|
|
3
|
-
<path d="M14.33 9.245H5.67C5.53739 9.245 5.41021 9.19232 5.31644 9.09855C5.22268 9.00478 5.17 8.8776 5.17 8.745C5.17 8.61239 5.22268 8.48521 5.31644 8.39144C5.41021 8.29767 5.53739 8.245 5.67 8.245H14.33C14.4626 8.245 14.5898 8.29767 14.6836 8.39144C14.7773 8.48521 14.83 8.61239 14.83 8.745C14.83 8.8776 14.7773 9.00478 14.6836 9.09855C14.5898 9.19232 14.4626 9.245 14.33 9.245Z" fill="#424E6E"/>
|
|
4
|
-
<path d="M11.605 14.27H8.395C8.2624 14.27 8.13522 14.2173 8.04145 14.1235C7.94768 14.0298 7.895 13.9026 7.895 13.77C7.895 13.6374 7.94768 13.5102 8.04145 13.4164C8.13522 13.3227 8.2624 13.27 8.395 13.27H11.605C11.7376 13.27 11.8648 13.3227 11.9586 13.4164C12.0523 13.5102 12.105 13.6374 12.105 13.77C12.105 13.9026 12.0523 14.0298 11.9586 14.1235C11.8648 14.2173 11.7376 14.27 11.605 14.27Z" fill="#424E6E"/>
|
|
5
|
-
<path d="M13.155 11.755H6.845C6.71239 11.755 6.58522 11.7023 6.49145 11.6085C6.39768 11.5148 6.345 11.3876 6.345 11.255C6.345 11.1224 6.39768 10.9952 6.49145 10.9014C6.58522 10.8077 6.71239 10.755 6.845 10.755H13.155C13.2876 10.755 13.4148 10.8077 13.5086 10.9014C13.6023 10.9952 13.655 11.1224 13.655 11.255C13.655 11.3876 13.6023 11.5148 13.5086 11.6085C13.4148 11.7023 13.2876 11.755 13.155 11.755Z" fill="#424E6E"/>
|
|
6
|
-
</svg>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import PFilterIcon from '@squirrel/components/p-table-header-cell/p-table-filter-icon.vue';
|
|
2
|
-
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
3
|
-
|
|
4
|
-
describe('PFilterIcon.vue', () => {
|
|
5
|
-
it('renders a filter icon', async () => {
|
|
6
|
-
const wrapper = createWrapperFor(PFilterIcon);
|
|
7
|
-
|
|
8
|
-
const icon = await wrapper.find('div.filter.w-5.h-5.cursor-pointer.shrink-0');
|
|
9
|
-
|
|
10
|
-
expect(icon.exists()).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('sets the active icon state', async () => {
|
|
14
|
-
const wrapper = createWrapperFor(PFilterIcon, { props: { active: true } });
|
|
15
|
-
|
|
16
|
-
const icon = await wrapper.find('div.filter.w-5.h-5.cursor-pointer.shrink-0');
|
|
17
|
-
|
|
18
|
-
expect(icon.classes()).toContain('active');
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import PFilterIcon from '@squirrel/components/p-table-header-cell/p-table-filter-icon.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/PFilterIcon',
|
|
5
|
-
component: PFilterIcon,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
render: (args) => ({
|
|
8
|
-
components: { PFilterIcon },
|
|
9
|
-
setup() {
|
|
10
|
-
return { args };
|
|
11
|
-
},
|
|
12
|
-
template: `<PFilterIcon v-bind="args" />`,
|
|
13
|
-
}),
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
component: 'A component that is used inside table header cells to display a filtering/sorting icon.',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const Default = {
|
|
24
|
-
args: {
|
|
25
|
-
active: false,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Active = {
|
|
30
|
-
args: {
|
|
31
|
-
active: true,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['h-5 w-5 shrink-0 cursor-pointer filter', { active: active }]" v-bind="$attrs"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
/**
|
|
7
|
-
* A filter icon component for table headers, used to indicate and toggle filter state.
|
|
8
|
-
* Changes its appearance based on the active state and supports hover effects.
|
|
9
|
-
*
|
|
10
|
-
* @displayName PTableFilterIcon
|
|
11
|
-
*/
|
|
12
|
-
defineOptions({
|
|
13
|
-
name: 'PTableFilterIcon',
|
|
14
|
-
inheritAttrs: false,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
defineProps({
|
|
18
|
-
/**
|
|
19
|
-
* Whether the filter icon is active (filtered state).
|
|
20
|
-
*/
|
|
21
|
-
active: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style lang="scss" scoped>
|
|
29
|
-
.filter {
|
|
30
|
-
background: url('@squirrel/assets/filter-icon.svg') no-repeat;
|
|
31
|
-
}
|
|
32
|
-
.filter:hover {
|
|
33
|
-
background: url('@squirrel/assets/filter-icon-hover.svg') no-repeat;
|
|
34
|
-
}
|
|
35
|
-
.filter.active {
|
|
36
|
-
background: url('@squirrel/assets/filter-icon-active.svg') no-repeat;
|
|
37
|
-
}
|
|
38
|
-
.filter.active:hover {
|
|
39
|
-
background: url('@squirrel/assets/filter-icon-active-hover.svg') no-repeat;
|
|
40
|
-
}
|
|
41
|
-
</style>
|