@threadlabs/looma 0.28.11 → 0.28.13
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/components/ui-editor-chip-editor/ui-editor-chip-editor.html +32 -0
- package/components/ui-editor-chip-editor/ui-editor-chip-editor.js +33 -0
- package/components/ui-radio-group/ui-radio-group.html +13 -1
- package/components/ui-swatch/ui-swatch.html +69 -0
- package/dist/index.js +38 -37
- package/editor/formatting-selection.d.ts +49 -0
- package/package.json +1 -1
- package/styles/ui-editor-chip-editor.css +1 -0
- package/styles/ui-radio-group.css +9 -0
- package/styles/ui-swatch.css +76 -0
- package/vanilla/UiEditorChipEditor.d.ts +18 -0
- package/vanilla/UiEditorChipEditor.js +45 -0
- package/vanilla/UiRadioGroup.d.ts +1 -0
- package/vanilla/UiRadioGroup.js +18 -13
- package/vanilla/UiSwatch.d.ts +14 -0
- package/vanilla/UiSwatch.js +54 -0
- package/vanilla/index.js +2 -0
- package/vue/UiEditorChipEditor.d.ts +45 -0
- package/vue/UiEditorChipEditor.js +2 -0
- package/vue/UiEditorChipEditor.vue +163 -0
- package/vue/UiRadioGroup.d.ts +9 -0
- package/vue/UiRadioGroup.vue +44 -2
- package/vue/UiSwatch.d.ts +16 -0
- package/vue/UiSwatch.js +2 -0
- package/vue/UiSwatch.vue +150 -0
- package/vue/chunks/UiEditorChipEditor.js +157 -0
- package/vue/chunks/UiEditorImageToolbar.js +2 -2
- package/vue/chunks/UiEditorLinkCard.js +1 -1
- package/vue/chunks/UiEditorLinkForm.js +2 -2
- package/vue/chunks/UiRadioGroup.js +26 -3
- package/vue/chunks/UiSwatch.js +78 -0
- package/vue/components.css +461 -443
- package/vue/editor/index.js +132 -109
- package/vue/editor/primitives.d.ts +9 -1
- package/vue/index.d.ts +2 -0
- package/vue/index.js +6 -4
package/vue/UiRadioGroup.vue
CHANGED
|
@@ -40,6 +40,15 @@ const propValidityContract = {
|
|
|
40
40
|
'The group\'s legend, shown above the radios and announced as the group\'s name. Phrase it as the question the radios answer.',
|
|
41
41
|
default: 'Options',
|
|
42
42
|
},
|
|
43
|
+
labelVisibility: {
|
|
44
|
+
type: { kind: 'terminal', name: 'keyword' },
|
|
45
|
+
required: false,
|
|
46
|
+
target: { attribute: 'labelvisibility' },
|
|
47
|
+
description:
|
|
48
|
+
'visible shows the legend; sr-only hides it visually but keeps it as the group\'s accessible name. Use sr-only only when the surrounding layout already makes\n the choice clear, as with a row of colour swatches.',
|
|
49
|
+
values: ['visible', 'sr-only'],
|
|
50
|
+
default: 'visible',
|
|
51
|
+
},
|
|
43
52
|
name: {
|
|
44
53
|
type: { kind: 'terminal', name: 'string' },
|
|
45
54
|
required: false,
|
|
@@ -79,6 +88,10 @@ const props = defineProps({
|
|
|
79
88
|
disabled: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
80
89
|
invalid: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
81
90
|
label: { type: null as unknown as PropType<string | null>, default: 'Options' },
|
|
91
|
+
labelVisibility: {
|
|
92
|
+
type: null as unknown as PropType<'visible' | 'sr-only' | null>,
|
|
93
|
+
default: 'visible',
|
|
94
|
+
},
|
|
82
95
|
name: { type: null as unknown as PropType<string | null>, default: '' },
|
|
83
96
|
orientation: {
|
|
84
97
|
type: null as unknown as PropType<'horizontal' | 'vertical' | null>,
|
|
@@ -91,6 +104,7 @@ const acceptedProps: Record<string, unknown> = {
|
|
|
91
104
|
disabled: false,
|
|
92
105
|
invalid: false,
|
|
93
106
|
label: 'Options',
|
|
107
|
+
labelVisibility: 'visible',
|
|
94
108
|
name: '',
|
|
95
109
|
orientation: 'horizontal',
|
|
96
110
|
required: false,
|
|
@@ -118,6 +132,13 @@ const checkedProps = computed(() => ({
|
|
|
118
132
|
'label',
|
|
119
133
|
acceptedProps,
|
|
120
134
|
) as string,
|
|
135
|
+
labelVisibility: checkedProp<'visible' | 'sr-only'>(
|
|
136
|
+
props['labelVisibility'],
|
|
137
|
+
{ kind: 'terminal', name: 'keyword' },
|
|
138
|
+
false,
|
|
139
|
+
'labelVisibility',
|
|
140
|
+
acceptedProps,
|
|
141
|
+
) as 'visible' | 'sr-only',
|
|
121
142
|
name: checkedProp<string>(
|
|
122
143
|
props['name'],
|
|
123
144
|
{ kind: 'terminal', name: 'string' },
|
|
@@ -239,7 +260,16 @@ useComponentHost(() => import('../components/ui-radio-group/ui-radio-group.js'),
|
|
|
239
260
|
? (incoming[name] ?? incoming[kebab] ?? null)
|
|
240
261
|
: null
|
|
241
262
|
},
|
|
242
|
-
propNames: [
|
|
263
|
+
propNames: [
|
|
264
|
+
'disabled',
|
|
265
|
+
'invalid',
|
|
266
|
+
'label',
|
|
267
|
+
'labelVisibility',
|
|
268
|
+
'name',
|
|
269
|
+
'orientation',
|
|
270
|
+
'required',
|
|
271
|
+
'value',
|
|
272
|
+
],
|
|
243
273
|
propValidity: (name: string) =>
|
|
244
274
|
propValidityState({ contract: propValidityContract, values: { ...props } }, name),
|
|
245
275
|
state: { internalValue },
|
|
@@ -258,6 +288,7 @@ useComponentHost(() => import('../components/ui-radio-group/ui-radio-group.js'),
|
|
|
258
288
|
:data-disabled="reflectedProp('disabled', 'disabled', checkedProps.disabled, undefined, false)"
|
|
259
289
|
:data-invalid="reflectedProp('invalid', 'invalid', checkedProps.invalid, undefined, false)"
|
|
260
290
|
:data-label="reflectedProp('label', 'label', checkedProps.label, undefined, false)"
|
|
291
|
+
:data-label-visibility="reflectedProp('labelVisibility', 'label-visibility', checkedProps.labelVisibility, undefined, false)"
|
|
261
292
|
:data-name="reflectedProp('name', 'name', checkedProps.name, undefined, false)"
|
|
262
293
|
:data-orientation="reflectedProp('orientation', 'orientation', checkedProps.orientation, undefined, false)"
|
|
263
294
|
:data-required="reflectedProp('required', 'required', checkedProps.required, undefined, false)"
|
|
@@ -265,7 +296,9 @@ useComponentHost(() => import('../components/ui-radio-group/ui-radio-group.js'),
|
|
|
265
296
|
:data-ui-radio-group-state="hostState || undefined"
|
|
266
297
|
ref="root"
|
|
267
298
|
>
|
|
268
|
-
<legend
|
|
299
|
+
<legend :class="{ 'sr-only': checkedProps.labelVisibility === 'sr-only' }">
|
|
300
|
+
{{ checkedProps.label }}
|
|
301
|
+
</legend>
|
|
269
302
|
<slot />
|
|
270
303
|
</fieldset>
|
|
271
304
|
</template>
|
|
@@ -306,6 +339,15 @@ useComponentHost(() => import('../components/ui-radio-group/ui-radio-group.js'),
|
|
|
306
339
|
clear: both;
|
|
307
340
|
}
|
|
308
341
|
|
|
342
|
+
legend.sr-only {
|
|
343
|
+
position: absolute;
|
|
344
|
+
inline-size: 1px;
|
|
345
|
+
block-size: 1px;
|
|
346
|
+
overflow: hidden;
|
|
347
|
+
clip-path: inset(50%);
|
|
348
|
+
white-space: nowrap;
|
|
349
|
+
}
|
|
350
|
+
|
|
309
351
|
:scope[data-ui-radio-group-state~="invalid"] legend {
|
|
310
352
|
color: var(--_ui-radio-group-invalid-text);
|
|
311
353
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
tone: {
|
|
4
|
+
type: PropType<"neutral" | "blue" | "green" | "yellow" | "red" | "purple" | null>;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
tone: {
|
|
9
|
+
type: PropType<"neutral" | "blue" | "green" | "yellow" | "red" | "purple" | null>;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
}>> & Readonly<{}>, {
|
|
13
|
+
tone: "blue" | "green" | "purple" | "red" | "yellow" | "neutral" | null;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
package/vue/UiSwatch.js
ADDED
package/vue/UiSwatch.vue
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!-- Generated by HTML Next 1.0.0-alpha.51 for Vue 3.5. Do not edit. -->
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import { computed, watchSyncEffect } from 'vue'
|
|
4
|
+
import type { PropType } from 'vue'
|
|
5
|
+
import {
|
|
6
|
+
attribute,
|
|
7
|
+
checkHydratedRoot,
|
|
8
|
+
cycleCheckedComputed,
|
|
9
|
+
nativeAttrs,
|
|
10
|
+
useReflectedProp,
|
|
11
|
+
} from './host'
|
|
12
|
+
import { checkedProp, vPropValidity } from './props'
|
|
13
|
+
|
|
14
|
+
defineOptions({ inheritAttrs: false })
|
|
15
|
+
|
|
16
|
+
const propValidityContract = {
|
|
17
|
+
props: {
|
|
18
|
+
tone: {
|
|
19
|
+
type: { kind: 'terminal', name: 'keyword' },
|
|
20
|
+
required: false,
|
|
21
|
+
target: { attribute: 'value' },
|
|
22
|
+
description:
|
|
23
|
+
'The swatch\'s colour, on the same tokens as editor chips. It is also the radio\'s value and, by name, its label.',
|
|
24
|
+
values: ['neutral', 'blue', 'green', 'yellow', 'red', 'purple'],
|
|
25
|
+
default: 'neutral',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as const
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
tone: {
|
|
31
|
+
type: null as unknown as PropType<
|
|
32
|
+
'neutral' | 'blue' | 'green' | 'yellow' | 'red' | 'purple' | null
|
|
33
|
+
>,
|
|
34
|
+
default: 'neutral',
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
const acceptedProps: Record<string, unknown> = { tone: 'neutral' }
|
|
38
|
+
const checkedProps = computed(() => ({
|
|
39
|
+
tone: checkedProp<'neutral' | 'blue' | 'green' | 'yellow' | 'red' | 'purple'>(
|
|
40
|
+
props['tone'],
|
|
41
|
+
{ kind: 'terminal', name: 'keyword' },
|
|
42
|
+
false,
|
|
43
|
+
'tone',
|
|
44
|
+
acceptedProps,
|
|
45
|
+
) as 'neutral' | 'blue' | 'green' | 'yellow' | 'red' | 'purple',
|
|
46
|
+
}))
|
|
47
|
+
void checkedProps.value
|
|
48
|
+
watchSyncEffect(() => {
|
|
49
|
+
void checkedProps.value
|
|
50
|
+
})
|
|
51
|
+
const reflectedProp = useReflectedProp()
|
|
52
|
+
|
|
53
|
+
const toneName = cycleCheckedComputed(() =>
|
|
54
|
+
(({
|
|
55
|
+
neutral: 'Neutral',
|
|
56
|
+
blue: 'Blue',
|
|
57
|
+
green: 'Green',
|
|
58
|
+
yellow: 'Yellow',
|
|
59
|
+
red: 'Red',
|
|
60
|
+
purple: 'Purple',
|
|
61
|
+
}) as Record<string, any>)[checkedProps.value.tone]
|
|
62
|
+
)
|
|
63
|
+
checkHydratedRoot('input', 'ui-swatch')
|
|
64
|
+
|
|
65
|
+
/** The values the styles' :host-state() rules test. */
|
|
66
|
+
const hostState = computed(() =>
|
|
67
|
+
[
|
|
68
|
+
checkedProps.value.tone && 'tone',
|
|
69
|
+
checkedProps.value.tone != null && `tone=${encodeURIComponent(checkedProps.value.tone)}`,
|
|
70
|
+
].filter(Boolean).join(' ')
|
|
71
|
+
)
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<input
|
|
76
|
+
class="ui-swatch"
|
|
77
|
+
type="radio"
|
|
78
|
+
v-bind="nativeAttrs($attrs)"
|
|
79
|
+
:value.attr="checkedProps.tone ?? undefined"
|
|
80
|
+
:aria-label="typeof toneName === 'boolean' ? String(toneName) : attribute(toneName)"
|
|
81
|
+
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
82
|
+
:data-tone="reflectedProp('tone', 'tone', checkedProps.tone, undefined, false)"
|
|
83
|
+
:data-ui-swatch-state="hostState || undefined"
|
|
84
|
+
>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<style scoped>
|
|
88
|
+
@property --ui-swatch-size {
|
|
89
|
+
syntax: "*";
|
|
90
|
+
inherits: false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* A native radio drawn as a round dot. Inside a ui-radio-group the group names it, applies its
|
|
94
|
+
value, and moves between swatches with the arrow keys. */
|
|
95
|
+
|
|
96
|
+
/* The chosen swatch and the focused one share one ring at the focus width (2px by default), in
|
|
97
|
+
the tone or the focus colour. */
|
|
98
|
+
|
|
99
|
+
@scope (.ui-swatch) {
|
|
100
|
+
:scope:where(:scope) {
|
|
101
|
+
--_surface: var(--ui-surface-subtle);
|
|
102
|
+
--_text: var(--ui-text-secondary);
|
|
103
|
+
|
|
104
|
+
appearance: none;
|
|
105
|
+
box-sizing: border-box;
|
|
106
|
+
flex: 0 0 auto;
|
|
107
|
+
inline-size: var(--ui-swatch-size, 1.65rem);
|
|
108
|
+
block-size: var(--ui-swatch-size, 1.65rem);
|
|
109
|
+
margin: 0;
|
|
110
|
+
border: var(--ui-border-width) solid color-mix(in srgb, var(--_surface) 75%, var(--_text) 25%);
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
background: var(--_surface);
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:scope:where(:scope):is([data-ui-swatch-state~="tone=blue"]) {
|
|
117
|
+
--_surface: var(--ui-info-soft);
|
|
118
|
+
--_text: var(--ui-info-subtle-text);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:scope:where(:scope):is([data-ui-swatch-state~="tone=green"]) {
|
|
122
|
+
--_surface: var(--ui-success-soft);
|
|
123
|
+
--_text: var(--ui-success-subtle-text);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:scope:where(:scope):is([data-ui-swatch-state~="tone=yellow"]) {
|
|
127
|
+
--_surface: var(--ui-warning-soft);
|
|
128
|
+
--_text: var(--ui-warning-subtle-text);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:scope:where(:scope):is([data-ui-swatch-state~="tone=red"]) {
|
|
132
|
+
--_surface: var(--ui-danger-soft);
|
|
133
|
+
--_text: var(--ui-danger-subtle-text);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:scope:where(:scope):is([data-ui-swatch-state~="tone=purple"]) {
|
|
137
|
+
--_surface: var(--ui-accent-soft);
|
|
138
|
+
--_text: var(--ui-accent-subtle-text);
|
|
139
|
+
}
|
|
140
|
+
:scope:where(:scope):is(:checked) {
|
|
141
|
+
outline: var(--ui-focus-width) solid var(--_text);
|
|
142
|
+
outline-offset: var(--ui-focus-width);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:scope:where(:scope):is(:focus-visible) {
|
|
146
|
+
outline: var(--ui-focus-width) solid var(--ui-focus-ring, var(--ui-accent-solid));
|
|
147
|
+
outline-offset: var(--ui-focus-width);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
|
|
2
|
+
import { a as vPropValidity, n as checkedProp, r as propValidityState } from "./props.js";
|
|
3
|
+
import { t as UiInput_default } from "./UiInput.js";
|
|
4
|
+
import { t as UiRadioGroup_default } from "./UiRadioGroup.js";
|
|
5
|
+
import { t as UiStack_default } from "./UiStack.js";
|
|
6
|
+
import { t as UiSwatch_default } from "./UiSwatch.js";
|
|
7
|
+
import { computed, createElementBlock, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, ref, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
|
|
8
|
+
//#region .build/vue/UiEditorChipEditor.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
var _hoisted_1 = ["data-color", "data-label"];
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region .build/vue/UiEditorChipEditor.vue
|
|
12
|
+
var UiEditorChipEditor_default = /* @__PURE__ */ defineComponent({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
__name: "UiEditorChipEditor",
|
|
15
|
+
props: {
|
|
16
|
+
color: {
|
|
17
|
+
type: null,
|
|
18
|
+
default: "neutral"
|
|
19
|
+
},
|
|
20
|
+
label: {
|
|
21
|
+
type: null,
|
|
22
|
+
default: ""
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
emits: [
|
|
26
|
+
"update:color",
|
|
27
|
+
"update:label",
|
|
28
|
+
"label",
|
|
29
|
+
"color",
|
|
30
|
+
"done"
|
|
31
|
+
],
|
|
32
|
+
setup(__props, { emit: __emit }) {
|
|
33
|
+
const propValidityContract = { props: {
|
|
34
|
+
color: {
|
|
35
|
+
type: {
|
|
36
|
+
kind: "terminal",
|
|
37
|
+
name: "keyword"
|
|
38
|
+
},
|
|
39
|
+
required: false,
|
|
40
|
+
target: { attribute: "value" },
|
|
41
|
+
description: "The chip's colour, checked among the swatches.",
|
|
42
|
+
values: [
|
|
43
|
+
"neutral",
|
|
44
|
+
"blue",
|
|
45
|
+
"green",
|
|
46
|
+
"yellow",
|
|
47
|
+
"red",
|
|
48
|
+
"purple"
|
|
49
|
+
],
|
|
50
|
+
default: "neutral"
|
|
51
|
+
},
|
|
52
|
+
label: {
|
|
53
|
+
type: {
|
|
54
|
+
kind: "terminal",
|
|
55
|
+
name: "string"
|
|
56
|
+
},
|
|
57
|
+
required: false,
|
|
58
|
+
target: { attribute: "value" },
|
|
59
|
+
description: "The chip's text, shown in the field as the reader edits it.",
|
|
60
|
+
default: ""
|
|
61
|
+
}
|
|
62
|
+
} };
|
|
63
|
+
const props = __props;
|
|
64
|
+
const acceptedProps = {
|
|
65
|
+
color: "neutral",
|
|
66
|
+
label: ""
|
|
67
|
+
};
|
|
68
|
+
const checkedProps = computed(() => ({
|
|
69
|
+
color: checkedProp(props["color"], {
|
|
70
|
+
kind: "terminal",
|
|
71
|
+
name: "keyword"
|
|
72
|
+
}, false, "color", acceptedProps),
|
|
73
|
+
label: checkedProp(props["label"], {
|
|
74
|
+
kind: "terminal",
|
|
75
|
+
name: "string"
|
|
76
|
+
}, false, "label", acceptedProps)
|
|
77
|
+
}));
|
|
78
|
+
checkedProps.value;
|
|
79
|
+
watchSyncEffect(() => {
|
|
80
|
+
checkedProps.value;
|
|
81
|
+
});
|
|
82
|
+
const reflectedProp = useReflectedProp();
|
|
83
|
+
const hydrationInstance = getCurrentInstance();
|
|
84
|
+
const emit = __emit;
|
|
85
|
+
const root = ref(null);
|
|
86
|
+
checkHydratedRoot("div", "ui-editor-chip-editor");
|
|
87
|
+
const isLabelDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["label"] === "string" && Object.keys(detail).every((key) => ["label"].includes(key));
|
|
88
|
+
const isColorDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && (detail["color"] === "neutral" || detail["color"] === "blue" || detail["color"] === "green" || detail["color"] === "yellow" || detail["color"] === "red" || detail["color"] === "purple") && Object.keys(detail).every((key) => ["color"].includes(key));
|
|
89
|
+
const isDoneDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && Object.values(detail).every((item) => true);
|
|
90
|
+
const dispatch = createDispatch(root, emit, {
|
|
91
|
+
checks: {
|
|
92
|
+
label: isLabelDetail,
|
|
93
|
+
color: isColorDetail,
|
|
94
|
+
done: isDoneDetail
|
|
95
|
+
},
|
|
96
|
+
modeled: ["color", "label"]
|
|
97
|
+
});
|
|
98
|
+
useComponentHost(() => import("@threadlabs/looma/components/ui-editor-chip-editor/ui-editor-chip-editor.js"), {
|
|
99
|
+
root,
|
|
100
|
+
dispatch,
|
|
101
|
+
controllerSource: {
|
|
102
|
+
specifier: "../components/ui-editor-chip-editor/ui-editor-chip-editor.js",
|
|
103
|
+
definition: "./components/ui-editor-chip-editor/ui-editor-chip-editor.html"
|
|
104
|
+
},
|
|
105
|
+
props: checkedProps,
|
|
106
|
+
propInputs: (name) => {
|
|
107
|
+
const incoming = hydrationInstance?.vnode.props;
|
|
108
|
+
const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
|
|
109
|
+
return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
|
|
110
|
+
},
|
|
111
|
+
propNames: ["color", "label"],
|
|
112
|
+
propValidity: (name) => propValidityState({
|
|
113
|
+
contract: propValidityContract,
|
|
114
|
+
values: { ...props }
|
|
115
|
+
}, name)
|
|
116
|
+
});
|
|
117
|
+
return (_ctx, _cache) => {
|
|
118
|
+
return withDirectives((openBlock(), createElementBlock("div", mergeProps({
|
|
119
|
+
role: "dialog",
|
|
120
|
+
"aria-label": "Edit chip"
|
|
121
|
+
}, unref(nativeAttrs)(_ctx.$attrs), {
|
|
122
|
+
"data-color": unref(reflectedProp)("color", "color", checkedProps.value.color, void 0, false),
|
|
123
|
+
"data-label": unref(reflectedProp)("label", "label", checkedProps.value.label, void 0, false),
|
|
124
|
+
ref_key: "root",
|
|
125
|
+
ref: root
|
|
126
|
+
}), [createVNode(UiStack_default, { gap: "s" }, {
|
|
127
|
+
default: withCtx(() => [createVNode(UiInput_default, {
|
|
128
|
+
"data-chip-label": "",
|
|
129
|
+
size: "sm",
|
|
130
|
+
placeholder: "Set a label",
|
|
131
|
+
"aria-label": "Chip text",
|
|
132
|
+
value: checkedProps.value.label
|
|
133
|
+
}, null, 8, ["value"]), createVNode(UiRadioGroup_default, {
|
|
134
|
+
label: "Chip color",
|
|
135
|
+
"label-visibility": "sr-only",
|
|
136
|
+
value: checkedProps.value.color
|
|
137
|
+
}, {
|
|
138
|
+
default: withCtx(() => [
|
|
139
|
+
createVNode(UiSwatch_default, { tone: "neutral" }),
|
|
140
|
+
createVNode(UiSwatch_default, { tone: "blue" }),
|
|
141
|
+
createVNode(UiSwatch_default, { tone: "green" }),
|
|
142
|
+
createVNode(UiSwatch_default, { tone: "yellow" }),
|
|
143
|
+
createVNode(UiSwatch_default, { tone: "red" }),
|
|
144
|
+
createVNode(UiSwatch_default, { tone: "purple" })
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["value"])]),
|
|
148
|
+
_: 1
|
|
149
|
+
})], 16, _hoisted_1)), [[unref(vPropValidity), {
|
|
150
|
+
contract: propValidityContract,
|
|
151
|
+
values: { ...props }
|
|
152
|
+
}]]);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
//#endregion
|
|
157
|
+
export { UiEditorChipEditor_default as t };
|
|
@@ -4,12 +4,12 @@ import { t as UiIcon_default } from "./UiIcon.js";
|
|
|
4
4
|
import { t as UiButton_default } from "./UiButton.js";
|
|
5
5
|
import { t as UiCluster_default } from "./UiCluster.js";
|
|
6
6
|
import { t as UiTooltip_default } from "./UiTooltip.js";
|
|
7
|
+
import { t as UiInput_default } from "./UiInput.js";
|
|
8
|
+
import { t as UiStack_default } from "./UiStack.js";
|
|
7
9
|
import { t as UiEditorToolbar_default } from "./UiEditorToolbar.js";
|
|
8
10
|
import { t as UiFormField_default } from "./UiFormField.js";
|
|
9
11
|
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
10
|
-
import { t as UiInput_default } from "./UiInput.js";
|
|
11
12
|
import { t as UiPopover_default } from "./UiPopover.js";
|
|
12
|
-
import { t as UiStack_default } from "./UiStack.js";
|
|
13
13
|
import { t as UiText_default } from "./UiText.js";
|
|
14
14
|
import { computed, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
|
|
15
15
|
//#region .build/vue/UiEditorImageToolbar.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -5,8 +5,8 @@ import { t as UiButton_default } from "./UiButton.js";
|
|
|
5
5
|
import { t as UiCard_default } from "./UiCard.js";
|
|
6
6
|
import { t as UiCluster_default } from "./UiCluster.js";
|
|
7
7
|
import { t as UiTooltip_default } from "./UiTooltip.js";
|
|
8
|
-
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
9
8
|
import { t as UiStack_default } from "./UiStack.js";
|
|
9
|
+
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
10
10
|
import { t as UiText_default } from "./UiText.js";
|
|
11
11
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, toDisplayString, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
|
|
12
12
|
//#region .build/vue/UiEditorLinkCard.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -3,10 +3,10 @@ import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acce
|
|
|
3
3
|
import { t as UiIcon_default } from "./UiIcon.js";
|
|
4
4
|
import { t as UiCheckbox_default } from "./UiCheckbox.js";
|
|
5
5
|
import { t as UiScrollArea_default } from "./UiScrollArea.js";
|
|
6
|
-
import { t as UiFormField_default } from "./UiFormField.js";
|
|
7
|
-
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
8
6
|
import { t as UiInput_default } from "./UiInput.js";
|
|
9
7
|
import { t as UiStack_default } from "./UiStack.js";
|
|
8
|
+
import { t as UiFormField_default } from "./UiFormField.js";
|
|
9
|
+
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
10
10
|
import { t as UiText_default } from "./UiText.js";
|
|
11
11
|
import { t as UiInputGroup_default } from "./UiInputGroup.js";
|
|
12
12
|
import { t as UiSearchResultRow_default } from "./UiSearchResultRow.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
|
|
2
2
|
import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
|
|
3
|
-
import { computed, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, watchSyncEffect, withDirectives } from "vue";
|
|
3
|
+
import { computed, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, mergeProps, normalizeClass, openBlock, provide, ref, renderSlot, toDisplayString, unref, watchSyncEffect, withDirectives } from "vue";
|
|
4
4
|
//#region .build/vue/UiRadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = [
|
|
6
6
|
"aria-required",
|
|
@@ -9,6 +9,7 @@ var _hoisted_1 = [
|
|
|
9
9
|
"data-disabled",
|
|
10
10
|
"data-invalid",
|
|
11
11
|
"data-label",
|
|
12
|
+
"data-label-visibility",
|
|
12
13
|
"data-name",
|
|
13
14
|
"data-orientation",
|
|
14
15
|
"data-required",
|
|
@@ -33,6 +34,10 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
33
34
|
type: null,
|
|
34
35
|
default: "Options"
|
|
35
36
|
},
|
|
37
|
+
labelVisibility: {
|
|
38
|
+
type: null,
|
|
39
|
+
default: "visible"
|
|
40
|
+
},
|
|
36
41
|
name: {
|
|
37
42
|
type: null,
|
|
38
43
|
default: ""
|
|
@@ -87,6 +92,17 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
87
92
|
description: "The group's legend, shown above the radios and announced as the group's name. Phrase it as the question the radios answer.",
|
|
88
93
|
default: "Options"
|
|
89
94
|
},
|
|
95
|
+
labelVisibility: {
|
|
96
|
+
type: {
|
|
97
|
+
kind: "terminal",
|
|
98
|
+
name: "keyword"
|
|
99
|
+
},
|
|
100
|
+
required: false,
|
|
101
|
+
target: { attribute: "labelvisibility" },
|
|
102
|
+
description: "visible shows the legend; sr-only hides it visually but keeps it as the group's accessible name. Use sr-only only when the surrounding layout already makes\n the choice clear, as with a row of colour swatches.",
|
|
103
|
+
values: ["visible", "sr-only"],
|
|
104
|
+
default: "visible"
|
|
105
|
+
},
|
|
90
106
|
name: {
|
|
91
107
|
type: {
|
|
92
108
|
kind: "terminal",
|
|
@@ -134,6 +150,7 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
134
150
|
disabled: false,
|
|
135
151
|
invalid: false,
|
|
136
152
|
label: "Options",
|
|
153
|
+
labelVisibility: "visible",
|
|
137
154
|
name: "",
|
|
138
155
|
orientation: "horizontal",
|
|
139
156
|
required: false,
|
|
@@ -152,6 +169,10 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
152
169
|
kind: "terminal",
|
|
153
170
|
name: "string"
|
|
154
171
|
}, false, "label", acceptedProps),
|
|
172
|
+
labelVisibility: checkedProp(props["labelVisibility"], {
|
|
173
|
+
kind: "terminal",
|
|
174
|
+
name: "keyword"
|
|
175
|
+
}, false, "labelVisibility", acceptedProps),
|
|
155
176
|
name: checkedProp(props["name"], {
|
|
156
177
|
kind: "terminal",
|
|
157
178
|
name: "string"
|
|
@@ -224,6 +245,7 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
224
245
|
"disabled",
|
|
225
246
|
"invalid",
|
|
226
247
|
"label",
|
|
248
|
+
"labelVisibility",
|
|
227
249
|
"name",
|
|
228
250
|
"orientation",
|
|
229
251
|
"required",
|
|
@@ -246,6 +268,7 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
246
268
|
"data-disabled": unref(reflectedProp)("disabled", "disabled", checkedProps.value.disabled, void 0, false),
|
|
247
269
|
"data-invalid": unref(reflectedProp)("invalid", "invalid", checkedProps.value.invalid, void 0, false),
|
|
248
270
|
"data-label": unref(reflectedProp)("label", "label", checkedProps.value.label, void 0, false),
|
|
271
|
+
"data-label-visibility": unref(reflectedProp)("labelVisibility", "label-visibility", checkedProps.value.labelVisibility, void 0, false),
|
|
249
272
|
"data-name": unref(reflectedProp)("name", "name", checkedProps.value.name, void 0, false),
|
|
250
273
|
"data-orientation": unref(reflectedProp)("orientation", "orientation", checkedProps.value.orientation, void 0, false),
|
|
251
274
|
"data-required": unref(reflectedProp)("required", "required", checkedProps.value.required, void 0, false),
|
|
@@ -253,12 +276,12 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
253
276
|
"data-ui-radio-group-state": hostState.value || void 0,
|
|
254
277
|
ref_key: "root",
|
|
255
278
|
ref: root
|
|
256
|
-
}), [createElementVNode("legend",
|
|
279
|
+
}), [createElementVNode("legend", { class: normalizeClass({ "sr-only": checkedProps.value.labelVisibility === "sr-only" }) }, toDisplayString(checkedProps.value.label), 3), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1)), [[unref(vPropValidity), {
|
|
257
280
|
contract: propValidityContract,
|
|
258
281
|
values: { ...props }
|
|
259
282
|
}]]);
|
|
260
283
|
};
|
|
261
284
|
}
|
|
262
|
-
}), [["__scopeId", "data-v-
|
|
285
|
+
}), [["__scopeId", "data-v-b26d4760"]]);
|
|
263
286
|
//#endregion
|
|
264
287
|
export { UiRadioGroup_default as t };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { i as checkHydratedRoot, p as nativeAttrs, r as attribute, s as cycleCheckedComputed, t as _plugin_vue_export_helper_default, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
|
|
2
|
+
import { a as vPropValidity, n as checkedProp } from "./props.js";
|
|
3
|
+
import { computed, createElementBlock, defineComponent, mergeProps, openBlock, unref, watchSyncEffect, withDirectives } from "vue";
|
|
4
|
+
//#region .build/vue/UiSwatch.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _hoisted_1 = [
|
|
6
|
+
"^value",
|
|
7
|
+
"aria-label",
|
|
8
|
+
"data-tone",
|
|
9
|
+
"data-ui-swatch-state"
|
|
10
|
+
];
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region .build/vue/UiSwatch.vue
|
|
13
|
+
var UiSwatch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
__name: "UiSwatch",
|
|
16
|
+
props: { tone: {
|
|
17
|
+
type: null,
|
|
18
|
+
default: "neutral"
|
|
19
|
+
} },
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const propValidityContract = { props: { tone: {
|
|
22
|
+
type: {
|
|
23
|
+
kind: "terminal",
|
|
24
|
+
name: "keyword"
|
|
25
|
+
},
|
|
26
|
+
required: false,
|
|
27
|
+
target: { attribute: "value" },
|
|
28
|
+
description: "The swatch's colour, on the same tokens as editor chips. It is also the radio's value and, by name, its label.",
|
|
29
|
+
values: [
|
|
30
|
+
"neutral",
|
|
31
|
+
"blue",
|
|
32
|
+
"green",
|
|
33
|
+
"yellow",
|
|
34
|
+
"red",
|
|
35
|
+
"purple"
|
|
36
|
+
],
|
|
37
|
+
default: "neutral"
|
|
38
|
+
} } };
|
|
39
|
+
const props = __props;
|
|
40
|
+
const acceptedProps = { tone: "neutral" };
|
|
41
|
+
const checkedProps = computed(() => ({ tone: checkedProp(props["tone"], {
|
|
42
|
+
kind: "terminal",
|
|
43
|
+
name: "keyword"
|
|
44
|
+
}, false, "tone", acceptedProps) }));
|
|
45
|
+
checkedProps.value;
|
|
46
|
+
watchSyncEffect(() => {
|
|
47
|
+
checkedProps.value;
|
|
48
|
+
});
|
|
49
|
+
const reflectedProp = useReflectedProp();
|
|
50
|
+
const toneName = cycleCheckedComputed(() => ({
|
|
51
|
+
neutral: "Neutral",
|
|
52
|
+
blue: "Blue",
|
|
53
|
+
green: "Green",
|
|
54
|
+
yellow: "Yellow",
|
|
55
|
+
red: "Red",
|
|
56
|
+
purple: "Purple"
|
|
57
|
+
})[checkedProps.value.tone]);
|
|
58
|
+
checkHydratedRoot("input", "ui-swatch");
|
|
59
|
+
/** The values the styles' :host-state() rules test. */
|
|
60
|
+
const hostState = computed(() => [checkedProps.value.tone && "tone", checkedProps.value.tone != null && `tone=${encodeURIComponent(checkedProps.value.tone)}`].filter(Boolean).join(" "));
|
|
61
|
+
return (_ctx, _cache) => {
|
|
62
|
+
return withDirectives((openBlock(), createElementBlock("input", mergeProps({
|
|
63
|
+
class: "ui-swatch",
|
|
64
|
+
type: "radio"
|
|
65
|
+
}, unref(nativeAttrs)(_ctx.$attrs), {
|
|
66
|
+
"^value": checkedProps.value.tone ?? void 0,
|
|
67
|
+
"aria-label": typeof unref(toneName) === "boolean" ? String(unref(toneName)) : unref(attribute)(unref(toneName)),
|
|
68
|
+
"data-tone": unref(reflectedProp)("tone", "tone", checkedProps.value.tone, void 0, false),
|
|
69
|
+
"data-ui-swatch-state": hostState.value || void 0
|
|
70
|
+
}), null, 16, _hoisted_1)), [[unref(vPropValidity), {
|
|
71
|
+
contract: propValidityContract,
|
|
72
|
+
values: { ...props }
|
|
73
|
+
}]]);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}), [["__scopeId", "data-v-42e76006"]]);
|
|
77
|
+
//#endregion
|
|
78
|
+
export { UiSwatch_default as t };
|