@nexxtmove/ui 1.17.0 → 1.18.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
@@ -65,6 +65,7 @@ var s = {
65
65
  NexxtToaster: "components/organisms/Toaster/Toaster.vue",
66
66
  NexxtVideoPlayer: "components/organisms/VideoPlayer/VideoPlayer.vue",
67
67
  NexxtEditorSettingsBlock: "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
68
+ NexxtEditorAlignItems: "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
68
69
  NexxtEditorFlexDirection: "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
69
70
  NexxtEditorJustifyContent: "components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue"
70
71
  }, c = ["@nexxtmove/ui/ui.css", "@nexxtmove/ui/dist/ui.css"], l = (e, t) => e.some((e) => e === t || c.includes(e)), u = i({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "1.17.0",
4
+ "version": "1.18.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -0,0 +1,94 @@
1
+ <script lang="ts">
2
+ /**
3
+ * The cross-axis alignment as the editor needs it: the Tailwind class itself,
4
+ * so the consumer can put the model value straight on the element it styles.
5
+ */
6
+ export type EditorAlignItemsValue = 'items-start' | 'items-center' | 'items-end' | 'items-stretch'
7
+
8
+ /** Overridable copy for the four options. Every key is optional. */
9
+ export interface EditorAlignItemsMessages {
10
+ /** Accessible name of the `items-start` option. Defaults to `'Begin'`. */
11
+ start?: string
12
+ /** Accessible name of the `items-center` option. Defaults to `'Midden'`. */
13
+ center?: string
14
+ /** Accessible name of the `items-end` option. Defaults to `'Einde'`. */
15
+ end?: string
16
+ /** Accessible name of the `items-stretch` option. Defaults to `'Uitrekken'`. */
17
+ stretch?: string
18
+ }
19
+
20
+ export interface NexxtEditorAlignItemsProps {
21
+ /**
22
+ * Header text of the settings block. Defaults to the Dutch
23
+ * `'Uitlijning items'`; 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?: EditorAlignItemsMessages
34
+ }
35
+
36
+ const DEFAULT_MESSAGES = {
37
+ start: 'Begin',
38
+ center: 'Midden',
39
+ end: 'Einde',
40
+ stretch: 'Uitrekken',
41
+ } satisfies Required<EditorAlignItemsMessages>
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: 'NexxtEditorAlignItems' })
51
+
52
+ const { label = 'Uitlijning items', messages } = defineProps<NexxtEditorAlignItemsProps>()
53
+
54
+ /** The selected alignment, as the Tailwind class to apply. */
55
+ const model = defineModel<EditorAlignItemsValue>({ required: true })
56
+
57
+ const copy = computed(() => ({ ...DEFAULT_MESSAGES, ...messages }))
58
+
59
+ // Icon-only and deliberately without tooltips, matching the justify-content
60
+ // block it sits next to: four labels do not fit side by side at the width the
61
+ // editor sidebar gives this block. The icons are the vertical counterparts of
62
+ // that block's horizontal ones. `items-stretch` gets `arrows-up-down` rather
63
+ // than a distribute-spacing icon, because stretching fills the cross axis --
64
+ // the spacing icons depict gaps between separate objects, which is the
65
+ // justify-between metaphor, not this one. The copy travels as `ariaLabel`, so
66
+ // the buttons still have a name for assistive technology.
67
+ const options = computed<NexxtToggleGroupOption[]>(() => [
68
+ { value: 'items-start', icon: 'objects-align-top', ariaLabel: copy.value.start },
69
+ {
70
+ value: 'items-center',
71
+ icon: 'objects-align-center-vertical',
72
+ ariaLabel: copy.value.center,
73
+ },
74
+ { value: 'items-end', icon: 'objects-align-bottom', ariaLabel: copy.value.end },
75
+ { value: 'items-stretch', icon: 'arrows-up-down', ariaLabel: copy.value.stretch },
76
+ ])
77
+
78
+ // ToggleGroup types its model as the open `string` of its options, so writing
79
+ // straight back into the narrower model is a type error. The setter is the one
80
+ // place that narrowing happens, and it is safe: the only values ToggleGroup can
81
+ // emit are the option values built above.
82
+ const selected = computed({
83
+ get: () => model.value,
84
+ set: (value: string) => {
85
+ model.value = value as EditorAlignItemsValue
86
+ },
87
+ })
88
+ </script>
89
+
90
+ <template>
91
+ <NexxtEditorSettingsBlock :label="label">
92
+ <NexxtToggleGroup v-model="selected" :options="options" />
93
+ </NexxtEditorSettingsBlock>
94
+ </template>
@@ -62,6 +62,7 @@
62
62
  "NexxtToaster": "components/organisms/Toaster/Toaster.vue",
63
63
  "NexxtVideoPlayer": "components/organisms/VideoPlayer/VideoPlayer.vue",
64
64
  "NexxtEditorSettingsBlock": "components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue",
65
+ "NexxtEditorAlignItems": "components/editor/molecules/EditorAlignItems/EditorAlignItems.vue",
65
66
  "NexxtEditorFlexDirection": "components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue",
66
67
  "NexxtEditorJustifyContent": "components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue"
67
68
  }
package/src/index.ts CHANGED
@@ -13,6 +13,10 @@ export type { EnergyLabelLetter } from './components/atoms/EnergyLabel/EnergyLab
13
13
  export type { IconType, NexxtIconName } from './components/atoms/Icon/Icon.vue'
14
14
  export type { CustomIconName } from './components/atoms/Icon/customIcons'
15
15
  export type { NexxtTabItem } from './components/molecules/Tabs/Tabs.vue'
16
+ export type {
17
+ EditorAlignItemsMessages,
18
+ EditorAlignItemsValue,
19
+ } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
16
20
  export type {
17
21
  EditorFlexDirectionMessages,
18
22
  EditorFlexDirectionValue,
@@ -44,6 +48,7 @@ export { default as NexxtCustomerJourneyTile } from './components/molecules/Cust
44
48
  export { default as NexxtDatePicker } from './components/organisms/DatePicker/DatePicker.vue'
45
49
  export { default as NexxtDoughnutChart } from './components/molecules/DoughnutChart/DoughnutChart.vue'
46
50
  export { default as NexxtDropdownButton } from './components/organisms/DropdownButton/DropdownButton.vue'
51
+ export { default as NexxtEditorAlignItems } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue'
47
52
  export { default as NexxtEditorFlexDirection } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue'
48
53
  export { default as NexxtEditorJustifyContent } from './components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue'
49
54
  export { default as NexxtEditorSettingsBlock } from './components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue'