@viraui/react 0.0.21 → 0.0.23
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/catalog.json +33 -3
- package/dist/components/avatar/avatar.css +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/avatar.module.js +3 -3
- package/dist/components/avatar-group/avatar-group.css +1 -1
- package/dist/components/avatar-group/avatar-group.js +3 -2
- package/dist/components/avatar-group/avatar-group.module.js +5 -5
- package/dist/components/basic-input/basic-input.css +1 -1
- package/dist/components/basic-input/basic-input.js +1 -2
- package/dist/components/basic-input/basic-input.module.js +1 -1
- package/dist/components/basic-input/field-helper-copy.d.ts +1 -1
- package/dist/components/basic-input/field-helper-copy.js +0 -1
- package/dist/components/basic-input/field-label.css +1 -1
- package/dist/components/basic-input/field-label.js +1 -2
- package/dist/components/basic-input/field-label.module.js +1 -1
- package/dist/components/basic-input/input-control-group.js +0 -1
- package/dist/components/button/button.css +1 -1
- package/dist/components/button/button.d.ts +13 -7
- package/dist/components/button/button.guide.json +7 -5
- package/dist/components/button/button.js +12 -11
- package/dist/components/button/button.module.js +3 -3
- package/dist/components/checkbox/checkbox-group.d.ts +12 -0
- package/dist/components/checkbox/checkbox-group.js +15 -0
- package/dist/components/checkbox/checkbox.css +1 -1
- package/dist/components/checkbox/checkbox.d.ts +6 -21
- package/dist/components/checkbox/checkbox.guide.json +10 -5
- package/dist/components/checkbox/checkbox.js +46 -60
- package/dist/components/checkbox/checkbox.module.js +7 -6
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/chip/chip.css +1 -1
- package/dist/components/chip/chip.js +1 -3
- package/dist/components/chip/chip.module.js +4 -4
- package/dist/components/clamp-text/clamp-text.css +1 -1
- package/dist/components/clamp-text/clamp-text.js +1 -1
- package/dist/components/clamp-text/clamp-text.module.js +1 -1
- package/dist/components/dialog/dialog-close.d.ts +15 -0
- package/dist/components/dialog/dialog-close.js +9 -0
- package/dist/components/dialog/dialog-sheet.d.ts +66 -0
- package/dist/components/dialog/dialog-sheet.js +80 -0
- package/dist/components/dialog/dialog-trigger.d.ts +13 -0
- package/dist/components/dialog/dialog-trigger.js +9 -0
- package/dist/components/dialog/dialog.css +1 -0
- package/dist/components/dialog/dialog.d.ts +21 -0
- package/dist/components/dialog/dialog.guide.json +26 -0
- package/dist/components/dialog/dialog.js +18 -0
- package/dist/components/dialog/dialog.module.js +13 -0
- package/dist/components/dialog/index.d.ts +8 -0
- package/dist/components/elevator/elevator.js +4 -4
- package/dist/components/fieldset/fieldset.d.ts +35 -0
- package/dist/components/fieldset/fieldset.guide.json +28 -0
- package/dist/components/fieldset/fieldset.js +30 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/icon/icon.css +1 -1
- package/dist/components/icon/icon.js +1 -1
- package/dist/components/icon/icon.module.js +1 -1
- package/dist/components/icon-button/icon-button.d.ts +1 -1
- package/dist/components/icon-button/icon-button.guide.json +1 -1
- package/dist/components/icon-button/icon-button.js +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/linear-progress/linear-progress.css +1 -1
- package/dist/components/linear-progress/linear-progress.js +1 -2
- package/dist/components/linear-progress/linear-progress.module.js +4 -4
- package/dist/components/masonry/masonry-item.js +1 -2
- package/dist/components/masonry/masonry.css +1 -1
- package/dist/components/masonry/masonry.js +3 -4
- package/dist/components/masonry/masonry.module.js +2 -2
- package/dist/components/progressive-blur/index.d.ts +2 -0
- package/dist/components/progressive-blur/progressive-blur.css +1 -0
- package/dist/components/progressive-blur/progressive-blur.d.ts +38 -0
- package/dist/components/progressive-blur/progressive-blur.guide.json +25 -0
- package/dist/components/progressive-blur/progressive-blur.js +39 -0
- package/dist/components/progressive-blur/progressive-blur.module.js +6 -0
- package/dist/components/progressive-blur/progressive-blur.utils.d.ts +14 -0
- package/dist/components/progressive-blur/progressive-blur.utils.js +40 -0
- package/dist/components/radio/radio-group.d.ts +5 -38
- package/dist/components/radio/radio-group.js +12 -50
- package/dist/components/radio/radio.css +1 -1
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.guide.json +12 -8
- package/dist/components/radio/radio.js +32 -30
- package/dist/components/radio/radio.module.js +3 -5
- package/dist/components/select/select-group.js +2 -2
- package/dist/components/select/select-indicator-slot.js +0 -1
- package/dist/components/select/select-option.d.ts +15 -2
- package/dist/components/select/select-option.js +34 -21
- package/dist/components/select/select-separator.js +1 -2
- package/dist/components/select/select.css +1 -1
- package/dist/components/select/select.d.ts +7 -1
- package/dist/components/select/select.guide.json +9 -3
- package/dist/components/select/select.js +6 -5
- package/dist/components/select/select.module.js +17 -15
- package/dist/components/skeleton/skeleton.css +1 -1
- package/dist/components/skeleton/skeleton.js +2 -2
- package/dist/components/skeleton/skeleton.module.js +2 -2
- package/dist/components/slider/slider-control.js +0 -1
- package/dist/components/slider/slider.css +1 -1
- package/dist/components/slider/slider.js +2 -4
- package/dist/components/slider/slider.module.js +9 -8
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/spinner/spinner.js +4 -4
- package/dist/components/spinner/spinner.module.js +3 -3
- package/dist/components/stack/stack.css +1 -1
- package/dist/components/stack/stack.d.ts +2 -2
- package/dist/components/stack/stack.js +1 -2
- package/dist/components/stack/stack.module.js +1 -1
- package/dist/components/static-noise/index.d.ts +2 -0
- package/dist/components/static-noise/static-noise.css +1 -0
- package/dist/components/static-noise/static-noise.d.ts +37 -0
- package/dist/components/static-noise/static-noise.guide.json +25 -0
- package/dist/components/static-noise/static-noise.js +46 -0
- package/dist/components/static-noise/static-noise.module.js +6 -0
- package/dist/components/surface/surface-radius-context.d.ts +45 -0
- package/dist/components/surface/surface-radius-context.js +81 -0
- package/dist/components/surface/surface.css +1 -1
- package/dist/components/surface/surface.d.ts +11 -5
- package/dist/components/surface/surface.guide.json +12 -4
- package/dist/components/surface/surface.js +26 -7
- package/dist/components/surface/surface.module.js +1 -4
- package/dist/components/switch/switch.css +1 -1
- package/dist/components/switch/switch.js +32 -30
- package/dist/components/switch/switch.module.js +4 -3
- package/dist/components/tabs/index.d.ts +6 -0
- package/dist/components/tabs/tabs-indicator.d.ts +9 -0
- package/dist/components/tabs/tabs-indicator.js +16 -0
- package/dist/components/tabs/tabs-list.d.ts +12 -0
- package/dist/components/tabs/tabs-list.js +29 -0
- package/dist/components/tabs/tabs-panel.d.ts +11 -0
- package/dist/components/tabs/tabs-panel.js +13 -0
- package/dist/components/tabs/tabs-tab.d.ts +24 -0
- package/dist/components/tabs/tabs-tab.js +24 -0
- package/dist/components/tabs/tabs-viewport.d.ts +8 -0
- package/dist/components/tabs/tabs-viewport.js +11 -0
- package/dist/components/tabs/tabs.css +1 -0
- package/dist/components/tabs/tabs.d.ts +31 -0
- package/dist/components/tabs/tabs.guide.json +23 -0
- package/dist/components/tabs/tabs.js +30 -0
- package/dist/components/tabs/tabs.module.js +11 -0
- package/dist/components/text/text.css +1 -1
- package/dist/components/text/text.d.ts +2 -2
- package/dist/components/text/text.js +3 -4
- package/dist/components/text/text.module.js +1 -1
- package/dist/components/textarea/textarea.css +1 -1
- package/dist/components/textarea/textarea.guide.json +8 -3
- package/dist/components/textarea/textarea.js +2 -4
- package/dist/components/textarea/textarea.module.js +4 -3
- package/dist/components/textfield/textfield.css +1 -1
- package/dist/components/textfield/textfield.guide.json +9 -3
- package/dist/components/textfield/textfield.js +2 -4
- package/dist/components/textfield/textfield.module.js +6 -5
- package/dist/components/title/title.css +1 -1
- package/dist/components/title/title.js +3 -4
- package/dist/components/title/title.module.js +1 -1
- package/dist/core/clsx.d.ts +1 -0
- package/dist/core/clsx.js +36 -0
- package/dist/core/elevation/get-elevation-props.js +2 -2
- package/dist/core/props/intrinsic-vira-props.d.ts +3 -3
- package/dist/index.js +10 -1
- package/dist/internal-icons/icon-registry.d.ts +4 -1
- package/dist/internal-icons/icon-registry.js +9 -0
- package/dist/internal-icons/icons/duo/ArrowDown.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowDownLeft.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowDownRight.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowLeft.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowRight.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowUp.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowUpLeft.js +1 -1
- package/dist/internal-icons/icons/duo/ArrowUpRight.js +1 -1
- package/dist/internal-icons/icons/duo/ChevronExpandY.js +2 -2
- package/dist/internal-icons/icons/duo/CircleCheck.d.ts +7 -0
- package/dist/internal-icons/icons/duo/CircleCheck.js +13 -0
- package/dist/internal-icons/icons/duo/Duplicate.d.ts +7 -0
- package/dist/internal-icons/icons/duo/Duplicate.js +13 -0
- package/dist/internal-icons/icons/duo/RefreshAnticlockwise.js +1 -1
- package/dist/internal-icons/icons/duo/ShieldCheck.d.ts +7 -0
- package/dist/internal-icons/icons/duo/ShieldCheck.js +13 -0
- package/dist/internal-icons/icons/duo/index.d.ts +3 -0
- package/dist/internal-icons/icons/duo/index.js +3 -0
- package/dist/preflight-surface.json +15 -1
- package/dist/preflight.css +1 -1
- package/dist/theme-surface.json +0 -5
- package/package.json +4 -7
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ThemeTypes } from '@viraui/foundation/vira/types';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
export type SurfaceRadius = ThemeTypes['radius'] | 'auto';
|
|
4
|
+
export type SurfaceRadiusCornerInput = ThemeTypes['radius'] | 0;
|
|
5
|
+
export type SurfaceRadiusCornersInput = [
|
|
6
|
+
SurfaceRadiusCornerInput,
|
|
7
|
+
SurfaceRadiusCornerInput,
|
|
8
|
+
SurfaceRadiusCornerInput,
|
|
9
|
+
SurfaceRadiusCornerInput
|
|
10
|
+
];
|
|
11
|
+
export type SurfaceRadiusInput = SurfaceRadius | SurfaceRadiusCornersInput;
|
|
12
|
+
export type SurfacePadding = ThemeTypes['space'] | [ThemeTypes['space'] | 0, ThemeTypes['space'] | 0];
|
|
13
|
+
export type SurfaceRadiusCorners = {
|
|
14
|
+
topLeft: string;
|
|
15
|
+
topRight: string;
|
|
16
|
+
bottomRight: string;
|
|
17
|
+
bottomLeft: string;
|
|
18
|
+
};
|
|
19
|
+
export type SurfacePaddingEdges = {
|
|
20
|
+
inlineStart: string;
|
|
21
|
+
inlineEnd: string;
|
|
22
|
+
blockStart: string;
|
|
23
|
+
blockEnd: string;
|
|
24
|
+
};
|
|
25
|
+
export type SurfaceRadiusContextValue = {
|
|
26
|
+
radius: SurfaceRadiusCorners;
|
|
27
|
+
padding: SurfacePaddingEdges;
|
|
28
|
+
};
|
|
29
|
+
export type SurfaceRadiusDefaults = {
|
|
30
|
+
hPadding?: SurfacePadding | undefined;
|
|
31
|
+
radius?: SurfaceRadiusInput | undefined;
|
|
32
|
+
style?: React.CSSProperties | undefined;
|
|
33
|
+
vPadding?: SurfacePadding | undefined;
|
|
34
|
+
};
|
|
35
|
+
type SurfaceRadiusConfig = SurfaceRadiusDefaults & {
|
|
36
|
+
defaults: SurfaceRadiusDefaults;
|
|
37
|
+
};
|
|
38
|
+
export declare const SurfaceRadiusContext: React.Context<SurfaceRadiusContextValue | null>;
|
|
39
|
+
export declare const useSurfaceRadiusContext: () => SurfaceRadiusContextValue | null;
|
|
40
|
+
export declare const useSurfaceRadius: ({ defaults, hPadding, radius, style, vPadding }: SurfaceRadiusConfig) => {
|
|
41
|
+
contextValue: SurfaceRadiusContextValue;
|
|
42
|
+
hasAutoRadius: boolean;
|
|
43
|
+
radiusStyle: React.CSSProperties;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveThemeValue } from "../../core/theme/resolve-theme-value.js";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
//#region src/components/surface/surface-radius-context.ts
|
|
5
|
+
var SurfaceRadiusContext = createContext(null);
|
|
6
|
+
var useSurfaceRadiusContext = () => useContext(SurfaceRadiusContext);
|
|
7
|
+
var toCssLength = (value) => value === void 0 || value === 0 ? "0px" : String(value);
|
|
8
|
+
var resolveAxisPaddingValues = (value) => {
|
|
9
|
+
if (!value) return ["0px", "0px"];
|
|
10
|
+
if (Array.isArray(value)) return [toCssLength(resolveThemeValue(value[0], "space", 0)), toCssLength(resolveThemeValue(value[1], "space", 0))];
|
|
11
|
+
const resolvedValue = toCssLength(resolveThemeValue(value, "space", 0));
|
|
12
|
+
return [resolvedValue, resolvedValue];
|
|
13
|
+
};
|
|
14
|
+
var resolveAutoRadiusCorners = ({ padding, radius }) => ({
|
|
15
|
+
topLeft: `max(0px, calc(${radius.topLeft} - max(${padding.blockStart}, ${padding.inlineStart})))`,
|
|
16
|
+
topRight: `max(0px, calc(${radius.topRight} - max(${padding.blockStart}, ${padding.inlineEnd})))`,
|
|
17
|
+
bottomRight: `max(0px, calc(${radius.bottomRight} - max(${padding.blockEnd}, ${padding.inlineEnd})))`,
|
|
18
|
+
bottomLeft: `max(0px, calc(${radius.bottomLeft} - max(${padding.blockEnd}, ${padding.inlineStart})))`
|
|
19
|
+
});
|
|
20
|
+
var resolveTokenRadiusCorners = (radius) => ({
|
|
21
|
+
topLeft: radius,
|
|
22
|
+
topRight: radius,
|
|
23
|
+
bottomRight: radius,
|
|
24
|
+
bottomLeft: radius
|
|
25
|
+
});
|
|
26
|
+
var isPerCornerRadius = (value) => Array.isArray(value);
|
|
27
|
+
var resolveRadiusToken = (value) => toCssLength(resolveThemeValue(value, "radius", 0));
|
|
28
|
+
var resolvePerCornerRadiusInput = (corners) => ({
|
|
29
|
+
topLeft: resolveRadiusToken(corners[0]),
|
|
30
|
+
topRight: resolveRadiusToken(corners[1]),
|
|
31
|
+
bottomRight: resolveRadiusToken(corners[2]),
|
|
32
|
+
bottomLeft: resolveRadiusToken(corners[3])
|
|
33
|
+
});
|
|
34
|
+
var getSurfaceStyleRadius = (style) => style?.["--surface-border-radius"];
|
|
35
|
+
var getSurfaceRadiusStyle = (radius) => ({
|
|
36
|
+
"--surface-border-radius-top-left": radius.topLeft,
|
|
37
|
+
"--surface-border-radius-top-right": radius.topRight,
|
|
38
|
+
"--surface-border-radius-bottom-right": radius.bottomRight,
|
|
39
|
+
"--surface-border-radius-bottom-left": radius.bottomLeft
|
|
40
|
+
});
|
|
41
|
+
var resolveDefaultContext = ({ hPadding, radius, style, vPadding }) => {
|
|
42
|
+
const [paddingInlineStart, paddingInlineEnd] = resolveAxisPaddingValues(hPadding);
|
|
43
|
+
const [paddingBlockStart, paddingBlockEnd] = resolveAxisPaddingValues(vPadding);
|
|
44
|
+
const styleRadius = getSurfaceStyleRadius(style);
|
|
45
|
+
return {
|
|
46
|
+
radius: isPerCornerRadius(radius) ? resolvePerCornerRadiusInput(radius) : resolveTokenRadiusCorners(toCssLength(styleRadius ?? resolveRadiusToken(radius === "auto" ? void 0 : radius))),
|
|
47
|
+
padding: {
|
|
48
|
+
inlineStart: paddingInlineStart,
|
|
49
|
+
inlineEnd: paddingInlineEnd,
|
|
50
|
+
blockStart: paddingBlockStart,
|
|
51
|
+
blockEnd: paddingBlockEnd
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var useSurfaceRadius = ({ defaults, hPadding, radius, style, vPadding }) => {
|
|
56
|
+
const parentContext = useSurfaceRadiusContext() ?? resolveDefaultContext(defaults);
|
|
57
|
+
const hasAutoRadius = radius === "auto";
|
|
58
|
+
const hasPerCornerRadius = isPerCornerRadius(radius);
|
|
59
|
+
const tokenRadius = toCssLength(getSurfaceStyleRadius(style) ?? (hasAutoRadius || hasPerCornerRadius ? void 0 : resolveRadiusToken(radius)));
|
|
60
|
+
let ownRadius;
|
|
61
|
+
if (hasAutoRadius) ownRadius = resolveAutoRadiusCorners(parentContext);
|
|
62
|
+
else if (hasPerCornerRadius) ownRadius = resolvePerCornerRadiusInput(radius);
|
|
63
|
+
else ownRadius = resolveTokenRadiusCorners(tokenRadius);
|
|
64
|
+
const [paddingInlineStart, paddingInlineEnd] = resolveAxisPaddingValues(hPadding);
|
|
65
|
+
const [paddingBlockStart, paddingBlockEnd] = resolveAxisPaddingValues(vPadding);
|
|
66
|
+
return {
|
|
67
|
+
contextValue: {
|
|
68
|
+
radius: ownRadius,
|
|
69
|
+
padding: {
|
|
70
|
+
inlineStart: paddingInlineStart,
|
|
71
|
+
inlineEnd: paddingInlineEnd,
|
|
72
|
+
blockStart: paddingBlockStart,
|
|
73
|
+
blockEnd: paddingBlockEnd
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
hasAutoRadius,
|
|
77
|
+
radiusStyle: hasAutoRadius || hasPerCornerRadius ? getSurfaceRadiusStyle(ownRadius) : { "--surface-border-radius": tokenRadius }
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { SurfaceRadiusContext, useSurfaceRadius };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.viraui__surface-module__Surface_slEYq{--surface-border-radius:0;--surface-border-radius-top-left:var(--surface-border-radius);--surface-border-radius-top-right:var(--surface-border-radius);--surface-border-radius-bottom-right:var(--surface-border-radius);--surface-border-radius-bottom-left:var(--surface-border-radius);--surface-padding-inline-start:0;--surface-padding-inline-end:0;--surface-padding-block-start:0;--surface-padding-block-end:0;--surface-background-hover:var(--surface-background);--surface-overflow:visible;--surface-vibrancy-background:var(--is-vibrancy-active) oklab(from var(--surface-background) l a b/80%);position:relative;overflow:var(--surface-overflow);box-sizing:border-box;background:var(--surface-vibrancy-background,var(--surface-background,transparent));border-radius:var(--surface-border-radius-top-left) var(--surface-border-radius-top-right) var(--surface-border-radius-bottom-right) var(--surface-border-radius-bottom-left);border:0;&[data-surface-radius=auto]{--surface-border-radius-top-left:0;--surface-border-radius-top-right:0;--surface-border-radius-bottom-right:0;--surface-border-radius-bottom-left:0}&[data-surface-has-padding=true]{padding:var(--surface-padding-block-start) var(--surface-padding-inline-end) var(--surface-padding-block-end) var(--surface-padding-inline-start)}&[data-surface-border]{border-style:var(--surface-border-style,solid);border-color:var(--global-contrast)}&[data-surface-border=all]{border-width:1px}&[data-surface-border=top]{border-width:1px 0 0}&[data-surface-border=right]{border-width:0 1px 0 0}&[data-surface-border=bottom]{border-width:0 0 1px}&[data-surface-border=left]{border-width:0 0 0 1px}&[data-surface-border=x]{border-width:0 1px}&[data-surface-border=y]{border-width:1px 0}@media (hover:hover) and (pointer:fine){&[data-surface-has-hover-color=true]:hover{background:var(--surface-background-hover)}}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
3
|
-
import {
|
|
3
|
+
import { SurfacePadding, SurfaceRadiusInput } from './surface-radius-context';
|
|
4
4
|
import type * as React from 'react';
|
|
5
5
|
/** Base ramp layer for nested surfaces; clamped to 1–3 at runtime. */
|
|
6
6
|
type SurfaceBaseLevel = 1 | 2 | 3;
|
|
@@ -51,23 +51,29 @@ export type SurfaceProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'color'>
|
|
|
51
51
|
*/
|
|
52
52
|
borderStyle?: 'solid' | 'dashed' | 'dotted' | 'double';
|
|
53
53
|
/**
|
|
54
|
-
* Sets
|
|
54
|
+
* Sets corner radius from the Vira radius token scale, a per-corner `[top-left, top-right, bottom-right, bottom-left]` tuple (`0` for square corners), or `auto` for concentric radii from the nearest ancestor Surface.
|
|
55
55
|
*
|
|
56
56
|
* @default No radius.
|
|
57
57
|
*/
|
|
58
|
-
radius?:
|
|
58
|
+
radius?: SurfaceRadiusInput;
|
|
59
59
|
/**
|
|
60
60
|
* Sets inline padding using one token for both sides or a `[start, end]` tuple.
|
|
61
61
|
*
|
|
62
62
|
* @default No inline padding.
|
|
63
63
|
*/
|
|
64
|
-
hPadding?:
|
|
64
|
+
hPadding?: SurfacePadding;
|
|
65
65
|
/**
|
|
66
66
|
* Sets block padding using one token for both sides or a `[start, end]` tuple.
|
|
67
67
|
*
|
|
68
68
|
* @default No block padding.
|
|
69
69
|
*/
|
|
70
|
-
vPadding?:
|
|
70
|
+
vPadding?: SurfacePadding;
|
|
71
|
+
/**
|
|
72
|
+
* Sets root overflow through the `--surface-overflow` custom property.
|
|
73
|
+
*
|
|
74
|
+
* @default visible
|
|
75
|
+
*/
|
|
76
|
+
overflow?: React.CSSProperties['overflow'];
|
|
71
77
|
};
|
|
72
78
|
export declare const Surface: React.FC<SurfaceProps>;
|
|
73
79
|
export {};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "Surface",
|
|
3
|
-
"summary": "Presentational container with token background, optional border, radius, and padding.",
|
|
3
|
+
"summary": "Presentational container with token background, optional border, radius, and padding; nested surfaces use radius=\"auto\" for concentric corners.",
|
|
4
4
|
"whenToUse": [
|
|
5
5
|
"Group content with base-level background and contrast border",
|
|
6
6
|
"Popup or card chrome with optional hover background",
|
|
7
|
-
"Compose with Elevator for animated elevation transitions"
|
|
7
|
+
"Compose with Elevator for animated elevation transitions",
|
|
8
|
+
"Set radius to a token on the outermost Surface that needs rounded corners",
|
|
9
|
+
"Set radius to a four-value tuple [top-left, top-right, bottom-right, bottom-left] when corners need different token radii",
|
|
10
|
+
"Set radius=\"auto\" on a nested Surface when its parent Surface has a radius so each corner subtracts the nearest ancestor padding and stays concentric",
|
|
11
|
+
"Stack nested auto-radius Surfaces recursively; context still resolves through wrapper layout such as Stack",
|
|
12
|
+
"Set overflow=\"hidden\" (or scroll/auto) when Surface must clip or scroll inner content with radius or padding"
|
|
8
13
|
],
|
|
9
14
|
"whenNotToUse": [
|
|
10
15
|
"Interactive control semantics without an appropriate render root",
|
|
11
|
-
"Expecting hover background on touch-primary devices"
|
|
16
|
+
"Expecting hover background on touch-primary devices",
|
|
17
|
+
"Using radius=\"auto\" on the outermost Surface when no ancestor Surface provides a radius context"
|
|
12
18
|
],
|
|
13
19
|
"accessibility": [
|
|
14
20
|
"Surface is presentational — pair with headings or labels so grouped content is discoverable",
|
|
@@ -17,7 +23,9 @@
|
|
|
17
23
|
],
|
|
18
24
|
"antiPatterns": [
|
|
19
25
|
"Overwriting transition shorthand without composing box-shadow when data-elevation is present",
|
|
20
|
-
"Assuming hoverColor applies on touch devices"
|
|
26
|
+
"Assuming hoverColor applies on touch devices",
|
|
27
|
+
"Reusing the parent token radius on nested Surfaces instead of radius=\"auto\" when concentric corners are required",
|
|
28
|
+
"Expecting radius=\"auto\" to inherit a token when the nearest ancestor Surface has no radius set"
|
|
21
29
|
],
|
|
22
30
|
"related": ["Elevator", "Stack"]
|
|
23
31
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './surface.css';
|
|
3
|
+
import { clsx } from "../../core/clsx.js";
|
|
3
4
|
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
4
|
-
import { resolveThemeValue } from "../../core/theme/resolve-theme-value.js";
|
|
5
5
|
import { resolveAxisPadding } from "../../core/styles/resolve-axis-padding.js";
|
|
6
|
+
import { SurfaceRadiusContext, useSurfaceRadius } from "./surface-radius-context.js";
|
|
6
7
|
import surface_module_default from "./surface.module.js";
|
|
7
|
-
import {
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
import { useRender } from "@base-ui/react/use-render";
|
|
9
10
|
//#region src/components/surface/surface.tsx
|
|
10
11
|
var clampSurfaceBaseLevel = (value) => {
|
|
@@ -13,21 +14,34 @@ var clampSurfaceBaseLevel = (value) => {
|
|
|
13
14
|
return value;
|
|
14
15
|
};
|
|
15
16
|
var toSurfaceColor = (value) => typeof value === "string" ? value : `var(--base-${clampSurfaceBaseLevel(value)})`;
|
|
16
|
-
var
|
|
17
|
-
|
|
17
|
+
var surfaceDefaultRadiusProps = {
|
|
18
|
+
hPadding: void 0,
|
|
19
|
+
radius: void 0,
|
|
20
|
+
style: void 0,
|
|
21
|
+
vPadding: void 0
|
|
22
|
+
};
|
|
23
|
+
var Surface = ({ border, borderStyle = "solid", className, color, hPadding, hoverColor, overflow, radius, ref, render, style, vPadding, ...otherProps }) => {
|
|
18
24
|
const hasPadding = Boolean(hPadding || vPadding);
|
|
19
25
|
const hasHoverColor = hoverColor !== void 0;
|
|
20
26
|
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
27
|
+
const { contextValue, hasAutoRadius, radiusStyle } = useSurfaceRadius({
|
|
28
|
+
defaults: surfaceDefaultRadiusProps,
|
|
29
|
+
hPadding,
|
|
30
|
+
radius,
|
|
31
|
+
style,
|
|
32
|
+
vPadding
|
|
33
|
+
});
|
|
21
34
|
const dynamicStyle = {
|
|
22
|
-
|
|
35
|
+
"--surface-background": toSurfaceColor(color ?? "none"),
|
|
23
36
|
...hasHoverColor ? { "--surface-background-hover": toSurfaceColor(hoverColor) } : {},
|
|
24
37
|
...border ? { "--surface-border-style": borderStyle } : {},
|
|
25
|
-
"--surface-
|
|
38
|
+
"--surface-overflow": overflow,
|
|
39
|
+
...radiusStyle,
|
|
26
40
|
...resolveAxisPadding(hPadding, "--surface-padding-inline-start", "--surface-padding-inline-end"),
|
|
27
41
|
...resolveAxisPadding(vPadding, "--surface-padding-block-start", "--surface-padding-block-end"),
|
|
28
42
|
...style
|
|
29
43
|
};
|
|
30
|
-
|
|
44
|
+
const surface = useRender({
|
|
31
45
|
defaultTagName: "div",
|
|
32
46
|
render,
|
|
33
47
|
ref,
|
|
@@ -35,12 +49,17 @@ var Surface = ({ border, borderStyle = "solid", className, color, hPadding, hove
|
|
|
35
49
|
...componentProps,
|
|
36
50
|
...intrinsicAttributes,
|
|
37
51
|
...border ? { "data-surface-border": border } : {},
|
|
52
|
+
...hasAutoRadius ? { "data-surface-radius": "auto" } : {},
|
|
38
53
|
"data-surface-has-hover-color": hasHoverColor ? "true" : "false",
|
|
39
54
|
"data-surface-has-padding": hasPadding ? "true" : "false",
|
|
40
55
|
className: clsx(surface_module_default.Surface, className),
|
|
41
56
|
style: dynamicStyle
|
|
42
57
|
}
|
|
43
58
|
});
|
|
59
|
+
return /* @__PURE__ */ jsx(SurfaceRadiusContext.Provider, {
|
|
60
|
+
value: contextValue,
|
|
61
|
+
children: surface
|
|
62
|
+
});
|
|
44
63
|
};
|
|
45
64
|
//#endregion
|
|
46
65
|
export { Surface };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var surface_module_default = {
|
|
2
|
-
Surface: "surface-module_Surface_slEYq",
|
|
3
|
-
"surface-background-hover": "surface-module_surface-background-hover_HwH9-"
|
|
4
|
-
};
|
|
1
|
+
var surface_module_default = { Surface: "viraui__surface-module__Surface_slEYq" };
|
|
5
2
|
//#endregion
|
|
6
3
|
export { surface_module_default as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.viraui__switch-module__Switch_L86y7{--switch-track-block-size:var(--space-large);--switch-track-radius:var(--radius-small);--switch-track-background:var(--global-contrast);--switch-thumb-background:var(--base-7);--switch-thumb-size:calc(var(--space-large) - var(--space-x-small));--switch-thumb-inset:var(--space-2x-small);&:has([required]) .viraui__switch-module__Label_9R-rv:after{content:" *";color:var(--highlight-red)}}.viraui__switch-module__SwitchRoot_Zv9An{position:relative;appearance:none;border:0;box-shadow:none;inline-size:calc((var(--switch-thumb-size) * 2) + var(--switch-thumb-inset) * 2);block-size:var(--switch-track-block-size);background:var(--switch-track-background);border-radius:var(--switch-track-radius);&[data-size=small]{--switch-track-radius:var(--radius-x-small);--switch-track-block-size:var(--space-medium);--switch-thumb-size:calc(var(--space-medium) - var(--space-x-small))}&[data-checked]:not([data-disabled]):not([data-invalid]){--switch-track-background:var(--global-primary);--switch-thumb-background:contrast-color(var(--global-primary))}&[data-invalid]:not([data-disabled]),.viraui__switch-module__Switch_L86y7[data-invalid]>&:not([data-disabled]){box-shadow:inset 0 0 0 1px var(--highlight-red);outline-color:oklab(from var(--highlight-red) l a b/.5)}&[data-disabled],.viraui__switch-module__Switch_L86y7[data-disabled]>&{--switch-track-background:var(--global-disabled-background);--switch-thumb-background:var(--global-disabled-foreground);box-shadow:none;cursor:not-allowed}}.viraui__switch-module__Thumb_ldwJw{--switch-thumb-radius:calc(var(--switch-track-radius) - var(--switch-thumb-inset));position:absolute;inset-block:var(--switch-thumb-inset);inset-inline-start:var(--switch-thumb-inset);background:var(--switch-thumb-background);inline-size:var(--switch-thumb-size);block-size:var(--switch-thumb-size);border-radius:var(--switch-thumb-radius);transition:translate var(--easing-entrance) var(--duration-fast);.viraui__switch-module__SwitchRoot_Zv9An[data-checked]>&{translate:100% 0}.viraui__switch-module__SwitchRoot_Zv9An[data-checked]:dir(rtl)>&{translate:-100% 0}}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import './switch.css';
|
|
2
|
+
import { clsx } from "../../core/clsx.js";
|
|
3
3
|
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
4
4
|
import { Stack } from "../stack/stack.js";
|
|
5
5
|
import { FieldHelperCopy } from "../basic-input/field-helper-copy.js";
|
|
6
6
|
import { FieldLabel } from "../basic-input/field-label.js";
|
|
7
7
|
import switch_module_default from "./switch.module.js";
|
|
8
|
-
import { clsx } from "clsx";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { Field } from "@base-ui/react/field";
|
|
11
10
|
import { Switch } from "@base-ui/react/switch";
|
|
@@ -30,35 +29,38 @@ var Switch$1 = ({ className, description, dirty, disabled, error, invalid, label
|
|
|
30
29
|
fillChildren: false,
|
|
31
30
|
vAlign: hasTextDescription ? "start" : "center"
|
|
32
31
|
}),
|
|
33
|
-
children: /* @__PURE__ */ jsx(Field.Label, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...hPadding !== void 0 ? { hPadding } : {},
|
|
39
|
-
...vPadding !== void 0 ? { vPadding } : {},
|
|
40
|
-
children: [/* @__PURE__ */ jsx(Switch.Root, {
|
|
41
|
-
...componentProps,
|
|
42
|
-
className: clsx(switch_module_default.SwitchRoot, className),
|
|
43
|
-
"data-shrink": "false",
|
|
44
|
-
"data-size": size,
|
|
45
|
-
disabled,
|
|
46
|
-
name,
|
|
47
|
-
ref,
|
|
48
|
-
children: /* @__PURE__ */ jsx(Switch.Thumb, { className: switch_module_default.Thumb })
|
|
49
|
-
}), label || description || error ? /* @__PURE__ */ jsxs(Stack, {
|
|
50
|
-
direction: "column",
|
|
32
|
+
children: /* @__PURE__ */ jsx(Field.Label, {
|
|
33
|
+
className: switch_module_default.Label,
|
|
34
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
35
|
+
direction: "row",
|
|
36
|
+
columnGap: size === "small" ? "small" : "medium",
|
|
51
37
|
fillChildren: false,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
vAlign: hasTextDescription ? "start" : "center",
|
|
39
|
+
hPadding,
|
|
40
|
+
vPadding,
|
|
41
|
+
children: [/* @__PURE__ */ jsx(Switch.Root, {
|
|
42
|
+
...componentProps,
|
|
43
|
+
className: clsx(switch_module_default.SwitchRoot, className),
|
|
44
|
+
"data-shrink": "false",
|
|
45
|
+
"data-size": size,
|
|
46
|
+
disabled,
|
|
47
|
+
name,
|
|
48
|
+
ref,
|
|
49
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, { className: switch_module_default.Thumb })
|
|
50
|
+
}), label || description || error ? /* @__PURE__ */ jsxs(Stack, {
|
|
51
|
+
direction: "column",
|
|
52
|
+
fillChildren: false,
|
|
53
|
+
rowGap: "small",
|
|
54
|
+
children: [label && /* @__PURE__ */ jsx(FieldLabel, {
|
|
55
|
+
size: size === "small" ? "small" : "medium",
|
|
56
|
+
children: label
|
|
57
|
+
}), /* @__PURE__ */ jsx(FieldHelperCopy, {
|
|
58
|
+
description,
|
|
59
|
+
error
|
|
60
|
+
})]
|
|
61
|
+
}) : null]
|
|
62
|
+
})
|
|
63
|
+
})
|
|
62
64
|
});
|
|
63
65
|
};
|
|
64
66
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var switch_module_default = {
|
|
2
|
-
Switch: "
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Switch: "viraui__switch-module__Switch_L86y7",
|
|
3
|
+
Label: "viraui__switch-module__Label_9R-rv",
|
|
4
|
+
SwitchRoot: "viraui__switch-module__SwitchRoot_Zv9An",
|
|
5
|
+
Thumb: "viraui__switch-module__Thumb_ldwJw"
|
|
5
6
|
};
|
|
6
7
|
//#endregion
|
|
7
8
|
export { switch_module_default as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Tabs } from './tabs';
|
|
2
|
+
export type { TabsProps } from './tabs';
|
|
3
|
+
export type { TabsTabProps } from './tabs-tab';
|
|
4
|
+
export type { TabsListProps } from './tabs-list';
|
|
5
|
+
export type { TabsPanelProps } from './tabs-panel';
|
|
6
|
+
export type { TabsViewportProps } from './tabs-viewport';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TabsIndicator as TabsIndicatorPrimitive } from '@base-ui/react/tabs';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Internal active tab indicator for `Tabs.List`.
|
|
5
|
+
*
|
|
6
|
+
* Positioned with Base UI `--active-tab-*` CSS variables.
|
|
7
|
+
*/
|
|
8
|
+
export type TabsIndicatorProps = TabsIndicatorPrimitive.Props;
|
|
9
|
+
export declare const TabsIndicator: React.FC<TabsIndicatorProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Surface } from "../surface/surface.js";
|
|
2
|
+
import tabs_module_default from "./tabs.module.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
5
|
+
//#region src/components/tabs/tabs-indicator.tsx
|
|
6
|
+
var TabsIndicator = ({ className, ref, ...props }) => /* @__PURE__ */ jsx(Tabs.Indicator, {
|
|
7
|
+
render: /* @__PURE__ */ jsx(Surface, {
|
|
8
|
+
border: "all",
|
|
9
|
+
radius: "auto",
|
|
10
|
+
color: 3
|
|
11
|
+
}),
|
|
12
|
+
className: tabs_module_default.Indicator,
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TabsIndicator };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TabsList as TabsListPrimitive } from '@base-ui/react/tabs';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Public Tabs.List props.
|
|
5
|
+
*
|
|
6
|
+
* Wraps Base UI `Tabs.List` in a compact `Surface`, lays out items with `Stack`,
|
|
7
|
+
* and renders the active tab indicator internally.
|
|
8
|
+
*
|
|
9
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
10
|
+
*/
|
|
11
|
+
export type TabsListProps = TabsListPrimitive.Props;
|
|
12
|
+
export declare const TabsList: React.FC<TabsListProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { Stack } from "../stack/stack.js";
|
|
3
|
+
import { Surface } from "../surface/surface.js";
|
|
4
|
+
import tabs_module_default from "./tabs.module.js";
|
|
5
|
+
import { TabsIndicator } from "./tabs-indicator.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
8
|
+
//#region src/components/tabs/tabs-list.tsx
|
|
9
|
+
var TabsList = ({ children, className, activateOnFocus = true, ref, ...props }) => /* @__PURE__ */ jsx(Tabs.List, {
|
|
10
|
+
className: clsx(tabs_module_default.List, className),
|
|
11
|
+
activateOnFocus,
|
|
12
|
+
render: /* @__PURE__ */ jsx(Surface, {
|
|
13
|
+
color: 1,
|
|
14
|
+
border: "all",
|
|
15
|
+
hPadding: "2x-small",
|
|
16
|
+
radius: "medium",
|
|
17
|
+
vPadding: "2x-small"
|
|
18
|
+
}),
|
|
19
|
+
...props,
|
|
20
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
21
|
+
direction: "row",
|
|
22
|
+
columnGap: "small",
|
|
23
|
+
hAlign: "start",
|
|
24
|
+
vAlign: "center",
|
|
25
|
+
children: [/* @__PURE__ */ jsx(TabsIndicator, {}), children]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { TabsList };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TabsPanel as TabsPanelPrimitive } from '@base-ui/react/tabs';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Public Tabs.Panel props.
|
|
5
|
+
*
|
|
6
|
+
* Base UI `Tabs.Panel` with entry slide/fade animation.
|
|
7
|
+
*
|
|
8
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
9
|
+
*/
|
|
10
|
+
export type TabsPanelProps = TabsPanelPrimitive.Props;
|
|
11
|
+
export declare const TabsPanel: React.FC<TabsPanelProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import tabs_module_default from "./tabs.module.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
5
|
+
//#region src/components/tabs/tabs-panel.tsx
|
|
6
|
+
var TabsPanel = ({ children, className, ref, ...props }) => /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
7
|
+
ref,
|
|
8
|
+
className: clsx(tabs_module_default.Panel, className),
|
|
9
|
+
...props,
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TabsPanel };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TabsTab as TabsTabPrimitive } from '@base-ui/react/tabs';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Public Tabs.Tab props.
|
|
5
|
+
*
|
|
6
|
+
* Wraps Base UI `Tabs.Tab` with optional decorative addon layout.
|
|
7
|
+
*
|
|
8
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
9
|
+
*/
|
|
10
|
+
export type TabsTabProps = TabsTabPrimitive.Props & {
|
|
11
|
+
/**
|
|
12
|
+
* Decorative addon rendered alongside the tab label.
|
|
13
|
+
*
|
|
14
|
+
* @default No addon is rendered.
|
|
15
|
+
*/
|
|
16
|
+
addon?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Controls whether the addon appears before or after the label.
|
|
19
|
+
*
|
|
20
|
+
* @default 'start'
|
|
21
|
+
*/
|
|
22
|
+
addonPosition?: 'start' | 'end';
|
|
23
|
+
};
|
|
24
|
+
export declare const TabsTab: React.FC<TabsTabProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { Text } from "../text/text.js";
|
|
4
|
+
import tabs_module_default from "./tabs.module.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
7
|
+
//#region src/components/tabs/tabs-tab.tsx
|
|
8
|
+
var TabsTab = ({ addon, addonPosition = "start", children, className, ...props }) => /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
9
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
10
|
+
variant: "flat",
|
|
11
|
+
addon,
|
|
12
|
+
addonPosition,
|
|
13
|
+
className: clsx(tabs_module_default.Item, className)
|
|
14
|
+
}),
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
17
|
+
tone: "muted",
|
|
18
|
+
whiteSpace: "nowrap",
|
|
19
|
+
className: tabs_module_default.Label,
|
|
20
|
+
children
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { TabsTab };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Public Tabs.Viewport props.
|
|
4
|
+
*
|
|
5
|
+
* Grid container for animated `Tabs.Panel` children.
|
|
6
|
+
*/
|
|
7
|
+
export type TabsViewportProps = React.ComponentPropsWithoutRef<'div'>;
|
|
8
|
+
export declare const TabsViewport: React.FC<TabsViewportProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import tabs_module_default from "./tabs.module.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/tabs/tabs-viewport.tsx
|
|
5
|
+
var TabsViewport = ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: clsx(tabs_module_default.Viewport, className),
|
|
7
|
+
...props,
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TabsViewport };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.viraui__tabs-module__Tabs_AwbZZ{--tabs-translate-amount:10px;min-block-size:10rem}.viraui__tabs-module__Viewport_15X1I{display:grid;grid-template-columns:minmax(0,1fr);inline-size:100%}.viraui__tabs-module__List_XJorr{position:relative;overflow-x:auto}.viraui__tabs-module__Indicator_UyNUn{position:absolute;pointer-events:none;inset-block-start:var(--active-tab-top);inset-inline-start:var(--active-tab-left);inline-size:var(--active-tab-width);block-size:var(--active-tab-height);transition:inset-inline-start var(--duration-fast) var(--easing-standard),inset-block-start var(--duration-fast) var(--easing-standard),inline-size var(--duration-fast) var(--easing-standard),block-size var(--duration-fast) var(--easing-standard)}.viraui__tabs-module__Item_XZ86Z{position:relative;flex-shrink:0;cursor:pointer;flex-basis:0;transition:none;will-change:auto;&[data-variant]:not(:disabled):active{translate:0 0}&:hover,&[data-disabled]{background:transparent}&[data-disabled]{opacity:.5}&[data-active]{color:var(--global-foreground)}&:focus-visible{border-radius:var(--radius-small);outline-offset:0}}.viraui__tabs-module__Item_XZ86Z[data-active] .viraui__tabs-module__Label_5-8-Y{color:var(--global-foreground)}.viraui__tabs-module__Panel_vkCFI{grid-area:1/1;inline-size:100%;opacity:1;translate:0 0;transition:opacity var(--duration-fast) var(--easing-entrance),translate var(--duration-fast) var(--easing-entrance);&[data-ending-style]{pointer-events:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-activation-direction=right][data-starting-style]{translate:var(--tabs-translate-amount) 0}&[data-activation-direction=left][data-starting-style],&[data-activation-direction=right][data-ending-style]{translate:calc(var(--tabs-translate-amount) * -1) 0}&[data-activation-direction=left][data-ending-style]{translate:var(--tabs-translate-amount) 0}&[data-activation-direction=none][data-ending-style],&[data-activation-direction=none][data-starting-style]{translate:0 var(--tabs-translate-amount)}&[hidden]{display:none}@media (prefers-reduced-motion:reduce){transition:none;&[data-ending-style],&[data-starting-style]{opacity:1;translate:0 0}}}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TabsRoot } from '@base-ui/react/tabs';
|
|
2
|
+
import { StackProps } from '..';
|
|
3
|
+
import { TabsListProps } from './tabs-list';
|
|
4
|
+
import { TabsPanelProps } from './tabs-panel';
|
|
5
|
+
import { TabsTabProps } from './tabs-tab';
|
|
6
|
+
import { TabsViewportProps } from './tabs-viewport';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Public Tabs root props.
|
|
10
|
+
*
|
|
11
|
+
* Includes Base UI tabs root props such as `value`, `defaultValue`, `orientation`,
|
|
12
|
+
* and `onValueChange`.
|
|
13
|
+
*
|
|
14
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
15
|
+
*/
|
|
16
|
+
export type TabsProps = TabsRoot.Props & {
|
|
17
|
+
/**
|
|
18
|
+
* Horizontal alignment of tab list within root Stack.
|
|
19
|
+
*
|
|
20
|
+
* @default 'start'
|
|
21
|
+
*/
|
|
22
|
+
listAlignment?: Extract<StackProps['hAlign'], 'start' | 'center' | 'end' | 'stretch'>;
|
|
23
|
+
};
|
|
24
|
+
type TabsComponent = React.FC<TabsProps> & {
|
|
25
|
+
List: React.FC<TabsListProps>;
|
|
26
|
+
Tab: React.FC<TabsTabProps>;
|
|
27
|
+
Viewport: React.FC<TabsViewportProps>;
|
|
28
|
+
Panel: React.FC<TabsPanelProps>;
|
|
29
|
+
};
|
|
30
|
+
export declare const Tabs: TabsComponent;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Tabs",
|
|
3
|
+
"summary": "Compound segmented tab control with Surface list chrome, moving indicator, and animated panels.",
|
|
4
|
+
"whenToUse": [
|
|
5
|
+
"Switching between related views in the same surface",
|
|
6
|
+
"Compact horizontal segmented navigation",
|
|
7
|
+
"Decorative start/end addons on tab labels without changing accessible names"
|
|
8
|
+
],
|
|
9
|
+
"whenNotToUse": [
|
|
10
|
+
"Primary app navigation that should use links or routes directly",
|
|
11
|
+
"Vertical tab layouts in v1 styled targets"
|
|
12
|
+
],
|
|
13
|
+
"accessibility": [
|
|
14
|
+
"Keep tab labels as visible text; addons are decorative and aria-hidden",
|
|
15
|
+
"Ensure each `Tabs.Panel` value matches a `Tabs.Tab` value",
|
|
16
|
+
"Disabled items cannot be activated through pointer or keyboard"
|
|
17
|
+
],
|
|
18
|
+
"antiPatterns": [
|
|
19
|
+
"Using addons as the only visible label for a tab",
|
|
20
|
+
"Trying to compose a separate public `Tabs.Indicator`; the indicator is owned by `Tabs.List`"
|
|
21
|
+
],
|
|
22
|
+
"related": ["Surface", "Stack", "Text"]
|
|
23
|
+
}
|