@phila/phila-ui-filter-chip 1.0.0-beta.10 → 1.0.0-beta.11
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/dist/FilterChip.vue.d.ts +2 -0
- package/dist/FilterChip.vue.d.ts.map +1 -1
- package/dist/FilterChipGroup.vue.d.ts +2 -0
- package/dist/FilterChipGroup.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +116 -115
- package/package.json +2 -2
package/dist/FilterChip.vue.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { FilterChipProps } from './index';
|
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FilterChipProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
3
3
|
click: (event: MouseEvent) => any;
|
|
4
4
|
"update:modelValue": (value: Record<string, boolean>) => any;
|
|
5
|
+
close: () => any;
|
|
5
6
|
"update:selected": (value: boolean) => any;
|
|
6
7
|
}, string, import('vue').PublicProps, Readonly<FilterChipProps> & Readonly<{
|
|
7
8
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
8
9
|
"onUpdate:modelValue"?: ((value: Record<string, boolean>) => any) | undefined;
|
|
10
|
+
onClose?: (() => any) | undefined;
|
|
9
11
|
"onUpdate:selected"?: ((value: boolean) => any) | undefined;
|
|
10
12
|
}>, {
|
|
11
13
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChip.vue.d.ts","sourceRoot":"","sources":["../src/FilterChip.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterChip.vue.d.ts","sourceRoot":"","sources":["../src/FilterChip.vue"],"names":[],"mappings":"AA+MA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA2XyiM,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA7EhrM,GAAG;;AAtSjC,wBA+VK;AAaL,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -3,9 +3,11 @@ import { FilterValues } from '@phila/phila-ui-core';
|
|
|
3
3
|
declare const _default: import('vue').DefineComponent<FilterChipGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
4
4
|
"update:modelValue": (value: FilterValues) => any;
|
|
5
5
|
"open-filters": () => any;
|
|
6
|
+
"dropdown-close": (key: string) => any;
|
|
6
7
|
}, string, import('vue').PublicProps, Readonly<FilterChipGroupProps> & Readonly<{
|
|
7
8
|
"onUpdate:modelValue"?: ((value: FilterValues) => any) | undefined;
|
|
8
9
|
"onOpen-filters"?: (() => any) | undefined;
|
|
10
|
+
"onDropdown-close"?: ((key: string) => any) | undefined;
|
|
9
11
|
}>, {
|
|
10
12
|
size: import('@phila/phila-ui-core').ComponentSize;
|
|
11
13
|
color: import('./index').FilterChipColor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChipGroup.vue.d.ts","sourceRoot":"","sources":["../src/FilterChipGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterChipGroup.vue.d.ts","sourceRoot":"","sources":["../src/FilterChipGroup.vue"],"names":[],"mappings":"AAsRA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,sBAAsB,CAAC;;;;;;;;;;;;;;;;;;;AAiW3E,wBAUG"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
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;display:flex;flex-direction:column;overflow:hidden}.phila-filter-chip-panel__body{flex:0 1 auto;min-height:0;overflow-y:auto;padding:var(--spacing-s, .75rem)}.phila-filter-chip-panel__footer{display:flex;justify-content:flex-end;align-items:center;gap:var(--spacing-s, .75rem);flex-shrink:0;padding:var(--spacing-s, .75rem);border-top:var(--border-width-s) solid var(--Schemes-Border)}.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;display:flex;flex-direction:column;max-height:80vh;overflow:hidden;box-sizing:border-box}.phila-filter-chip-sheet__header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding:var(--spacing-m, 1rem) var(--spacing-m, 1rem) var(--spacing-s, .75rem)}.phila-filter-chip-sheet__body{flex:1;min-height:0;overflow-y:auto;padding:0 var(--spacing-m, 1rem) var(--spacing-m, 1rem)}.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);flex-shrink:0;padding:var(--spacing-s, .75rem) var(--spacing-m, 1rem) var(--spacing-m, 1rem);border-top:var(--border-width-s) solid var(--Schemes-Border)}.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,.phila-filter-chip-panel .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-
|
|
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;display:flex;flex-direction:column;overflow:hidden}.phila-filter-chip-panel__body{flex:0 1 auto;min-height:0;overflow-y:auto;padding:var(--spacing-s, .75rem)}.phila-filter-chip-panel__footer{display:flex;justify-content:flex-end;align-items:center;gap:var(--spacing-s, .75rem);flex-shrink:0;padding:var(--spacing-s, .75rem);border-top:var(--border-width-s) solid var(--Schemes-Border)}.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;display:flex;flex-direction:column;max-height:80vh;overflow:hidden;box-sizing:border-box}.phila-filter-chip-sheet__header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding:var(--spacing-m, 1rem) var(--spacing-m, 1rem) var(--spacing-s, .75rem)}.phila-filter-chip-sheet__body{flex:1;min-height:0;overflow-y:auto;padding:0 var(--spacing-m, 1rem) var(--spacing-m, 1rem)}.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);flex-shrink:0;padding:var(--spacing-s, .75rem) var(--spacing-m, 1rem) var(--spacing-m, 1rem);border-top:var(--border-width-s) solid var(--Schemes-Border)}.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,.phila-filter-chip-panel .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-6db1a7a1]{display:flex;flex-direction:column;gap:var(--spacing-2xs)}.phila-filter-chip-group__viewport[data-v-6db1a7a1]{position:relative}.phila-filter-chip-group__label[data-v-6db1a7a1]{padding-inline:var(--spacing-m)}.phila-filter-chip-group__row[data-v-6db1a7a1]{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-6db1a7a1]::-webkit-scrollbar{display:none}.phila-filter-chip-group__arrow[data-v-6db1a7a1]{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-6db1a7a1]{left:var(--spacing-m)}.phila-filter-chip-group__arrow--right[data-v-6db1a7a1]{right:var(--spacing-m)}@media(hover:hover)and (pointer:fine){.phila-filter-chip-group__viewport:hover .phila-filter-chip-group__arrow[data-v-6db1a7a1]{display:flex}}.phila-filter-chip-group.is-elevated[data-v-6db1a7a1] .phila-filter-chip{box-shadow:0 2px 4px #0003}.phila-filter-chip-group.is-elevated .phila-filter-chip-group__row[data-v-6db1a7a1]{padding-top:2px;padding-bottom:8px}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),g=require("@phila/phila-ui-core"),N=require("@phila/phila-ui-core/icons"),U=require("@phila/phila-ui-radio"),L=require("@phila/phila-ui-checkbox"),I=require("@phila/phila-ui-button"),j=["aria-pressed","aria-expanded"],O="xxsmall",R=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(t,{expose:s}){const l=t,n=e.ref(null),d=e.computed(()=>g.cn("phila-filter-chip",`phila-filter-chip--${l.color}`,l.size!=="medium"&&`is-${l.size}`,"has-text-body-"+f(l.size),l.active&&"is-active",l.iconOnly&&"is-icon-only"));s({el:n});const f=c=>{switch(c){case"extra-large":return"default";case"large":return"small";default:return"extra-small"}};return(c,y)=>(e.openBlock(),e.createElementBlock("button",{ref_key:"rootEl",ref:n,type:"button",class:e.normalizeClass(d.value),style:e.normalizeStyle(t.iconColor?{"--chip-icon-color":t.iconColor}:void 0),"aria-pressed":t.ariaPressed,"aria-expanded":t.ariaExpanded,onClick:y[0]||(y[0]=v=>c.$emit("click",v))},[e.createVNode(e.unref(g.ActionContent),{icon:t.icon,size:t.size,inline:"","icon-size":O,"icon-only":t.iconOnly},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)],!0)]),_:3},8,["icon","size","icon-only"]),t.chevron?(e.openBlock(),e.createBlock(e.unref(g.Icon),{key:0,icon:e.unref(N.IconChevronDown),size:"xxsmall",inline:"",decorative:"",class:"phila-filter-chip__chevron"},null,8,["icon"])):t.trailingIcon?(e.openBlock(),e.createBlock(e.unref(g.Icon),{key:1,icon:t.trailingIcon,size:O,inline:"",decorative:""},null,8,["icon"])):e.createCommentVNode("",!0)],14,j))}}),P=(t,s)=>{const l=t.__vccOpts||t;for(const[n,d]of s)l[n]=d;return l},T=P(R,[["__scopeId","data-v-40c7e692"]]),M=["id","aria-label"],q={key:0,class:"phila-filter-chip-sheet__header"},G={class:"phila-filter-chip-sheet__title"},H={key:1,class:"phila-filter-chip-sheet__footer"},W={key:2,class:"phila-filter-chip-panel__footer"},X=e.defineComponent({__name:"FilterChipDropdownPanel",props:{menuId:{},label:{},choices:{},multiple:{type:Boolean},value:{},showActions:{type:Boolean,default:!1},top:{},left:{},mobile:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"}},emits:["update:modelValue","apply","reset","close"],setup(t,{emit:s}){const l=t,n=s;function d(u){return Object.fromEntries(l.choices.map(h=>[h.value,!!u[h.value]]))}const f=e.ref(d(l.value));e.watch(()=>l.value,u=>f.value=d(u));const c=e.computed(()=>l.showActions?f.value:d(l.value)),y=e.computed(()=>Object.values(c.value).filter(Boolean).length),v=e.computed(()=>y.value>0?`${l.applyText} (${y.value})`:l.applyText),k=e.computed(()=>l.choices.map(u=>({text:u.text,value:u.value,tooltip:u.tooltip})));function p(u){l.showActions?f.value=u:n("update:modelValue",u)}const m=()=>{f.value=Object.fromEntries(l.choices.map(u=>[u.value,!1])),n("reset")},C=()=>n("apply",{...f.value}),V=e.computed(()=>({top:l.top+"px",left:l.left+"px",maxHeight:`calc(100dvh - ${l.top}px - 0.5rem)`}));return(u,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.mobile?(e.openBlock(),e.createElementBlock("div",{key:0,class:"phila-filter-chip-sheet__scrim",onClick:h[0]||(h[0]=b=>n("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:V.value)},[t.mobile?(e.openBlock(),e.createElementBlock("header",q,[e.createElementVNode("span",G,e.toDisplayString(t.label),1),e.createElementVNode("button",{type:"button",class:"phila-filter-chip-sheet__close","aria-label":"Close",onClick:h[1]||(h[1]=b=>n("close"))}," ✕ ")])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(t.mobile?"phila-filter-chip-sheet__body":"phila-filter-chip-panel__body")},[t.multiple?(e.openBlock(),e.createBlock(e.unref(L.CheckboxGroup),{key:0,"group-label":t.label,choices:k.value,"model-value":c.value,"onUpdate:modelValue":p},null,8,["group-label","choices","model-value"])):(e.openBlock(),e.createBlock(e.unref(U.RadioGroup),{key:1,"group-label":t.label,choices:k.value,"model-value":c.value,"onUpdate:modelValue":p},null,8,["group-label","choices","model-value"]))],2),t.mobile?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(I.PhilaButton),{variant:"secondary",text:t.resetText,onClick:m},null,8,["text"]),t.showActions?(e.openBlock(),e.createBlock(e.unref(I.PhilaButton),{key:0,variant:"primary",text:v.value,onClick:C},null,8,["text"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("button",{type:"button",class:"phila-filter-chip-panel__reset has-text-body-small",onClick:m},e.toDisplayString(t.resetText),1),t.showActions?(e.openBlock(),e.createBlock(e.unref(I.PhilaButton),{key:0,variant:"primary",size:"small",text:t.applyText,onClick:C},null,8,["text"])):e.createCommentVNode("",!0)]))],14,M)]))}}),A="(max-width: 1064px) and (max-height: 915px)";function K(){const t=e.ref(typeof window<"u"&&window.matchMedia(A).matches);let s=null;function l(n){t.value=n.matches}return e.onMounted(()=>{s=window.matchMedia(A),t.value=s.matches,s.addEventListener("change",l)}),e.onBeforeUnmount(()=>{s?.removeEventListener("change",l)}),{isMobile:t}}let Q=0;const D=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:{default:void 0},showActions:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"},className:{}},emits:["update:selected","update:modelValue","click"],setup(t,{emit:s}){const l=t,n=s,d=e.computed(()=>Array.isArray(l.choices)),f=e.useSlots(),c=e.computed(()=>!d.value&&!!l.icon&&!l.text&&!l.label&&!f.default);function y(a){n("update:selected",!l.selected),n("click",a)}const v=`phila-filter-chip-${e.useId()}-${++Q}`,{isVisible:k,setVisibility:p}=g.useVisibility({id:v,group:"phila-filter-chip",outsideClickHide:!0,escapeKeyHide:!0,showSingle:!0}),m=e.computed(()=>k(v)),{isMobile:C}=K(),V=e.ref(null),u=e.ref(0),h=e.ref(0),b=e.computed(()=>{const a=l.choices??[],B=l.modelValue??{};return Object.fromEntries(a.map(E=>[E.value,!!B[E.value]]))}),w=e.computed(()=>Object.values(b.value).filter(Boolean).length),z=e.computed(()=>w.value>0),i=e.computed(()=>{const a=l.label??l.text??"";return w.value>0?`${a} (${w.value})`:a});function r(){const a=V.value?.el??null;if(!a)return;const B=a.getBoundingClientRect();u.value=B.bottom+4,h.value=B.left}function o(a){if(!m.value)return;const B=document.getElementById(v),E=a.target;B&&E&&B.contains(E)||p(!1)}e.watch(m,a=>{a&&!C.value?window.addEventListener("scroll",o,{capture:!0}):window.removeEventListener("scroll",o,{capture:!0})});function x(){const a=!m.value;a&&!C.value&&r(),p(a)}function $(a){n("update:modelValue",a)}function S(a){n("update:modelValue",a),p(!1)}function F(){n("update:modelValue",Object.fromEntries((l.choices??[]).map(a=>[a.value,!1])))}return e.onMounted(()=>{d.value&&n("update:modelValue",b.value)}),(a,B)=>d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(T,{ref_key:"triggerRef",ref:V,text:i.value,size:t.size,color:t.color,icon:t.icon,"icon-color":t.iconColor,active:z.value||m.value,chevron:"","aria-expanded":m.value,"data-toggle":`visibility-${v}`,onClick:x},null,8,["text","size","color","icon","icon-color","active","aria-expanded","data-toggle"]),m.value?(e.openBlock(),e.createBlock(X,{key:0,"menu-id":v,label:t.label??t.text??"",choices:t.choices,multiple:t.multiple,value:b.value,"show-actions":t.showActions,top:u.value,left:h.value,mobile:e.unref(C),"apply-text":t.applyText,"reset-text":t.resetText,"onUpdate:modelValue":$,onApply:S,onReset:F,onClose:B[0]||(B[0]=E=>e.unref(p)(!1))},null,8,["label","choices","multiple","value","show-actions","top","left","mobile","apply-text","reset-text"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(T,{key:1,size:t.size,color:t.color,icon:t.icon,"icon-color":t.iconColor,"trailing-icon":t.trailingIcon,"icon-only":c.value,active:t.selected,"aria-pressed":t.selected,onClick:y},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])]),_:3},8,["size","color","icon","icon-color","trailing-icon","icon-only","active","aria-pressed"]))}}),Y=5;function J(){const t=e.ref(null),s=e.ref(!1);let l=!1,n=0,d=0,f=!1,c=null;const y=p=>{t.value&&p.pointerType!=="mouse"&&(l=!0,f=!1,n=p.clientX,d=t.value.scrollLeft)},v=p=>{if(!l||!t.value)return;const m=p.clientX-n;!f&&Math.abs(m)>Y&&(f=!0,s.value=!0,t.value.setPointerCapture(p.pointerId),c=p.pointerId),f&&(t.value.scrollLeft=d-m)},k=()=>{if(t.value&&c!==null){try{t.value.releasePointerCapture(c)}catch{}c=null}l=!1,f&&setTimeout(()=>s.value=!1,0)};return e.onBeforeUnmount(k),{el:t,suppressClick:s,dragHandlers:{onPointerdown:y,onPointermove:v,onPointerup:k,onPointerleave:k}}}const Z={key:0,class:"phila-filter-chip-group__label has-text-label-default"},_={class:"phila-filter-chip-group__viewport"},ee=e.defineComponent({__name:"FilterChipGroup",props:{filters:{},modelValue:{default:()=>({})},label:{},size:{default:"medium"},color:{default:"blue"},filterButton:{type:Boolean,default:!1},filterButtonText:{default:"Filters"},elevated:{type:Boolean,default:!1},className:{}},emits:["update:modelValue","open-filters"],setup(t,{emit:s}){const l=t,n=s,d=e.computed(()=>{let i=0;for(const r of l.filters){if(r.excludeFromCount)continue;const o=l.modelValue[r.key];o&&typeof o=="object"?i+=Object.values(o).filter(Boolean).length:o===!0&&(i+=1)}return i}),f=e.computed(()=>d.value>0?`${l.filterButtonText} (${d.value})`:l.filterButtonText),{el:c,suppressClick:y,dragHandlers:v}=J(),k=e.computed(()=>g.cn("phila-filter-chip-group",l.elevated&&"is-elevated",l.className));function p(i){return Array.isArray(i.choices)}function m(i){const r={};for(const o of l.filters){const x=i[o.key];if(Array.isArray(o.choices)&&o.choices.length>0){const $=x&&typeof x=="object"?x:{};r[o.key]=Object.fromEntries(o.choices.map(S=>[S.value,!!$[S.value]]))}else r[o.key]=x===!0}return r}function C(i,r){n("update:modelValue",m({...l.modelValue,[i]:r}))}function V(i){y.value&&(i.stopPropagation(),i.preventDefault())}const u=e.ref(!1),h=e.ref(!1);function b(){const i=c.value;i&&(u.value=i.scrollLeft>1,h.value=i.scrollLeft+i.clientWidth<i.scrollWidth-1)}function w(i){const r=c.value;r&&r.scrollBy({left:i*r.clientWidth*.8,behavior:"smooth"})}let z=null;return e.onMounted(()=>{n("update:modelValue",m(l.modelValue)),e.nextTick(b),c.value&&(z=new ResizeObserver(()=>b()),z.observe(c.value))}),e.onBeforeUnmount(()=>{z?.disconnect(),z=null}),e.watch(()=>l.filters,()=>e.nextTick(b)),(i,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(k.value)},[t.label?(e.openBlock(),e.createElementBlock("span",Z,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[u.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:r[0]||(r[0]=o=>w(-1))},[e.createVNode(e.unref(g.Icon),{icon:e.unref(N.IconChevronLeft),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps({ref_key:"el",ref:c,class:"phila-filter-chip-group__row"},e.unref(v),{onClickCapture:V,onScroll:b}),[t.filterButton?(e.openBlock(),e.createBlock(T,{key:0,size:t.size,color:t.color,icon:e.unref(N.IconSliders),text:f.value,active:d.value>0,"aria-label":f.value,onClick:r[1]||(r[1]=o=>n("open-filters"))},null,8,["size","color","icon","text","active","aria-label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filters,o=>(e.openBlock(),e.createBlock(D,{key:o.key,label:o.label,text:o.label,size:t.size,color:t.color,icon:o.icon,"icon-color":o.iconColor,choices:o.choices,multiple:o.multiple,"show-actions":o.showActions,"model-value":p(o)?t.modelValue[o.key]:void 0,selected:!p(o)&&t.modelValue[o.key]===!0,"onUpdate:modelValue":x=>C(o.key,x),"onUpdate:selected":x=>C(o.key,x)},null,8,["label","text","size","color","icon","icon-color","choices","multiple","show-actions","model-value","selected","onUpdate:modelValue","onUpdate:selected"]))),128))],16),h.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:r[2]||(r[2]=o=>w(1))},[e.createVNode(e.unref(g.Icon),{icon:e.unref(N.IconChevronRight),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0)])],2))}}),te=P(ee,[["__scopeId","data-v-b84936b9"]]);exports.FilterChip=D;exports.FilterChipGroup=te;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),g=require("@phila/phila-ui-core"),$=require("@phila/phila-ui-core/icons"),U=require("@phila/phila-ui-radio"),L=require("@phila/phila-ui-checkbox"),I=require("@phila/phila-ui-button"),j=["aria-pressed","aria-expanded"],O="xxsmall",R=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(t,{expose:s}){const l=t,n=e.ref(null),d=e.computed(()=>g.cn("phila-filter-chip",`phila-filter-chip--${l.color}`,l.size!=="medium"&&`is-${l.size}`,"has-text-body-"+f(l.size),l.active&&"is-active",l.iconOnly&&"is-icon-only"));s({el:n});const f=c=>{switch(c){case"extra-large":return"default";case"large":return"small";default:return"extra-small"}};return(c,y)=>(e.openBlock(),e.createElementBlock("button",{ref_key:"rootEl",ref:n,type:"button",class:e.normalizeClass(d.value),style:e.normalizeStyle(t.iconColor?{"--chip-icon-color":t.iconColor}:void 0),"aria-pressed":t.ariaPressed,"aria-expanded":t.ariaExpanded,onClick:y[0]||(y[0]=v=>c.$emit("click",v))},[e.createVNode(e.unref(g.ActionContent),{icon:t.icon,size:t.size,inline:"","icon-size":O,"icon-only":t.iconOnly},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)],!0)]),_:3},8,["icon","size","icon-only"]),t.chevron?(e.openBlock(),e.createBlock(e.unref(g.Icon),{key:0,icon:e.unref($.IconChevronDown),size:"xxsmall",inline:"",decorative:"",class:"phila-filter-chip__chevron"},null,8,["icon"])):t.trailingIcon?(e.openBlock(),e.createBlock(e.unref(g.Icon),{key:1,icon:t.trailingIcon,size:O,inline:"",decorative:""},null,8,["icon"])):e.createCommentVNode("",!0)],14,j))}}),P=(t,s)=>{const l=t.__vccOpts||t;for(const[n,d]of s)l[n]=d;return l},T=P(R,[["__scopeId","data-v-40c7e692"]]),M=["id","aria-label"],q={key:0,class:"phila-filter-chip-sheet__header"},G={class:"phila-filter-chip-sheet__title"},H={key:1,class:"phila-filter-chip-sheet__footer"},W={key:2,class:"phila-filter-chip-panel__footer"},X=e.defineComponent({__name:"FilterChipDropdownPanel",props:{menuId:{},label:{},choices:{},multiple:{type:Boolean},value:{},showActions:{type:Boolean,default:!1},top:{},left:{},mobile:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"}},emits:["update:modelValue","apply","reset","close"],setup(t,{emit:s}){const l=t,n=s;function d(u){return Object.fromEntries(l.choices.map(h=>[h.value,!!u[h.value]]))}const f=e.ref(d(l.value));e.watch(()=>l.value,u=>f.value=d(u));const c=e.computed(()=>l.showActions?f.value:d(l.value)),y=e.computed(()=>Object.values(c.value).filter(Boolean).length),v=e.computed(()=>y.value>0?`${l.applyText} (${y.value})`:l.applyText),b=e.computed(()=>l.choices.map(u=>({text:u.text,value:u.value,tooltip:u.tooltip})));function p(u){l.showActions?f.value=u:n("update:modelValue",u)}const m=()=>{f.value=Object.fromEntries(l.choices.map(u=>[u.value,!1])),n("reset")},C=()=>n("apply",{...f.value}),V=e.computed(()=>({top:l.top+"px",left:l.left+"px",maxHeight:`calc(100dvh - ${l.top}px - 0.5rem)`}));return(u,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.mobile?(e.openBlock(),e.createElementBlock("div",{key:0,class:"phila-filter-chip-sheet__scrim",onClick:h[0]||(h[0]=x=>n("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:V.value)},[t.mobile?(e.openBlock(),e.createElementBlock("header",q,[e.createElementVNode("span",G,e.toDisplayString(t.label),1),e.createElementVNode("button",{type:"button",class:"phila-filter-chip-sheet__close","aria-label":"Close",onClick:h[1]||(h[1]=x=>n("close"))}," ✕ ")])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(t.mobile?"phila-filter-chip-sheet__body":"phila-filter-chip-panel__body")},[t.multiple?(e.openBlock(),e.createBlock(e.unref(L.CheckboxGroup),{key:0,"group-label":t.label,choices:b.value,"model-value":c.value,"onUpdate:modelValue":p},null,8,["group-label","choices","model-value"])):(e.openBlock(),e.createBlock(e.unref(U.RadioGroup),{key:1,"group-label":t.label,choices:b.value,"model-value":c.value,"onUpdate:modelValue":p},null,8,["group-label","choices","model-value"]))],2),t.mobile?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(I.PhilaButton),{variant:"secondary",text:t.resetText,onClick:m},null,8,["text"]),t.showActions?(e.openBlock(),e.createBlock(e.unref(I.PhilaButton),{key:0,variant:"primary",text:v.value,onClick:C},null,8,["text"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("button",{type:"button",class:"phila-filter-chip-panel__reset has-text-body-small",onClick:m},e.toDisplayString(t.resetText),1),t.showActions?(e.openBlock(),e.createBlock(e.unref(I.PhilaButton),{key:0,variant:"primary",size:"small",text:t.applyText,onClick:C},null,8,["text"])):e.createCommentVNode("",!0)]))],14,M)]))}}),A="(max-width: 1064px) and (max-height: 915px)";function K(){const t=e.ref(typeof window<"u"&&window.matchMedia(A).matches);let s=null;function l(n){t.value=n.matches}return e.onMounted(()=>{s=window.matchMedia(A),t.value=s.matches,s.addEventListener("change",l)}),e.onBeforeUnmount(()=>{s?.removeEventListener("change",l)}),{isMobile:t}}let Q=0;const D=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:{default:void 0},showActions:{type:Boolean,default:!1},applyText:{default:"Apply"},resetText:{default:"Reset"},className:{}},emits:["update:selected","update:modelValue","click","close"],setup(t,{emit:s}){const l=t,n=s,d=e.computed(()=>Array.isArray(l.choices)),f=e.useSlots(),c=e.computed(()=>!d.value&&!!l.icon&&!l.text&&!l.label&&!f.default);function y(a){n("update:selected",!l.selected),n("click",a)}const v=`phila-filter-chip-${e.useId()}-${++Q}`,{isVisible:b,setVisibility:p}=g.useVisibility({id:v,group:"phila-filter-chip",outsideClickHide:!0,escapeKeyHide:!0,showSingle:!0}),m=e.computed(()=>b(v)),{isMobile:C}=K(),V=e.ref(null),u=e.ref(0),h=e.ref(0),x=e.computed(()=>{const a=l.choices??[],B=l.modelValue??{};return Object.fromEntries(a.map(E=>[E.value,!!B[E.value]]))}),w=e.computed(()=>Object.values(x.value).filter(Boolean).length),z=e.computed(()=>w.value>0),i=e.computed(()=>{const a=l.label??l.text??"";return w.value>0?`${a} (${w.value})`:a});function r(){const a=V.value?.el??null;if(!a)return;const B=a.getBoundingClientRect();u.value=B.bottom+4,h.value=B.left}function o(a){if(!m.value)return;const B=document.getElementById(v),E=a.target;B&&E&&B.contains(E)||p(!1)}e.watch(m,a=>{a&&!C.value?window.addEventListener("scroll",o,{capture:!0}):window.removeEventListener("scroll",o,{capture:!0}),a||n("close")});function k(){const a=!m.value;a&&!C.value&&r(),p(a)}function N(a){n("update:modelValue",a)}function S(a){n("update:modelValue",a),p(!1)}function F(){n("update:modelValue",Object.fromEntries((l.choices??[]).map(a=>[a.value,!1])))}return e.onMounted(()=>{d.value&&n("update:modelValue",x.value)}),(a,B)=>d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(T,{ref_key:"triggerRef",ref:V,text:i.value,size:t.size,color:t.color,icon:t.icon,"icon-color":t.iconColor,active:z.value||m.value,chevron:"","aria-expanded":m.value,"data-toggle":`visibility-${v}`,onClick:k},null,8,["text","size","color","icon","icon-color","active","aria-expanded","data-toggle"]),m.value?(e.openBlock(),e.createBlock(X,{key:0,"menu-id":v,label:t.label??t.text??"",choices:t.choices,multiple:t.multiple,value:x.value,"show-actions":t.showActions,top:u.value,left:h.value,mobile:e.unref(C),"apply-text":t.applyText,"reset-text":t.resetText,"onUpdate:modelValue":N,onApply:S,onReset:F,onClose:B[0]||(B[0]=E=>e.unref(p)(!1))},null,8,["label","choices","multiple","value","show-actions","top","left","mobile","apply-text","reset-text"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(T,{key:1,size:t.size,color:t.color,icon:t.icon,"icon-color":t.iconColor,"trailing-icon":t.trailingIcon,"icon-only":c.value,active:t.selected,"aria-pressed":t.selected,onClick:y},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])]),_:3},8,["size","color","icon","icon-color","trailing-icon","icon-only","active","aria-pressed"]))}}),Y=5;function J(){const t=e.ref(null),s=e.ref(!1);let l=!1,n=0,d=0,f=!1,c=null;const y=p=>{t.value&&p.pointerType!=="mouse"&&(l=!0,f=!1,n=p.clientX,d=t.value.scrollLeft)},v=p=>{if(!l||!t.value)return;const m=p.clientX-n;!f&&Math.abs(m)>Y&&(f=!0,s.value=!0,t.value.setPointerCapture(p.pointerId),c=p.pointerId),f&&(t.value.scrollLeft=d-m)},b=()=>{if(t.value&&c!==null){try{t.value.releasePointerCapture(c)}catch{}c=null}l=!1,f&&setTimeout(()=>s.value=!1,0)};return e.onBeforeUnmount(b),{el:t,suppressClick:s,dragHandlers:{onPointerdown:y,onPointermove:v,onPointerup:b,onPointerleave:b}}}const Z={key:0,class:"phila-filter-chip-group__label has-text-label-default"},_={class:"phila-filter-chip-group__viewport"},ee=e.defineComponent({__name:"FilterChipGroup",props:{filters:{},modelValue:{default:()=>({})},label:{},size:{default:"medium"},color:{default:"blue"},filterButton:{type:Boolean,default:!1},filterButtonText:{default:"Filters"},elevated:{type:Boolean,default:!1},className:{}},emits:["update:modelValue","open-filters","dropdown-close"],setup(t,{emit:s}){const l=t,n=s,d=e.computed(()=>{let i=0;for(const r of l.filters){if(r.excludeFromCount)continue;const o=l.modelValue[r.key];o&&typeof o=="object"?i+=Object.values(o).filter(Boolean).length:o===!0&&(i+=1)}return i}),f=e.computed(()=>d.value>0?`${l.filterButtonText} (${d.value})`:l.filterButtonText),{el:c,suppressClick:y,dragHandlers:v}=J(),b=e.computed(()=>g.cn("phila-filter-chip-group",l.elevated&&"is-elevated",l.className));function p(i){return Array.isArray(i.choices)}function m(i){const r={};for(const o of l.filters){const k=i[o.key];if(Array.isArray(o.choices)&&o.choices.length>0){const N=k&&typeof k=="object"?k:{};r[o.key]=Object.fromEntries(o.choices.map(S=>[S.value,!!N[S.value]]))}else r[o.key]=k===!0}return r}function C(i,r){n("update:modelValue",m({...l.modelValue,[i]:r}))}function V(i){y.value&&(i.stopPropagation(),i.preventDefault())}const u=e.ref(!1),h=e.ref(!1);function x(){const i=c.value;i&&(u.value=i.scrollLeft>1,h.value=i.scrollLeft+i.clientWidth<i.scrollWidth-1)}function w(i){const r=c.value;r&&r.scrollBy({left:i*r.clientWidth*.8,behavior:"smooth"})}let z=null;return e.onMounted(()=>{n("update:modelValue",m(l.modelValue)),e.nextTick(x),c.value&&(z=new ResizeObserver(()=>x()),z.observe(c.value))}),e.onBeforeUnmount(()=>{z?.disconnect(),z=null}),e.watch(()=>l.filters,()=>e.nextTick(x)),(i,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(b.value)},[t.label?(e.openBlock(),e.createElementBlock("span",Z,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[u.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:r[0]||(r[0]=o=>w(-1))},[e.createVNode(e.unref(g.Icon),{icon:e.unref($.IconChevronLeft),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps({ref_key:"el",ref:c,class:"phila-filter-chip-group__row"},e.unref(v),{onClickCapture:V,onScroll:x}),[t.filterButton?(e.openBlock(),e.createBlock(T,{key:0,size:t.size,color:t.color,icon:e.unref($.IconSliders),text:f.value,active:d.value>0,"aria-label":f.value,onClick:r[1]||(r[1]=o=>n("open-filters"))},null,8,["size","color","icon","text","active","aria-label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filters,o=>(e.openBlock(),e.createBlock(D,{key:o.key,label:o.label,text:o.label,size:t.size,color:t.color,icon:o.icon,"icon-color":o.iconColor,choices:o.choices,multiple:o.multiple,"show-actions":o.showActions,"model-value":p(o)?t.modelValue[o.key]:void 0,selected:!p(o)&&t.modelValue[o.key]===!0,"onUpdate:modelValue":k=>C(o.key,k),"onUpdate:selected":k=>C(o.key,k),onClose:k=>n("dropdown-close",o.key)},null,8,["label","text","size","color","icon","icon-color","choices","multiple","show-actions","model-value","selected","onUpdate:modelValue","onUpdate:selected","onClose"]))),128))],16),h.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:r[2]||(r[2]=o=>w(1))},[e.createVNode(e.unref(g.Icon),{icon:e.unref($.IconChevronRight),size:"xxsmall",inline:"",decorative:""},null,8,["icon"])])):e.createCommentVNode("",!0)])],2))}}),te=P(ee,[["__scopeId","data-v-6db1a7a1"]]);exports.FilterChip=D;exports.FilterChipGroup=te;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as R, ref as $, computed as m, createElementBlock as
|
|
1
|
+
import { defineComponent as R, ref as $, computed as m, createElementBlock as k, openBlock as n, normalizeStyle as Q, normalizeClass as j, createVNode as P, createBlock as C, createCommentVNode as V, unref as p, withCtx as Y, renderSlot as J, createTextVNode as Z, toDisplayString as L, watch as N, Teleport as oe, createElementVNode as T, onMounted as G, onBeforeUnmount as W, useSlots as ie, useId as ae, Fragment as _, nextTick as X, mergeProps as ne, renderList as ce } from "vue";
|
|
2
2
|
import { cn as ee, ActionContent as se, Icon as D, useVisibility as ue } from "@phila/phila-ui-core";
|
|
3
3
|
import { IconChevronDown as re, IconChevronLeft as de, IconSliders as fe, IconChevronRight as ve } from "@phila/phila-ui-core/icons";
|
|
4
4
|
import { RadioGroup as pe } from "@phila/phila-ui-radio";
|
|
@@ -21,14 +21,14 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
21
21
|
},
|
|
22
22
|
emits: ["click"],
|
|
23
23
|
setup(e, { expose: r }) {
|
|
24
|
-
const
|
|
24
|
+
const l = e, o = $(null), d = m(
|
|
25
25
|
() => ee(
|
|
26
26
|
"phila-filter-chip",
|
|
27
|
-
`phila-filter-chip--${
|
|
28
|
-
|
|
29
|
-
"has-text-body-" + f(
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
`phila-filter-chip--${l.color}`,
|
|
28
|
+
l.size !== "medium" && `is-${l.size}`,
|
|
29
|
+
"has-text-body-" + f(l.size),
|
|
30
|
+
l.active && "is-active",
|
|
31
|
+
l.iconOnly && "is-icon-only"
|
|
32
32
|
)
|
|
33
33
|
);
|
|
34
34
|
r({ el: o });
|
|
@@ -42,7 +42,7 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
42
42
|
return "extra-small";
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
return (c, x) => (n(),
|
|
45
|
+
return (c, x) => (n(), k("button", {
|
|
46
46
|
ref_key: "rootEl",
|
|
47
47
|
ref: o,
|
|
48
48
|
type: "button",
|
|
@@ -66,14 +66,14 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
66
66
|
]),
|
|
67
67
|
_: 3
|
|
68
68
|
}, 8, ["icon", "size", "icon-only"]),
|
|
69
|
-
e.chevron ? (n(),
|
|
69
|
+
e.chevron ? (n(), C(p(D), {
|
|
70
70
|
key: 0,
|
|
71
71
|
icon: p(re),
|
|
72
72
|
size: "xxsmall",
|
|
73
73
|
inline: "",
|
|
74
74
|
decorative: "",
|
|
75
75
|
class: "phila-filter-chip__chevron"
|
|
76
|
-
}, null, 8, ["icon"])) : e.trailingIcon ? (n(),
|
|
76
|
+
}, null, 8, ["icon"])) : e.trailingIcon ? (n(), C(p(D), {
|
|
77
77
|
key: 1,
|
|
78
78
|
icon: e.trailingIcon,
|
|
79
79
|
size: q,
|
|
@@ -82,12 +82,12 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
82
82
|
}, null, 8, ["icon"])) : V("", !0)
|
|
83
83
|
], 14, he));
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
86
|
-
const
|
|
85
|
+
}), le = (e, r) => {
|
|
86
|
+
const l = e.__vccOpts || e;
|
|
87
87
|
for (const [o, d] of r)
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
}, H = /* @__PURE__ */
|
|
88
|
+
l[o] = d;
|
|
89
|
+
return l;
|
|
90
|
+
}, H = /* @__PURE__ */ le(ye, [["__scopeId", "data-v-40c7e692"]]), be = ["id", "aria-label"], xe = {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "phila-filter-chip-sheet__header"
|
|
93
93
|
}, ge = { class: "phila-filter-chip-sheet__title" }, ke = {
|
|
@@ -113,33 +113,33 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
113
113
|
},
|
|
114
114
|
emits: ["update:modelValue", "apply", "reset", "close"],
|
|
115
115
|
setup(e, { emit: r }) {
|
|
116
|
-
const
|
|
116
|
+
const l = e, o = r;
|
|
117
117
|
function d(u) {
|
|
118
|
-
return Object.fromEntries(
|
|
118
|
+
return Object.fromEntries(l.choices.map((b) => [b.value, !!u[b.value]]));
|
|
119
119
|
}
|
|
120
|
-
const f = $(d(
|
|
120
|
+
const f = $(d(l.value));
|
|
121
121
|
N(
|
|
122
|
-
() =>
|
|
122
|
+
() => l.value,
|
|
123
123
|
(u) => f.value = d(u)
|
|
124
124
|
);
|
|
125
|
-
const c = m(() =>
|
|
126
|
-
() => x.value > 0 ? `${
|
|
127
|
-
),
|
|
125
|
+
const c = m(() => l.showActions ? f.value : d(l.value)), x = m(() => Object.values(c.value).filter(Boolean).length), y = m(
|
|
126
|
+
() => x.value > 0 ? `${l.applyText} (${x.value})` : l.applyText
|
|
127
|
+
), w = m(() => l.choices.map((u) => ({ text: u.text, value: u.value, tooltip: u.tooltip })));
|
|
128
128
|
function v(u) {
|
|
129
|
-
|
|
129
|
+
l.showActions ? f.value = u : o("update:modelValue", u);
|
|
130
130
|
}
|
|
131
131
|
const h = () => {
|
|
132
|
-
f.value = Object.fromEntries(
|
|
132
|
+
f.value = Object.fromEntries(l.choices.map((u) => [u.value, !1])), o("reset");
|
|
133
133
|
}, I = () => o("apply", { ...f.value }), O = m(() => ({
|
|
134
|
-
top:
|
|
135
|
-
left:
|
|
136
|
-
maxHeight: `calc(100dvh - ${
|
|
134
|
+
top: l.top + "px",
|
|
135
|
+
left: l.left + "px",
|
|
136
|
+
maxHeight: `calc(100dvh - ${l.top}px - 0.5rem)`
|
|
137
137
|
}));
|
|
138
|
-
return (u, b) => (n(),
|
|
139
|
-
e.mobile ? (n(),
|
|
138
|
+
return (u, b) => (n(), C(oe, { to: "body" }, [
|
|
139
|
+
e.mobile ? (n(), k("div", {
|
|
140
140
|
key: 0,
|
|
141
141
|
class: "phila-filter-chip-sheet__scrim",
|
|
142
|
-
onClick: b[0] || (b[0] = (
|
|
142
|
+
onClick: b[0] || (b[0] = (z) => o("close"))
|
|
143
143
|
})) : V("", !0),
|
|
144
144
|
T("div", {
|
|
145
145
|
id: e.menuId,
|
|
@@ -148,51 +148,51 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
148
148
|
"aria-label": e.label,
|
|
149
149
|
style: Q(e.mobile ? void 0 : O.value)
|
|
150
150
|
}, [
|
|
151
|
-
e.mobile ? (n(),
|
|
151
|
+
e.mobile ? (n(), k("header", xe, [
|
|
152
152
|
T("span", ge, L(e.label), 1),
|
|
153
153
|
T("button", {
|
|
154
154
|
type: "button",
|
|
155
155
|
class: "phila-filter-chip-sheet__close",
|
|
156
156
|
"aria-label": "Close",
|
|
157
|
-
onClick: b[1] || (b[1] = (
|
|
157
|
+
onClick: b[1] || (b[1] = (z) => o("close"))
|
|
158
158
|
}, " ✕ ")
|
|
159
159
|
])) : V("", !0),
|
|
160
160
|
T("div", {
|
|
161
161
|
class: j(e.mobile ? "phila-filter-chip-sheet__body" : "phila-filter-chip-panel__body")
|
|
162
162
|
}, [
|
|
163
|
-
e.multiple ? (n(),
|
|
163
|
+
e.multiple ? (n(), C(p(me), {
|
|
164
164
|
key: 0,
|
|
165
165
|
"group-label": e.label,
|
|
166
|
-
choices:
|
|
166
|
+
choices: w.value,
|
|
167
167
|
"model-value": c.value,
|
|
168
168
|
"onUpdate:modelValue": v
|
|
169
|
-
}, null, 8, ["group-label", "choices", "model-value"])) : (n(),
|
|
169
|
+
}, null, 8, ["group-label", "choices", "model-value"])) : (n(), C(p(pe), {
|
|
170
170
|
key: 1,
|
|
171
171
|
"group-label": e.label,
|
|
172
|
-
choices:
|
|
172
|
+
choices: w.value,
|
|
173
173
|
"model-value": c.value,
|
|
174
174
|
"onUpdate:modelValue": v
|
|
175
175
|
}, null, 8, ["group-label", "choices", "model-value"]))
|
|
176
176
|
], 2),
|
|
177
|
-
e.mobile ? (n(),
|
|
177
|
+
e.mobile ? (n(), k("div", ke, [
|
|
178
178
|
P(p(M), {
|
|
179
179
|
variant: "secondary",
|
|
180
180
|
text: e.resetText,
|
|
181
181
|
onClick: h
|
|
182
182
|
}, null, 8, ["text"]),
|
|
183
|
-
e.showActions ? (n(),
|
|
183
|
+
e.showActions ? (n(), C(p(M), {
|
|
184
184
|
key: 0,
|
|
185
185
|
variant: "primary",
|
|
186
186
|
text: y.value,
|
|
187
187
|
onClick: I
|
|
188
188
|
}, null, 8, ["text"])) : V("", !0)
|
|
189
|
-
])) : (n(),
|
|
189
|
+
])) : (n(), k("div", Ce, [
|
|
190
190
|
T("button", {
|
|
191
191
|
type: "button",
|
|
192
192
|
class: "phila-filter-chip-panel__reset has-text-body-small",
|
|
193
193
|
onClick: h
|
|
194
194
|
}, L(e.resetText), 1),
|
|
195
|
-
e.showActions ? (n(),
|
|
195
|
+
e.showActions ? (n(), C(p(M), {
|
|
196
196
|
key: 0,
|
|
197
197
|
variant: "primary",
|
|
198
198
|
size: "small",
|
|
@@ -207,13 +207,13 @@ import './index.css';const he = ["aria-pressed", "aria-expanded"], q = "xxsmall"
|
|
|
207
207
|
function ze() {
|
|
208
208
|
const e = $(typeof window < "u" && window.matchMedia(K).matches);
|
|
209
209
|
let r = null;
|
|
210
|
-
function
|
|
210
|
+
function l(o) {
|
|
211
211
|
e.value = o.matches;
|
|
212
212
|
}
|
|
213
213
|
return G(() => {
|
|
214
|
-
r = window.matchMedia(K), e.value = r.matches, r.addEventListener("change",
|
|
214
|
+
r = window.matchMedia(K), e.value = r.matches, r.addEventListener("change", l);
|
|
215
215
|
}), W(() => {
|
|
216
|
-
r?.removeEventListener("change",
|
|
216
|
+
r?.removeEventListener("change", l);
|
|
217
217
|
}), { isMobile: e };
|
|
218
218
|
}
|
|
219
219
|
let Be = 0;
|
|
@@ -236,25 +236,25 @@ const Ve = /* @__PURE__ */ R({
|
|
|
236
236
|
resetText: { default: "Reset" },
|
|
237
237
|
className: {}
|
|
238
238
|
},
|
|
239
|
-
emits: ["update:selected", "update:modelValue", "click"],
|
|
239
|
+
emits: ["update:selected", "update:modelValue", "click", "close"],
|
|
240
240
|
setup(e, { emit: r }) {
|
|
241
|
-
const
|
|
242
|
-
() => !d.value && !!
|
|
241
|
+
const l = e, o = r, d = m(() => Array.isArray(l.choices)), f = ie(), c = m(
|
|
242
|
+
() => !d.value && !!l.icon && !l.text && !l.label && !f.default
|
|
243
243
|
);
|
|
244
244
|
function x(i) {
|
|
245
|
-
o("update:selected", !
|
|
245
|
+
o("update:selected", !l.selected), o("click", i);
|
|
246
246
|
}
|
|
247
|
-
const y = `phila-filter-chip-${ae()}-${++Be}`, { isVisible:
|
|
247
|
+
const y = `phila-filter-chip-${ae()}-${++Be}`, { isVisible: w, setVisibility: v } = ue({
|
|
248
248
|
id: y,
|
|
249
249
|
group: "phila-filter-chip",
|
|
250
250
|
outsideClickHide: !0,
|
|
251
251
|
escapeKeyHide: !0,
|
|
252
252
|
showSingle: !0
|
|
253
|
-
}), h = m(() =>
|
|
254
|
-
const i =
|
|
253
|
+
}), h = m(() => w(y)), { isMobile: I } = ze(), O = $(null), u = $(0), b = $(0), z = m(() => {
|
|
254
|
+
const i = l.choices ?? [], B = l.modelValue ?? {};
|
|
255
255
|
return Object.fromEntries(i.map((E) => [E.value, !!B[E.value]]));
|
|
256
|
-
}), A = m(() => Object.values(
|
|
257
|
-
const i =
|
|
256
|
+
}), A = m(() => Object.values(z.value).filter(Boolean).length), S = m(() => A.value > 0), a = m(() => {
|
|
257
|
+
const i = l.label ?? l.text ?? "";
|
|
258
258
|
return A.value > 0 ? `${i} (${A.value})` : i;
|
|
259
259
|
});
|
|
260
260
|
function s() {
|
|
@@ -263,15 +263,15 @@ const Ve = /* @__PURE__ */ R({
|
|
|
263
263
|
const B = i.getBoundingClientRect();
|
|
264
264
|
u.value = B.bottom + 4, b.value = B.left;
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function t(i) {
|
|
267
267
|
if (!h.value) return;
|
|
268
268
|
const B = document.getElementById(y), E = i.target;
|
|
269
269
|
B && E && B.contains(E) || v(!1);
|
|
270
270
|
}
|
|
271
271
|
N(h, (i) => {
|
|
272
|
-
i && !I.value ? window.addEventListener("scroll",
|
|
272
|
+
i && !I.value ? window.addEventListener("scroll", t, { capture: !0 }) : window.removeEventListener("scroll", t, { capture: !0 }), i || o("close");
|
|
273
273
|
});
|
|
274
|
-
function
|
|
274
|
+
function g() {
|
|
275
275
|
const i = !h.value;
|
|
276
276
|
i && !I.value && s(), v(i);
|
|
277
277
|
}
|
|
@@ -281,12 +281,12 @@ const Ve = /* @__PURE__ */ R({
|
|
|
281
281
|
function F(i) {
|
|
282
282
|
o("update:modelValue", i), v(!1);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
o("update:modelValue", Object.fromEntries((
|
|
284
|
+
function te() {
|
|
285
|
+
o("update:modelValue", Object.fromEntries((l.choices ?? []).map((i) => [i.value, !1])));
|
|
286
286
|
}
|
|
287
287
|
return G(() => {
|
|
288
|
-
d.value && o("update:modelValue",
|
|
289
|
-
}), (i, B) => d.value ? (n(),
|
|
288
|
+
d.value && o("update:modelValue", z.value);
|
|
289
|
+
}), (i, B) => d.value ? (n(), k(_, { key: 0 }, [
|
|
290
290
|
P(H, {
|
|
291
291
|
ref_key: "triggerRef",
|
|
292
292
|
ref: O,
|
|
@@ -299,15 +299,15 @@ const Ve = /* @__PURE__ */ R({
|
|
|
299
299
|
chevron: "",
|
|
300
300
|
"aria-expanded": h.value,
|
|
301
301
|
"data-toggle": `visibility-${y}`,
|
|
302
|
-
onClick:
|
|
302
|
+
onClick: g
|
|
303
303
|
}, null, 8, ["text", "size", "color", "icon", "icon-color", "active", "aria-expanded", "data-toggle"]),
|
|
304
|
-
h.value ? (n(),
|
|
304
|
+
h.value ? (n(), C(we, {
|
|
305
305
|
key: 0,
|
|
306
306
|
"menu-id": y,
|
|
307
307
|
label: e.label ?? e.text ?? "",
|
|
308
308
|
choices: e.choices,
|
|
309
309
|
multiple: e.multiple,
|
|
310
|
-
value:
|
|
310
|
+
value: z.value,
|
|
311
311
|
"show-actions": e.showActions,
|
|
312
312
|
top: u.value,
|
|
313
313
|
left: b.value,
|
|
@@ -316,10 +316,10 @@ const Ve = /* @__PURE__ */ R({
|
|
|
316
316
|
"reset-text": e.resetText,
|
|
317
317
|
"onUpdate:modelValue": U,
|
|
318
318
|
onApply: F,
|
|
319
|
-
onReset:
|
|
319
|
+
onReset: te,
|
|
320
320
|
onClose: B[0] || (B[0] = (E) => p(v)(!1))
|
|
321
321
|
}, null, 8, ["label", "choices", "multiple", "value", "show-actions", "top", "left", "mobile", "apply-text", "reset-text"])) : V("", !0)
|
|
322
|
-
], 64)) : (n(),
|
|
322
|
+
], 64)) : (n(), C(H, {
|
|
323
323
|
key: 1,
|
|
324
324
|
size: e.size,
|
|
325
325
|
color: e.color,
|
|
@@ -342,14 +342,14 @@ const Ve = /* @__PURE__ */ R({
|
|
|
342
342
|
}), $e = 5;
|
|
343
343
|
function Ie() {
|
|
344
344
|
const e = $(null), r = $(!1);
|
|
345
|
-
let
|
|
345
|
+
let l = !1, o = 0, d = 0, f = !1, c = null;
|
|
346
346
|
const x = (v) => {
|
|
347
|
-
e.value && v.pointerType !== "mouse" && (
|
|
347
|
+
e.value && v.pointerType !== "mouse" && (l = !0, f = !1, o = v.clientX, d = e.value.scrollLeft);
|
|
348
348
|
}, y = (v) => {
|
|
349
|
-
if (!
|
|
349
|
+
if (!l || !e.value) return;
|
|
350
350
|
const h = v.clientX - o;
|
|
351
351
|
!f && Math.abs(h) > $e && (f = !0, r.value = !0, e.value.setPointerCapture(v.pointerId), c = v.pointerId), f && (e.value.scrollLeft = d - h);
|
|
352
|
-
},
|
|
352
|
+
}, w = () => {
|
|
353
353
|
if (e.value && c !== null) {
|
|
354
354
|
try {
|
|
355
355
|
e.value.releasePointerCapture(c);
|
|
@@ -357,16 +357,16 @@ function Ie() {
|
|
|
357
357
|
}
|
|
358
358
|
c = null;
|
|
359
359
|
}
|
|
360
|
-
|
|
360
|
+
l = !1, f && setTimeout(() => r.value = !1, 0);
|
|
361
361
|
};
|
|
362
|
-
return W(
|
|
362
|
+
return W(w), {
|
|
363
363
|
el: e,
|
|
364
364
|
suppressClick: r,
|
|
365
365
|
dragHandlers: {
|
|
366
366
|
onPointerdown: x,
|
|
367
367
|
onPointermove: y,
|
|
368
|
-
onPointerup:
|
|
369
|
-
onPointerleave:
|
|
368
|
+
onPointerup: w,
|
|
369
|
+
onPointerleave: w
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
}
|
|
@@ -386,42 +386,42 @@ const Te = {
|
|
|
386
386
|
elevated: { type: Boolean, default: !1 },
|
|
387
387
|
className: {}
|
|
388
388
|
},
|
|
389
|
-
emits: ["update:modelValue", "open-filters"],
|
|
389
|
+
emits: ["update:modelValue", "open-filters", "dropdown-close"],
|
|
390
390
|
setup(e, { emit: r }) {
|
|
391
|
-
const
|
|
391
|
+
const l = e, o = r, d = m(() => {
|
|
392
392
|
let a = 0;
|
|
393
|
-
for (const s of
|
|
393
|
+
for (const s of l.filters) {
|
|
394
394
|
if (s.excludeFromCount) continue;
|
|
395
|
-
const
|
|
396
|
-
|
|
395
|
+
const t = l.modelValue[s.key];
|
|
396
|
+
t && typeof t == "object" ? a += Object.values(t).filter(Boolean).length : t === !0 && (a += 1);
|
|
397
397
|
}
|
|
398
398
|
return a;
|
|
399
399
|
}), f = m(
|
|
400
|
-
() => d.value > 0 ? `${
|
|
401
|
-
), { el: c, suppressClick: x, dragHandlers: y } = Ie(),
|
|
400
|
+
() => d.value > 0 ? `${l.filterButtonText} (${d.value})` : l.filterButtonText
|
|
401
|
+
), { el: c, suppressClick: x, dragHandlers: y } = Ie(), w = m(() => ee("phila-filter-chip-group", l.elevated && "is-elevated", l.className));
|
|
402
402
|
function v(a) {
|
|
403
403
|
return Array.isArray(a.choices);
|
|
404
404
|
}
|
|
405
405
|
function h(a) {
|
|
406
406
|
const s = {};
|
|
407
|
-
for (const
|
|
408
|
-
const
|
|
409
|
-
if (Array.isArray(
|
|
410
|
-
const U =
|
|
411
|
-
s[
|
|
407
|
+
for (const t of l.filters) {
|
|
408
|
+
const g = a[t.key];
|
|
409
|
+
if (Array.isArray(t.choices) && t.choices.length > 0) {
|
|
410
|
+
const U = g && typeof g == "object" ? g : {};
|
|
411
|
+
s[t.key] = Object.fromEntries(t.choices.map((F) => [F.value, !!U[F.value]]));
|
|
412
412
|
} else
|
|
413
|
-
s[
|
|
413
|
+
s[t.key] = g === !0;
|
|
414
414
|
}
|
|
415
415
|
return s;
|
|
416
416
|
}
|
|
417
417
|
function I(a, s) {
|
|
418
|
-
o("update:modelValue", h({ ...
|
|
418
|
+
o("update:modelValue", h({ ...l.modelValue, [a]: s }));
|
|
419
419
|
}
|
|
420
420
|
function O(a) {
|
|
421
421
|
x.value && (a.stopPropagation(), a.preventDefault());
|
|
422
422
|
}
|
|
423
423
|
const u = $(!1), b = $(!1);
|
|
424
|
-
function
|
|
424
|
+
function z() {
|
|
425
425
|
const a = c.value;
|
|
426
426
|
a && (u.value = a.scrollLeft > 1, b.value = a.scrollLeft + a.clientWidth < a.scrollWidth - 1);
|
|
427
427
|
}
|
|
@@ -431,23 +431,23 @@ const Te = {
|
|
|
431
431
|
}
|
|
432
432
|
let S = null;
|
|
433
433
|
return G(() => {
|
|
434
|
-
o("update:modelValue", h(
|
|
434
|
+
o("update:modelValue", h(l.modelValue)), X(z), c.value && (S = new ResizeObserver(() => z()), S.observe(c.value));
|
|
435
435
|
}), W(() => {
|
|
436
436
|
S?.disconnect(), S = null;
|
|
437
437
|
}), N(
|
|
438
|
-
() =>
|
|
439
|
-
() => X(
|
|
440
|
-
), (a, s) => (n(),
|
|
441
|
-
class: j(
|
|
438
|
+
() => l.filters,
|
|
439
|
+
() => X(z)
|
|
440
|
+
), (a, s) => (n(), k("div", {
|
|
441
|
+
class: j(w.value)
|
|
442
442
|
}, [
|
|
443
|
-
e.label ? (n(),
|
|
443
|
+
e.label ? (n(), k("span", Te, L(e.label), 1)) : V("", !0),
|
|
444
444
|
T("div", Oe, [
|
|
445
|
-
u.value ? (n(),
|
|
445
|
+
u.value ? (n(), k("button", {
|
|
446
446
|
key: 0,
|
|
447
447
|
type: "button",
|
|
448
448
|
class: "phila-filter-chip-group__arrow phila-filter-chip-group__arrow--left",
|
|
449
449
|
"aria-label": "Scroll filters left",
|
|
450
|
-
onClick: s[0] || (s[0] = (
|
|
450
|
+
onClick: s[0] || (s[0] = (t) => A(-1))
|
|
451
451
|
}, [
|
|
452
452
|
P(p(D), {
|
|
453
453
|
icon: p(de),
|
|
@@ -462,9 +462,9 @@ const Te = {
|
|
|
462
462
|
class: "phila-filter-chip-group__row"
|
|
463
463
|
}, p(y), {
|
|
464
464
|
onClickCapture: O,
|
|
465
|
-
onScroll:
|
|
465
|
+
onScroll: z
|
|
466
466
|
}), [
|
|
467
|
-
e.filterButton ? (n(),
|
|
467
|
+
e.filterButton ? (n(), C(H, {
|
|
468
468
|
key: 0,
|
|
469
469
|
size: e.size,
|
|
470
470
|
color: e.color,
|
|
@@ -472,31 +472,32 @@ const Te = {
|
|
|
472
472
|
text: f.value,
|
|
473
473
|
active: d.value > 0,
|
|
474
474
|
"aria-label": f.value,
|
|
475
|
-
onClick: s[1] || (s[1] = (
|
|
475
|
+
onClick: s[1] || (s[1] = (t) => o("open-filters"))
|
|
476
476
|
}, null, 8, ["size", "color", "icon", "text", "active", "aria-label"])) : V("", !0),
|
|
477
|
-
(n(!0),
|
|
478
|
-
key:
|
|
479
|
-
label:
|
|
480
|
-
text:
|
|
477
|
+
(n(!0), k(_, null, ce(e.filters, (t) => (n(), C(Ve, {
|
|
478
|
+
key: t.key,
|
|
479
|
+
label: t.label,
|
|
480
|
+
text: t.label,
|
|
481
481
|
size: e.size,
|
|
482
482
|
color: e.color,
|
|
483
|
-
icon:
|
|
484
|
-
"icon-color":
|
|
485
|
-
choices:
|
|
486
|
-
multiple:
|
|
487
|
-
"show-actions":
|
|
488
|
-
"model-value": v(
|
|
489
|
-
selected: !v(
|
|
490
|
-
"onUpdate:modelValue": (
|
|
491
|
-
"onUpdate:selected": (
|
|
492
|
-
|
|
483
|
+
icon: t.icon,
|
|
484
|
+
"icon-color": t.iconColor,
|
|
485
|
+
choices: t.choices,
|
|
486
|
+
multiple: t.multiple,
|
|
487
|
+
"show-actions": t.showActions,
|
|
488
|
+
"model-value": v(t) ? e.modelValue[t.key] : void 0,
|
|
489
|
+
selected: !v(t) && e.modelValue[t.key] === !0,
|
|
490
|
+
"onUpdate:modelValue": (g) => I(t.key, g),
|
|
491
|
+
"onUpdate:selected": (g) => I(t.key, g),
|
|
492
|
+
onClose: (g) => o("dropdown-close", t.key)
|
|
493
|
+
}, null, 8, ["label", "text", "size", "color", "icon", "icon-color", "choices", "multiple", "show-actions", "model-value", "selected", "onUpdate:modelValue", "onUpdate:selected", "onClose"]))), 128))
|
|
493
494
|
], 16),
|
|
494
|
-
b.value ? (n(),
|
|
495
|
+
b.value ? (n(), k("button", {
|
|
495
496
|
key: 1,
|
|
496
497
|
type: "button",
|
|
497
498
|
class: "phila-filter-chip-group__arrow phila-filter-chip-group__arrow--right",
|
|
498
499
|
"aria-label": "Scroll filters right",
|
|
499
|
-
onClick: s[2] || (s[2] = (
|
|
500
|
+
onClick: s[2] || (s[2] = (t) => A(1))
|
|
500
501
|
}, [
|
|
501
502
|
P(p(D), {
|
|
502
503
|
icon: p(ve),
|
|
@@ -508,7 +509,7 @@ const Te = {
|
|
|
508
509
|
])
|
|
509
510
|
], 2));
|
|
510
511
|
}
|
|
511
|
-
}), De = /* @__PURE__ */
|
|
512
|
+
}), De = /* @__PURE__ */ le(Ae, [["__scopeId", "data-v-6db1a7a1"]]);
|
|
512
513
|
export {
|
|
513
514
|
Ve as FilterChip,
|
|
514
515
|
De as FilterChipGroup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-filter-chip",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Filter chips for faceted filtering",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"vue": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@phila/phila-ui-core": "3.0.0-beta.9",
|
|
32
31
|
"@phila/phila-ui-radio": "1.0.0-beta.12",
|
|
32
|
+
"@phila/phila-ui-core": "3.0.0-beta.9",
|
|
33
33
|
"@phila/phila-ui-checkbox": "1.0.0-beta.12",
|
|
34
34
|
"@phila/phila-ui-button": "2.3.0-beta.10"
|
|
35
35
|
},
|