@phila/phila-ui-filter-chip 0.2.0-beta.3 → 0.2.0-beta.5
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/FilterChip.vue.d.ts +13 -13
- package/dist/FilterChip.vue.d.ts.map +1 -1
- package/dist/FilterChipBase.vue.d.ts +5 -6
- package/dist/FilterChipBase.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +185 -185
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ interface FilterDefinition {
|
|
|
30
30
|
label: string; // chip label
|
|
31
31
|
choices?: FilterChoice[]; // present → dropdown; absent → toggle
|
|
32
32
|
multiple?: boolean; // dropdown only: checkbox (true) vs radio (false)
|
|
33
|
-
|
|
33
|
+
icon?: IconComponent;
|
|
34
34
|
excludeFromCount?: boolean; // leave out of the filter button's count (e.g. Sort)
|
|
35
35
|
}
|
|
36
36
|
|
package/dist/FilterChip.vue.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
11
11
|
text: string;
|
|
12
12
|
size: import('@phila/phila-ui-core').ComponentSize;
|
|
13
13
|
color: import('./index').FilterChipColor;
|
|
14
|
-
|
|
14
|
+
icon: import('@phila/phila-ui-core').IconComponent;
|
|
15
15
|
iconColor: string;
|
|
16
|
-
|
|
16
|
+
trailingIcon: import('@phila/phila-ui-core').IconComponent;
|
|
17
17
|
label: string;
|
|
18
18
|
choices: import('@phila/phila-ui-core').FilterChoice[];
|
|
19
19
|
multiple: boolean;
|
|
@@ -29,9 +29,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
29
29
|
readonly text?: string | undefined;
|
|
30
30
|
readonly size?: import('@phila/phila-ui-core').ComponentSize | undefined;
|
|
31
31
|
readonly color?: import('./index').FilterChipColor | undefined;
|
|
32
|
-
readonly
|
|
32
|
+
readonly icon?: import('@phila/phila-ui-core').IconComponent | undefined;
|
|
33
33
|
readonly iconColor?: string | undefined;
|
|
34
|
-
readonly
|
|
34
|
+
readonly trailingIcon?: import('@phila/phila-ui-core').IconComponent | undefined;
|
|
35
35
|
readonly iconOnly?: boolean | undefined;
|
|
36
36
|
readonly active?: boolean | undefined;
|
|
37
37
|
readonly chevron?: boolean | undefined;
|
|
@@ -59,9 +59,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
59
59
|
text?: string;
|
|
60
60
|
size?: import('@phila/phila-ui-core').ComponentSize;
|
|
61
61
|
color?: import('./index').FilterChipColor;
|
|
62
|
-
|
|
62
|
+
icon?: import('@phila/phila-ui-core').IconComponent;
|
|
63
63
|
iconColor?: string;
|
|
64
|
-
|
|
64
|
+
trailingIcon?: import('@phila/phila-ui-core').IconComponent;
|
|
65
65
|
iconOnly?: boolean;
|
|
66
66
|
active?: boolean;
|
|
67
67
|
chevron?: boolean;
|
|
@@ -77,9 +77,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
77
77
|
text: string;
|
|
78
78
|
size: import('@phila/phila-ui-core').ComponentSize;
|
|
79
79
|
color: import('./index').FilterChipColor;
|
|
80
|
-
|
|
80
|
+
icon: import('@phila/phila-ui-core').IconComponent;
|
|
81
81
|
iconColor: string;
|
|
82
|
-
|
|
82
|
+
trailingIcon: import('@phila/phila-ui-core').IconComponent;
|
|
83
83
|
iconOnly: boolean;
|
|
84
84
|
active: boolean;
|
|
85
85
|
chevron: boolean;
|
|
@@ -107,9 +107,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
107
107
|
text: string;
|
|
108
108
|
size: import('@phila/phila-ui-core').ComponentSize;
|
|
109
109
|
color: import('./index').FilterChipColor;
|
|
110
|
-
|
|
110
|
+
icon: import('@phila/phila-ui-core').IconComponent;
|
|
111
111
|
iconColor: string;
|
|
112
|
-
|
|
112
|
+
trailingIcon: import('@phila/phila-ui-core').IconComponent;
|
|
113
113
|
iconOnly: boolean;
|
|
114
114
|
active: boolean;
|
|
115
115
|
chevron: boolean;
|
|
@@ -117,9 +117,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
117
117
|
text?: string;
|
|
118
118
|
size?: import('@phila/phila-ui-core').ComponentSize;
|
|
119
119
|
color?: import('./index').FilterChipColor;
|
|
120
|
-
|
|
120
|
+
icon?: import('@phila/phila-ui-core').IconComponent;
|
|
121
121
|
iconColor?: string;
|
|
122
|
-
|
|
122
|
+
trailingIcon?: import('@phila/phila-ui-core').IconComponent;
|
|
123
123
|
iconOnly?: boolean;
|
|
124
124
|
active?: boolean;
|
|
125
125
|
chevron?: boolean;
|
|
@@ -127,7 +127,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Fi
|
|
|
127
127
|
ariaExpanded?: boolean;
|
|
128
128
|
}> & Readonly<{
|
|
129
129
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
130
|
-
}>, "el" | ("text" | "size" | "color" | "
|
|
130
|
+
}>, "el" | ("text" | "size" | "color" | "icon" | "iconColor" | "trailingIcon" | "iconOnly" | "active" | "chevron")> & import('vue').ShallowUnwrapRef<{
|
|
131
131
|
el: import('vue').Ref<HTMLButtonElement | null, HTMLButtonElement | null>;
|
|
132
132
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
133
133
|
$slots: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChip.vue.d.ts","sourceRoot":"","sources":["../src/FilterChip.vue"],"names":[],"mappings":"AAsLA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FilterChip.vue.d.ts","sourceRoot":"","sources":["../src/FilterChip.vue"],"names":[],"mappings":"AAsLA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA4VinR,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA5ExvR,GAAG;;AAxQjC,wBAgUK;AAaL,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ComponentSize } from '@phila/phila-ui-core';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
1
|
+
import { ComponentSize, IconComponent } from '@phila/phila-ui-core';
|
|
3
2
|
import { FilterChipColor } from './index';
|
|
4
3
|
type __VLS_Props = {
|
|
5
4
|
text?: string;
|
|
6
5
|
size?: ComponentSize;
|
|
7
6
|
color?: FilterChipColor;
|
|
8
|
-
|
|
7
|
+
icon?: IconComponent;
|
|
9
8
|
/** CSS color for the leading icon, independent of the chip's text color. */
|
|
10
9
|
iconColor?: string;
|
|
11
10
|
/** trailing icon (toggle mode); ignored when `chevron` is set. */
|
|
12
|
-
|
|
11
|
+
trailingIcon?: IconComponent;
|
|
13
12
|
/** render only the icon, centered, with no text content. */
|
|
14
13
|
iconOnly?: boolean;
|
|
15
14
|
/** active = selected (toggle) or has-value/open (dropdown). */
|
|
@@ -41,9 +40,9 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
|
41
40
|
text: string;
|
|
42
41
|
size: ComponentSize;
|
|
43
42
|
color: FilterChipColor;
|
|
44
|
-
|
|
43
|
+
icon: IconComponent;
|
|
45
44
|
iconColor: string;
|
|
46
|
-
|
|
45
|
+
trailingIcon: IconComponent;
|
|
47
46
|
iconOnly: boolean;
|
|
48
47
|
active: boolean;
|
|
49
48
|
chevron: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChipBase.vue.d.ts","sourceRoot":"","sources":["../src/FilterChipBase.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterChipBase.vue.d.ts","sourceRoot":"","sources":["../src/FilterChipBase.vue"],"names":[],"mappings":"AAiQA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,KAAK,WAAW,GAAG;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AA+DJ,iBAAS,cAAc;WA4GT,OAAO,IAA6B;;yBAXrB,GAAG;;;;;;EAgB/B;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;UAlNV,MAAM;UACN,aAAa;WACZ,eAAe;UAChB,aAAa;eAER,MAAM;kBAEH,aAAa;cAEjB,OAAO;YAET,OAAO;aAEN,OAAO;;;qBAgNnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.phila-filter-chip[data-v-
|
|
1
|
+
.phila-filter-chip[data-v-40c7e692]{display:inline-flex;align-items:center;height:var(--scale-350, 1.75rem);cursor:pointer;border-style:solid;border-radius:var(--border-radius-l);white-space:nowrap;box-sizing:border-box;appearance:none;text-decoration:none;padding:var(--scale-25) var(--scale-75);gap:var(--spacing-xs);border-width:var(--border-width-s)}.phila-filter-chip.is-extra-large[data-v-40c7e692]{height:var(--scale-400, 2rem);padding:var(--scale-75) var(--spacing-xs);gap:var(--spacing-2xs)}.phila-filter-chip.is-large[data-v-40c7e692]{height:var(--scale-400, 2rem);padding:var(--scale-75) var(--spacing-xs)}.phila-filter-chip.is-small[data-v-40c7e692]{height:var(--scale-250, 1.25rem);padding:var(--scale-10) var(--spacing-2xs);gap:var(--spacing-2xs)}.phila-filter-chip.is-icon-only[data-v-40c7e692]{padding-left:var(--spacing-s, .75rem);padding-right:var(--spacing-s, .75rem)}.phila-filter-chip.phila-filter-chip--blue[data-v-40c7e692]{color:var(--Schemes-Inverse-Primary);border-color:var(--Schemes-Inverse-Primary);background:var(--Schemes-Info-Container)}.phila-filter-chip.phila-filter-chip--blue.is-active[data-v-40c7e692]{background:var(--Palettes-Secondary-Secondary-150);color:var(--Schemes-On-Primary);border-color:var(--Palettes-Tertiary-Tertiary-100)}.phila-filter-chip.phila-filter-chip--blue[data-v-40c7e692]:hover:not(:disabled){background:var(--Palettes-Secondary-Secondary-600);color:var(--Palettes-Tertiary-Tertiary-50);border-color:var(--Palettes-Tertiary-Tertiary-100)}.phila-filter-chip.phila-filter-chip--grey[data-v-40c7e692]{color:var(--Palettes-Neutral-Variant-Neutral-Variant-200);border-color:var(--Schemes-Border-low);background:var(--Palettes-Neutral-Neutral-700)}.phila-filter-chip.phila-filter-chip--grey.is-active[data-v-40c7e692]{background:var(--Palettes-Neutral-Neutral-100);color:var(--Schemes-On-Primary);border-color:var(--Schemes-Border-low)}.phila-filter-chip.phila-filter-chip--grey[data-v-40c7e692]:hover:not(:disabled){background:var(--Palettes-Neutral-Neutral-600);color:var(--Palettes-Neutral-Variant-Neutral-Variant-50);border-color:var(--Schemes-Border-low)}.phila-filter-chip.phila-filter-chip--green[data-v-40c7e692]{color:var(--Palettes-Success-Success-100);border-color:var(--Palettes-Success-Success-150);background:var(--Palettes-Success-Success-700)}.phila-filter-chip.phila-filter-chip--green.is-active[data-v-40c7e692]{background:var(--Palettes-Success-Success-200);color:var(--Schemes-On-Primary);border-color:var(--Palettes-Success-Success-200)}.phila-filter-chip.phila-filter-chip--green[data-v-40c7e692]:hover:not(:disabled){background:var(--Palettes-Success-Success-600);color:var(--Palettes-Success-Success-100);border-color:var(--Palettes-Success-Success-150)}.phila-filter-chip.phila-filter-chip--red[data-v-40c7e692]{color:var(--Schemes-On-Error-Container);border-color:var(--Schemes-On-Error-Container);background:var(--Schemes-Error-Container)}.phila-filter-chip.phila-filter-chip--red.is-active[data-v-40c7e692]{background:var(--Palettes-Error-Error-250);color:var(--Schemes-On-Primary);border-color:var(--Palettes-Error-Error-150)}.phila-filter-chip.phila-filter-chip--red[data-v-40c7e692]:hover:not(:disabled){background:var(--Palettes-Error-Error-650);color:var(--Palettes-Error-Error-200);border-color:var(--Palettes-Error-Error-150)}.phila-filter-chip.phila-filter-chip--white[data-v-40c7e692]{color:var(--Palettes-Neutral-Variant-Neutral-Variant-200);border-color:var(--Schemes-Border-low);background:var(--Schemes-On-Primary)}.phila-filter-chip.phila-filter-chip--white.is-active[data-v-40c7e692]{background:var(--Palettes-Neutral-Neutral-100);color:var(--Schemes-On-Primary);border-color:var(--Schemes-Border-low)}.phila-filter-chip.phila-filter-chip--white[data-v-40c7e692]:hover:not(:disabled){background:var(--Schemes-Surface-Container-Lowest);color:var(--Schemes-Inverse-Surface);border-color:var(--Schemes-Border-low)}.phila-filter-chip.phila-filter-chip--yellow[data-v-40c7e692]{color:var(--Schemes-On-Alert-Container);border-color:var(--Palettes-Alert-Alert-150);background:var(--Palettes-Alert-Alert-700)}.phila-filter-chip.phila-filter-chip--yellow.is-active[data-v-40c7e692]{background:var(--Palettes-Alert-Alert-250);color:var(--Schemes-On-Primary);border-color:var(--Palettes-Alert-Alert-150)}.phila-filter-chip.phila-filter-chip--yellow[data-v-40c7e692]:hover:not(:disabled){background:var(--Palettes-Alert-Alert-550);color:var(--Schemes-On-Alert-Container);border-color:var(--Palettes-Alert-Alert-150)}.phila-filter-chip[data-v-40c7e692]:focus-visible{outline:2px solid currentColor;outline-offset:var(--spacing-2xs)}.phila-filter-chip[data-v-40c7e692] .icon{color:var(--chip-icon-color, currentColor)}.phila-filter-chip[data-v-40c7e692] .icon path{fill:var(--chip-icon-color, currentColor)}.phila-filter-chip-panel{position:fixed;z-index:1000;min-width:12rem;background:var(--Schemes-Background);border:var(--border-width-s) solid var(--Schemes-Border);border-radius:var(--border-radius-s);box-shadow:0 4px 8px #0000001a;padding:var(--spacing-s, .75rem);display:flex;flex-direction:column;gap:var(--spacing-s, .75rem)}.phila-filter-chip-panel__footer{display:flex;justify-content:flex-end;align-items:center;gap:var(--spacing-s, .75rem)}.phila-filter-chip-sheet__scrim{position:fixed;inset:0;z-index:1000;background:#0000004d}.phila-filter-chip-sheet{position:fixed;left:0;right:0;bottom:0;z-index:1001;background:var(--Schemes-Background);border-top-left-radius:var(--border-radius-l, 1rem);border-top-right-radius:var(--border-radius-l, 1rem);box-shadow:0 -4px 16px #00000026;padding:var(--spacing-m, 1rem);display:flex;flex-direction:column;gap:var(--spacing-s, .75rem);max-height:80vh;overflow-y:auto}.phila-filter-chip-sheet__header{display:flex;align-items:center;justify-content:space-between}.phila-filter-chip-sheet__title{font-weight:700;font-family:var(--Body-Default-font-body-default-family, "Montserrat", sans-serif)}.phila-filter-chip-sheet__footer{display:flex;gap:var(--spacing-s, .75rem);margin-top:var(--spacing-xs, .5rem)}.phila-filter-chip-sheet__footer>*{flex:1}.phila-filter-chip-sheet__close{background:none;border:none;cursor:pointer;font-size:1.25rem;line-height:1;padding:0;color:var(--Schemes-On-Surface, inherit)}.phila-filter-chip-sheet .labels-container{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.phila-filter-chip-panel .phila-filter-chip-panel__reset{background:none;border:none;padding:0;cursor:pointer;color:var(--Schemes-Primary);text-decoration:underline;font-weight:600}.phila-filter-chip-panel .phila-filter-chip-panel__reset:focus-visible{outline:2px solid var(--Schemes-Primary);outline-offset:2px}.phila-filter-chip-group[data-v-8e691eda]{display:flex;flex-direction:column;gap:var(--spacing-2xs)}.phila-filter-chip-group__viewport[data-v-8e691eda]{position:relative}.phila-filter-chip-group__label[data-v-8e691eda]{padding-inline:var(--spacing-m)}.phila-filter-chip-group__row[data-v-8e691eda]{display:flex;flex-wrap:nowrap;gap:var(--spacing-xs);overflow-x:auto;overflow-y:hidden;scrollbar-width:none;padding-inline:var(--spacing-m)}.phila-filter-chip-group__row[data-v-8e691eda]::-webkit-scrollbar{display:none}.phila-filter-chip-group__arrow[data-v-8e691eda]{position:absolute;top:50%;transform:translateY(-50%);z-index:1;display:none;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border-radius:50%;border:var(--border-width-s) solid var(--Schemes-Border);background:var(--Schemes-Background);color:var(--Schemes-On-Surface);box-shadow:0 6px 8px -2px #00000059;cursor:pointer}.phila-filter-chip-group__arrow--left[data-v-8e691eda]{left:var(--spacing-m)}.phila-filter-chip-group__arrow--right[data-v-8e691eda]{right:var(--spacing-m)}@media(hover:hover)and (pointer:fine){.phila-filter-chip-group__viewport:hover .phila-filter-chip-group__arrow[data-v-8e691eda]{display:flex}}.phila-filter-chip-group.is-elevated[data-v-8e691eda] .phila-filter-chip{box-shadow:0 2px 4px #0003}.phila-filter-chip-group.is-elevated .phila-filter-chip-group__row[data-v-8e691eda]{padding-top:2px;padding-bottom:8px}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BaseProps, ComponentSize, FilterChoice, FilterDefinition, FilterValues } from '@phila/phila-ui-core';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
1
|
+
import { BaseProps, ComponentSize, FilterChoice, FilterDefinition, FilterValues, IconComponent } from '@phila/phila-ui-core';
|
|
3
2
|
export { default as FilterChip } from './FilterChip.vue';
|
|
4
3
|
export { default as FilterChipGroup } from './FilterChipGroup.vue';
|
|
5
4
|
export type FilterChipColor = "blue" | "grey" | "green" | "red" | "white" | "yellow";
|
|
@@ -11,11 +10,11 @@ export interface FilterChipProps extends BaseProps {
|
|
|
11
10
|
text?: string;
|
|
12
11
|
size?: ComponentSize;
|
|
13
12
|
color?: FilterChipColor;
|
|
14
|
-
|
|
13
|
+
icon?: IconComponent;
|
|
15
14
|
/** CSS color for the leading icon, independent of the text color. */
|
|
16
15
|
iconColor?: string;
|
|
17
16
|
/** Toggle mode: trailing icon (ignored in dropdown mode, which uses a chevron). */
|
|
18
|
-
|
|
17
|
+
trailingIcon?: IconComponent;
|
|
19
18
|
/** Toggle mode: selection state. */
|
|
20
19
|
selected?: boolean;
|
|
21
20
|
/** Dropdown mode: presence switches the chip to a dropdown. */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErF,uFAAuF;AACvF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,+FAA+F;IAC/F,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),b=require("@phila/phila-ui-core"),w=require("@fortawesome/pro-solid-svg-icons"),L=require("@phila/phila-ui-radio"),R=require("@phila/phila-ui-checkbox"),S=require("@phila/phila-ui-button"),F=["aria-pressed","aria-expanded"],E="xxsmall",U=e.defineComponent({__name:"FilterChipBase",props:{text:{default:void 0},size:{default:"medium"},color:{default:"blue"},iconDefinition:{default:void 0},iconColor:{default:void 0},trailingIconDefinition:{default:void 0},iconOnly:{type:Boolean,default:!1},active:{type:Boolean,default:!1},chevron:{type:Boolean,default:!1},ariaPressed:{type:Boolean},ariaExpanded:{type:Boolean}},emits:["click"],setup(t,{expose:u}){const l=t,a=e.ref(null),i=e.computed(()=>b.cn("phila-filter-chip",`phila-filter-chip--${l.color}`,l.size!=="medium"&&`is-${l.size}`,"has-text-body-"+s(l.size),l.active&&"is-active",l.iconOnly&&"is-icon-only"));u({el:a});const s=r=>{switch(r){case"extra-large":return"default";case"large":return"small";default:return"extra-small"}};return(r,h)=>(e.openBlock(),e.createElementBlock("button",{ref_key:"rootEl",ref:a,type:"button",class:e.normalizeClass(i.value),style:e.normalizeStyle(t.iconColor?{"--chip-icon-color":t.iconColor}:void 0),"aria-pressed":t.ariaPressed,"aria-expanded":t.ariaExpanded,onClick:h[0]||(h[0]=v=>r.$emit("click",v))},[e.createVNode(e.unref(b.ActionContent),{"icon-definition":t.iconDefinition,size:t.size,inline:"","icon-size":E,"icon-only":t.iconOnly},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)],!0)]),_:3},8,["icon-definition","size","icon-only"]),t.chevron?(e.openBlock(),e.createBlock(e.unref(b.Icon),{key:0,"icon-definition":e.unref(w.faChevronDown),size:"xxsmall",inline:"",decorative:"",class:"phila-filter-chip__chevron"},null,8,["icon-definition"])):t.trailingIconDefinition?(e.openBlock(),e.createBlock(e.unref(b.Icon),{key:1,"icon-definition":t.trailingIconDefinition,size:E,inline:"",decorative:""},null,8,["icon-definition"])):e.createCommentVNode("",!0)],14,F))}}),$=(t,u)=>{const l=t.__vccOpts||t;for(const[a,i]of u)l[a]=i;return l},D=$(U,[["__scopeId","data-v-2925d75a"]]),M=["id","aria-label"],O={key:0,class:"phila-filter-chip-sheet__header"},q={class:"phila-filter-chip-sheet__title"},G={key:3,class:"phila-filter-chip-sheet__footer"},H={key:4,class:"phila-filter-chip-panel__footer"},W=e.defineComponent({__name:"FilterChipDropdownPanel",props:{menuId:{},label:{},choices:{},multiple:{type:Boolean},value:{},top:{},left:{},mobile:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"}},emits:["apply","reset","close"],setup(t,{emit:u}){const l=t,a=u,i=e.ref(typeof l.value=="string"?l.value:""),s=e.ref(Array.isArray(l.value)?[...l.value]:[]);e.watch(()=>l.value,c=>{l.multiple?s.value=Array.isArray(c)?[...c]:[]:i.value=typeof c=="string"?c:""});const r=e.computed(()=>l.choices.map(c=>({text:c.text,value:c.value}))),h=e.computed(()=>l.multiple?s.value.length:i.value?1:0),v=e.computed(()=>h.value>0?`${l.applyText} (${h.value})`:l.applyText),k=()=>{i.value="",s.value=[],a("reset")},d=()=>{a("apply",l.multiple?[...s.value]:i.value)};return(c,p)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.mobile?(e.openBlock(),e.createElementBlock("div",{key:0,class:"phila-filter-chip-sheet__scrim",onClick:p[0]||(p[0]=y=>a("close"))})):e.createCommentVNode("",!0),e.createElementVNode("div",{id:t.menuId,class:e.normalizeClass(t.mobile?"phila-filter-chip-sheet":"phila-filter-chip-panel"),role:"dialog","aria-label":t.label,style:e.normalizeStyle(t.mobile?void 0:{top:t.top+"px",left:t.left+"px"})},[t.mobile?(e.openBlock(),e.createElementBlock("header",O,[e.createElementVNode("span",q,e.toDisplayString(t.label),1),e.createElementVNode("button",{type:"button",class:"phila-filter-chip-sheet__close","aria-label":"Close",onClick:p[1]||(p[1]=y=>a("close"))}," ✕ ")])):e.createCommentVNode("",!0),t.multiple?(e.openBlock(),e.createBlock(e.unref(R.CheckboxGroup),{key:1,"group-label":t.label,choices:r.value,"model-value":s.value,"onUpdate:modelValue":p[2]||(p[2]=y=>s.value=y)},null,8,["group-label","choices","model-value"])):(e.openBlock(),e.createBlock(e.unref(L.RadioGroup),{key:2,"group-label":t.label,choices:r.value,"model-value":i.value,"onUpdate:modelValue":p[3]||(p[3]=y=>i.value=y)},null,8,["group-label","choices","model-value"])),t.mobile?(e.openBlock(),e.createElementBlock("div",G,[e.createVNode(e.unref(S.PhilaButton),{variant:"secondary",text:t.resetText,onClick:k},null,8,["text"]),e.createVNode(e.unref(S.PhilaButton),{variant:"primary",text:v.value,onClick:d},null,8,["text"])])):(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("button",{type:"button",class:"phila-filter-chip-panel__reset has-text-body-small",onClick:k},e.toDisplayString(t.resetText),1),e.createVNode(e.unref(S.PhilaButton),{variant:"primary",size:"small",text:t.applyText,onClick:d},null,8,["text"])]))],14,M)]))}}),N="(max-width: 1064px) and (max-height: 915px)";function X(){const t=e.ref(typeof window<"u"&&window.matchMedia(N).matches);let u=null;function l(a){t.value=a.matches}return e.onMounted(()=>{u=window.matchMedia(N),t.value=u.matches,u.addEventListener("change",l)}),e.onBeforeUnmount(()=>{u?.removeEventListener("change",l)}),{isMobile:t}}let j=0;const A=e.defineComponent({__name:"FilterChip",props:{label:{default:void 0},text:{default:void 0},size:{default:"medium"},color:{default:"blue"},iconDefinition:{default:void 0},iconColor:{default:void 0},trailingIconDefinition:{default:void 0},selected:{type:Boolean,default:!1},choices:{default:void 0},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Array,Boolean],default:void 0},applyText:{default:"Apply"},resetText:{default:"Reset"},className:{}},emits:["update:selected","update:modelValue","click"],setup(t,{emit:u}){const l=t,a=u,i=e.computed(()=>Array.isArray(l.choices)),s=e.useSlots(),r=e.computed(()=>!i.value&&!!l.iconDefinition&&!l.text&&!l.label&&!s.default);function h(m){a("update:selected",!l.selected),a("click",m)}const v=`phila-filter-chip-${e.useId()}-${++j}`,{isVisible:k,setVisibility:d}=b.useVisibility({id:v,group:"phila-filter-chip",outsideClickHide:!0,escapeKeyHide:!0,showSingle:!0}),c=e.computed(()=>k(v)),{isMobile:p}=X(),y=e.ref(null),B=e.ref(0),g=e.ref(0),z=e.computed(()=>l.multiple?Array.isArray(l.modelValue)?l.modelValue:[]:typeof l.modelValue=="string"?l.modelValue:""),x=e.computed(()=>l.multiple?Array.isArray(l.modelValue)&&l.modelValue.length>0:typeof l.modelValue=="string"&&l.modelValue!==""),n=e.computed(()=>l.multiple&&Array.isArray(l.modelValue)?l.modelValue.length:0),f=e.computed(()=>{const m=l.label??l.text??"";return n.value>0?`${m} (${n.value})`:m});function o(){const m=y.value?.el??null;if(!m)return;const V=m.getBoundingClientRect();B.value=V.bottom+4,g.value=V.left}function C(){c.value&&d(!1)}e.watch(c,m=>{m&&!p.value?window.addEventListener("scroll",C,{capture:!0}):window.removeEventListener("scroll",C,{capture:!0})});function T(){const m=!c.value;m&&!p.value&&o(),d(m)}function I(m){a("update:modelValue",m),d(!1)}function P(){a("update:modelValue",l.multiple?[]:"")}return(m,V)=>i.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(D,{ref_key:"triggerRef",ref:y,text:f.value,size:t.size,color:t.color,"icon-definition":t.iconDefinition,"icon-color":t.iconColor,active:x.value||c.value,chevron:"","aria-expanded":c.value,"data-toggle":`visibility-${v}`,onClick:T},null,8,["text","size","color","icon-definition","icon-color","active","aria-expanded","data-toggle"]),c.value?(e.openBlock(),e.createBlock(W,{key:0,"menu-id":v,label:t.label??t.text??"",choices:t.choices,multiple:t.multiple,value:z.value,top:B.value,left:g.value,mobile:e.unref(p),"apply-text":t.applyText,"reset-text":t.resetText,onApply:I,onReset:P,onClose:V[0]||(V[0]=ee=>e.unref(d)(!1))},null,8,["label","choices","multiple","value","top","left","mobile","apply-text","reset-text"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(D,{key:1,size:t.size,color:t.color,"icon-definition":t.iconDefinition,"icon-color":t.iconColor,"trailing-icon-definition":t.trailingIconDefinition,"icon-only":r.value,active:t.selected,"aria-pressed":t.selected,onClick:h},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])]),_:3},8,["size","color","icon-definition","icon-color","trailing-icon-definition","icon-only","active","aria-pressed"]))}}),K=5;function Q(){const t=e.ref(null),u=e.ref(!1);let l=!1,a=0,i=0,s=!1,r=null;const h=d=>{t.value&&d.pointerType!=="mouse"&&(l=!0,s=!1,a=d.clientX,i=t.value.scrollLeft)},v=d=>{if(!l||!t.value)return;const c=d.clientX-a;!s&&Math.abs(c)>K&&(s=!0,u.value=!0,t.value.setPointerCapture(d.pointerId),r=d.pointerId),s&&(t.value.scrollLeft=i-c)},k=()=>{if(t.value&&r!==null){try{t.value.releasePointerCapture(r)}catch{}r=null}l=!1,s&&setTimeout(()=>u.value=!1,0)};return e.onBeforeUnmount(k),{el:t,suppressClick:u,dragHandlers:{onPointerdown:h,onPointermove:v,onPointerup:k,onPointerleave:k}}}const Y={key:0,class:"phila-filter-chip-group__label has-text-label-default"},J={class:"phila-filter-chip-group__viewport"},Z=e.defineComponent({__name:"FilterChipGroup",props:{filters:{},modelValue:{default:()=>({})},label:{},size:{default:"medium"},color:{default:"blue"},filterButton:{type:Boolean,default:!1},elevated:{type:Boolean,default:!1},className:{}},emits:["update:modelValue","open-filters"],setup(t,{emit:u}){const l=t,a=u,i=e.computed(()=>{let n=0;for(const f of l.filters){if(f.excludeFromCount)continue;const o=l.modelValue[f.key];Array.isArray(o)?n+=o.length:typeof o=="string"?n+=o?1:0:o===!0&&(n+=1)}return n}),s=e.computed(()=>i.value>0?`Filters (${i.value} selected)`:"Filters"),{el:r,suppressClick:h,dragHandlers:v}=Q(),k=e.computed(()=>b.cn("phila-filter-chip-group",l.elevated&&"is-elevated",l.className));function d(n){return Array.isArray(n.choices)}function c(n,f){a("update:modelValue",{...l.modelValue,[n]:f})}function p(n){h.value&&(n.stopPropagation(),n.preventDefault())}const y=e.ref(!1),B=e.ref(!1);function g(){const n=r.value;n&&(y.value=n.scrollLeft>1,B.value=n.scrollLeft+n.clientWidth<n.scrollWidth-1)}function z(n){const f=r.value;f&&f.scrollBy({left:n*f.clientWidth*.8,behavior:"smooth"})}let x=null;return e.onMounted(()=>{e.nextTick(g),r.value&&(x=new ResizeObserver(()=>g()),x.observe(r.value))}),e.onBeforeUnmount(()=>{x?.disconnect(),x=null}),e.watch(()=>l.filters,()=>e.nextTick(g)),(n,f)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(k.value)},[t.label?(e.openBlock(),e.createElementBlock("span",Y,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",J,[y.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"phila-filter-chip-group__arrow phila-filter-chip-group__arrow--left","aria-label":"Scroll filters left",onClick:f[0]||(f[0]=o=>z(-1))},[e.createVNode(e.unref(b.Icon),{"icon-definition":e.unref(w.faChevronLeft),size:"xxsmall",inline:"",decorative:""},null,8,["icon-definition"])])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps({ref_key:"el",ref:r,class:"phila-filter-chip-group__row"},e.unref(v),{onClickCapture:p,onScroll:g}),[t.filterButton?(e.openBlock(),e.createBlock(D,{key:0,size:t.size,color:t.color,"icon-definition":e.unref(w.faSliders),text:i.value>0?`(${i.value})`:"","icon-only":i.value===0,active:i.value>0,"aria-label":s.value,onClick:f[1]||(f[1]=o=>a("open-filters"))},null,8,["size","color","icon-definition","text","icon-only","active","aria-label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filters,o=>(e.openBlock(),e.createBlock(A,{key:o.key,label:o.label,text:o.label,size:t.size,color:t.color,"icon-definition":o.iconDefinition,"icon-color":o.iconColor,choices:o.choices,multiple:o.multiple,"model-value":d(o)?t.modelValue[o.key]:void 0,selected:!d(o)&&t.modelValue[o.key]===!0,"onUpdate:modelValue":C=>c(o.key,C),"onUpdate:selected":C=>c(o.key,C)},null,8,["label","text","size","color","icon-definition","icon-color","choices","multiple","model-value","selected","onUpdate:modelValue","onUpdate:selected"]))),128))],16),B.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"phila-filter-chip-group__arrow phila-filter-chip-group__arrow--right","aria-label":"Scroll filters right",onClick:f[2]||(f[2]=o=>z(1))},[e.createVNode(e.unref(b.Icon),{"icon-definition":e.unref(w.faChevronRight),size:"xxsmall",inline:"",decorative:""},null,8,["icon-definition"])])):e.createCommentVNode("",!0)])],2))}}),_=$(Z,[["__scopeId","data-v-9c777e02"]]);exports.FilterChip=A;exports.FilterChipGroup=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),b=require("@phila/phila-ui-core"),w=require("@phila/phila-ui-core/icons"),F=require("@phila/phila-ui-radio"),L=require("@phila/phila-ui-checkbox"),S=require("@phila/phila-ui-button"),R=["aria-pressed","aria-expanded"],N="xxsmall",O=e.defineComponent({__name:"FilterChipBase",props:{text:{default:void 0},size:{default:"medium"},color:{default:"blue"},icon:{type:[Function,Object],default:void 0},iconColor:{default:void 0},trailingIcon:{type:[Function,Object],default:void 0},iconOnly:{type:Boolean,default:!1},active:{type:Boolean,default:!1},chevron:{type:Boolean,default:!1},ariaPressed:{type:Boolean},ariaExpanded:{type:Boolean}},emits:["click"],setup(l,{expose:u}){const t=l,a=e.ref(null),n=e.computed(()=>b.cn("phila-filter-chip",`phila-filter-chip--${t.color}`,t.size!=="medium"&&`is-${t.size}`,"has-text-body-"+s(t.size),t.active&&"is-active",t.iconOnly&&"is-icon-only"));u({el:a});const s=r=>{switch(r){case"extra-large":return"default";case"large":return"small";default:return"extra-small"}};return(r,h)=>(e.openBlock(),e.createElementBlock("button",{ref_key:"rootEl",ref:a,type:"button",class:e.normalizeClass(n.value),style:e.normalizeStyle(l.iconColor?{"--chip-icon-color":l.iconColor}:void 0),"aria-pressed":l.ariaPressed,"aria-expanded":l.ariaExpanded,onClick:h[0]||(h[0]=v=>r.$emit("click",v))},[e.createVNode(e.unref(b.ActionContent),{icon:l.icon,size:l.size,inline:"","icon-size":N,"icon-only":l.iconOnly},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)],!0)]),_:3},8,["icon","size","icon-only"]),l.chevron?(e.openBlock(),e.createBlock(e.unref(b.Icon),{key:0,icon:e.unref(w.IconChevronDown),size:"xxsmall",inline:"",decorative:"",class:"phila-filter-chip__chevron"},null,8,["icon"])):l.trailingIcon?(e.openBlock(),e.createBlock(e.unref(b.Icon),{key:1,icon:l.trailingIcon,size:N,inline:"",decorative:""},null,8,["icon"])):e.createCommentVNode("",!0)],14,R))}}),I=(l,u)=>{const t=l.__vccOpts||l;for(const[a,n]of u)t[a]=n;return t},E=I(O,[["__scopeId","data-v-40c7e692"]]),U=["id","aria-label"],M={key:0,class:"phila-filter-chip-sheet__header"},q={class:"phila-filter-chip-sheet__title"},G={key:3,class:"phila-filter-chip-sheet__footer"},H={key:4,class:"phila-filter-chip-panel__footer"},j=e.defineComponent({__name:"FilterChipDropdownPanel",props:{menuId:{},label:{},choices:{},multiple:{type:Boolean},value:{},top:{},left:{},mobile:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"}},emits:["apply","reset","close"],setup(l,{emit:u}){const t=l,a=u,n=e.ref(typeof t.value=="string"?t.value:""),s=e.ref(Array.isArray(t.value)?[...t.value]:[]);e.watch(()=>t.value,c=>{t.multiple?s.value=Array.isArray(c)?[...c]:[]:n.value=typeof c=="string"?c:""});const r=e.computed(()=>t.choices.map(c=>({text:c.text,value:c.value}))),h=e.computed(()=>t.multiple?s.value.length:n.value?1:0),v=e.computed(()=>h.value>0?`${t.applyText} (${h.value})`:t.applyText),k=()=>{n.value="",s.value=[],a("reset")},d=()=>{a("apply",t.multiple?[...s.value]:n.value)};return(c,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.mobile?(e.openBlock(),e.createElementBlock("div",{key:0,class:"phila-filter-chip-sheet__scrim",onClick:m[0]||(m[0]=y=>a("close"))})):e.createCommentVNode("",!0),e.createElementVNode("div",{id:l.menuId,class:e.normalizeClass(l.mobile?"phila-filter-chip-sheet":"phila-filter-chip-panel"),role:"dialog","aria-label":l.label,style:e.normalizeStyle(l.mobile?void 0:{top:l.top+"px",left:l.left+"px"})},[l.mobile?(e.openBlock(),e.createElementBlock("header",M,[e.createElementVNode("span",q,e.toDisplayString(l.label),1),e.createElementVNode("button",{type:"button",class:"phila-filter-chip-sheet__close","aria-label":"Close",onClick:m[1]||(m[1]=y=>a("close"))}," ✕ ")])):e.createCommentVNode("",!0),l.multiple?(e.openBlock(),e.createBlock(e.unref(L.CheckboxGroup),{key:1,"group-label":l.label,choices:r.value,"model-value":s.value,"onUpdate:modelValue":m[2]||(m[2]=y=>s.value=y)},null,8,["group-label","choices","model-value"])):(e.openBlock(),e.createBlock(e.unref(F.RadioGroup),{key:2,"group-label":l.label,choices:r.value,"model-value":n.value,"onUpdate:modelValue":m[3]||(m[3]=y=>n.value=y)},null,8,["group-label","choices","model-value"])),l.mobile?(e.openBlock(),e.createElementBlock("div",G,[e.createVNode(e.unref(S.PhilaButton),{variant:"secondary",text:l.resetText,onClick:k},null,8,["text"]),e.createVNode(e.unref(S.PhilaButton),{variant:"primary",text:v.value,onClick:d},null,8,["text"])])):(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("button",{type:"button",class:"phila-filter-chip-panel__reset has-text-body-small",onClick:k},e.toDisplayString(l.resetText),1),e.createVNode(e.unref(S.PhilaButton),{variant:"primary",size:"small",text:l.applyText,onClick:d},null,8,["text"])]))],14,U)]))}}),$="(max-width: 1064px) and (max-height: 915px)";function W(){const l=e.ref(typeof window<"u"&&window.matchMedia($).matches);let u=null;function t(a){l.value=a.matches}return e.onMounted(()=>{u=window.matchMedia($),l.value=u.matches,u.addEventListener("change",t)}),e.onBeforeUnmount(()=>{u?.removeEventListener("change",t)}),{isMobile:l}}let X=0;const A=e.defineComponent({__name:"FilterChip",props:{label:{default:void 0},text:{default:void 0},size:{default:"medium"},color:{default:"blue"},icon:{type:[Function,Object],default:void 0},iconColor:{default:void 0},trailingIcon:{type:[Function,Object],default:void 0},selected:{type:Boolean,default:!1},choices:{default:void 0},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Array,Boolean],default:void 0},applyText:{default:"Apply"},resetText:{default:"Reset"},className:{}},emits:["update:selected","update:modelValue","click"],setup(l,{emit:u}){const t=l,a=u,n=e.computed(()=>Array.isArray(t.choices)),s=e.useSlots(),r=e.computed(()=>!n.value&&!!t.icon&&!t.text&&!t.label&&!s.default);function h(p){a("update:selected",!t.selected),a("click",p)}const v=`phila-filter-chip-${e.useId()}-${++X}`,{isVisible:k,setVisibility:d}=b.useVisibility({id:v,group:"phila-filter-chip",outsideClickHide:!0,escapeKeyHide:!0,showSingle:!0}),c=e.computed(()=>k(v)),{isMobile:m}=W(),y=e.ref(null),B=e.ref(0),x=e.ref(0),z=e.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:typeof t.modelValue=="string"?t.modelValue:""),g=e.computed(()=>t.multiple?Array.isArray(t.modelValue)&&t.modelValue.length>0:typeof t.modelValue=="string"&&t.modelValue!==""),i=e.computed(()=>t.multiple&&Array.isArray(t.modelValue)?t.modelValue.length:0),f=e.computed(()=>{const p=t.label??t.text??"";return i.value>0?`${p} (${i.value})`:p});function o(){const p=y.value?.el??null;if(!p)return;const V=p.getBoundingClientRect();B.value=V.bottom+4,x.value=V.left}function C(){c.value&&d(!1)}e.watch(c,p=>{p&&!m.value?window.addEventListener("scroll",C,{capture:!0}):window.removeEventListener("scroll",C,{capture:!0})});function T(){const p=!c.value;p&&!m.value&&o(),d(p)}function P(p){a("update:modelValue",p),d(!1)}function D(){a("update:modelValue",t.multiple?[]:"")}return(p,V)=>n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(E,{ref_key:"triggerRef",ref:y,text:f.value,size:l.size,color:l.color,icon:l.icon,"icon-color":l.iconColor,active:g.value||c.value,chevron:"","aria-expanded":c.value,"data-toggle":`visibility-${v}`,onClick:T},null,8,["text","size","color","icon","icon-color","active","aria-expanded","data-toggle"]),c.value?(e.openBlock(),e.createBlock(j,{key:0,"menu-id":v,label:l.label??l.text??"",choices:l.choices,multiple:l.multiple,value:z.value,top:B.value,left:x.value,mobile:e.unref(m),"apply-text":l.applyText,"reset-text":l.resetText,onApply:P,onReset:D,onClose:V[0]||(V[0]=ee=>e.unref(d)(!1))},null,8,["label","choices","multiple","value","top","left","mobile","apply-text","reset-text"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(E,{key:1,size:l.size,color:l.color,icon:l.icon,"icon-color":l.iconColor,"trailing-icon":l.trailingIcon,"icon-only":r.value,active:l.selected,"aria-pressed":l.selected,onClick:h},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},8,["size","color","icon","icon-color","trailing-icon","icon-only","active","aria-pressed"]))}}),K=5;function Q(){const l=e.ref(null),u=e.ref(!1);let t=!1,a=0,n=0,s=!1,r=null;const h=d=>{l.value&&d.pointerType!=="mouse"&&(t=!0,s=!1,a=d.clientX,n=l.value.scrollLeft)},v=d=>{if(!t||!l.value)return;const c=d.clientX-a;!s&&Math.abs(c)>K&&(s=!0,u.value=!0,l.value.setPointerCapture(d.pointerId),r=d.pointerId),s&&(l.value.scrollLeft=n-c)},k=()=>{if(l.value&&r!==null){try{l.value.releasePointerCapture(r)}catch{}r=null}t=!1,s&&setTimeout(()=>u.value=!1,0)};return e.onBeforeUnmount(k),{el:l,suppressClick:u,dragHandlers:{onPointerdown:h,onPointermove:v,onPointerup:k,onPointerleave:k}}}const Y={key:0,class:"phila-filter-chip-group__label has-text-label-default"},J={class:"phila-filter-chip-group__viewport"},Z=e.defineComponent({__name:"FilterChipGroup",props:{filters:{},modelValue:{default:()=>({})},label:{},size:{default:"medium"},color:{default:"blue"},filterButton:{type:Boolean,default:!1},elevated:{type:Boolean,default:!1},className:{}},emits:["update:modelValue","open-filters"],setup(l,{emit:u}){const t=l,a=u,n=e.computed(()=>{let i=0;for(const f of t.filters){if(f.excludeFromCount)continue;const o=t.modelValue[f.key];Array.isArray(o)?i+=o.length:typeof o=="string"?i+=o?1:0:o===!0&&(i+=1)}return i}),s=e.computed(()=>n.value>0?`Filters (${n.value} selected)`:"Filters"),{el:r,suppressClick:h,dragHandlers:v}=Q(),k=e.computed(()=>b.cn("phila-filter-chip-group",t.elevated&&"is-elevated",t.className));function d(i){return Array.isArray(i.choices)}function c(i,f){a("update:modelValue",{...t.modelValue,[i]:f})}function m(i){h.value&&(i.stopPropagation(),i.preventDefault())}const y=e.ref(!1),B=e.ref(!1);function x(){const i=r.value;i&&(y.value=i.scrollLeft>1,B.value=i.scrollLeft+i.clientWidth<i.scrollWidth-1)}function z(i){const f=r.value;f&&f.scrollBy({left:i*f.clientWidth*.8,behavior:"smooth"})}let g=null;return e.onMounted(()=>{e.nextTick(x),r.value&&(g=new ResizeObserver(()=>x()),g.observe(r.value))}),e.onBeforeUnmount(()=>{g?.disconnect(),g=null}),e.watch(()=>t.filters,()=>e.nextTick(x)),(i,f)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(k.value)},[l.label?(e.openBlock(),e.createElementBlock("span",Y,e.toDisplayString(l.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",J,[y.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"phila-filter-chip-group__arrow phila-filter-chip-group__arrow--left","aria-label":"Scroll filters left",onClick:f[0]||(f[0]=o=>z(-1))},[e.createVNode(e.unref(b.Icon),{icon:e.unref(w.IconChevronLeft),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps({ref_key:"el",ref:r,class:"phila-filter-chip-group__row"},e.unref(v),{onClickCapture:m,onScroll:x}),[l.filterButton?(e.openBlock(),e.createBlock(E,{key:0,size:l.size,color:l.color,icon:e.unref(w.IconSliders),text:n.value>0?`(${n.value})`:"","icon-only":n.value===0,active:n.value>0,"aria-label":s.value,onClick:f[1]||(f[1]=o=>a("open-filters"))},null,8,["size","color","icon","text","icon-only","active","aria-label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.filters,o=>(e.openBlock(),e.createBlock(A,{key:o.key,label:o.label,text:o.label,size:l.size,color:l.color,icon:o.icon,"icon-color":o.iconColor,choices:o.choices,multiple:o.multiple,"model-value":d(o)?l.modelValue[o.key]:void 0,selected:!d(o)&&l.modelValue[o.key]===!0,"onUpdate:modelValue":C=>c(o.key,C),"onUpdate:selected":C=>c(o.key,C)},null,8,["label","text","size","color","icon","icon-color","choices","multiple","model-value","selected","onUpdate:modelValue","onUpdate:selected"]))),128))],16),B.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"phila-filter-chip-group__arrow phila-filter-chip-group__arrow--right","aria-label":"Scroll filters right",onClick:f[2]||(f[2]=o=>z(1))},[e.createVNode(e.unref(b.Icon),{icon:e.unref(w.IconChevronRight),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0)])],2))}}),_=I(Z,[["__scopeId","data-v-8e691eda"]]);exports.FilterChip=A;exports.FilterChipGroup=_;
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cn as
|
|
3
|
-
import {
|
|
1
|
+
import { defineComponent as D, ref as C, computed as h, createElementBlock as g, openBlock as r, normalizeStyle as j, normalizeClass as E, createVNode as $, createBlock as V, createCommentVNode as z, unref as v, withCtx as W, renderSlot as X, createTextVNode as q, toDisplayString as P, watch as M, Teleport as le, createElementVNode as I, onMounted as K, onBeforeUnmount as U, useSlots as te, useId as oe, Fragment as Q, nextTick as N, mergeProps as ie, renderList as ae } from "vue";
|
|
2
|
+
import { cn as Y, ActionContent as ne, Icon as L, useVisibility as ce } from "@phila/phila-ui-core";
|
|
3
|
+
import { IconChevronDown as re, IconChevronLeft as ue, IconSliders as se, IconChevronRight as de } from "@phila/phila-ui-core/icons";
|
|
4
4
|
import { RadioGroup as fe } from "@phila/phila-ui-radio";
|
|
5
5
|
import { CheckboxGroup as ve } from "@phila/phila-ui-checkbox";
|
|
6
|
-
import { PhilaButton as
|
|
7
|
-
import './index.css';const
|
|
6
|
+
import { PhilaButton as R } from "@phila/phila-ui-button";
|
|
7
|
+
import './index.css';const pe = ["aria-pressed", "aria-expanded"], H = "xxsmall", me = /* @__PURE__ */ D({
|
|
8
8
|
__name: "FilterChipBase",
|
|
9
9
|
props: {
|
|
10
10
|
text: { default: void 0 },
|
|
11
11
|
size: { default: "medium" },
|
|
12
12
|
color: { default: "blue" },
|
|
13
|
-
|
|
13
|
+
icon: { type: [Function, Object], default: void 0 },
|
|
14
14
|
iconColor: { default: void 0 },
|
|
15
|
-
|
|
15
|
+
trailingIcon: { type: [Function, Object], default: void 0 },
|
|
16
16
|
iconOnly: { type: Boolean, default: !1 },
|
|
17
17
|
active: { type: Boolean, default: !1 },
|
|
18
18
|
chevron: { type: Boolean, default: !1 },
|
|
@@ -20,20 +20,20 @@ import './index.css';const me = ["aria-pressed", "aria-expanded"], H = "xxsmall"
|
|
|
20
20
|
ariaExpanded: { type: Boolean }
|
|
21
21
|
},
|
|
22
22
|
emits: ["click"],
|
|
23
|
-
setup(e, { expose:
|
|
24
|
-
const l = e,
|
|
25
|
-
() =>
|
|
23
|
+
setup(e, { expose: u }) {
|
|
24
|
+
const l = e, a = C(null), o = h(
|
|
25
|
+
() => Y(
|
|
26
26
|
"phila-filter-chip",
|
|
27
27
|
`phila-filter-chip--${l.color}`,
|
|
28
28
|
l.size !== "medium" && `is-${l.size}`,
|
|
29
|
-
"has-text-body-" +
|
|
29
|
+
"has-text-body-" + s(l.size),
|
|
30
30
|
l.active && "is-active",
|
|
31
31
|
l.iconOnly && "is-icon-only"
|
|
32
32
|
)
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
switch (
|
|
34
|
+
u({ el: a });
|
|
35
|
+
const s = (c) => {
|
|
36
|
+
switch (c) {
|
|
37
37
|
case "extra-large":
|
|
38
38
|
return "default";
|
|
39
39
|
case "large":
|
|
@@ -42,52 +42,52 @@ import './index.css';const me = ["aria-pressed", "aria-expanded"], H = "xxsmall"
|
|
|
42
42
|
return "extra-small";
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
return (
|
|
45
|
+
return (c, b) => (r(), g("button", {
|
|
46
46
|
ref_key: "rootEl",
|
|
47
|
-
ref:
|
|
47
|
+
ref: a,
|
|
48
48
|
type: "button",
|
|
49
|
-
class:
|
|
50
|
-
style:
|
|
49
|
+
class: E(o.value),
|
|
50
|
+
style: j(e.iconColor ? { "--chip-icon-color": e.iconColor } : void 0),
|
|
51
51
|
"aria-pressed": e.ariaPressed,
|
|
52
52
|
"aria-expanded": e.ariaExpanded,
|
|
53
|
-
onClick: b[0] || (b[0] = (y) =>
|
|
53
|
+
onClick: b[0] || (b[0] = (y) => c.$emit("click", y))
|
|
54
54
|
}, [
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
$(v(ne), {
|
|
56
|
+
icon: e.icon,
|
|
57
57
|
size: e.size,
|
|
58
58
|
inline: "",
|
|
59
59
|
"icon-size": H,
|
|
60
60
|
"icon-only": e.iconOnly
|
|
61
61
|
}, {
|
|
62
|
-
default:
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
default: W(() => [
|
|
63
|
+
X(c.$slots, "default", {}, () => [
|
|
64
|
+
q(P(e.text), 1)
|
|
65
65
|
], !0)
|
|
66
66
|
]),
|
|
67
67
|
_: 3
|
|
68
|
-
}, 8, ["icon
|
|
69
|
-
e.chevron ? (
|
|
68
|
+
}, 8, ["icon", "size", "icon-only"]),
|
|
69
|
+
e.chevron ? (r(), V(v(L), {
|
|
70
70
|
key: 0,
|
|
71
|
-
|
|
71
|
+
icon: v(re),
|
|
72
72
|
size: "xxsmall",
|
|
73
73
|
inline: "",
|
|
74
74
|
decorative: "",
|
|
75
75
|
class: "phila-filter-chip__chevron"
|
|
76
|
-
}, null, 8, ["icon
|
|
76
|
+
}, null, 8, ["icon"])) : e.trailingIcon ? (r(), V(v(L), {
|
|
77
77
|
key: 1,
|
|
78
|
-
|
|
78
|
+
icon: e.trailingIcon,
|
|
79
79
|
size: H,
|
|
80
80
|
inline: "",
|
|
81
81
|
decorative: ""
|
|
82
|
-
}, null, 8, ["icon
|
|
83
|
-
], 14,
|
|
82
|
+
}, null, 8, ["icon"])) : z("", !0)
|
|
83
|
+
], 14, pe));
|
|
84
84
|
}
|
|
85
|
-
}), J = (e,
|
|
85
|
+
}), J = (e, u) => {
|
|
86
86
|
const l = e.__vccOpts || e;
|
|
87
|
-
for (const [
|
|
88
|
-
l[
|
|
87
|
+
for (const [a, o] of u)
|
|
88
|
+
l[a] = o;
|
|
89
89
|
return l;
|
|
90
|
-
},
|
|
90
|
+
}, O = /* @__PURE__ */ J(me, [["__scopeId", "data-v-40c7e692"]]), he = ["id", "aria-label"], ye = {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "phila-filter-chip-sheet__header"
|
|
93
93
|
}, be = { class: "phila-filter-chip-sheet__title" }, xe = {
|
|
@@ -96,7 +96,7 @@ import './index.css';const me = ["aria-pressed", "aria-expanded"], H = "xxsmall"
|
|
|
96
96
|
}, ge = {
|
|
97
97
|
key: 4,
|
|
98
98
|
class: "phila-filter-chip-panel__footer"
|
|
99
|
-
}, Ce = /* @__PURE__ */
|
|
99
|
+
}, Ce = /* @__PURE__ */ D({
|
|
100
100
|
__name: "FilterChipDropdownPanel",
|
|
101
101
|
props: {
|
|
102
102
|
menuId: {},
|
|
@@ -111,74 +111,74 @@ import './index.css';const me = ["aria-pressed", "aria-expanded"], H = "xxsmall"
|
|
|
111
111
|
resetText: { default: "Reset" }
|
|
112
112
|
},
|
|
113
113
|
emits: ["apply", "reset", "close"],
|
|
114
|
-
setup(e, { emit:
|
|
115
|
-
const l = e,
|
|
116
|
-
|
|
114
|
+
setup(e, { emit: u }) {
|
|
115
|
+
const l = e, a = u, o = C(typeof l.value == "string" ? l.value : ""), s = C(Array.isArray(l.value) ? [...l.value] : []);
|
|
116
|
+
M(
|
|
117
117
|
() => l.value,
|
|
118
|
-
(
|
|
119
|
-
l.multiple ?
|
|
118
|
+
(n) => {
|
|
119
|
+
l.multiple ? s.value = Array.isArray(n) ? [...n] : [] : o.value = typeof n == "string" ? n : "";
|
|
120
120
|
}
|
|
121
121
|
);
|
|
122
|
-
const
|
|
122
|
+
const c = h(() => l.choices.map((n) => ({ text: n.text, value: n.value }))), b = h(() => l.multiple ? s.value.length : o.value ? 1 : 0), y = h(
|
|
123
123
|
() => b.value > 0 ? `${l.applyText} (${b.value})` : l.applyText
|
|
124
124
|
), k = () => {
|
|
125
|
-
|
|
125
|
+
o.value = "", s.value = [], a("reset");
|
|
126
126
|
}, d = () => {
|
|
127
|
-
|
|
127
|
+
a("apply", l.multiple ? [...s.value] : o.value);
|
|
128
128
|
};
|
|
129
|
-
return (
|
|
130
|
-
e.mobile ? (
|
|
129
|
+
return (n, m) => (r(), V(le, { to: "body" }, [
|
|
130
|
+
e.mobile ? (r(), g("div", {
|
|
131
131
|
key: 0,
|
|
132
132
|
class: "phila-filter-chip-sheet__scrim",
|
|
133
|
-
onClick:
|
|
133
|
+
onClick: m[0] || (m[0] = (x) => a("close"))
|
|
134
134
|
})) : z("", !0),
|
|
135
|
-
|
|
135
|
+
I("div", {
|
|
136
136
|
id: e.menuId,
|
|
137
|
-
class:
|
|
137
|
+
class: E(e.mobile ? "phila-filter-chip-sheet" : "phila-filter-chip-panel"),
|
|
138
138
|
role: "dialog",
|
|
139
139
|
"aria-label": e.label,
|
|
140
|
-
style:
|
|
140
|
+
style: j(e.mobile ? void 0 : { top: e.top + "px", left: e.left + "px" })
|
|
141
141
|
}, [
|
|
142
|
-
e.mobile ? (
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
e.mobile ? (r(), g("header", ye, [
|
|
143
|
+
I("span", be, P(e.label), 1),
|
|
144
|
+
I("button", {
|
|
145
145
|
type: "button",
|
|
146
146
|
class: "phila-filter-chip-sheet__close",
|
|
147
147
|
"aria-label": "Close",
|
|
148
|
-
onClick:
|
|
148
|
+
onClick: m[1] || (m[1] = (x) => a("close"))
|
|
149
149
|
}, " ✕ ")
|
|
150
150
|
])) : z("", !0),
|
|
151
|
-
e.multiple ? (
|
|
151
|
+
e.multiple ? (r(), V(v(ve), {
|
|
152
152
|
key: 1,
|
|
153
153
|
"group-label": e.label,
|
|
154
|
-
choices:
|
|
155
|
-
"model-value":
|
|
156
|
-
"onUpdate:modelValue":
|
|
157
|
-
}, null, 8, ["group-label", "choices", "model-value"])) : (
|
|
154
|
+
choices: c.value,
|
|
155
|
+
"model-value": s.value,
|
|
156
|
+
"onUpdate:modelValue": m[2] || (m[2] = (x) => s.value = x)
|
|
157
|
+
}, null, 8, ["group-label", "choices", "model-value"])) : (r(), V(v(fe), {
|
|
158
158
|
key: 2,
|
|
159
159
|
"group-label": e.label,
|
|
160
|
-
choices:
|
|
161
|
-
"model-value":
|
|
162
|
-
"onUpdate:modelValue":
|
|
160
|
+
choices: c.value,
|
|
161
|
+
"model-value": o.value,
|
|
162
|
+
"onUpdate:modelValue": m[3] || (m[3] = (x) => o.value = x)
|
|
163
163
|
}, null, 8, ["group-label", "choices", "model-value"])),
|
|
164
|
-
e.mobile ? (
|
|
165
|
-
|
|
164
|
+
e.mobile ? (r(), g("div", xe, [
|
|
165
|
+
$(v(R), {
|
|
166
166
|
variant: "secondary",
|
|
167
167
|
text: e.resetText,
|
|
168
168
|
onClick: k
|
|
169
169
|
}, null, 8, ["text"]),
|
|
170
|
-
|
|
170
|
+
$(v(R), {
|
|
171
171
|
variant: "primary",
|
|
172
172
|
text: y.value,
|
|
173
173
|
onClick: d
|
|
174
174
|
}, null, 8, ["text"])
|
|
175
|
-
])) : (
|
|
176
|
-
|
|
175
|
+
])) : (r(), g("div", ge, [
|
|
176
|
+
I("button", {
|
|
177
177
|
type: "button",
|
|
178
178
|
class: "phila-filter-chip-panel__reset has-text-body-small",
|
|
179
179
|
onClick: k
|
|
180
|
-
},
|
|
181
|
-
|
|
180
|
+
}, P(e.resetText), 1),
|
|
181
|
+
$(v(R), {
|
|
182
182
|
variant: "primary",
|
|
183
183
|
size: "small",
|
|
184
184
|
text: e.applyText,
|
|
@@ -191,27 +191,27 @@ import './index.css';const me = ["aria-pressed", "aria-expanded"], H = "xxsmall"
|
|
|
191
191
|
}), G = "(max-width: 1064px) and (max-height: 915px)";
|
|
192
192
|
function ke() {
|
|
193
193
|
const e = C(typeof window < "u" && window.matchMedia(G).matches);
|
|
194
|
-
let
|
|
195
|
-
function l(
|
|
196
|
-
e.value =
|
|
194
|
+
let u = null;
|
|
195
|
+
function l(a) {
|
|
196
|
+
e.value = a.matches;
|
|
197
197
|
}
|
|
198
|
-
return
|
|
199
|
-
|
|
198
|
+
return K(() => {
|
|
199
|
+
u = window.matchMedia(G), e.value = u.matches, u.addEventListener("change", l);
|
|
200
200
|
}), U(() => {
|
|
201
|
-
|
|
201
|
+
u?.removeEventListener("change", l);
|
|
202
202
|
}), { isMobile: e };
|
|
203
203
|
}
|
|
204
204
|
let Ve = 0;
|
|
205
|
-
const ze = /* @__PURE__ */
|
|
205
|
+
const ze = /* @__PURE__ */ D({
|
|
206
206
|
__name: "FilterChip",
|
|
207
207
|
props: {
|
|
208
208
|
label: { default: void 0 },
|
|
209
209
|
text: { default: void 0 },
|
|
210
210
|
size: { default: "medium" },
|
|
211
211
|
color: { default: "blue" },
|
|
212
|
-
|
|
212
|
+
icon: { type: [Function, Object], default: void 0 },
|
|
213
213
|
iconColor: { default: void 0 },
|
|
214
|
-
|
|
214
|
+
trailingIcon: { type: [Function, Object], default: void 0 },
|
|
215
215
|
selected: { type: Boolean, default: !1 },
|
|
216
216
|
choices: { default: void 0 },
|
|
217
217
|
multiple: { type: Boolean, default: !1 },
|
|
@@ -221,119 +221,119 @@ const ze = /* @__PURE__ */ R({
|
|
|
221
221
|
className: {}
|
|
222
222
|
},
|
|
223
223
|
emits: ["update:selected", "update:modelValue", "click"],
|
|
224
|
-
setup(e, { emit:
|
|
225
|
-
const l = e,
|
|
226
|
-
() => !
|
|
224
|
+
setup(e, { emit: u }) {
|
|
225
|
+
const l = e, a = u, o = h(() => Array.isArray(l.choices)), s = te(), c = h(
|
|
226
|
+
() => !o.value && !!l.icon && !l.text && !l.label && !s.default
|
|
227
227
|
);
|
|
228
|
-
function b(
|
|
229
|
-
|
|
228
|
+
function b(p) {
|
|
229
|
+
a("update:selected", !l.selected), a("click", p);
|
|
230
230
|
}
|
|
231
|
-
const y = `phila-filter-chip-${
|
|
231
|
+
const y = `phila-filter-chip-${oe()}-${++Ve}`, { isVisible: k, setVisibility: d } = ce({
|
|
232
232
|
id: y,
|
|
233
233
|
group: "phila-filter-chip",
|
|
234
234
|
outsideClickHide: !0,
|
|
235
235
|
escapeKeyHide: !0,
|
|
236
236
|
showSingle: !0
|
|
237
|
-
}),
|
|
238
|
-
const
|
|
239
|
-
return
|
|
237
|
+
}), n = h(() => k(y)), { isMobile: m } = ke(), x = C(null), S = C(0), w = C(0), F = h(() => l.multiple ? Array.isArray(l.modelValue) ? l.modelValue : [] : typeof l.modelValue == "string" ? l.modelValue : ""), B = h(() => l.multiple ? Array.isArray(l.modelValue) && l.modelValue.length > 0 : typeof l.modelValue == "string" && l.modelValue !== ""), i = h(() => l.multiple && Array.isArray(l.modelValue) ? l.modelValue.length : 0), f = h(() => {
|
|
238
|
+
const p = l.label ?? l.text ?? "";
|
|
239
|
+
return i.value > 0 ? `${p} (${i.value})` : p;
|
|
240
240
|
});
|
|
241
241
|
function t() {
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
244
|
-
const T =
|
|
242
|
+
const p = x.value?.el ?? null;
|
|
243
|
+
if (!p) return;
|
|
244
|
+
const T = p.getBoundingClientRect();
|
|
245
245
|
S.value = T.bottom + 4, w.value = T.left;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
|
|
247
|
+
function A() {
|
|
248
|
+
n.value && d(!1);
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
M(n, (p) => {
|
|
251
|
+
p && !m.value ? window.addEventListener("scroll", A, { capture: !0 }) : window.removeEventListener("scroll", A, { capture: !0 });
|
|
252
252
|
});
|
|
253
253
|
function Z() {
|
|
254
|
-
const
|
|
255
|
-
|
|
254
|
+
const p = !n.value;
|
|
255
|
+
p && !m.value && t(), d(p);
|
|
256
256
|
}
|
|
257
|
-
function _(
|
|
258
|
-
|
|
257
|
+
function _(p) {
|
|
258
|
+
a("update:modelValue", p), d(!1);
|
|
259
259
|
}
|
|
260
260
|
function ee() {
|
|
261
|
-
|
|
261
|
+
a("update:modelValue", l.multiple ? [] : "");
|
|
262
262
|
}
|
|
263
|
-
return (
|
|
264
|
-
|
|
263
|
+
return (p, T) => o.value ? (r(), g(Q, { key: 0 }, [
|
|
264
|
+
$(O, {
|
|
265
265
|
ref_key: "triggerRef",
|
|
266
266
|
ref: x,
|
|
267
267
|
text: f.value,
|
|
268
268
|
size: e.size,
|
|
269
269
|
color: e.color,
|
|
270
|
-
|
|
270
|
+
icon: e.icon,
|
|
271
271
|
"icon-color": e.iconColor,
|
|
272
|
-
active:
|
|
272
|
+
active: B.value || n.value,
|
|
273
273
|
chevron: "",
|
|
274
|
-
"aria-expanded":
|
|
274
|
+
"aria-expanded": n.value,
|
|
275
275
|
"data-toggle": `visibility-${y}`,
|
|
276
276
|
onClick: Z
|
|
277
|
-
}, null, 8, ["text", "size", "color", "icon
|
|
278
|
-
|
|
277
|
+
}, null, 8, ["text", "size", "color", "icon", "icon-color", "active", "aria-expanded", "data-toggle"]),
|
|
278
|
+
n.value ? (r(), V(Ce, {
|
|
279
279
|
key: 0,
|
|
280
280
|
"menu-id": y,
|
|
281
281
|
label: e.label ?? e.text ?? "",
|
|
282
282
|
choices: e.choices,
|
|
283
283
|
multiple: e.multiple,
|
|
284
|
-
value:
|
|
284
|
+
value: F.value,
|
|
285
285
|
top: S.value,
|
|
286
286
|
left: w.value,
|
|
287
|
-
mobile: v(
|
|
287
|
+
mobile: v(m),
|
|
288
288
|
"apply-text": e.applyText,
|
|
289
289
|
"reset-text": e.resetText,
|
|
290
290
|
onApply: _,
|
|
291
291
|
onReset: ee,
|
|
292
292
|
onClose: T[0] || (T[0] = (Se) => v(d)(!1))
|
|
293
293
|
}, null, 8, ["label", "choices", "multiple", "value", "top", "left", "mobile", "apply-text", "reset-text"])) : z("", !0)
|
|
294
|
-
], 64)) : (
|
|
294
|
+
], 64)) : (r(), V(O, {
|
|
295
295
|
key: 1,
|
|
296
296
|
size: e.size,
|
|
297
297
|
color: e.color,
|
|
298
|
-
|
|
298
|
+
icon: e.icon,
|
|
299
299
|
"icon-color": e.iconColor,
|
|
300
|
-
"trailing-icon
|
|
301
|
-
"icon-only":
|
|
300
|
+
"trailing-icon": e.trailingIcon,
|
|
301
|
+
"icon-only": c.value,
|
|
302
302
|
active: e.selected,
|
|
303
303
|
"aria-pressed": e.selected,
|
|
304
304
|
onClick: b
|
|
305
305
|
}, {
|
|
306
|
-
default:
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
default: W(() => [
|
|
307
|
+
X(p.$slots, "default", {}, () => [
|
|
308
|
+
q(P(e.text), 1)
|
|
309
309
|
])
|
|
310
310
|
]),
|
|
311
311
|
_: 3
|
|
312
|
-
}, 8, ["size", "color", "icon
|
|
312
|
+
}, 8, ["size", "color", "icon", "icon-color", "trailing-icon", "icon-only", "active", "aria-pressed"]));
|
|
313
313
|
}
|
|
314
314
|
}), we = 5;
|
|
315
|
-
function
|
|
316
|
-
const e = C(null),
|
|
317
|
-
let l = !1,
|
|
315
|
+
function $e() {
|
|
316
|
+
const e = C(null), u = C(!1);
|
|
317
|
+
let l = !1, a = 0, o = 0, s = !1, c = null;
|
|
318
318
|
const b = (d) => {
|
|
319
|
-
e.value && d.pointerType !== "mouse" && (l = !0,
|
|
319
|
+
e.value && d.pointerType !== "mouse" && (l = !0, s = !1, a = d.clientX, o = e.value.scrollLeft);
|
|
320
320
|
}, y = (d) => {
|
|
321
321
|
if (!l || !e.value) return;
|
|
322
|
-
const
|
|
323
|
-
!
|
|
322
|
+
const n = d.clientX - a;
|
|
323
|
+
!s && Math.abs(n) > we && (s = !0, u.value = !0, e.value.setPointerCapture(d.pointerId), c = d.pointerId), s && (e.value.scrollLeft = o - n);
|
|
324
324
|
}, k = () => {
|
|
325
|
-
if (e.value &&
|
|
325
|
+
if (e.value && c !== null) {
|
|
326
326
|
try {
|
|
327
|
-
e.value.releasePointerCapture(
|
|
327
|
+
e.value.releasePointerCapture(c);
|
|
328
328
|
} catch {
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
c = null;
|
|
331
331
|
}
|
|
332
|
-
l = !1,
|
|
332
|
+
l = !1, s && setTimeout(() => u.value = !1, 0);
|
|
333
333
|
};
|
|
334
334
|
return U(k), {
|
|
335
335
|
el: e,
|
|
336
|
-
suppressClick:
|
|
336
|
+
suppressClick: u,
|
|
337
337
|
dragHandlers: {
|
|
338
338
|
onPointerdown: b,
|
|
339
339
|
onPointermove: y,
|
|
@@ -342,10 +342,10 @@ function De() {
|
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const Be = {
|
|
346
346
|
key: 0,
|
|
347
347
|
class: "phila-filter-chip-group__label has-text-label-default"
|
|
348
|
-
},
|
|
348
|
+
}, Ae = { class: "phila-filter-chip-group__viewport" }, Ie = /* @__PURE__ */ D({
|
|
349
349
|
__name: "FilterChipGroup",
|
|
350
350
|
props: {
|
|
351
351
|
filters: {},
|
|
@@ -358,117 +358,117 @@ const $e = {
|
|
|
358
358
|
className: {}
|
|
359
359
|
},
|
|
360
360
|
emits: ["update:modelValue", "open-filters"],
|
|
361
|
-
setup(e, { emit:
|
|
362
|
-
const l = e,
|
|
363
|
-
let
|
|
361
|
+
setup(e, { emit: u }) {
|
|
362
|
+
const l = e, a = u, o = h(() => {
|
|
363
|
+
let i = 0;
|
|
364
364
|
for (const f of l.filters) {
|
|
365
365
|
if (f.excludeFromCount) continue;
|
|
366
366
|
const t = l.modelValue[f.key];
|
|
367
|
-
Array.isArray(t) ?
|
|
367
|
+
Array.isArray(t) ? i += t.length : typeof t == "string" ? i += t ? 1 : 0 : t === !0 && (i += 1);
|
|
368
368
|
}
|
|
369
|
-
return
|
|
370
|
-
}),
|
|
371
|
-
() =>
|
|
372
|
-
), { el:
|
|
373
|
-
function d(
|
|
374
|
-
return Array.isArray(
|
|
369
|
+
return i;
|
|
370
|
+
}), s = h(
|
|
371
|
+
() => o.value > 0 ? `Filters (${o.value} selected)` : "Filters"
|
|
372
|
+
), { el: c, suppressClick: b, dragHandlers: y } = $e(), k = h(() => Y("phila-filter-chip-group", l.elevated && "is-elevated", l.className));
|
|
373
|
+
function d(i) {
|
|
374
|
+
return Array.isArray(i.choices);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
|
|
376
|
+
function n(i, f) {
|
|
377
|
+
a("update:modelValue", { ...l.modelValue, [i]: f });
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
b.value && (
|
|
379
|
+
function m(i) {
|
|
380
|
+
b.value && (i.stopPropagation(), i.preventDefault());
|
|
381
381
|
}
|
|
382
382
|
const x = C(!1), S = C(!1);
|
|
383
383
|
function w() {
|
|
384
|
-
const
|
|
385
|
-
|
|
384
|
+
const i = c.value;
|
|
385
|
+
i && (x.value = i.scrollLeft > 1, S.value = i.scrollLeft + i.clientWidth < i.scrollWidth - 1);
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
const f =
|
|
389
|
-
f && f.scrollBy({ left:
|
|
387
|
+
function F(i) {
|
|
388
|
+
const f = c.value;
|
|
389
|
+
f && f.scrollBy({ left: i * f.clientWidth * 0.8, behavior: "smooth" });
|
|
390
390
|
}
|
|
391
|
-
let
|
|
392
|
-
return
|
|
393
|
-
N(w),
|
|
391
|
+
let B = null;
|
|
392
|
+
return K(() => {
|
|
393
|
+
N(w), c.value && (B = new ResizeObserver(() => w()), B.observe(c.value));
|
|
394
394
|
}), U(() => {
|
|
395
|
-
|
|
396
|
-
}),
|
|
395
|
+
B?.disconnect(), B = null;
|
|
396
|
+
}), M(
|
|
397
397
|
() => l.filters,
|
|
398
398
|
() => N(w)
|
|
399
|
-
), (
|
|
400
|
-
class:
|
|
399
|
+
), (i, f) => (r(), g("div", {
|
|
400
|
+
class: E(k.value)
|
|
401
401
|
}, [
|
|
402
|
-
e.label ? (
|
|
403
|
-
|
|
404
|
-
x.value ? (
|
|
402
|
+
e.label ? (r(), g("span", Be, P(e.label), 1)) : z("", !0),
|
|
403
|
+
I("div", Ae, [
|
|
404
|
+
x.value ? (r(), g("button", {
|
|
405
405
|
key: 0,
|
|
406
406
|
type: "button",
|
|
407
407
|
class: "phila-filter-chip-group__arrow phila-filter-chip-group__arrow--left",
|
|
408
408
|
"aria-label": "Scroll filters left",
|
|
409
|
-
onClick: f[0] || (f[0] = (t) =>
|
|
409
|
+
onClick: f[0] || (f[0] = (t) => F(-1))
|
|
410
410
|
}, [
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
$(v(L), {
|
|
412
|
+
icon: v(ue),
|
|
413
413
|
size: "xxsmall",
|
|
414
414
|
inline: "",
|
|
415
415
|
decorative: ""
|
|
416
|
-
}, null, 8, ["icon
|
|
416
|
+
}, null, 8, ["icon"])
|
|
417
417
|
])) : z("", !0),
|
|
418
|
-
|
|
418
|
+
I("div", ie({
|
|
419
419
|
ref_key: "el",
|
|
420
|
-
ref:
|
|
420
|
+
ref: c,
|
|
421
421
|
class: "phila-filter-chip-group__row"
|
|
422
422
|
}, v(y), {
|
|
423
|
-
onClickCapture:
|
|
423
|
+
onClickCapture: m,
|
|
424
424
|
onScroll: w
|
|
425
425
|
}), [
|
|
426
|
-
e.filterButton ? (
|
|
426
|
+
e.filterButton ? (r(), V(O, {
|
|
427
427
|
key: 0,
|
|
428
428
|
size: e.size,
|
|
429
429
|
color: e.color,
|
|
430
|
-
|
|
431
|
-
text:
|
|
432
|
-
"icon-only":
|
|
433
|
-
active:
|
|
434
|
-
"aria-label":
|
|
435
|
-
onClick: f[1] || (f[1] = (t) =>
|
|
436
|
-
}, null, 8, ["size", "color", "icon
|
|
437
|
-
(
|
|
430
|
+
icon: v(se),
|
|
431
|
+
text: o.value > 0 ? `(${o.value})` : "",
|
|
432
|
+
"icon-only": o.value === 0,
|
|
433
|
+
active: o.value > 0,
|
|
434
|
+
"aria-label": s.value,
|
|
435
|
+
onClick: f[1] || (f[1] = (t) => a("open-filters"))
|
|
436
|
+
}, null, 8, ["size", "color", "icon", "text", "icon-only", "active", "aria-label"])) : z("", !0),
|
|
437
|
+
(r(!0), g(Q, null, ae(e.filters, (t) => (r(), V(ze, {
|
|
438
438
|
key: t.key,
|
|
439
439
|
label: t.label,
|
|
440
440
|
text: t.label,
|
|
441
441
|
size: e.size,
|
|
442
442
|
color: e.color,
|
|
443
|
-
|
|
443
|
+
icon: t.icon,
|
|
444
444
|
"icon-color": t.iconColor,
|
|
445
445
|
choices: t.choices,
|
|
446
446
|
multiple: t.multiple,
|
|
447
447
|
"model-value": d(t) ? e.modelValue[t.key] : void 0,
|
|
448
448
|
selected: !d(t) && e.modelValue[t.key] === !0,
|
|
449
|
-
"onUpdate:modelValue": (
|
|
450
|
-
"onUpdate:selected": (
|
|
451
|
-
}, null, 8, ["label", "text", "size", "color", "icon
|
|
449
|
+
"onUpdate:modelValue": (A) => n(t.key, A),
|
|
450
|
+
"onUpdate:selected": (A) => n(t.key, A)
|
|
451
|
+
}, null, 8, ["label", "text", "size", "color", "icon", "icon-color", "choices", "multiple", "model-value", "selected", "onUpdate:modelValue", "onUpdate:selected"]))), 128))
|
|
452
452
|
], 16),
|
|
453
|
-
S.value ? (
|
|
453
|
+
S.value ? (r(), g("button", {
|
|
454
454
|
key: 1,
|
|
455
455
|
type: "button",
|
|
456
456
|
class: "phila-filter-chip-group__arrow phila-filter-chip-group__arrow--right",
|
|
457
457
|
"aria-label": "Scroll filters right",
|
|
458
|
-
onClick: f[2] || (f[2] = (t) =>
|
|
458
|
+
onClick: f[2] || (f[2] = (t) => F(1))
|
|
459
459
|
}, [
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
$(v(L), {
|
|
461
|
+
icon: v(de),
|
|
462
462
|
size: "xxsmall",
|
|
463
463
|
inline: "",
|
|
464
464
|
decorative: ""
|
|
465
|
-
}, null, 8, ["icon
|
|
465
|
+
}, null, 8, ["icon"])
|
|
466
466
|
])) : z("", !0)
|
|
467
467
|
])
|
|
468
468
|
], 2));
|
|
469
469
|
}
|
|
470
|
-
}),
|
|
470
|
+
}), Oe = /* @__PURE__ */ J(Ie, [["__scopeId", "data-v-8e691eda"]]);
|
|
471
471
|
export {
|
|
472
472
|
ze as FilterChip,
|
|
473
|
-
|
|
473
|
+
Oe as FilterChipGroup
|
|
474
474
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-filter-chip",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Filter chips for faceted filtering",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,15 +25,13 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"vue": "^3.0.0"
|
|
29
|
-
"@fortawesome/fontawesome-svg-core": "^7.1.0",
|
|
30
|
-
"@fortawesome/pro-solid-svg-icons": "^7.1.0"
|
|
28
|
+
"vue": "^3.0.0"
|
|
31
29
|
},
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"@phila/phila-ui-core": "3.0.0-beta.
|
|
34
|
-
"@phila/phila-ui-radio": "0.1.1-beta.
|
|
35
|
-
"@phila/phila-ui-checkbox": "0.1.1-beta.
|
|
36
|
-
"@phila/phila-ui-button": "2.
|
|
31
|
+
"@phila/phila-ui-core": "3.0.0-beta.7",
|
|
32
|
+
"@phila/phila-ui-radio": "0.1.1-beta.8",
|
|
33
|
+
"@phila/phila-ui-checkbox": "0.1.1-beta.8",
|
|
34
|
+
"@phila/phila-ui-button": "2.3.0-beta.8"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"@types/node": "^24.0.0",
|