@nexxtmove/ui 1.8.1 → 1.10.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/atoms/SelectableOption/SelectableOption.vue.d.ts +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +219 -177
- package/dist/nuxt.js +1 -0
- package/package.json +1 -2
- package/src/components/atoms/SelectableOption/SelectableOption.vue +64 -0
- package/src/components.json +1 -0
- package/src/index.ts +2 -0
package/dist/nuxt.js
CHANGED
|
@@ -13,6 +13,7 @@ var s = {
|
|
|
13
13
|
NexxtIcon: "components/atoms/Icon/Icon.vue",
|
|
14
14
|
NexxtPresenceIndicator: "components/atoms/PresenceIndicator/PresenceIndicator.vue",
|
|
15
15
|
NexxtPropertyListing: "components/atoms/PropertyListing/PropertyListing.vue",
|
|
16
|
+
NexxtSelectableOption: "components/atoms/SelectableOption/SelectableOption.vue",
|
|
16
17
|
NexxtSkeleton: "components/atoms/Skeleton/Skeleton.vue",
|
|
17
18
|
NexxtSlider: "components/atoms/Slider/Slider.vue",
|
|
18
19
|
NexxtSquircle: "components/atoms/Squircle/Squircle.vue",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexxtmove/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"build": "vite build",
|
|
85
85
|
"format": "prettier --write .",
|
|
86
86
|
"generate:index": "node --experimental-strip-types ./scripts/generate-index.ts",
|
|
87
|
-
"version": "node --experimental-strip-types ./scripts/changelog.ts && git add CHANGELOG.md",
|
|
88
87
|
"lint": "eslint .",
|
|
89
88
|
"lint:fix": "eslint . --fix",
|
|
90
89
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import NexxtIcon from '../Icon/Icon.vue'
|
|
3
|
+
|
|
4
|
+
interface NexxtSelectableOptionProps {
|
|
5
|
+
/** Whether this option is currently chosen. */
|
|
6
|
+
selected?: boolean
|
|
7
|
+
/** Disables the option, so it can no longer be chosen. */
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
/** Corner radius. Tile pickers use `xl`, compact rows of choices use `lg`. */
|
|
10
|
+
rounded?: 'lg' | 'xl' | '3xl'
|
|
11
|
+
/** Shows a check badge in the top-right corner while selected. For cards; compact rows of choices do without. */
|
|
12
|
+
checkmark?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
defineOptions({
|
|
16
|
+
name: 'NexxtSelectableOption',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
selected = false,
|
|
21
|
+
disabled = false,
|
|
22
|
+
rounded = 'xl',
|
|
23
|
+
checkmark = false,
|
|
24
|
+
} = defineProps<NexxtSelectableOptionProps>()
|
|
25
|
+
|
|
26
|
+
// Content often styles itself by the selection too -- an icon or label that
|
|
27
|
+
// changes colour -- so the state is handed to the slot rather than kept inside.
|
|
28
|
+
defineSlots<{ default(props: { selected: boolean }): unknown }>()
|
|
29
|
+
|
|
30
|
+
// The template must stay single-root: a leading comment would turn it into a
|
|
31
|
+
// fragment, and then class, disabled and aria-pressed no longer reach the
|
|
32
|
+
// button. type="button" so an option inside a form never submits it.
|
|
33
|
+
|
|
34
|
+
// Written out in full so Tailwind can find every class in the source.
|
|
35
|
+
const RADIUS = {
|
|
36
|
+
lg: 'rounded-lg',
|
|
37
|
+
xl: 'rounded-xl',
|
|
38
|
+
'3xl': 'rounded-3xl',
|
|
39
|
+
} as const
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
:disabled="disabled"
|
|
46
|
+
:aria-pressed="selected"
|
|
47
|
+
class="border transition-colors disabled:cursor-not-allowed disabled:opacity-50"
|
|
48
|
+
:class="[
|
|
49
|
+
RADIUS[rounded],
|
|
50
|
+
checkmark && 'relative',
|
|
51
|
+
selected
|
|
52
|
+
? 'border-cornflower-blue-500 bg-cornflower-blue-50 text-cornflower-blue-700'
|
|
53
|
+
: 'border-gray-200 bg-white text-neutral-700 hover:border-gray-300 hover:bg-gray-50',
|
|
54
|
+
]"
|
|
55
|
+
>
|
|
56
|
+
<slot :selected="selected" />
|
|
57
|
+
<span
|
|
58
|
+
v-if="checkmark && selected"
|
|
59
|
+
class="absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center rounded-full bg-cornflower-blue-500 text-white shadow"
|
|
60
|
+
>
|
|
61
|
+
<NexxtIcon name="check" type="solid" class="text-xs" />
|
|
62
|
+
</span>
|
|
63
|
+
</button>
|
|
64
|
+
</template>
|
package/src/components.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"NexxtIcon": "components/atoms/Icon/Icon.vue",
|
|
11
11
|
"NexxtPresenceIndicator": "components/atoms/PresenceIndicator/PresenceIndicator.vue",
|
|
12
12
|
"NexxtPropertyListing": "components/atoms/PropertyListing/PropertyListing.vue",
|
|
13
|
+
"NexxtSelectableOption": "components/atoms/SelectableOption/SelectableOption.vue",
|
|
13
14
|
"NexxtSkeleton": "components/atoms/Skeleton/Skeleton.vue",
|
|
14
15
|
"NexxtSlider": "components/atoms/Slider/Slider.vue",
|
|
15
16
|
"NexxtSquircle": "components/atoms/Squircle/Squircle.vue",
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type {
|
|
|
9
9
|
TimelinePhase,
|
|
10
10
|
TimelineResponse,
|
|
11
11
|
} from './components/molecules/TimelineEvent/TimelineTypes'
|
|
12
|
+
export type { EnergyLabelLetter } from './components/atoms/EnergyLabel/EnergyLabel.vue'
|
|
12
13
|
export type { IconType, NexxtIconName } from './components/atoms/Icon/Icon.vue'
|
|
13
14
|
export type { CustomIconName } from './components/atoms/Icon/customIcons'
|
|
14
15
|
export type { NexxtTabItem } from './components/molecules/Tabs/Tabs.vue'
|
|
@@ -46,6 +47,7 @@ export { default as NexxtPropertyCard } from './components/molecules/PropertyCar
|
|
|
46
47
|
export { default as NexxtPropertyListing } from './components/atoms/PropertyListing/PropertyListing.vue'
|
|
47
48
|
export { default as NexxtReferenceCard } from './components/organisms/ReferenceCard/ReferenceCard.vue'
|
|
48
49
|
export { default as NexxtSelect } from './components/molecules/Select/Select.vue'
|
|
50
|
+
export { default as NexxtSelectableOption } from './components/atoms/SelectableOption/SelectableOption.vue'
|
|
49
51
|
export { default as NexxtSidebarMenuItem } from './components/molecules/SidebarMenuItem/SidebarMenuItem.vue'
|
|
50
52
|
export { default as NexxtSkeleton } from './components/atoms/Skeleton/Skeleton.vue'
|
|
51
53
|
export { default as NexxtSkeletonPropertyCard } from './components/molecules/SkeletonPropertyCard/SkeletonPropertyCard.vue'
|