@nexxtmove/ui 1.23.0 → 1.24.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/components/editor/molecules/EditorTextAlign/EditorTextAlign.vue.d.ts +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +319 -263
- package/dist/nuxt.js +2 -1
- package/package.json +1 -1
- package/src/components/editor/molecules/EditorTextAlign/EditorTextAlign.vue +86 -0
- package/src/components.json +2 -1
- package/src/index.ts +5 -0
package/dist/nuxt.js
CHANGED
|
@@ -72,7 +72,8 @@ var s = {
|
|
|
72
72
|
NexxtEditorHeadingType: "components/editor/molecules/EditorHeadingType/EditorHeadingType.vue",
|
|
73
73
|
NexxtEditorJustifyContent: "components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue",
|
|
74
74
|
NexxtEditorPadding: "components/editor/molecules/EditorPadding/EditorPadding.vue",
|
|
75
|
-
NexxtEditorRadius: "components/editor/molecules/EditorRadius/EditorRadius.vue"
|
|
75
|
+
NexxtEditorRadius: "components/editor/molecules/EditorRadius/EditorRadius.vue",
|
|
76
|
+
NexxtEditorTextAlign: "components/editor/molecules/EditorTextAlign/EditorTextAlign.vue"
|
|
76
77
|
}, c = ["@nexxtmove/ui/ui.css", "@nexxtmove/ui/dist/ui.css"], l = (e, t) => e.some((e) => e === t || c.includes(e)), u = i({
|
|
77
78
|
meta: {
|
|
78
79
|
name: "@nexxtmove/ui",
|
package/package.json
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The text alignment as the editor needs it: the Tailwind class itself, so the
|
|
4
|
+
* consumer can put the model value straight on the element it styles.
|
|
5
|
+
*/
|
|
6
|
+
export type EditorTextAlignValue = 'text-left' | 'text-center' | 'text-right' | 'text-justify'
|
|
7
|
+
|
|
8
|
+
/** Overridable copy for the four options. Every key is optional. */
|
|
9
|
+
export interface EditorTextAlignMessages {
|
|
10
|
+
/** Accessible name of the `text-left` option. Defaults to `'Links'`. */
|
|
11
|
+
left?: string
|
|
12
|
+
/** Accessible name of the `text-center` option. Defaults to `'Midden'`. */
|
|
13
|
+
center?: string
|
|
14
|
+
/** Accessible name of the `text-right` option. Defaults to `'Rechts'`. */
|
|
15
|
+
right?: string
|
|
16
|
+
/** Accessible name of the `text-justify` option. Defaults to `'Uitvullen'`. */
|
|
17
|
+
justify?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NexxtEditorTextAlignProps {
|
|
21
|
+
/**
|
|
22
|
+
* Header text of the settings block. Defaults to the Dutch
|
|
23
|
+
* `'Tekst uitlijning'`; the library has no i18n layer, so a consumer in
|
|
24
|
+
* another language passes its own copy in.
|
|
25
|
+
*/
|
|
26
|
+
label?: string
|
|
27
|
+
/**
|
|
28
|
+
* Copy of the four options. The options are icon-only and show no tooltip, so
|
|
29
|
+
* this copy is purely the accessible name of each button. Defaults are Dutch
|
|
30
|
+
* and are merged per key, so overriding one keeps the defaults of the others.
|
|
31
|
+
* Copy is never translated inside the component.
|
|
32
|
+
*/
|
|
33
|
+
messages?: EditorTextAlignMessages
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const DEFAULT_MESSAGES = {
|
|
37
|
+
left: 'Links',
|
|
38
|
+
center: 'Midden',
|
|
39
|
+
right: 'Rechts',
|
|
40
|
+
justify: 'Uitvullen',
|
|
41
|
+
} satisfies Required<EditorTextAlignMessages>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import { computed } from 'vue'
|
|
46
|
+
import NexxtEditorSettingsBlock from '../../atoms/EditorSettingsBlock/EditorSettingsBlock.vue'
|
|
47
|
+
import NexxtToggleGroup from '../../../molecules/ToggleGroup/ToggleGroup.vue'
|
|
48
|
+
import type { NexxtToggleGroupOption } from '../../../molecules/ToggleGroup/ToggleGroup.vue'
|
|
49
|
+
|
|
50
|
+
defineOptions({ name: 'NexxtEditorTextAlign' })
|
|
51
|
+
|
|
52
|
+
const { label = 'Tekst uitlijning', messages } = defineProps<NexxtEditorTextAlignProps>()
|
|
53
|
+
|
|
54
|
+
/** The selected text alignment, as the Tailwind class to apply. */
|
|
55
|
+
const model = defineModel<EditorTextAlignValue>({ required: true })
|
|
56
|
+
|
|
57
|
+
const copy = computed(() => ({ ...DEFAULT_MESSAGES, ...messages }))
|
|
58
|
+
|
|
59
|
+
// Icon-only and deliberately without tooltips: four labels do not fit side by
|
|
60
|
+
// side at the width the editor sidebar gives this block, and the icons are
|
|
61
|
+
// conventional enough to stand on their own. The copy travels as `ariaLabel`,
|
|
62
|
+
// so the buttons still have a name for assistive technology.
|
|
63
|
+
const options = computed<NexxtToggleGroupOption[]>(() => [
|
|
64
|
+
{ value: 'text-left', icon: 'align-left', ariaLabel: copy.value.left },
|
|
65
|
+
{ value: 'text-center', icon: 'align-center', ariaLabel: copy.value.center },
|
|
66
|
+
{ value: 'text-right', icon: 'align-right', ariaLabel: copy.value.right },
|
|
67
|
+
{ value: 'text-justify', icon: 'align-justify', ariaLabel: copy.value.justify },
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
// ToggleGroup types its model as the open `string` of its options, so writing
|
|
71
|
+
// straight back into the narrower model is a type error. The setter is the one
|
|
72
|
+
// place that narrowing happens, and it is safe: the only values ToggleGroup can
|
|
73
|
+
// emit are the option values built above.
|
|
74
|
+
const selected = computed({
|
|
75
|
+
get: () => model.value,
|
|
76
|
+
set: (value: string) => {
|
|
77
|
+
model.value = value as EditorTextAlignValue
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<NexxtEditorSettingsBlock :label="label">
|
|
84
|
+
<NexxtToggleGroup v-model="selected" :options="options" />
|
|
85
|
+
</NexxtEditorSettingsBlock>
|
|
86
|
+
</template>
|
package/src/components.json
CHANGED
|
@@ -69,5 +69,6 @@
|
|
|
69
69
|
"NexxtEditorHeadingType": "components/editor/molecules/EditorHeadingType/EditorHeadingType.vue",
|
|
70
70
|
"NexxtEditorJustifyContent": "components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue",
|
|
71
71
|
"NexxtEditorPadding": "components/editor/molecules/EditorPadding/EditorPadding.vue",
|
|
72
|
-
"NexxtEditorRadius": "components/editor/molecules/EditorRadius/EditorRadius.vue"
|
|
72
|
+
"NexxtEditorRadius": "components/editor/molecules/EditorRadius/EditorRadius.vue",
|
|
73
|
+
"NexxtEditorTextAlign": "components/editor/molecules/EditorTextAlign/EditorTextAlign.vue"
|
|
73
74
|
}
|
package/src/index.ts
CHANGED
|
@@ -38,6 +38,10 @@ export type {
|
|
|
38
38
|
EditorRadiusMessages,
|
|
39
39
|
EditorRadiusValue,
|
|
40
40
|
} from './components/editor/molecules/EditorRadius/EditorRadius.vue'
|
|
41
|
+
export type {
|
|
42
|
+
EditorTextAlignMessages,
|
|
43
|
+
EditorTextAlignValue,
|
|
44
|
+
} from './components/editor/molecules/EditorTextAlign/EditorTextAlign.vue'
|
|
41
45
|
export type {
|
|
42
46
|
EditorJustifyContentMessages,
|
|
43
47
|
EditorJustifyContentValue,
|
|
@@ -75,6 +79,7 @@ export { default as NexxtEditorJustifyContent } from './components/editor/molecu
|
|
|
75
79
|
export { default as NexxtEditorPadding } from './components/editor/molecules/EditorPadding/EditorPadding.vue'
|
|
76
80
|
export { default as NexxtEditorRadius } from './components/editor/molecules/EditorRadius/EditorRadius.vue'
|
|
77
81
|
export { default as NexxtEditorSettingsBlock } from './components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue'
|
|
82
|
+
export { default as NexxtEditorTextAlign } from './components/editor/molecules/EditorTextAlign/EditorTextAlign.vue'
|
|
78
83
|
export { default as NexxtEnergyLabel } from './components/atoms/EnergyLabel/EnergyLabel.vue'
|
|
79
84
|
export { default as NexxtFloatingPanel } from './components/atoms/FloatingPanel/FloatingPanel.vue'
|
|
80
85
|
export { default as NexxtHeader } from './components/organisms/Header/Header.vue'
|