@leavepulse/ui 0.74.2 → 0.76.0
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 +44 -0
- package/dist/assets/{LpShortcutsDialog-BUp_BX4s.css → LpShortcutsDialog-C6uzPeMf.css} +7 -7
- package/dist/assets/{LpTable-DHvorDiU.css → LpTable-Bv-EcQs7.css} +19 -19
- package/dist/assets/LpTabs-CJ0rYQbx.css +18 -0
- package/dist/chunks/{LpAddressInput-Al3HT5ey.js → LpAddressInput-De_LTYM7.js} +1 -1
- package/dist/chunks/{LpAppShell-CpSSm5WT.js → LpAppShell-Cpy_t1U_.js} +1 -1
- package/dist/chunks/{LpConfirmDialog-DY2VjDji.js → LpConfirmDialog-CphJR6Q9.js} +4 -2
- package/dist/chunks/{LpConfirmHost-DvSZTJ4N.js → LpConfirmHost-QSJ0zl63.js} +1 -1
- package/dist/chunks/{LpDrawer-RRamxbLV.js → LpDrawer-DQZixOqJ.js} +13 -0
- package/dist/chunks/{LpModal-BnjZ2iem.js → LpModal-C0tGg_D_.js} +13 -0
- package/dist/chunks/{LpModalNav-DQpV2kdn.js → LpModalNav-iDDtT9c1.js} +2 -2
- package/dist/chunks/{LpSidebar-BoNLKgh-.js → LpSidebar-D6zO8vLm.js} +1 -1
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpConfirmDialog.vue.d.ts +4 -0
- package/dist/components/LpConfirmDialog.vue.js +1 -1
- package/dist/components/LpConfirmHost.vue.js +1 -1
- package/dist/components/LpDrawer.vue.d.ts +16 -0
- package/dist/components/LpDrawer.vue.js +1 -1
- package/dist/components/LpModal.vue.d.ts +9 -0
- package/dist/components/LpModal.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpShortcutsDialog.vue.d.ts +4 -0
- package/dist/components/LpShortcutsDialog.vue.js +6 -4
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/LpTable.vue.d.ts +37 -0
- package/dist/components/LpTable.vue.js +34 -15
- package/dist/components/LpTabs.vue.d.ts +9 -0
- package/dist/components/LpTabs.vue.js +18 -4
- package/dist/components/tableFilter.d.ts +28 -0
- package/dist/components/tableFilter.js +43 -0
- package/dist/composables/overlayHistory.d.ts +33 -0
- package/dist/composables/overlayHistory.js +237 -0
- package/dist/composables/useOverlayHistory.d.ts +45 -0
- package/dist/composables/useOverlayHistory.js +84 -0
- package/dist/composables/useTableFilterChoice.d.ts +16 -0
- package/dist/composables/useTableFilterChoice.js +34 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -8
- package/package.json +2 -1
- package/src/components/LpConfirmDialog.vue +5 -1
- package/src/components/LpDrawer.vue +21 -0
- package/src/components/LpModal.vue +21 -1
- package/src/components/LpShortcutsDialog.vue +5 -1
- package/src/components/LpTable.vue +86 -23
- package/src/components/LpTabs.vue +26 -2
- package/src/components/tableFilter.ts +66 -0
- package/src/composables/overlayHistory.ts +381 -0
- package/src/composables/useOverlayHistory.ts +173 -0
- package/src/composables/useTableFilterChoice.ts +51 -0
- package/src/index.ts +6 -0
- package/dist/assets/LpTabs-CDchzoRL.css +0 -18
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { computed, toValue, type MaybeRefOrGetter, type Ref, type WritableComputedRef } from "vue"
|
|
2
|
+
import { shownValues, showOnly, type TableFilters } from "../components/tableFilter"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One column of LpTable's header filters as a single choice, for a control
|
|
6
|
+
* above the table (LpSegmented, LpSelect, a row of stat tiles) that filters
|
|
7
|
+
* the same thing as the column's funnel. Both then read and write one state:
|
|
8
|
+
* picking a choice sets the funnel, and narrowing the funnel to a choice's
|
|
9
|
+
* values lights that choice up.
|
|
10
|
+
*
|
|
11
|
+
* `choices` maps each choice to the values it shows; `null` is the choice
|
|
12
|
+
* that shows everything. `values` is the column's vocabulary, by default every
|
|
13
|
+
* value the choices name. The ref reads `undefined` while the funnel holds a
|
|
14
|
+
* mix no choice describes, so the control shows nothing picked rather than a
|
|
15
|
+
* choice that is not what the table shows.
|
|
16
|
+
*/
|
|
17
|
+
export function useTableFilterChoice<C extends string>(
|
|
18
|
+
filters: Ref<TableFilters>,
|
|
19
|
+
column: string,
|
|
20
|
+
choices: Record<C, readonly unknown[] | null>,
|
|
21
|
+
values?: MaybeRefOrGetter<readonly unknown[]>,
|
|
22
|
+
): WritableComputedRef<C | undefined> {
|
|
23
|
+
const entries = Object.entries(choices) as [C, readonly unknown[] | null][]
|
|
24
|
+
const vocabulary = computed(() => {
|
|
25
|
+
const own = values === undefined ? undefined : toValue(values)
|
|
26
|
+
return own ?? [...new Set(entries.flatMap(([, shown]) => shown ?? []))]
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return computed({
|
|
30
|
+
get: () => {
|
|
31
|
+
const all = vocabulary.value
|
|
32
|
+
const shown = new Set(shownValues(all, filters.value[column]))
|
|
33
|
+
for (const [choice, keep] of entries) {
|
|
34
|
+
if (keep === null) {
|
|
35
|
+
if (shown.size === all.length) return choice
|
|
36
|
+
continue
|
|
37
|
+
}
|
|
38
|
+
if (keep.length === shown.size && keep.every((v) => shown.has(v))) return choice
|
|
39
|
+
}
|
|
40
|
+
return undefined
|
|
41
|
+
},
|
|
42
|
+
set: (choice) => {
|
|
43
|
+
const keep = choice === undefined ? null : choices[choice]
|
|
44
|
+
const hidden = keep === null ? [] : showOnly(vocabulary.value, keep)
|
|
45
|
+
const next = { ...filters.value }
|
|
46
|
+
delete next[column]
|
|
47
|
+
if (hidden.length) next[column] = hidden
|
|
48
|
+
filters.value = next
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -220,6 +220,9 @@ export type { SortState, TableColumn, TablePage, TableQuery } from "./components
|
|
|
220
220
|
export type { TableLabels } from "./components/LpTable.vue"
|
|
221
221
|
export type { TableExportOptions } from "./components/LpTable.vue"
|
|
222
222
|
export { compareValues } from "./components/tableSort"
|
|
223
|
+
export { filterRows, showOnly, shownValues } from "./components/tableFilter"
|
|
224
|
+
export type { TableFilters } from "./components/tableFilter"
|
|
225
|
+
export { useTableFilterChoice } from "./composables/useTableFilterChoice"
|
|
223
226
|
export { resolveRowMenu } from "./components/tableRowMenu"
|
|
224
227
|
export type { TableRowMenu, TableRowMenuResult } from "./components/tableRowMenu"
|
|
225
228
|
export { default as LpTableOfContents } from "./components/LpTableOfContents.vue"
|
|
@@ -355,6 +358,9 @@ export type { UseGamepadNavOptions } from "./composables/useGamepadNav"
|
|
|
355
358
|
export { focusableIn, nextInDirection } from "./composables/spatialNav"
|
|
356
359
|
export type { Box, Direction } from "./composables/spatialNav"
|
|
357
360
|
export { provideGlass, useGlass } from "./composables/useGlass"
|
|
361
|
+
export { provideOverlayHistory, useOverlayHistory, useStepHistory } from "./composables/useOverlayHistory"
|
|
362
|
+
export type { OverlayHistoryMode, OverlayHistoryOptions, ProvideOverlayHistoryOptions, StepHistoryOptions } from "./composables/useOverlayHistory"
|
|
363
|
+
export type { HistoryRouter } from "./composables/overlayHistory"
|
|
358
364
|
export { LP_CONFIG, lpConfig, mergeConfig, provideLpConfig, useLabels, useLinkComponent, useLpConfig } from "./composables/useLpConfig"
|
|
359
365
|
export type { KitStorage, LabelScope, LpConfig } from "./composables/useLpConfig"
|
|
360
366
|
export { browserStorage, useKitStorage, usePersisted } from "./composables/usePersisted"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.lp-tab-badge-enter-active[data-v-9f51a497],
|
|
3
|
-
.lp-tab-badge-leave-active[data-v-9f51a497] {
|
|
4
|
-
transition:
|
|
5
|
-
opacity var(--duration-fast) var(--ease-emphasized),
|
|
6
|
-
transform var(--duration-fast) var(--ease-emphasized);
|
|
7
|
-
}
|
|
8
|
-
.lp-tab-badge-enter-from[data-v-9f51a497],
|
|
9
|
-
.lp-tab-badge-leave-to[data-v-9f51a497] {
|
|
10
|
-
opacity: 0;
|
|
11
|
-
transform: scale(0.6);
|
|
12
|
-
}
|
|
13
|
-
@media (prefers-reduced-motion: reduce) {
|
|
14
|
-
.lp-tab-badge-enter-active[data-v-9f51a497],
|
|
15
|
-
.lp-tab-badge-leave-active[data-v-9f51a497] {
|
|
16
|
-
transition: none;
|
|
17
|
-
}
|
|
18
|
-
}
|