@thekestongroup/ui 0.5.0 → 0.7.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/FormField/FormField.vue.d.ts +5 -0
- package/dist/components/Input/Input.vue.d.ts +2 -0
- package/dist/components/InputDate/InputDate.vue.d.ts +2 -0
- package/dist/components/InputNumber/InputNumber.vue.d.ts +2 -0
- package/dist/components/InputPassword/InputPassword.vue.d.ts +2 -0
- package/dist/components/InputRichText/InputRichText.vue.d.ts +2 -0
- package/dist/components/Menu/Menu.vue.d.ts +38 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts +30 -3
- package/dist/components/Select/Select.vue.d.ts +2 -0
- package/dist/components/Tabs/Tabs.vue.d.ts +42 -0
- package/dist/index.d.ts +5 -1
- package/dist/keston-ui.js +983 -721
- package/package.json +1 -1
- package/src/components/FormField/FormField.vue +7 -2
- package/src/components/Input/Input.stories.ts +21 -0
- package/src/components/Input/Input.vue +3 -0
- package/src/components/InputDate/InputDate.vue +3 -0
- package/src/components/InputNumber/InputNumber.vue +3 -0
- package/src/components/InputPassword/InputPassword.vue +3 -0
- package/src/components/InputRichText/InputRichText.vue +3 -0
- package/src/components/Menu/Menu.stories.ts +40 -0
- package/src/components/Menu/Menu.vue +104 -0
- package/src/components/PageHeader/PageHeader.stories.ts +61 -1
- package/src/components/PageHeader/PageHeader.vue +131 -5
- package/src/components/Select/Select.vue +3 -0
- package/src/components/Tabs/Tabs.stories.ts +47 -0
- package/src/components/Tabs/Tabs.vue +69 -0
- package/src/index.ts +5 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component, HTMLAttributes } from 'vue'
|
|
3
|
+
import { TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from 'reka-ui'
|
|
4
|
+
import { cn } from '../../lib/cn'
|
|
5
|
+
|
|
6
|
+
export interface Tab {
|
|
7
|
+
/** Identifies the tab: v-model's value, and the name of its content slot. */
|
|
8
|
+
value: string
|
|
9
|
+
label: string
|
|
10
|
+
/** A Lucide (or any) icon component, shown before the label. */
|
|
11
|
+
icon?: Component
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sections of one page, one shown at a time, e.g. a user's Account and
|
|
17
|
+
* Licences & Apps. Built on Reka UI's Tabs: a tab list (arrow keys move
|
|
18
|
+
* between tabs, Home / End jump), each tab's content in a slot named after
|
|
19
|
+
* its value. Use v-model to know or set the open tab (e.g. to keep it in
|
|
20
|
+
* the URL).
|
|
21
|
+
*/
|
|
22
|
+
export interface TabsProps {
|
|
23
|
+
tabs: Tab[]
|
|
24
|
+
/** The tab list's accessible name, e.g. "User details". */
|
|
25
|
+
label: string
|
|
26
|
+
class?: HTMLAttributes['class']
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = defineProps<TabsProps>()
|
|
30
|
+
/** The open tab's value. Defaults to the first tab. */
|
|
31
|
+
const model = defineModel<string>()
|
|
32
|
+
|
|
33
|
+
defineSlots<Record<string, () => unknown>>()
|
|
34
|
+
|
|
35
|
+
// Like Sidebar's items: muted until hovered or chosen; the chosen one is
|
|
36
|
+
// primary, with a bar under it that slides between tabs.
|
|
37
|
+
const trigger = [
|
|
38
|
+
'relative inline-flex h-10 items-center gap-2 px-3 text-sm whitespace-nowrap text-black/65 outline-none',
|
|
39
|
+
'[&_svg]:size-4 [&_svg]:shrink-0',
|
|
40
|
+
'not-data-disabled:hover:text-black',
|
|
41
|
+
'data-[state=active]:font-bold data-[state=active]:text-primary',
|
|
42
|
+
'focus-visible:rounded focus-visible:ring-2 focus-visible:ring-primary',
|
|
43
|
+
'data-disabled:cursor-not-allowed data-disabled:opacity-40'
|
|
44
|
+
]
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<TabsRoot
|
|
49
|
+
:model-value="model ?? tabs[0]?.value"
|
|
50
|
+
:class="cn('flex flex-col gap-6', props.class)"
|
|
51
|
+
@update:model-value="model = String($event)"
|
|
52
|
+
>
|
|
53
|
+
<!-- Scrolls sideways on narrow screens rather than wrapping. -->
|
|
54
|
+
<TabsList :aria-label="label" class="relative flex overflow-x-auto overflow-y-hidden border-b border-black/15">
|
|
55
|
+
<TabsTrigger v-for="t in tabs" :key="t.value" :value="t.value" :disabled="t.disabled" :class="trigger">
|
|
56
|
+
<component :is="t.icon" v-if="t.icon" aria-hidden="true" />
|
|
57
|
+
{{ t.label }}
|
|
58
|
+
</TabsTrigger>
|
|
59
|
+
<TabsIndicator
|
|
60
|
+
class="absolute bottom-0 left-0 h-0.5 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position) rounded-full transition-[width,translate] duration-200 motion-reduce:transition-none"
|
|
61
|
+
>
|
|
62
|
+
<span class="block size-full rounded-full bg-primary" />
|
|
63
|
+
</TabsIndicator>
|
|
64
|
+
</TabsList>
|
|
65
|
+
<TabsContent v-for="t in tabs" :key="t.value" :value="t.value" class="outline-none">
|
|
66
|
+
<slot :name="t.value" />
|
|
67
|
+
</TabsContent>
|
|
68
|
+
</TabsRoot>
|
|
69
|
+
</template>
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { AppShellProps } from './components/AppShell/AppShell.vue'
|
|
|
11
11
|
export { default as Header } from './components/Header/Header.vue'
|
|
12
12
|
export type { HeaderProps, HeaderUser, HeaderUserAction } from './components/Header/Header.vue'
|
|
13
13
|
export { default as PageHeader } from './components/PageHeader/PageHeader.vue'
|
|
14
|
-
export type { PageHeaderProps } from './components/PageHeader/PageHeader.vue'
|
|
14
|
+
export type { PageHeaderAction, PageHeaderProps } from './components/PageHeader/PageHeader.vue'
|
|
15
15
|
|
|
16
16
|
// Element
|
|
17
17
|
export { default as Avatar } from './components/Avatar/Avatar.vue'
|
|
@@ -89,6 +89,10 @@ export type { LinkProps } from './components/Link/Link.vue'
|
|
|
89
89
|
// Overlay
|
|
90
90
|
export { default as Popover } from './components/Popover/Popover.vue'
|
|
91
91
|
export type { PopoverProps } from './components/Popover/Popover.vue'
|
|
92
|
+
export { default as Menu } from './components/Menu/Menu.vue'
|
|
93
|
+
export type { MenuItem, MenuProps } from './components/Menu/Menu.vue'
|
|
94
|
+
export { default as Tabs } from './components/Tabs/Tabs.vue'
|
|
95
|
+
export type { Tab, TabsProps } from './components/Tabs/Tabs.vue'
|
|
92
96
|
export { default as Slideover } from './components/Slideover/Slideover.vue'
|
|
93
97
|
export type { SlideoverProps } from './components/Slideover/Slideover.vue'
|
|
94
98
|
export { default as Tooltip } from './components/Tooltip/Tooltip.vue'
|