@nexxtmove/ui 1.29.0 → 1.30.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/nuxt.js CHANGED
@@ -70,6 +70,7 @@ var s = {
70
70
  NexxtVideoPlayer: "components/organisms/VideoPlayer/VideoPlayer.vue",
71
71
  NexxtEditorSettingsBlock: "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
72
72
  NexxtEditorAlignItems: "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
73
+ NexxtEditorBackgroundSize: "components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue",
73
74
  NexxtEditorBorder: "components/editor/molecules/EditorBorder/EditorBorder.vue",
74
75
  NexxtEditorColor: "components/editor/molecules/EditorColor/EditorColor.vue",
75
76
  NexxtEditorFlexDirection: "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "1.29.0",
4
+ "version": "1.30.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -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>
@@ -67,6 +67,7 @@
67
67
  "NexxtVideoPlayer": "components/organisms/VideoPlayer/VideoPlayer.vue",
68
68
  "NexxtEditorSettingsBlock": "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
69
69
  "NexxtEditorAlignItems": "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
70
+ "NexxtEditorBackgroundSize": "components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue",
70
71
  "NexxtEditorBorder": "components/editor/molecules/EditorBorder/EditorBorder.vue",
71
72
  "NexxtEditorColor": "components/editor/molecules/EditorColor/EditorColor.vue",
72
73
  "NexxtEditorFlexDirection": "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
package/src/index.ts CHANGED
@@ -23,6 +23,10 @@ export type {
23
23
  EditorAlignItemsMessages,
24
24
  EditorAlignItemsValue,
25
25
  } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
26
+ export type {
27
+ EditorBackgroundSizeMessages,
28
+ EditorBackgroundSizeValue,
29
+ } from './components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue'
26
30
  export type {
27
31
  EditorFlexDirectionMessages,
28
32
  EditorFlexDirectionValue,
@@ -86,6 +90,7 @@ export { default as NexxtDatePicker } from './components/organisms/DatePicker/Da
86
90
  export { default as NexxtDoughnutChart } from './components/molecules/DoughnutChart/DoughnutChart.vue'
87
91
  export { default as NexxtDropdownButton } from './components/organisms/DropdownButton/DropdownButton.vue'
88
92
  export { default as NexxtEditorAlignItems } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
93
+ export { default as NexxtEditorBackgroundSize } from './components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue'
89
94
  export { default as NexxtEditorBorder } from './components/editor/molecules/EditorBorder/EditorBorder.vue'
90
95
  export { default as NexxtEditorColor } from './components/editor/molecules/EditorColor/EditorColor.vue'
91
96
  export { default as NexxtEditorFlexDirection } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue'