@leavepulse/ui 0.37.10 → 0.38.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/dist/assets/LpCommandPalette-C0yStVNy.css +21 -0
- package/dist/chunks/LpSwitch-Blizvqyt.js +94 -0
- package/dist/components/LpCommandPalette.vue.d.ts +87 -1
- package/dist/components/LpCommandPalette.vue.js +410 -121
- package/dist/components/LpSwitch.vue.d.ts +31 -2
- package/dist/components/LpSwitch.vue.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/LpCommandPalette.vue +492 -76
- package/src/components/LpSwitch.vue +55 -10
- package/src/tokens/tokens.css +21 -0
- package/dist/assets/LpCommandPalette-B-g1fa8r.css +0 -16
- package/dist/chunks/LpSwitch-xgnRU2k0.js +0 -35
|
@@ -6,28 +6,73 @@ export default { inheritAttrs: false }
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
+
import { computed, useSlots } from "vue"
|
|
9
10
|
import { SwitchRoot, SwitchThumb } from "reka-ui"
|
|
10
11
|
import { useMergedAttrs } from "../composables/useMergedClass"
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const props = withDefaults(
|
|
14
|
+
defineProps<{
|
|
15
|
+
modelValue?: boolean
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
label?: string
|
|
18
|
+
/** Secondary line under the label. */
|
|
19
|
+
description?: string
|
|
20
|
+
/**
|
|
21
|
+
* Where the text sits. `end` (default) reads like LpCheckbox: switch, then
|
|
22
|
+
* text. `start` is the settings-row shape: text on the left, the switch
|
|
23
|
+
* pushed to the right edge of the row.
|
|
24
|
+
*/
|
|
25
|
+
labelPosition?: "start" | "end"
|
|
26
|
+
}>(),
|
|
27
|
+
{ labelPosition: "end" },
|
|
18
28
|
)
|
|
29
|
+
const emit = defineEmits<{ (e: "update:modelValue", value: boolean): void }>()
|
|
30
|
+
|
|
31
|
+
const slots = useSlots()
|
|
32
|
+
const labelled = computed(() => Boolean(props.label || props.description || slots.default))
|
|
33
|
+
|
|
34
|
+
const TRACK =
|
|
35
|
+
"group inline-flex h-5 w-9 shrink-0 items-center rounded-pill border border-line bg-surface-soft px-0.5 outline-none transition-colors duration-[var(--duration-fast)] focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-transparent data-[state=checked]:bg-brand disabled:cursor-not-allowed disabled:opacity-55"
|
|
36
|
+
const THUMB =
|
|
37
|
+
"h-3.5 w-3.5 rounded-full bg-ink shadow transition-[translate,width,background-color] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:w-5 group-data-[state=checked]:translate-x-4 group-data-[state=checked]:bg-ink-inverse group-data-[state=checked]:group-active:-translate-x-1 motion-reduce:group-active:w-3.5"
|
|
38
|
+
|
|
39
|
+
// Bare, the switch is the root, so a consumer asking for a bigger track must not
|
|
40
|
+
// have to depend on stylesheet order to get it. With text, the row is the root
|
|
41
|
+
// and the consumer's class lays out the row, as on LpCheckbox.
|
|
42
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs(() => {
|
|
43
|
+
if (!labelled.value) return TRACK
|
|
44
|
+
return props.labelPosition === "start"
|
|
45
|
+
? "flex w-full cursor-pointer items-center justify-between gap-3 text-sm text-ink"
|
|
46
|
+
: "inline-flex cursor-pointer items-center gap-2 text-sm text-ink"
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
function onUpdate(value: boolean) {
|
|
50
|
+
emit("update:modelValue", value)
|
|
51
|
+
}
|
|
19
52
|
</script>
|
|
20
53
|
|
|
21
54
|
<template>
|
|
55
|
+
<label v-if="labelled" :class="[rootClass, disabled && 'cursor-not-allowed']" v-bind="rest">
|
|
56
|
+
<span v-if="labelPosition === 'start'" class="flex min-w-0 flex-col">
|
|
57
|
+
<slot>{{ label }}</slot>
|
|
58
|
+
<span v-if="description" class="text-xs text-muted">{{ description }}</span>
|
|
59
|
+
</span>
|
|
60
|
+
<SwitchRoot :model-value="modelValue" :disabled="disabled" :class="TRACK" @update:model-value="onUpdate">
|
|
61
|
+
<SwitchThumb :class="THUMB" />
|
|
62
|
+
</SwitchRoot>
|
|
63
|
+
<span v-if="labelPosition === 'end'" class="flex min-w-0 flex-col">
|
|
64
|
+
<slot>{{ label }}</slot>
|
|
65
|
+
<span v-if="description" class="text-xs text-muted">{{ description }}</span>
|
|
66
|
+
</span>
|
|
67
|
+
</label>
|
|
22
68
|
<SwitchRoot
|
|
69
|
+
v-else
|
|
23
70
|
:model-value="modelValue"
|
|
24
71
|
:disabled="disabled"
|
|
25
72
|
:class="rootClass"
|
|
26
73
|
v-bind="rest"
|
|
27
|
-
@update:model-value="
|
|
74
|
+
@update:model-value="onUpdate"
|
|
28
75
|
>
|
|
29
|
-
<SwitchThumb
|
|
30
|
-
class="h-3.5 w-3.5 rounded-full bg-ink shadow transition-[translate,width,background-color] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:w-5 group-data-[state=checked]:translate-x-4 group-data-[state=checked]:bg-ink-inverse group-data-[state=checked]:group-active:-translate-x-1 motion-reduce:group-active:w-3.5"
|
|
31
|
-
/>
|
|
76
|
+
<SwitchThumb :class="THUMB" />
|
|
32
77
|
</SwitchRoot>
|
|
33
78
|
</template>
|
package/src/tokens/tokens.css
CHANGED
|
@@ -522,6 +522,27 @@
|
|
|
522
522
|
--scrim-opacity: 0.78;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
+
/*
|
|
526
|
+
* Frosted overlay: a floating panel that lets the page show through, softened.
|
|
527
|
+
* For surfaces that float over everything and are read briefly (the command
|
|
528
|
+
* palette), where a hint of what lies beneath says "this is on top, the page
|
|
529
|
+
* is still there" better than a solid slab. The fill keeps enough opacity for
|
|
530
|
+
* text to read without the blur; where the blur does not composite
|
|
531
|
+
* (WebKitGTK, see above) the fill turns solid instead of leaving the page
|
|
532
|
+
* readable through it.
|
|
533
|
+
*/
|
|
534
|
+
.lp-glass-overlay {
|
|
535
|
+
background-color: color-mix(in srgb, var(--color-surface-raised) var(--glass-overlay-fill, 82%), transparent);
|
|
536
|
+
-webkit-backdrop-filter: blur(var(--glass-overlay-blur, 24px)) saturate(140%);
|
|
537
|
+
backdrop-filter: blur(var(--glass-overlay-blur, 24px)) saturate(140%);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
:root[data-lp-no-backdrop] .lp-glass-overlay {
|
|
541
|
+
background-color: var(--color-surface-raised);
|
|
542
|
+
-webkit-backdrop-filter: none;
|
|
543
|
+
backdrop-filter: none;
|
|
544
|
+
}
|
|
545
|
+
|
|
525
546
|
/* The overlay gradient rides above the base fill but under the content. */
|
|
526
547
|
.lp-skin-panel::before {
|
|
527
548
|
content: "";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/* Each result eases in; honours reduced motion. */
|
|
3
|
-
.lp-cmd-item[data-v-dbc1130a] {
|
|
4
|
-
animation: lp-cmd-in-dbc1130a 140ms ease-out both;
|
|
5
|
-
}
|
|
6
|
-
@keyframes lp-cmd-in-dbc1130a {
|
|
7
|
-
from {
|
|
8
|
-
opacity: 0;
|
|
9
|
-
transform: translateY(3px);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
@media (prefers-reduced-motion: reduce) {
|
|
13
|
-
.lp-cmd-item[data-v-dbc1130a] {
|
|
14
|
-
animation: none;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, createVNode } from "vue";
|
|
2
|
-
import { SwitchRoot, SwitchThumb } from "reka-ui";
|
|
3
|
-
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
4
|
-
const __default__ = { inheritAttrs: false };
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
...__default__,
|
|
7
|
-
__name: "LpSwitch",
|
|
8
|
-
props: {
|
|
9
|
-
modelValue: { type: Boolean },
|
|
10
|
-
disabled: { type: Boolean }
|
|
11
|
-
},
|
|
12
|
-
emits: ["update:modelValue"],
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const { class: rootClass, attrs: rest } = useMergedAttrs(
|
|
15
|
-
"group inline-flex h-5 w-9 shrink-0 items-center rounded-pill border border-line bg-surface-soft px-0.5 outline-none transition-colors duration-[var(--duration-fast)] focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-transparent data-[state=checked]:bg-brand disabled:cursor-not-allowed disabled:opacity-55"
|
|
16
|
-
);
|
|
17
|
-
return (_ctx, _cache) => {
|
|
18
|
-
return openBlock(), createBlock(unref(SwitchRoot), mergeProps({
|
|
19
|
-
"model-value": __props.modelValue,
|
|
20
|
-
disabled: __props.disabled,
|
|
21
|
-
class: unref(rootClass)
|
|
22
|
-
}, unref(rest), {
|
|
23
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => _ctx.$emit("update:modelValue", v))
|
|
24
|
-
}), {
|
|
25
|
-
default: withCtx(() => [
|
|
26
|
-
createVNode(unref(SwitchThumb), { class: "h-3.5 w-3.5 rounded-full bg-ink shadow transition-[translate,width,background-color] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:w-5 group-data-[state=checked]:translate-x-4 group-data-[state=checked]:bg-ink-inverse group-data-[state=checked]:group-active:-translate-x-1 motion-reduce:group-active:w-3.5" })
|
|
27
|
-
]),
|
|
28
|
-
_: 1
|
|
29
|
-
}, 16, ["model-value", "disabled", "class"]);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
export {
|
|
34
|
-
_sfc_main as _
|
|
35
|
-
};
|