@nexxtmove/ui 1.29.0 → 1.31.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/EditorBackgroundSize/EditorBackgroundSize.vue.d.ts +42 -0
- package/dist/components/molecules/PlaceholderInput/PlaceholderInput.vue.d.ts +33 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +565 -424
- package/dist/nuxt.js +2 -0
- package/package.json +1 -1
- package/src/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue +83 -0
- package/src/components/molecules/PlaceholderInput/PlaceholderInput.vue +121 -0
- package/src/components.json +2 -0
- package/src/index.ts +11 -0
package/dist/nuxt.js
CHANGED
|
@@ -33,6 +33,7 @@ var s = {
|
|
|
33
33
|
NexxtPageMockup: "components/molecules/PageMockup/PageMockup.vue",
|
|
34
34
|
NexxtPageTypeTile: "components/molecules/PageTypeTile/PageTypeTile.vue",
|
|
35
35
|
NexxtPagination: "components/molecules/Pagination/Pagination.vue",
|
|
36
|
+
NexxtPlaceholderInput: "components/molecules/PlaceholderInput/PlaceholderInput.vue",
|
|
36
37
|
NexxtPropertyCard: "components/molecules/PropertyCard/PropertyCard.vue",
|
|
37
38
|
NexxtSelect: "components/molecules/Select/Select.vue",
|
|
38
39
|
NexxtSidebarMenuItem: "components/molecules/SidebarMenuItem/SidebarMenuItem.vue",
|
|
@@ -70,6 +71,7 @@ var s = {
|
|
|
70
71
|
NexxtVideoPlayer: "components/organisms/VideoPlayer/VideoPlayer.vue",
|
|
71
72
|
NexxtEditorSettingsBlock: "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
|
|
72
73
|
NexxtEditorAlignItems: "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
|
|
74
|
+
NexxtEditorBackgroundSize: "components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue",
|
|
73
75
|
NexxtEditorBorder: "components/editor/molecules/EditorBorder/EditorBorder.vue",
|
|
74
76
|
NexxtEditorColor: "components/editor/molecules/EditorColor/EditorColor.vue",
|
|
75
77
|
NexxtEditorFlexDirection: "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
|
package/package.json
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The background size 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 EditorBackgroundSizeValue = 'bg-cover' | 'bg-contain' | 'bg-auto'
|
|
7
|
+
|
|
8
|
+
/** Overridable copy for the three options. Every key is optional. */
|
|
9
|
+
export interface EditorBackgroundSizeMessages {
|
|
10
|
+
/** Accessible name of the `bg-cover` option. Defaults to `'Opvullen'`. */
|
|
11
|
+
cover?: string
|
|
12
|
+
/** Accessible name of the `bg-contain` option. Defaults to `'Passend'`. */
|
|
13
|
+
contain?: string
|
|
14
|
+
/** Accessible name of the `bg-auto` option. Defaults to `'Origineel'`. */
|
|
15
|
+
auto?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface NexxtEditorBackgroundSizeProps {
|
|
19
|
+
/**
|
|
20
|
+
* Header text of the settings block. Defaults to the Dutch `'Vulling'`;
|
|
21
|
+
* the library has no i18n layer, so a consumer in another language passes
|
|
22
|
+
* its own copy in.
|
|
23
|
+
*/
|
|
24
|
+
label?: string
|
|
25
|
+
/**
|
|
26
|
+
* Copy of the three options. The options are icon-only and show no tooltip,
|
|
27
|
+
* so this copy is purely the accessible name of each button. Defaults are
|
|
28
|
+
* Dutch and are merged per key, so overriding one keeps the defaults of the
|
|
29
|
+
* others. Copy is never translated inside the component.
|
|
30
|
+
*/
|
|
31
|
+
messages?: EditorBackgroundSizeMessages
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DEFAULT_MESSAGES = {
|
|
35
|
+
cover: 'Opvullen',
|
|
36
|
+
contain: 'Passend',
|
|
37
|
+
auto: 'Origineel',
|
|
38
|
+
} satisfies Required<EditorBackgroundSizeMessages>
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<script lang="ts" setup>
|
|
42
|
+
import { computed } from 'vue'
|
|
43
|
+
import NexxtEditorSettingsBlock from '../../atoms/EditorSettingsBlock/EditorSettingsBlock.vue'
|
|
44
|
+
import NexxtToggleGroup from '../../../molecules/ToggleGroup/ToggleGroup.vue'
|
|
45
|
+
import type { NexxtToggleGroupOption } from '../../../molecules/ToggleGroup/ToggleGroup.vue'
|
|
46
|
+
|
|
47
|
+
defineOptions({ name: 'NexxtEditorBackgroundSize' })
|
|
48
|
+
|
|
49
|
+
const { label = 'Vulling', messages } = defineProps<NexxtEditorBackgroundSizeProps>()
|
|
50
|
+
|
|
51
|
+
/** The selected background size, as the Tailwind class to apply. */
|
|
52
|
+
const model = defineModel<EditorBackgroundSizeValue>({ required: true })
|
|
53
|
+
|
|
54
|
+
const copy = computed(() => ({ ...DEFAULT_MESSAGES, ...messages }))
|
|
55
|
+
|
|
56
|
+
// Icon-only and deliberately without tooltips, matching the other editor
|
|
57
|
+
// molecules in the panel (align items, justify content, text align): labelled
|
|
58
|
+
// options do not fit the width the editor sidebar gives this block. The copy
|
|
59
|
+
// travels as `ariaLabel`, so the buttons still have a name for assistive
|
|
60
|
+
// technology.
|
|
61
|
+
const options = computed<NexxtToggleGroupOption[]>(() => [
|
|
62
|
+
{ value: 'bg-cover', icon: 'arrows-maximize', ariaLabel: copy.value.cover },
|
|
63
|
+
{ value: 'bg-contain', icon: 'arrows-minimize', ariaLabel: copy.value.contain },
|
|
64
|
+
{ value: 'bg-auto', icon: 'image', ariaLabel: copy.value.auto },
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
// ToggleGroup types its model as the open `string` of its options, so writing
|
|
68
|
+
// straight back into the narrower model is a type error. The setter is the one
|
|
69
|
+
// place that narrowing happens, and it is safe: the only values ToggleGroup can
|
|
70
|
+
// emit are the option values built above.
|
|
71
|
+
const selected = computed({
|
|
72
|
+
get: () => model.value,
|
|
73
|
+
set: (value: string) => {
|
|
74
|
+
model.value = value as EditorBackgroundSizeValue
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<NexxtEditorSettingsBlock :label="label">
|
|
81
|
+
<NexxtToggleGroup v-model="selected" :options="options" />
|
|
82
|
+
</NexxtEditorSettingsBlock>
|
|
83
|
+
</template>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface NexxtPlaceholderGroup {
|
|
3
|
+
/** Heading of the group, shown when there is more than one group. */
|
|
4
|
+
label: string
|
|
5
|
+
/** Placeholder keys, inserted as `{{key}}`. */
|
|
6
|
+
items: string[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface NexxtPlaceholderInputMessages {
|
|
10
|
+
/** Accessible name and tooltip of the pen button. */
|
|
11
|
+
insert?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface NexxtPlaceholderInputProps {
|
|
15
|
+
placeholders: NexxtPlaceholderGroup[]
|
|
16
|
+
label?: string
|
|
17
|
+
placeholder?: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
error?: boolean
|
|
20
|
+
errorMessage?: string
|
|
21
|
+
required?: boolean
|
|
22
|
+
messages?: NexxtPlaceholderInputMessages
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { computed, nextTick, useTemplateRef } from 'vue'
|
|
28
|
+
import NexxtFloatingPanel from '../../atoms/FloatingPanel/FloatingPanel.vue'
|
|
29
|
+
import NexxtIcon from '../../atoms/Icon/Icon.vue'
|
|
30
|
+
import NexxtTooltip from '../../atoms/Tooltip/Tooltip.vue'
|
|
31
|
+
import NexxtInputField from '../InputField/InputField.vue'
|
|
32
|
+
|
|
33
|
+
defineOptions({ name: 'NexxtPlaceholderInput' })
|
|
34
|
+
|
|
35
|
+
const { placeholders, disabled = false, messages } = defineProps<NexxtPlaceholderInputProps>()
|
|
36
|
+
|
|
37
|
+
/** The text, with placeholders written as `{{key}}`. */
|
|
38
|
+
const model = defineModel<string>({ default: '' })
|
|
39
|
+
|
|
40
|
+
const insertLabel = computed(() => messages?.insert ?? 'Placeholder invoegen')
|
|
41
|
+
|
|
42
|
+
// A single group has nothing to be told apart from, so its heading is left out
|
|
43
|
+
const grouped = computed(() => placeholders.length > 1)
|
|
44
|
+
|
|
45
|
+
const field = useTemplateRef<InstanceType<typeof NexxtInputField>>('field')
|
|
46
|
+
|
|
47
|
+
// Inserts at the caret, or appends when the field was never focused
|
|
48
|
+
const insert = (key: string, close: () => void) => {
|
|
49
|
+
const el = field.value?.inputEl ?? null
|
|
50
|
+
const token = `{{${key}}}`
|
|
51
|
+
const start = el?.selectionStart ?? model.value.length
|
|
52
|
+
const end = el?.selectionEnd ?? start
|
|
53
|
+
|
|
54
|
+
model.value = model.value.slice(0, start) + token + model.value.slice(end)
|
|
55
|
+
close()
|
|
56
|
+
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
el?.focus()
|
|
59
|
+
el?.setSelectionRange(start + token.length, start + token.length)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<NexxtInputField
|
|
66
|
+
ref="field"
|
|
67
|
+
v-model="model"
|
|
68
|
+
:label="label"
|
|
69
|
+
:placeholder="placeholder"
|
|
70
|
+
:error="error"
|
|
71
|
+
:error-message="errorMessage"
|
|
72
|
+
:required="required"
|
|
73
|
+
:disabled="disabled"
|
|
74
|
+
>
|
|
75
|
+
<template #right>
|
|
76
|
+
<NexxtFloatingPanel surface placement="bottom-end">
|
|
77
|
+
<template #trigger="{ open }">
|
|
78
|
+
<NexxtTooltip>
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
class="flex h-10 w-9 shrink-0 cursor-pointer items-center justify-center text-gray-400 transition-colors hover:text-cornflower-blue-600 focus:outline-none focus-visible:text-cornflower-blue-600 disabled:cursor-default disabled:opacity-50"
|
|
82
|
+
:disabled="disabled"
|
|
83
|
+
:aria-label="insertLabel"
|
|
84
|
+
@click="open"
|
|
85
|
+
>
|
|
86
|
+
<NexxtIcon name="pen" aria-hidden="true" />
|
|
87
|
+
</button>
|
|
88
|
+
<template #tooltip>{{ insertLabel }}</template>
|
|
89
|
+
</NexxtTooltip>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<template #content="{ close }">
|
|
93
|
+
<div
|
|
94
|
+
class="flex max-h-96 w-80 flex-col gap-4 overflow-y-auto p-4"
|
|
95
|
+
role="listbox"
|
|
96
|
+
:aria-label="insertLabel"
|
|
97
|
+
>
|
|
98
|
+
<div v-for="group in placeholders" :key="group.label" class="flex flex-col gap-1">
|
|
99
|
+
<span
|
|
100
|
+
v-if="grouped"
|
|
101
|
+
class="pb-2 extra-small-semibold text-cornflower-blue-500 uppercase"
|
|
102
|
+
>
|
|
103
|
+
{{ group.label }}
|
|
104
|
+
</span>
|
|
105
|
+
<button
|
|
106
|
+
v-for="key in group.items"
|
|
107
|
+
:key="key"
|
|
108
|
+
type="button"
|
|
109
|
+
role="option"
|
|
110
|
+
class="cursor-pointer rounded-lg px-2 py-1 text-left small-normal text-gray-950 transition-colors hover:bg-cornflower-blue-50"
|
|
111
|
+
@click="insert(key, close)"
|
|
112
|
+
>
|
|
113
|
+
{{ key }}
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</template>
|
|
118
|
+
</NexxtFloatingPanel>
|
|
119
|
+
</template>
|
|
120
|
+
</NexxtInputField>
|
|
121
|
+
</template>
|
package/src/components.json
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"NexxtPageMockup": "components/molecules/PageMockup/PageMockup.vue",
|
|
31
31
|
"NexxtPageTypeTile": "components/molecules/PageTypeTile/PageTypeTile.vue",
|
|
32
32
|
"NexxtPagination": "components/molecules/Pagination/Pagination.vue",
|
|
33
|
+
"NexxtPlaceholderInput": "components/molecules/PlaceholderInput/PlaceholderInput.vue",
|
|
33
34
|
"NexxtPropertyCard": "components/molecules/PropertyCard/PropertyCard.vue",
|
|
34
35
|
"NexxtSelect": "components/molecules/Select/Select.vue",
|
|
35
36
|
"NexxtSidebarMenuItem": "components/molecules/SidebarMenuItem/SidebarMenuItem.vue",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"NexxtVideoPlayer": "components/organisms/VideoPlayer/VideoPlayer.vue",
|
|
68
69
|
"NexxtEditorSettingsBlock": "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
|
|
69
70
|
"NexxtEditorAlignItems": "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
|
|
71
|
+
"NexxtEditorBackgroundSize": "components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue",
|
|
70
72
|
"NexxtEditorBorder": "components/editor/molecules/EditorBorder/EditorBorder.vue",
|
|
71
73
|
"NexxtEditorColor": "components/editor/molecules/EditorColor/EditorColor.vue",
|
|
72
74
|
"NexxtEditorFlexDirection": "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
|
package/src/index.ts
CHANGED
|
@@ -19,10 +19,19 @@ export type {
|
|
|
19
19
|
} from './components/molecules/PageCard/PageCard.vue'
|
|
20
20
|
export type { NexxtPageMockupType } from './components/molecules/PageMockup/PageMockup.vue'
|
|
21
21
|
export type { NexxtTreeNode, NexxtTreeProps } from './components/molecules/Tree/Tree.vue'
|
|
22
|
+
export type {
|
|
23
|
+
NexxtPlaceholderGroup,
|
|
24
|
+
NexxtPlaceholderInputMessages,
|
|
25
|
+
NexxtPlaceholderInputProps,
|
|
26
|
+
} from './components/molecules/PlaceholderInput/PlaceholderInput.vue'
|
|
22
27
|
export type {
|
|
23
28
|
EditorAlignItemsMessages,
|
|
24
29
|
EditorAlignItemsValue,
|
|
25
30
|
} from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
|
|
31
|
+
export type {
|
|
32
|
+
EditorBackgroundSizeMessages,
|
|
33
|
+
EditorBackgroundSizeValue,
|
|
34
|
+
} from './components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue'
|
|
26
35
|
export type {
|
|
27
36
|
EditorFlexDirectionMessages,
|
|
28
37
|
EditorFlexDirectionValue,
|
|
@@ -86,6 +95,7 @@ export { default as NexxtDatePicker } from './components/organisms/DatePicker/Da
|
|
|
86
95
|
export { default as NexxtDoughnutChart } from './components/molecules/DoughnutChart/DoughnutChart.vue'
|
|
87
96
|
export { default as NexxtDropdownButton } from './components/organisms/DropdownButton/DropdownButton.vue'
|
|
88
97
|
export { default as NexxtEditorAlignItems } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
|
|
98
|
+
export { default as NexxtEditorBackgroundSize } from './components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue'
|
|
89
99
|
export { default as NexxtEditorBorder } from './components/editor/molecules/EditorBorder/EditorBorder.vue'
|
|
90
100
|
export { default as NexxtEditorColor } from './components/editor/molecules/EditorColor/EditorColor.vue'
|
|
91
101
|
export { default as NexxtEditorFlexDirection } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue'
|
|
@@ -112,6 +122,7 @@ export { default as NexxtPageContainer } from './components/molecules/PageContai
|
|
|
112
122
|
export { default as NexxtPageMockup } from './components/molecules/PageMockup/PageMockup.vue'
|
|
113
123
|
export { default as NexxtPageTypeTile } from './components/molecules/PageTypeTile/PageTypeTile.vue'
|
|
114
124
|
export { default as NexxtPagination } from './components/molecules/Pagination/Pagination.vue'
|
|
125
|
+
export { default as NexxtPlaceholderInput } from './components/molecules/PlaceholderInput/PlaceholderInput.vue'
|
|
115
126
|
export { default as NexxtPresenceIndicator } from './components/atoms/PresenceIndicator/PresenceIndicator.vue'
|
|
116
127
|
export { default as NexxtProgressBar } from './components/organisms/ProgressBar/ProgressBar.vue'
|
|
117
128
|
export { default as NexxtPropertyCard } from './components/molecules/PropertyCard/PropertyCard.vue'
|