nuance-ui 0.2.36 → 0.3.1
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/module.d.mts +3 -0
- package/dist/module.d.ts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -3
- package/dist/runtime/app-config.d.ts +4 -0
- package/dist/runtime/components/accordion/accordion-header.d.vue.ts +28 -0
- package/dist/runtime/components/accordion/accordion-header.vue +79 -0
- package/dist/runtime/components/accordion/accordion-header.vue.d.ts +28 -0
- package/dist/runtime/components/accordion/accordion-item.d.vue.ts +18 -0
- package/dist/runtime/components/accordion/accordion-item.vue +44 -0
- package/dist/runtime/components/accordion/accordion-item.vue.d.ts +18 -0
- package/dist/runtime/components/accordion/accordion-panel.d.vue.ts +18 -0
- package/dist/runtime/components/accordion/accordion-panel.vue +40 -0
- package/dist/runtime/components/accordion/accordion-panel.vue.d.ts +18 -0
- package/dist/runtime/components/accordion/accordion.d.vue.ts +61 -0
- package/dist/runtime/components/accordion/accordion.module.css +1 -0
- package/dist/runtime/components/accordion/accordion.vue +91 -0
- package/dist/runtime/components/accordion/accordion.vue.d.ts +61 -0
- package/dist/runtime/components/accordion/index.d.ts +6 -0
- package/dist/runtime/components/accordion/index.js +4 -0
- package/dist/runtime/components/accordion/lib/context.d.ts +34 -0
- package/dist/runtime/components/accordion/lib/context.js +9 -0
- package/dist/runtime/components/action-icon/action-icon.d.vue.ts +11 -1
- package/dist/runtime/components/action-icon/action-icon.module.css +1 -1
- package/dist/runtime/components/action-icon/action-icon.vue +20 -5
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +11 -1
- package/dist/runtime/components/button/button.d.vue.ts +8 -0
- package/dist/runtime/components/button/button.module.css +1 -1
- package/dist/runtime/components/button/button.vue +17 -4
- package/dist/runtime/components/button/button.vue.d.ts +8 -0
- package/dist/runtime/components/collapse.d.vue.ts +65 -0
- package/dist/runtime/components/collapse.vue +144 -0
- package/dist/runtime/components/collapse.vue.d.ts +65 -0
- package/dist/runtime/components/date-time-picker.d.vue.ts +2 -2
- package/dist/runtime/components/date-time-picker.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-close-button.vue +5 -0
- package/dist/runtime/components/drawer/drawer-close-button.vue +5 -0
- package/dist/runtime/components/files/file-upload-button.vue +4 -0
- package/dist/runtime/components/files/file-upload-icon.vue +5 -0
- package/dist/runtime/components/index.d.ts +2 -2
- package/dist/runtime/components/index.js +1 -1
- package/dist/runtime/components/input/date-picker.d.vue.ts +2 -2
- package/dist/runtime/components/input/date-picker.vue.d.ts +2 -2
- package/dist/runtime/components/link/lib.d.ts +2 -2
- package/dist/runtime/components/link/link-button.vue +4 -0
- package/dist/runtime/components/modal/modal-close-button.vue +5 -0
- package/dist/runtime/components/nav-link/nav-icon-link.d.vue.ts +5 -11
- package/dist/runtime/components/nav-link/nav-icon-link.vue +12 -8
- package/dist/runtime/components/nav-link/nav-icon-link.vue.d.ts +5 -11
- package/dist/runtime/components/table/ui/table-sortable-header.vue +4 -0
- package/dist/runtime/components/tabs/tabs-root.d.vue.ts +1 -1
- package/dist/runtime/components/tabs/tabs-root.vue.d.ts +1 -1
- package/dist/runtime/components/text.vue +1 -1
- package/dist/runtime/components/theme-toggle.vue +5 -0
- package/dist/runtime/composables/use-config.d.ts +1 -0
- package/dist/runtime/composables/use-config.js +2 -1
- package/dist/runtime/utils/const/active-variants.d.ts +11 -0
- package/dist/runtime/utils/const/active-variants.js +9 -0
- package/dist/runtime/utils/const/index.d.ts +1 -0
- package/dist/runtime/utils/const/index.js +1 -0
- package/package.json +1 -1
- package/dist/runtime/components/accordion.d.vue.ts +0 -79
- package/dist/runtime/components/accordion.vue +0 -44
- package/dist/runtime/components/accordion.vue.d.ts +0 -79
- package/dist/runtime/components/collapsible/collapsible-content.d.vue.ts +0 -18
- package/dist/runtime/components/collapsible/collapsible-content.vue +0 -76
- package/dist/runtime/components/collapsible/collapsible-content.vue.d.ts +0 -18
- package/dist/runtime/components/collapsible/collapsible-root.d.vue.ts +0 -42
- package/dist/runtime/components/collapsible/collapsible-root.vue +0 -41
- package/dist/runtime/components/collapsible/collapsible-root.vue.d.ts +0 -42
- package/dist/runtime/components/collapsible/collapsible-trigger.d.vue.ts +0 -13
- package/dist/runtime/components/collapsible/collapsible-trigger.vue +0 -20
- package/dist/runtime/components/collapsible/collapsible-trigger.vue.d.ts +0 -13
- package/dist/runtime/components/collapsible/index.d.ts +0 -3
- package/dist/runtime/components/collapsible/index.js +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Classes } from '@nui/types';
|
|
2
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
3
|
+
export type AccordionVariant = 'default' | 'contained' | 'filled' | 'separated';
|
|
4
|
+
export type AccordionChevronPosition = 'left' | 'right';
|
|
5
|
+
export type AccordionClasses = Classes<'root' | 'item' | 'header' | 'control' | 'label' | 'icon' | 'chevron' | 'panel' | 'content'>;
|
|
6
|
+
export interface AccordionRootContext {
|
|
7
|
+
/** User-provided class names per styles-API part */
|
|
8
|
+
classes: Ref<AccordionClasses | undefined>;
|
|
9
|
+
/** Whether the item with the given value is currently open */
|
|
10
|
+
isItemActive: (value: string) => boolean;
|
|
11
|
+
/** Toggle the item with the given value */
|
|
12
|
+
toggleItem: (value: string) => void;
|
|
13
|
+
/** Build the accessible id for an item header */
|
|
14
|
+
getHeaderId: (value: string) => string;
|
|
15
|
+
/** Build the accessible id for an item panel */
|
|
16
|
+
getPanelId: (value: string) => string;
|
|
17
|
+
disabled: Ref<boolean | undefined>;
|
|
18
|
+
variant: Ref<AccordionVariant>;
|
|
19
|
+
transitionDuration: Ref<number>;
|
|
20
|
+
disableChevronRotation: Ref<boolean | undefined>;
|
|
21
|
+
chevronPosition: Ref<AccordionChevronPosition>;
|
|
22
|
+
chevron: Ref<string | undefined>;
|
|
23
|
+
order: Ref<'1' | '2' | '3' | '4' | '5' | '6' | undefined>;
|
|
24
|
+
loop: Ref<boolean>;
|
|
25
|
+
keepMounted: Ref<boolean>;
|
|
26
|
+
}
|
|
27
|
+
export interface AccordionItemContext {
|
|
28
|
+
value: ComputedRef<string>;
|
|
29
|
+
open: ComputedRef<boolean>;
|
|
30
|
+
disabled: ComputedRef<boolean | undefined>;
|
|
31
|
+
dataState: ComputedRef<'open' | 'closed'>;
|
|
32
|
+
}
|
|
33
|
+
export declare const provideAccordionRootState: (state: AccordionRootContext) => AccordionRootContext, useAccordionRootState: () => AccordionRootContext;
|
|
34
|
+
export declare const provideAccordionItemState: (state: AccordionItemContext) => AccordionItemContext, useAccordionItemState: () => AccordionItemContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createStrictInjection } from "@nui/composables";
|
|
2
|
+
export const [provideAccordionRootState, useAccordionRootState] = createStrictInjection(
|
|
3
|
+
(state) => state,
|
|
4
|
+
{ name: "AccordionRoot", injectionKey: Symbol("accordion-root") }
|
|
5
|
+
);
|
|
6
|
+
export const [provideAccordionItemState, useAccordionItemState] = createStrictInjection(
|
|
7
|
+
(state) => state,
|
|
8
|
+
{ name: "AccordionItem", injectionKey: Symbol("accordion-item") }
|
|
9
|
+
);
|
|
@@ -4,11 +4,13 @@ export type ActionIconClasses = 'root' | 'icon';
|
|
|
4
4
|
export type ActionIconVariant = 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient';
|
|
5
5
|
export type ActionIconSize = NuanceSize | `input-${NuanceSize}` | AnyString;
|
|
6
6
|
export interface ActionIconVars {
|
|
7
|
-
root: '--ai-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
|
|
7
|
+
root: '--ai-size' | '--ai-icon-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
|
|
8
8
|
}
|
|
9
9
|
export interface ActionIconProps {
|
|
10
10
|
/** Component size @default 'md' */
|
|
11
11
|
size?: ActionIconSize;
|
|
12
|
+
/** Icon size — `%` stays relative to the button, other values resolve via size tokens @default '70%' */
|
|
13
|
+
iconSize?: number | string;
|
|
12
14
|
/** Gradient configuration (used with `variant="gradient"`) */
|
|
13
15
|
gradient?: NuanceGradient;
|
|
14
16
|
/** Color from theme */
|
|
@@ -25,6 +27,14 @@ export interface ActionIconProps {
|
|
|
25
27
|
mod?: BoxProps['mod'];
|
|
26
28
|
/** Visual variant */
|
|
27
29
|
variant?: ActionIconVariant;
|
|
30
|
+
/** Active/pressed state — adds `data-active` and the matching ARIA attribute */
|
|
31
|
+
active?: boolean;
|
|
32
|
+
/** ARIA semantic for `active` @default 'pressed' */
|
|
33
|
+
activeMode?: 'pressed' | 'current';
|
|
34
|
+
/** Variant applied when `active`. Defaults to the configured map for the current `variant` */
|
|
35
|
+
activeVariant?: ActionIconVariant;
|
|
36
|
+
/** Color applied when `active` @default 'primary' */
|
|
37
|
+
activeColor?: NuanceColor;
|
|
28
38
|
/** Styles API */
|
|
29
39
|
classes?: Classes<ActionIconClasses>;
|
|
30
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--ai-size-xs:rem(26px);--ai-size-sm:rem(30px);--ai-size-md:rem(36px);--ai-size-lg:rem(42px);--ai-size-xl:rem(50px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-sm);--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover);color:var(--ai-color)}.loader{align-items:center;border-radius:var(--ai-radius,var(--radius-default));display:flex;justify-content:center;left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2);@mixin where-light{background-color:hsla(0,0%,100%,.15)}@mixin where-dark{background-color:rgba(0,0,0,.15)}}.icon{align-items:center;display:flex;height:100%;justify-content:center;transition:transform .15s ease,opacity .1s ease;width:100%}.icon-element{height:
|
|
1
|
+
.root{--ai-size-xs:rem(26px);--ai-size-sm:rem(30px);--ai-size-md:rem(36px);--ai-size-lg:rem(42px);--ai-size-xl:rem(50px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-sm);--ai-icon-size:70%;--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover);color:var(--ai-color)}.loader{align-items:center;border-radius:var(--ai-radius,var(--radius-default));display:flex;justify-content:center;left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2);@mixin where-light{background-color:hsla(0,0%,100%,.15)}@mixin where-dark{background-color:rgba(0,0,0,.15)}}.icon{align-items:center;display:flex;height:100%;justify-content:center;transition:transform .15s ease,opacity .1s ease;width:100%}.icon-element{height:var(--ai-icon-size);width:var(--ai-icon-size)}.group{--ai-border-width:1px;display:flex}.group :where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal] .groupSection:not(:only-child):first-child,.group[data-orientation=horizontal] .root:not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--ai-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):last-child,.group[data-orientation=horizontal] .root:not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--ai-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=horizontal] .root:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--ai-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical] .groupSection:not(:only-child):first-child,.group[data-orientation=vertical] .root:not(:only-child):first-child{border-bottom-width:calc(var(--ai-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical] .groupSection:not(:only-child):last-child,.group[data-orientation=vertical] .root:not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.group[data-orientation=vertical] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=vertical] .root:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--ai-border-width)/2);border-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.section{--section-height-xs:var(--ai-size-xs);--section-height-sm:var(--ai-size-sm);--section-height-md:var(--ai-size-md);--section-height-lg:var(--ai-size-lg);--section-height-xl:var(--ai-size-xl);--section-height-input-xs:var(--ai-size-input-xs);--section-height-input-sm:var(--ai-size-input-sm);--section-height-input-md:var(--ai-size-input-md);--section-height-input-lg:var(--ai-size-input-lg);--section-height-input-xl:var(--ai-size-input-xl);--section-padding-x-xs:rem(6px);--section-padding-x-sm:rem(8px);--section-padding-x-md:rem(10px);--section-padding-x-lg:rem(12px);--section-padding-x-xl:rem(16px);--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--color-white);align-items:center;background:var(--section-bg,var(--color-primary-filled));border:var(--section-bd,rem(1px) solid transparent);border-radius:var(--section-radius,var(--radius-default));color:var(--section-color,var(--color-white));display:inline-flex;font-size:var(--section-fz,var(--font-size-md));font-weight:600;height:var(--section-height,var(--section-height-sm));justify-content:center;line-height:1;padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;width:auto}
|
|
@@ -5,8 +5,9 @@ import Box from "../box.vue";
|
|
|
5
5
|
import Loader from "../loader/loader.vue";
|
|
6
6
|
import css from "./action-icon.module.css";
|
|
7
7
|
const {
|
|
8
|
-
color,
|
|
8
|
+
color = "gray",
|
|
9
9
|
size,
|
|
10
|
+
iconSize,
|
|
10
11
|
variant = "default",
|
|
11
12
|
gradient,
|
|
12
13
|
loading,
|
|
@@ -14,9 +15,14 @@ const {
|
|
|
14
15
|
radius,
|
|
15
16
|
mod,
|
|
16
17
|
icon,
|
|
17
|
-
disabled
|
|
18
|
+
disabled,
|
|
19
|
+
active,
|
|
20
|
+
activeMode = "pressed",
|
|
21
|
+
activeVariant,
|
|
22
|
+
activeColor = "primary"
|
|
18
23
|
} = defineProps({
|
|
19
24
|
size: { type: null, required: false },
|
|
25
|
+
iconSize: { type: [Number, String], required: false },
|
|
20
26
|
gradient: { type: Object, required: false },
|
|
21
27
|
color: { type: null, required: false },
|
|
22
28
|
radius: { type: [String, Number, Object], required: false },
|
|
@@ -25,19 +31,26 @@ const {
|
|
|
25
31
|
disabled: { type: Boolean, required: false },
|
|
26
32
|
mod: { type: [Object, Array, null], required: false },
|
|
27
33
|
variant: { type: String, required: false },
|
|
34
|
+
active: { type: Boolean, required: false },
|
|
35
|
+
activeMode: { type: String, required: false },
|
|
36
|
+
activeVariant: { type: String, required: false },
|
|
37
|
+
activeColor: { type: null, required: false },
|
|
28
38
|
classes: { type: Object, required: false }
|
|
29
39
|
});
|
|
30
|
-
const { variantResolver } = useConfig();
|
|
40
|
+
const { variantResolver, activeVariants } = useConfig();
|
|
31
41
|
const style = useVarsResolver((theme) => {
|
|
42
|
+
const resolvedVariant = active ? activeVariant ?? activeVariants[variant] : variant;
|
|
43
|
+
const resolvedColor = active ? activeColor : color;
|
|
32
44
|
const {
|
|
33
45
|
background,
|
|
34
46
|
border,
|
|
35
47
|
hover,
|
|
36
48
|
text
|
|
37
|
-
} = variantResolver({ variant, color, theme, gradient });
|
|
49
|
+
} = variantResolver({ variant: resolvedVariant, color: resolvedColor, theme, gradient });
|
|
38
50
|
return {
|
|
39
51
|
root: {
|
|
40
52
|
"--ai-size": getSize(size, "ai-size"),
|
|
53
|
+
"--ai-icon-size": getSize(iconSize),
|
|
41
54
|
"--ai-radius": getRadius(radius),
|
|
42
55
|
"--ai-bg": background,
|
|
43
56
|
"--ai-hover": hover,
|
|
@@ -52,10 +65,12 @@ const style = useVarsResolver((theme) => {
|
|
|
52
65
|
<Box
|
|
53
66
|
is='button'
|
|
54
67
|
type='button'
|
|
55
|
-
:mod='[{ loading }, mod]'
|
|
68
|
+
:mod='[{ loading, active }, mod]'
|
|
56
69
|
:style='style.root'
|
|
57
70
|
:class='[css.root, classes?.root]'
|
|
58
71
|
:disabled='(!disabled ? loading : disabled) || void 0'
|
|
72
|
+
:aria-pressed='activeMode === "pressed" ? active : void 0'
|
|
73
|
+
:aria-current='active && activeMode === "current" ? "page" : void 0'
|
|
59
74
|
>
|
|
60
75
|
<Transition name='slide-down'>
|
|
61
76
|
<Loader
|
|
@@ -4,11 +4,13 @@ export type ActionIconClasses = 'root' | 'icon';
|
|
|
4
4
|
export type ActionIconVariant = 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient';
|
|
5
5
|
export type ActionIconSize = NuanceSize | `input-${NuanceSize}` | AnyString;
|
|
6
6
|
export interface ActionIconVars {
|
|
7
|
-
root: '--ai-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
|
|
7
|
+
root: '--ai-size' | '--ai-icon-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
|
|
8
8
|
}
|
|
9
9
|
export interface ActionIconProps {
|
|
10
10
|
/** Component size @default 'md' */
|
|
11
11
|
size?: ActionIconSize;
|
|
12
|
+
/** Icon size — `%` stays relative to the button, other values resolve via size tokens @default '70%' */
|
|
13
|
+
iconSize?: number | string;
|
|
12
14
|
/** Gradient configuration (used with `variant="gradient"`) */
|
|
13
15
|
gradient?: NuanceGradient;
|
|
14
16
|
/** Color from theme */
|
|
@@ -25,6 +27,14 @@ export interface ActionIconProps {
|
|
|
25
27
|
mod?: BoxProps['mod'];
|
|
26
28
|
/** Visual variant */
|
|
27
29
|
variant?: ActionIconVariant;
|
|
30
|
+
/** Active/pressed state — adds `data-active` and the matching ARIA attribute */
|
|
31
|
+
active?: boolean;
|
|
32
|
+
/** ARIA semantic for `active` @default 'pressed' */
|
|
33
|
+
activeMode?: 'pressed' | 'current';
|
|
34
|
+
/** Variant applied when `active`. Defaults to the configured map for the current `variant` */
|
|
35
|
+
activeVariant?: ActionIconVariant;
|
|
36
|
+
/** Color applied when `active` @default 'primary' */
|
|
37
|
+
activeColor?: NuanceColor;
|
|
28
38
|
/** Styles API */
|
|
29
39
|
classes?: Classes<ActionIconClasses>;
|
|
30
40
|
}
|
|
@@ -30,6 +30,14 @@ export interface ButtonProps extends BoxProps {
|
|
|
30
30
|
rightSectionProps?: HTMLAttributes;
|
|
31
31
|
/** Visual variant */
|
|
32
32
|
variant?: ButtonVariant;
|
|
33
|
+
/** Active/pressed state — adds `data-active` and the matching ARIA attribute */
|
|
34
|
+
active?: boolean;
|
|
35
|
+
/** ARIA semantic for `active` @default 'pressed' */
|
|
36
|
+
activeMode?: 'pressed' | 'current';
|
|
37
|
+
/** Variant applied when `active`. Defaults to the configured map for the current `variant` */
|
|
38
|
+
activeVariant?: ButtonVariant;
|
|
39
|
+
/** Color applied when `active` @default 'primary' */
|
|
40
|
+
activeColor?: NuanceColor;
|
|
33
41
|
/** Styles API */
|
|
34
42
|
classes?: Classes<ButtonClasses>;
|
|
35
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--button-height-xs:rem(26px);--button-height-sm:rem(30px);--button-height-md:rem(36px);--button-height-lg:rem(42px);--button-height-xl:rem(50px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-md);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);--button-spacing:0;--button-justify:center;--button-section-size:calc(var(--button-height) - 0.25rem);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:500;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:0}.root:where([data-with-right-section]){padding-inline-end:0}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled-text);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root:hover:where(:not([data-loading],:disabled))
|
|
1
|
+
.root{--button-height-xs:rem(26px);--button-height-sm:rem(30px);--button-height-md:rem(36px);--button-height-lg:rem(42px);--button-height-xl:rem(50px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-md);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);--button-spacing:0;--button-justify:center;--button-section-size:calc(var(--button-height) - 0.25rem);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:500;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:0}.root:where([data-with-right-section]){padding-inline-end:0}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled-text);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root:hover:where(:not([data-loading],:disabled)){background:var(--button-hover);color:var(--button-color)}.root:hover:where(:not([data-loading],:disabled)):where([data-variant=gradient-outline]){color:#fff}.inner{gap:var(--button-spacing);justify-content:center;overflow:visible;transition:transform .15s ease,opacity .1s ease;width:100%}.inner,.label{align-items:center;display:flex;height:100%}.label{flex:1;justify-content:var(--button-justify);opacity:1;overflow:hidden;white-space:nowrap}.label:where([data-loading]){opacity:.2}.section{--section-pointer-events:none;align-items:center;display:flex;height:100%;justify-content:center;pointer-events:var(--section-pointer-events);width:var(--button-section-size)}.loader{left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2)}.group{--group-border-width:1px;display:flex}.group>:where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal]>:where(*):not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--group-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--group-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--group-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical]>:where(*):not(:only-child):first-child{border-bottom-width:calc(var(--group-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical]>:where(*):not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--group-border-width)/2)}.group[data-orientation=vertical]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--group-border-width)/2);border-radius:0;border-top-width:calc(var(--group-border-width)/2)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useConfig, useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { getFontSize, getRadius, getSize, getSpacing } from "@nui/utils";
|
|
4
|
+
import { computed } from "vue";
|
|
4
5
|
import Box from "../box.vue";
|
|
5
6
|
import Loader from "../loader/loader.vue";
|
|
6
7
|
import css from "./button.module.css";
|
|
@@ -14,6 +15,10 @@ const {
|
|
|
14
15
|
loading,
|
|
15
16
|
classes,
|
|
16
17
|
rightSectionProps,
|
|
18
|
+
active,
|
|
19
|
+
activeMode = "pressed",
|
|
20
|
+
activeVariant,
|
|
21
|
+
activeColor = "primary",
|
|
17
22
|
...props
|
|
18
23
|
} = defineProps({
|
|
19
24
|
color: { type: null, required: false },
|
|
@@ -29,16 +34,21 @@ const {
|
|
|
29
34
|
leftSectionProps: { type: Object, required: false },
|
|
30
35
|
rightSectionProps: { type: Object, required: false },
|
|
31
36
|
variant: { type: String, required: false },
|
|
37
|
+
active: { type: Boolean, required: false },
|
|
38
|
+
activeMode: { type: String, required: false },
|
|
39
|
+
activeVariant: { type: String, required: false },
|
|
40
|
+
activeColor: { type: null, required: false },
|
|
32
41
|
classes: { type: Object, required: false },
|
|
33
42
|
is: { type: null, required: false },
|
|
34
43
|
mod: { type: [Object, Array, null], required: false }
|
|
35
44
|
});
|
|
36
|
-
const { variantResolver } = useConfig();
|
|
45
|
+
const { variantResolver, activeVariants } = useConfig();
|
|
46
|
+
const resolvedVariant = computed(() => active ? activeVariant ?? activeVariants[variant] : variant);
|
|
37
47
|
const style = useVarsResolver((theme) => {
|
|
38
48
|
const { background, border, hover, text } = variantResolver({
|
|
39
49
|
theme,
|
|
40
|
-
variant,
|
|
41
|
-
color: props.color,
|
|
50
|
+
variant: resolvedVariant.value,
|
|
51
|
+
color: active ? activeColor : props.color,
|
|
42
52
|
gradient: props.gradient
|
|
43
53
|
});
|
|
44
54
|
return {
|
|
@@ -72,11 +82,14 @@ const style = useVarsResolver((theme) => {
|
|
|
72
82
|
"with-left-section": !!$slots?.leftSection || !!icon,
|
|
73
83
|
"with-right-section": !!$slots?.rightSection,
|
|
74
84
|
loading,
|
|
75
|
-
|
|
85
|
+
active,
|
|
86
|
+
"variant": resolvedVariant
|
|
76
87
|
}]'
|
|
77
88
|
:style='style.root'
|
|
78
89
|
:class='[css.root, classes?.root]'
|
|
79
90
|
:disabled='loading'
|
|
91
|
+
:aria-pressed='activeMode === "pressed" ? active : void 0'
|
|
92
|
+
:aria-current='active && activeMode === "current" ? "page" : void 0'
|
|
80
93
|
>
|
|
81
94
|
<Transition name='fade-down'>
|
|
82
95
|
<Loader v-show='loading' :class='css.loader' :color :size />
|
|
@@ -30,6 +30,14 @@ export interface ButtonProps extends BoxProps {
|
|
|
30
30
|
rightSectionProps?: HTMLAttributes;
|
|
31
31
|
/** Visual variant */
|
|
32
32
|
variant?: ButtonVariant;
|
|
33
|
+
/** Active/pressed state — adds `data-active` and the matching ARIA attribute */
|
|
34
|
+
active?: boolean;
|
|
35
|
+
/** ARIA semantic for `active` @default 'pressed' */
|
|
36
|
+
activeMode?: 'pressed' | 'current';
|
|
37
|
+
/** Variant applied when `active`. Defaults to the configured map for the current `variant` */
|
|
38
|
+
activeVariant?: ButtonVariant;
|
|
39
|
+
/** Color applied when `active` @default 'primary' */
|
|
40
|
+
activeColor?: NuanceColor;
|
|
33
41
|
/** Styles API */
|
|
34
42
|
classes?: Classes<ButtonClasses>;
|
|
35
43
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Classes } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export type CollapseClasses = 'root' | 'trigger' | 'content';
|
|
4
|
+
/** Props passed to the trigger slot, spread onto a custom toggle element for a11y. */
|
|
5
|
+
export interface CollapseTriggerProps {
|
|
6
|
+
'aria-controls': string;
|
|
7
|
+
'aria-expanded': boolean;
|
|
8
|
+
'disabled': boolean | undefined;
|
|
9
|
+
'data-state': 'open' | 'closed';
|
|
10
|
+
'data-disabled': '' | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface CollapseProps {
|
|
13
|
+
/**
|
|
14
|
+
* The open state of the collapsible when it is initially rendered.
|
|
15
|
+
* Use when you do not need to control its open state.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
/** Disables the component */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If set, the content stays mounted when collapsed.
|
|
23
|
+
* When `false`, content is unmounted after the exit transition.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
keepMounted?: boolean;
|
|
27
|
+
/** Transition duration in ms @default 200 */
|
|
28
|
+
transitionDuration?: number;
|
|
29
|
+
/** Transition timing function @default 'ease' */
|
|
30
|
+
transitionTimingFunction?: string;
|
|
31
|
+
/** If set, opacity is animated alongside height @default true */
|
|
32
|
+
animateOpacity?: boolean;
|
|
33
|
+
/** Element modifiers transformed into `data-` attributes, falsy values are removed */
|
|
34
|
+
mod?: BoxProps['mod'];
|
|
35
|
+
/** Styles API */
|
|
36
|
+
classes?: Classes<CollapseClasses>;
|
|
37
|
+
}
|
|
38
|
+
export interface CollapseSlots {
|
|
39
|
+
/** Collapsible content */
|
|
40
|
+
default?: (props: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
}) => any;
|
|
43
|
+
/** Toggle control. Spread `props` onto a button to get a11y wiring. */
|
|
44
|
+
trigger?: (props: {
|
|
45
|
+
open: boolean;
|
|
46
|
+
toggle: () => void;
|
|
47
|
+
props: CollapseTriggerProps;
|
|
48
|
+
}) => any;
|
|
49
|
+
}
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
52
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapseProps & {
|
|
53
|
+
open?: boolean;
|
|
54
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
55
|
+
"update:open": (value: boolean) => any;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<CollapseProps & {
|
|
57
|
+
open?: boolean;
|
|
58
|
+
}> & Readonly<{
|
|
59
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
60
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CollapseSlots>;
|
|
61
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
62
|
+
new (): {
|
|
63
|
+
$slots: S;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Box from "./box.vue";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { unrefElement, usePreferredReducedMotion } from "@vueuse/core";
|
|
7
|
+
import { computed, nextTick, onMounted, ref, useId, useTemplateRef, watch } from "vue";
|
|
8
|
+
const {
|
|
9
|
+
disabled,
|
|
10
|
+
keepMounted = true,
|
|
11
|
+
transitionDuration = 200,
|
|
12
|
+
transitionTimingFunction = "ease",
|
|
13
|
+
animateOpacity = true,
|
|
14
|
+
mod,
|
|
15
|
+
classes
|
|
16
|
+
} = defineProps({
|
|
17
|
+
defaultOpen: { type: Boolean, required: false },
|
|
18
|
+
disabled: { type: Boolean, required: false },
|
|
19
|
+
keepMounted: { type: Boolean, required: false },
|
|
20
|
+
transitionDuration: { type: Number, required: false },
|
|
21
|
+
transitionTimingFunction: { type: String, required: false },
|
|
22
|
+
animateOpacity: { type: Boolean, required: false },
|
|
23
|
+
mod: { type: [Object, Array, null], required: false },
|
|
24
|
+
classes: { type: Object, required: false }
|
|
25
|
+
});
|
|
26
|
+
defineSlots();
|
|
27
|
+
const opened = defineModel("open", { type: Boolean, ...{ default: (p) => p.defaultOpen } });
|
|
28
|
+
const contentId = useId();
|
|
29
|
+
const reducedMotion = usePreferredReducedMotion();
|
|
30
|
+
const duration = computed(() => reducedMotion.value === "reduce" ? 0 : transitionDuration);
|
|
31
|
+
function toggle() {
|
|
32
|
+
if (disabled)
|
|
33
|
+
return;
|
|
34
|
+
opened.value = !opened.value;
|
|
35
|
+
}
|
|
36
|
+
const dataState = computed(() => opened.value ? "open" : "closed");
|
|
37
|
+
const triggerProps = computed(() => ({
|
|
38
|
+
"aria-controls": contentId,
|
|
39
|
+
"aria-expanded": opened.value,
|
|
40
|
+
"disabled": disabled || void 0,
|
|
41
|
+
"data-state": dataState.value,
|
|
42
|
+
"data-disabled": disabled ? "" : void 0
|
|
43
|
+
}));
|
|
44
|
+
const el = useTemplateRef("content");
|
|
45
|
+
const mounted = ref(keepMounted || opened.value);
|
|
46
|
+
let timer;
|
|
47
|
+
function transitionStyle() {
|
|
48
|
+
const opacity = animateOpacity ? `, opacity ${duration.value}ms ${transitionTimingFunction}` : "";
|
|
49
|
+
return `height ${duration.value}ms ${transitionTimingFunction}${opacity}`;
|
|
50
|
+
}
|
|
51
|
+
function expand(node, instant) {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
node.style.overflow = "hidden";
|
|
54
|
+
if (instant) {
|
|
55
|
+
node.style.height = "";
|
|
56
|
+
node.style.opacity = "";
|
|
57
|
+
node.style.transition = "";
|
|
58
|
+
node.style.overflow = "";
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
node.style.height = "0px";
|
|
62
|
+
if (animateOpacity)
|
|
63
|
+
node.style.opacity = "0";
|
|
64
|
+
void node.offsetHeight;
|
|
65
|
+
node.style.transition = transitionStyle();
|
|
66
|
+
node.style.height = `${node.scrollHeight}px`;
|
|
67
|
+
if (animateOpacity)
|
|
68
|
+
node.style.opacity = "1";
|
|
69
|
+
timer = setTimeout(() => {
|
|
70
|
+
node.style.transition = "";
|
|
71
|
+
node.style.height = "";
|
|
72
|
+
node.style.overflow = "";
|
|
73
|
+
node.style.opacity = "";
|
|
74
|
+
}, duration.value);
|
|
75
|
+
}
|
|
76
|
+
function collapse(node, instant) {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
node.style.overflow = "hidden";
|
|
79
|
+
node.style.height = `${node.scrollHeight}px`;
|
|
80
|
+
void node.offsetHeight;
|
|
81
|
+
if (instant) {
|
|
82
|
+
node.style.transition = "";
|
|
83
|
+
node.style.height = "0px";
|
|
84
|
+
if (animateOpacity)
|
|
85
|
+
node.style.opacity = "0";
|
|
86
|
+
if (!keepMounted)
|
|
87
|
+
mounted.value = false;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
node.style.transition = transitionStyle();
|
|
91
|
+
node.style.height = "0px";
|
|
92
|
+
if (animateOpacity)
|
|
93
|
+
node.style.opacity = "0";
|
|
94
|
+
timer = setTimeout(() => {
|
|
95
|
+
if (!keepMounted)
|
|
96
|
+
mounted.value = false;
|
|
97
|
+
}, duration.value);
|
|
98
|
+
}
|
|
99
|
+
onMounted(() => {
|
|
100
|
+
const node = unrefElement(el);
|
|
101
|
+
if (!node || opened.value)
|
|
102
|
+
return;
|
|
103
|
+
node.style.height = "0px";
|
|
104
|
+
node.style.overflow = "hidden";
|
|
105
|
+
if (animateOpacity)
|
|
106
|
+
node.style.opacity = "0";
|
|
107
|
+
});
|
|
108
|
+
watch(opened, async (value) => {
|
|
109
|
+
if (value) {
|
|
110
|
+
if (!mounted.value) {
|
|
111
|
+
mounted.value = true;
|
|
112
|
+
await nextTick();
|
|
113
|
+
}
|
|
114
|
+
if (el.value)
|
|
115
|
+
expand(unrefElement(el), duration.value === 0);
|
|
116
|
+
} else if (el.value) {
|
|
117
|
+
collapse(unrefElement(el), duration.value === 0);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<template>
|
|
123
|
+
<Box
|
|
124
|
+
:mod='[{ disabled, state: dataState }, mod]'
|
|
125
|
+
:class='classes?.root'
|
|
126
|
+
>
|
|
127
|
+
<slot
|
|
128
|
+
name='trigger'
|
|
129
|
+
:open='opened'
|
|
130
|
+
:toggle='toggle'
|
|
131
|
+
:props='triggerProps'
|
|
132
|
+
/>
|
|
133
|
+
|
|
134
|
+
<Box
|
|
135
|
+
v-if='mounted'
|
|
136
|
+
:id='contentId'
|
|
137
|
+
ref='content'
|
|
138
|
+
:class='classes?.content'
|
|
139
|
+
:mod='{ disabled, open: opened }'
|
|
140
|
+
>
|
|
141
|
+
<slot :open='opened' />
|
|
142
|
+
</Box>
|
|
143
|
+
</box>
|
|
144
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Classes } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export type CollapseClasses = 'root' | 'trigger' | 'content';
|
|
4
|
+
/** Props passed to the trigger slot, spread onto a custom toggle element for a11y. */
|
|
5
|
+
export interface CollapseTriggerProps {
|
|
6
|
+
'aria-controls': string;
|
|
7
|
+
'aria-expanded': boolean;
|
|
8
|
+
'disabled': boolean | undefined;
|
|
9
|
+
'data-state': 'open' | 'closed';
|
|
10
|
+
'data-disabled': '' | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface CollapseProps {
|
|
13
|
+
/**
|
|
14
|
+
* The open state of the collapsible when it is initially rendered.
|
|
15
|
+
* Use when you do not need to control its open state.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
/** Disables the component */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If set, the content stays mounted when collapsed.
|
|
23
|
+
* When `false`, content is unmounted after the exit transition.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
keepMounted?: boolean;
|
|
27
|
+
/** Transition duration in ms @default 200 */
|
|
28
|
+
transitionDuration?: number;
|
|
29
|
+
/** Transition timing function @default 'ease' */
|
|
30
|
+
transitionTimingFunction?: string;
|
|
31
|
+
/** If set, opacity is animated alongside height @default true */
|
|
32
|
+
animateOpacity?: boolean;
|
|
33
|
+
/** Element modifiers transformed into `data-` attributes, falsy values are removed */
|
|
34
|
+
mod?: BoxProps['mod'];
|
|
35
|
+
/** Styles API */
|
|
36
|
+
classes?: Classes<CollapseClasses>;
|
|
37
|
+
}
|
|
38
|
+
export interface CollapseSlots {
|
|
39
|
+
/** Collapsible content */
|
|
40
|
+
default?: (props: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
}) => any;
|
|
43
|
+
/** Toggle control. Spread `props` onto a button to get a11y wiring. */
|
|
44
|
+
trigger?: (props: {
|
|
45
|
+
open: boolean;
|
|
46
|
+
toggle: () => void;
|
|
47
|
+
props: CollapseTriggerProps;
|
|
48
|
+
}) => any;
|
|
49
|
+
}
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
52
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapseProps & {
|
|
53
|
+
open?: boolean;
|
|
54
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
55
|
+
"update:open": (value: boolean) => any;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<CollapseProps & {
|
|
57
|
+
open?: boolean;
|
|
58
|
+
}> & Readonly<{
|
|
59
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
60
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CollapseSlots>;
|
|
61
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
62
|
+
new (): {
|
|
63
|
+
$slots: S;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -41,16 +41,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
41
41
|
next: () => any;
|
|
42
42
|
"update:modelValue": (value: string | Date | null | undefined) => any;
|
|
43
43
|
prev: () => any;
|
|
44
|
-
level: () => any;
|
|
45
44
|
open: () => any;
|
|
45
|
+
level: () => any;
|
|
46
46
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
47
47
|
onSelect?: ((date: import("./calendar/index.js").Selection) => any) | undefined;
|
|
48
48
|
onClose?: (() => any) | undefined;
|
|
49
49
|
onNext?: (() => any) | undefined;
|
|
50
50
|
"onUpdate:modelValue"?: ((value: string | Date | null | undefined) => any) | undefined;
|
|
51
51
|
onPrev?: (() => any) | undefined;
|
|
52
|
-
onLevel?: (() => any) | undefined;
|
|
53
52
|
onOpen?: (() => any) | undefined;
|
|
53
|
+
onLevel?: (() => any) | undefined;
|
|
54
54
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
55
55
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
56
56
|
declare const _default: typeof __VLS_export;
|
|
@@ -41,16 +41,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
41
41
|
next: () => any;
|
|
42
42
|
"update:modelValue": (value: string | Date | null | undefined) => any;
|
|
43
43
|
prev: () => any;
|
|
44
|
-
level: () => any;
|
|
45
44
|
open: () => any;
|
|
45
|
+
level: () => any;
|
|
46
46
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
47
47
|
onSelect?: ((date: import("./calendar/index.js").Selection) => any) | undefined;
|
|
48
48
|
onClose?: (() => any) | undefined;
|
|
49
49
|
onNext?: (() => any) | undefined;
|
|
50
50
|
"onUpdate:modelValue"?: ((value: string | Date | null | undefined) => any) | undefined;
|
|
51
51
|
onPrev?: (() => any) | undefined;
|
|
52
|
-
onLevel?: (() => any) | undefined;
|
|
53
52
|
onOpen?: (() => any) | undefined;
|
|
53
|
+
onLevel?: (() => any) | undefined;
|
|
54
54
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
55
55
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
56
56
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,6 +9,7 @@ const {
|
|
|
9
9
|
...props
|
|
10
10
|
} = defineProps({
|
|
11
11
|
size: { type: null, required: false },
|
|
12
|
+
iconSize: { type: [Number, String], required: false },
|
|
12
13
|
gradient: { type: Object, required: false },
|
|
13
14
|
color: { type: null, required: false },
|
|
14
15
|
radius: { type: [String, Number, Object], required: false },
|
|
@@ -17,6 +18,10 @@ const {
|
|
|
17
18
|
disabled: { type: Boolean, required: false },
|
|
18
19
|
mod: { type: [Object, Array, null], required: false },
|
|
19
20
|
variant: { type: String, required: false },
|
|
21
|
+
active: { type: Boolean, required: false },
|
|
22
|
+
activeMode: { type: String, required: false },
|
|
23
|
+
activeVariant: { type: String, required: false },
|
|
24
|
+
activeColor: { type: null, required: false },
|
|
20
25
|
classes: { type: Object, required: false }
|
|
21
26
|
});
|
|
22
27
|
const close = useDialogState();
|