@viraui/react 0.0.15 → 0.0.17
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 +6 -0
- package/dist/components/avatar/avatar.css +1 -55
- package/dist/components/avatar/avatar.d.ts +1 -2
- package/dist/components/avatar/avatar.js +49 -14
- package/dist/components/avatar/avatar.module.js +7 -0
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/basic-input/basic-input.css +1 -45
- package/dist/components/basic-input/basic-input.d.ts +0 -1
- package/dist/components/basic-input/basic-input.js +24 -13
- package/dist/components/basic-input/basic-input.module.js +3 -0
- package/dist/components/basic-input/field-helper-copy.d.ts +2 -1
- package/dist/components/basic-input/field-helper-copy.js +43 -24
- package/dist/components/basic-input/field-label.css +1 -0
- package/dist/components/basic-input/field-label.d.ts +10 -0
- package/dist/components/basic-input/field-label.js +24 -0
- package/dist/components/basic-input/field-label.module.js +3 -0
- package/dist/components/basic-input/index.d.ts +7 -2
- package/dist/components/basic-input/input-control-group.d.ts +2 -0
- package/dist/components/basic-input/input-control-group.js +40 -7
- package/dist/components/button/button.css +1 -156
- package/dist/components/button/button.d.ts +3 -3
- package/dist/components/button/button.js +104 -14
- package/dist/components/button/button.module.js +7 -0
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/checkbox/checkbox.css +1 -0
- package/dist/components/checkbox/checkbox.d.ts +65 -0
- package/dist/components/checkbox/checkbox.guide.json +22 -0
- package/dist/components/checkbox/checkbox.js +73 -0
- package/dist/components/checkbox/checkbox.module.js +10 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/clamp-text/clamp-text.css +1 -12
- package/dist/components/clamp-text/clamp-text.d.ts +1 -2
- package/dist/components/clamp-text/clamp-text.js +27 -22
- package/dist/components/clamp-text/clamp-text.module.js +3 -0
- package/dist/components/clamp-text/index.d.ts +2 -2
- package/dist/components/elevator/elevator.d.ts +5 -5
- package/dist/components/elevator/elevator.js +27 -27
- package/dist/components/elevator/index.d.ts +2 -2
- package/dist/components/icon/icon.css +1 -7
- package/dist/components/icon/icon.d.ts +2 -3
- package/dist/components/icon/icon.js +18 -9
- package/dist/components/icon/icon.module.js +3 -0
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon-button/icon-button.d.ts +2 -2
- package/dist/components/icon-button/icon-button.js +10 -3
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/index.d.ts +18 -17
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/select-group.d.ts +1 -1
- package/dist/components/select/select-group.js +37 -9
- package/dist/components/select/select-indicator-slot.js +33 -10
- package/dist/components/select/select-option.d.ts +1 -1
- package/dist/components/select/select-option.js +40 -10
- package/dist/components/select/select-separator.js +14 -6
- package/dist/components/select/select.css +1 -193
- package/dist/components/select/select.d.ts +10 -11
- package/dist/components/select/select.js +156 -32
- package/dist/components/select/select.module.js +19 -0
- package/dist/components/skeleton/index.d.ts +2 -2
- package/dist/components/skeleton/skeleton.css +1 -36
- package/dist/components/skeleton/skeleton.d.ts +2 -3
- package/dist/components/skeleton/skeleton.js +26 -15
- package/dist/components/skeleton/skeleton.module.js +6 -0
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/slider-control.d.ts +1 -2
- package/dist/components/slider/slider-control.js +43 -19
- package/dist/components/slider/slider-utils.js +6 -3
- package/dist/components/slider/slider.css +1 -64
- package/dist/components/slider/slider.d.ts +5 -8
- package/dist/components/slider/slider.js +83 -17
- package/dist/components/slider/slider.module.js +12 -0
- package/dist/components/spinner/index.d.ts +2 -2
- package/dist/components/spinner/spinner.css +1 -45
- package/dist/components/spinner/spinner.d.ts +1 -2
- package/dist/components/spinner/spinner.js +29 -6
- package/dist/components/spinner/spinner.module.js +7 -0
- package/dist/components/stack/index.d.ts +2 -2
- package/dist/components/stack/stack.css +1 -57
- package/dist/components/stack/stack.d.ts +2 -3
- package/dist/components/stack/stack.js +40 -36
- package/dist/components/stack/stack.module.js +3 -0
- package/dist/components/surface/index.d.ts +2 -2
- package/dist/components/surface/surface.css +1 -70
- package/dist/components/surface/surface.d.ts +10 -6
- package/dist/components/surface/surface.js +43 -40
- package/dist/components/surface/surface.module.js +6 -0
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/switch.css +1 -73
- package/dist/components/switch/switch.d.ts +17 -5
- package/dist/components/switch/switch.js +59 -13
- package/dist/components/switch/switch.module.js +7 -0
- package/dist/components/text/index.d.ts +2 -2
- package/dist/components/text/text.css +1 -140
- package/dist/components/text/text.d.ts +8 -3
- package/dist/components/text/text.js +46 -41
- package/dist/components/text/text.module.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -2
- package/dist/components/textarea/textarea.css +1 -45
- package/dist/components/textarea/textarea.d.ts +3 -4
- package/dist/components/textarea/textarea.js +51 -11
- package/dist/components/textarea/textarea.module.js +7 -0
- package/dist/components/textfield/index.d.ts +2 -2
- package/dist/components/textfield/textfield.css +1 -87
- package/dist/components/textfield/textfield.d.ts +3 -4
- package/dist/components/textfield/textfield.js +58 -12
- package/dist/components/textfield/textfield.module.js +9 -0
- package/dist/components/title/index.d.ts +2 -2
- package/dist/components/title/title.css +1 -127
- package/dist/components/title/title.d.ts +8 -3
- package/dist/components/title/title.js +44 -39
- package/dist/components/title/title.module.js +3 -0
- package/dist/consumption.json +8 -4
- package/dist/core/elevation/elevation-types.js +6 -3
- package/dist/core/elevation/get-elevation-props.d.ts +1 -1
- package/dist/core/elevation/get-elevation-props.js +14 -11
- package/dist/core/props/intrinsic-vira-props.js +12 -9
- package/dist/core/styles/resolve-axis-padding.d.ts +1 -1
- package/dist/core/styles/resolve-axis-padding.js +15 -16
- package/dist/core/theme/resolve-theme-value.d.ts +1 -1
- package/dist/core/theme/resolve-theme-value.js +7 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -1
- package/dist/internal-icons/icon-registry.d.ts +242 -239
- package/dist/internal-icons/icon-registry.js +247 -238
- package/dist/internal-icons/icons/duo/Magnifier.d.ts +7 -0
- package/dist/internal-icons/icons/duo/Magnifier.js +13 -0
- package/dist/internal-icons/icons/duo/Minus.d.ts +7 -0
- package/dist/internal-icons/icons/duo/Minus.js +13 -0
- package/dist/internal-icons/icons/duo/Plus.d.ts +7 -0
- package/dist/internal-icons/icons/duo/Plus.js +13 -0
- package/dist/internal-icons/icons/duo/index.d.ts +241 -238
- package/dist/internal-icons/icons/duo/index.js +241 -238
- package/dist/preflight-surface.json +160 -0
- package/dist/preflight.css +1 -1
- package/package.json +11 -9
- package/dist/components/avatar/index.js +0 -1
- package/dist/components/basic-input/index.js +0 -1
- package/dist/components/button/index.js +0 -1
- package/dist/components/clamp-text/index.js +0 -1
- package/dist/components/elevator/index.js +0 -1
- package/dist/components/icon/index.js +0 -1
- package/dist/components/icon-button/index.js +0 -1
- package/dist/components/index.js +0 -17
- package/dist/components/select/index.js +0 -1
- package/dist/components/skeleton/index.js +0 -1
- package/dist/components/slider/index.js +0 -1
- package/dist/components/slider/slider-control.css +0 -71
- package/dist/components/spinner/index.js +0 -1
- package/dist/components/stack/index.js +0 -1
- package/dist/components/surface/index.js +0 -1
- package/dist/components/switch/index.js +0 -1
- package/dist/components/text/index.js +0 -1
- package/dist/components/textarea/index.js +0 -1
- package/dist/components/textfield/index.js +0 -1
- package/dist/components/title/index.js +0 -1
package/dist/catalog.json
CHANGED
|
@@ -56,6 +56,12 @@
|
|
|
56
56
|
"summary": "Field-wrapped toggle control with regular or small track and optional field copy.",
|
|
57
57
|
"guidePath": "./components/switch/switch.guide.json"
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
"id": "checkbox",
|
|
61
|
+
"name": "Checkbox",
|
|
62
|
+
"summary": "Field-wrapped checkbox control with optional field copy.",
|
|
63
|
+
"guidePath": "./components/checkbox/checkbox.guide.json"
|
|
64
|
+
},
|
|
59
65
|
{
|
|
60
66
|
"id": "select",
|
|
61
67
|
"name": "Select",
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
|
|
2
|
-
:scope {
|
|
3
|
-
--avatar-size: var(--space-2x-large);
|
|
4
|
-
--avatar-background: var(--global-contrast);
|
|
5
|
-
--avatar-foreground: var(--global-foreground);
|
|
6
|
-
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
inline-size: var(--avatar-size);
|
|
11
|
-
block-size: var(--avatar-size);
|
|
12
|
-
min-inline-size: var(--avatar-size);
|
|
13
|
-
min-block-size: var(--avatar-size);
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
border-radius: var(--radius-infinite);
|
|
16
|
-
background: var(--avatar-background);
|
|
17
|
-
color: var(--avatar-foreground);
|
|
18
|
-
vertical-align: middle;
|
|
19
|
-
-webkit-user-select: none;
|
|
20
|
-
user-select: none;
|
|
21
|
-
container-name: viraui-avatar;
|
|
22
|
-
container-type: inline-size;
|
|
23
|
-
|
|
24
|
-
&[data-size='x-small'] {
|
|
25
|
-
--avatar-size: var(--space-large);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&[data-size='small'] {
|
|
29
|
-
--avatar-size: var(--space-2x-large);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&[data-size='regular'] {
|
|
33
|
-
--avatar-size: var(--space-wide);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&[data-size='big'] {
|
|
37
|
-
--avatar-size: var(--space-2x-wide);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
> .Image,
|
|
41
|
-
> .SkeletonPlaceholder {
|
|
42
|
-
inline-size: 100%;
|
|
43
|
-
block-size: 100%;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
> .Image {
|
|
47
|
-
display: block;
|
|
48
|
-
object-fit: cover;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
> .Label {
|
|
52
|
-
font-size: 30cqw;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
.avatar-module_Avatar_BRuS3{--avatar-size:var(--space-2x-large);--avatar-background:var(--global-contrast);--avatar-foreground:var(--global-foreground);display:inline-flex;align-items:center;justify-content:center;inline-size:var(--avatar-size);block-size:var(--avatar-size);min-inline-size:var(--avatar-size);min-block-size:var(--avatar-size);overflow:hidden;border-radius:var(--radius-infinite);background:var(--avatar-background);color:var(--avatar-foreground);vertical-align:middle;-webkit-user-select:none;user-select:none;container-name:viraui-avatar;container-type:inline-size;&[data-size=x-small]{--avatar-size:var(--space-large)}&[data-size=small]{--avatar-size:var(--space-2x-large)}&[data-size=regular]{--avatar-size:var(--space-wide)}&[data-size=big]{--avatar-size:var(--space-2x-wide)}}.avatar-module_Image_Q7bHi{inline-size:100%;block-size:100%;display:block;object-fit:cover}.avatar-module_Label_QASTF{font-size:30cqw}
|
|
@@ -1,17 +1,52 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Avatar as PrimitiveAvatar } from '@base-ui/react/avatar';
|
|
3
|
-
import { Skeleton, Text } from '../index.js';
|
|
4
|
-
import { extractIntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
1
|
import './avatar.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
3
|
+
import avatar_module_default from "./avatar.module.js";
|
|
4
|
+
import { Text } from "../text/text.js";
|
|
5
|
+
import { Skeleton } from "../skeleton/skeleton.js";
|
|
6
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/avatar/avatar.tsx
|
|
10
|
+
var fallbackTextSizeByAvatarSize = {
|
|
11
|
+
"x-small": "x-small",
|
|
12
|
+
small: "x-small",
|
|
13
|
+
regular: "small",
|
|
14
|
+
big: "large"
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
var Avatar$1 = ({ alt = "", className, fallback, loading = false, ref, size = "small", src, ...otherProps }) => {
|
|
17
|
+
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
18
|
+
const hasImage = Boolean(src);
|
|
19
|
+
return /* @__PURE__ */ jsx(Avatar.Root, {
|
|
20
|
+
...componentProps,
|
|
21
|
+
...intrinsicAttributes,
|
|
22
|
+
ref,
|
|
23
|
+
"aria-busy": loading || void 0,
|
|
24
|
+
className: clsx(avatar_module_default.Avatar, className),
|
|
25
|
+
"data-has-image": hasImage ? "true" : "false",
|
|
26
|
+
"data-loading": loading ? "true" : "false",
|
|
27
|
+
"data-size": size,
|
|
28
|
+
children: loading ? /* @__PURE__ */ jsx(Skeleton, {
|
|
29
|
+
minHeight: "100%",
|
|
30
|
+
minWidth: "100%",
|
|
31
|
+
radius: "infinite",
|
|
32
|
+
width: "100%"
|
|
33
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [hasImage ? /* @__PURE__ */ jsx(Avatar.Image, {
|
|
34
|
+
draggable: false,
|
|
35
|
+
decoding: "async",
|
|
36
|
+
loading: "eager",
|
|
37
|
+
alt,
|
|
38
|
+
className: avatar_module_default.Image,
|
|
39
|
+
src
|
|
40
|
+
}) : null, /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
41
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
42
|
+
className: avatar_module_default.Label,
|
|
43
|
+
whiteSpace: "nowrap",
|
|
44
|
+
weight: "semibold",
|
|
45
|
+
size: fallbackTextSizeByAvatarSize[size]
|
|
46
|
+
}),
|
|
47
|
+
children: fallback
|
|
48
|
+
})] })
|
|
49
|
+
});
|
|
17
50
|
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Avatar$1 as Avatar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Avatar } from './avatar
|
|
2
|
-
export type { AvatarProps } from './avatar
|
|
1
|
+
export { Avatar } from './avatar';
|
|
2
|
+
export type { AvatarProps } from './avatar';
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
:scope {
|
|
3
|
-
--basic-input-background: var(--base-1);
|
|
4
|
-
--basic-input-color: var(--global-foreground);
|
|
5
|
-
--basic-input-placeholder-color: var(--global-disabled-foreground);
|
|
6
|
-
--basic-input-padding-inline: var(--space-small);
|
|
7
|
-
--basic-input-font-size: var(--font-scale-body-small);
|
|
8
|
-
--basic-input-border-radius: var(--radius-small);
|
|
9
|
-
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
margin: 0;
|
|
12
|
-
inline-size: 100%;
|
|
13
|
-
min-inline-size: 0;
|
|
14
|
-
padding-inline: calc(var(--basic-input-padding-inline) + ((var(--basic-input-border-radius) + 0px) / 4));
|
|
15
|
-
font-family: inherit;
|
|
16
|
-
font-size: var(--basic-input-font-size);
|
|
17
|
-
font-variation-settings: 'wght' 400;
|
|
18
|
-
color: var(--basic-input-color);
|
|
19
|
-
background: var(--basic-input-background);
|
|
20
|
-
border: none;
|
|
21
|
-
border-radius: var(--basic-input-border-radius);
|
|
22
|
-
appearance: none;
|
|
23
|
-
|
|
24
|
-
/* Safari contacts autofill affordance: match input text color */
|
|
25
|
-
&::-webkit-contacts-auto-fill-button {
|
|
26
|
-
background-color: var(--basic-input-color);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&::placeholder {
|
|
30
|
-
color: var(--basic-input-placeholder-color);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&:disabled {
|
|
34
|
-
--basic-input-background: var(--global-disabled-background);
|
|
35
|
-
--basic-input-color: var(--global-disabled-foreground);
|
|
36
|
-
--basic-input-placeholder-color: var(--global-disabled-foreground);
|
|
37
|
-
|
|
38
|
-
cursor: not-allowed;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&[data-invalid] {
|
|
42
|
-
outline-color: oklab(from var(--highlight-red) l a b / 0.3);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
.basic-input-module_BasicInput_5uE64{--basic-input-background:var(--base-1);--basic-input-color:var(--global-foreground);--basic-input-placeholder-color:var(--global-disabled-foreground);--basic-input-padding-inline:var(--space-small);--basic-input-font-size:var(--font-scale-body-small);--basic-input-border-radius:var(--radius-small);box-sizing:border-box;margin:0;inline-size:100%;min-inline-size:0;padding-inline:calc(var(--basic-input-padding-inline) + ((var(--basic-input-border-radius) + 0px) / 4));font-family:inherit;font-size:var(--basic-input-font-size);font-variation-settings:"wght" 400;color:var(--basic-input-color);background:var(--basic-input-background);border:none;border-radius:var(--basic-input-border-radius);appearance:none;&::-webkit-contacts-auto-fill-button{background-color:var(--basic-input-color)}&::placeholder{color:var(--basic-input-placeholder-color)}&:disabled{--basic-input-background:var(--global-disabled-background);--basic-input-color:var(--global-disabled-foreground);--basic-input-placeholder-color:var(--global-disabled-foreground);cursor:not-allowed}&[data-invalid]{outline-color:oklab(from var(--highlight-red) l a b/.3)}}
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Field } from '@base-ui/react/field';
|
|
4
|
-
import { Input as PrimitiveInput } from '@base-ui/react/input';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
import * as React from 'react';
|
|
7
1
|
import './basic-input.css';
|
|
2
|
+
"use client";
|
|
3
|
+
import basic_input_module_default from "./basic-input.module.js";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Field } from "@base-ui/react/field";
|
|
8
|
+
import { Input } from "@base-ui/react/input";
|
|
9
|
+
//#region src/components/basic-input/basic-input.tsx
|
|
8
10
|
function usesInputPrimitiveRender(render) {
|
|
9
|
-
|
|
11
|
+
return React.isValidElement(render) && render.type === Input;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var BasicInput = React.forwardRef(function BasicInput({ className, render, ...props }, ref) {
|
|
14
|
+
const mergedClassName = clsx(basic_input_module_default.BasicInput, className);
|
|
15
|
+
if (usesInputPrimitiveRender(render)) return /* @__PURE__ */ jsx(Input, {
|
|
16
|
+
ref,
|
|
17
|
+
className: mergedClassName,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(Field.Control, {
|
|
21
|
+
ref,
|
|
22
|
+
className: mergedClassName,
|
|
23
|
+
render,
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
17
26
|
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { BasicInput };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
type FieldHelperCopyProps = {
|
|
3
|
+
className?: string | undefined;
|
|
3
4
|
description?: React.ReactNode;
|
|
4
5
|
error?: React.ReactNode;
|
|
5
6
|
};
|
|
@@ -9,5 +10,5 @@ type FieldHelperCopyProps = {
|
|
|
9
10
|
* `description` stays visible when invalid if `error` is omitted.
|
|
10
11
|
* `validate` / native messages render through `Field.Error` when there is no `description`.
|
|
11
12
|
*/
|
|
12
|
-
export declare
|
|
13
|
+
export declare const FieldHelperCopy: React.FC<FieldHelperCopyProps>;
|
|
13
14
|
export {};
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { Text } from "../text/text.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Field } from "@base-ui/react/field";
|
|
5
|
+
//#region src/components/basic-input/field-helper-copy.tsx
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
* Renders field helper copy in the shared `Description` slot via `Field.Validity`.
|
|
8
|
+
* Static `error` replaces `description` only while invalid and `error` is set.
|
|
9
|
+
* `description` stays visible when invalid if `error` is omitted.
|
|
10
|
+
* `validate` / native messages render through `Field.Error` when there is no `description`.
|
|
11
|
+
*/
|
|
12
|
+
var FieldHelperCopy = ({ className, description, error }) => /* @__PURE__ */ jsx(Field.Validity, { children: (validity) => {
|
|
13
|
+
const isInvalid = validity.validity.valid === false;
|
|
14
|
+
if (isInvalid && error) return /* @__PURE__ */ jsx(Field.Error, {
|
|
15
|
+
className,
|
|
16
|
+
match: true,
|
|
17
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
18
|
+
selection: false,
|
|
19
|
+
size: "x-small",
|
|
20
|
+
tone: "danger"
|
|
21
|
+
}),
|
|
22
|
+
children: error
|
|
23
|
+
});
|
|
24
|
+
if (description) return /* @__PURE__ */ jsx(Field.Description, {
|
|
25
|
+
className,
|
|
26
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
27
|
+
selection: false,
|
|
28
|
+
size: "x-small",
|
|
29
|
+
tone: "muted"
|
|
30
|
+
}),
|
|
31
|
+
children: description
|
|
32
|
+
});
|
|
33
|
+
if (isInvalid) return /* @__PURE__ */ jsx(Field.Error, {
|
|
34
|
+
className,
|
|
35
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
36
|
+
selection: false,
|
|
37
|
+
size: "x-small",
|
|
38
|
+
tone: "danger"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
return null;
|
|
42
|
+
} });
|
|
43
|
+
//#endregion
|
|
44
|
+
export { FieldHelperCopy };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.field-label-module_FieldLabel_R9SYf{display:flex;flex-direction:column;align-items:stretch;inline-size:100%;padding-inline:var(--field-label-padding-inline,0)}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
export type FieldLabelProps = React.ComponentProps<'span'>;
|
|
3
|
+
/**
|
|
4
|
+
* Shared visible field label typography for Vira field components.
|
|
5
|
+
*
|
|
6
|
+
* Renders consistent `Text` styling. Pair with `Field.Label` at the field root when the
|
|
7
|
+
* label must associate with a control; choice inputs wrap `Field.Label` around the
|
|
8
|
+
* control and render this component for the visible label copy.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FieldLabel: React.FC<FieldLabelProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './field-label.css';
|
|
2
|
+
"use client";
|
|
3
|
+
import { Text } from "../text/text.js";
|
|
4
|
+
import field_label_module_default from "./field-label.module.js";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/basic-input/field-label.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Shared visible field label typography for Vira field components.
|
|
10
|
+
*
|
|
11
|
+
* Renders consistent `Text` styling. Pair with `Field.Label` at the field root when the
|
|
12
|
+
* label must associate with a control; choice inputs wrap `Field.Label` around the
|
|
13
|
+
* control and render this component for the visible label copy.
|
|
14
|
+
*/
|
|
15
|
+
var FieldLabel = ({ children, className }) => /* @__PURE__ */ jsx(Text, {
|
|
16
|
+
className: clsx(field_label_module_default.FieldLabel, className),
|
|
17
|
+
lineHeight: "small",
|
|
18
|
+
selection: false,
|
|
19
|
+
size: "small",
|
|
20
|
+
weight: "semibold",
|
|
21
|
+
children
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { FieldLabel };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export { BasicInput } from './basic-input
|
|
2
|
-
export
|
|
1
|
+
export { BasicInput } from './basic-input';
|
|
2
|
+
export { FieldHelperCopy } from './field-helper-copy';
|
|
3
|
+
export { FieldLabel } from './field-label';
|
|
4
|
+
export { InputControlGroup } from './input-control-group';
|
|
5
|
+
export type { BasicInputProps } from './basic-input';
|
|
6
|
+
export type { FieldLabelProps } from './field-label';
|
|
7
|
+
export type { InputControlGroupProps } from './input-control-group';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
export type InputControlGroupProps = {
|
|
3
|
+
addonClassName: string | undefined;
|
|
3
4
|
/**
|
|
4
5
|
* Optional content rendered before the control (for example a currency prefix).
|
|
5
6
|
*
|
|
@@ -18,6 +19,7 @@ export type InputControlGroupProps = {
|
|
|
18
19
|
* @required
|
|
19
20
|
*/
|
|
20
21
|
children: React.ReactNode;
|
|
22
|
+
controlGroupClassName: string | undefined;
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
23
25
|
* Internal flex wrapper for a field control plus optional start/end addons.
|
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { Stack } from "../stack/stack.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/basic-input/input-control-group.tsx
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
* Internal flex wrapper for a field control plus optional start/end addons.
|
|
7
|
+
* Not exported from the package public surface.
|
|
8
|
+
*/
|
|
9
|
+
var InputControlGroup = ({ addonClassName, children, controlGroupClassName, endAddon, startAddon }) => /* @__PURE__ */ jsxs(Stack, {
|
|
10
|
+
className: controlGroupClassName,
|
|
11
|
+
direction: "row",
|
|
12
|
+
fillChildren: false,
|
|
13
|
+
vAlign: "stretch",
|
|
14
|
+
children: [
|
|
15
|
+
startAddon && /* @__PURE__ */ jsx(Stack, {
|
|
16
|
+
className: addonClassName,
|
|
17
|
+
"data-position": "start",
|
|
18
|
+
fillChildren: false,
|
|
19
|
+
hAlign: "center",
|
|
20
|
+
hPadding: ["small", "x-small"],
|
|
21
|
+
inline: true,
|
|
22
|
+
shrink: false,
|
|
23
|
+
vAlign: "center",
|
|
24
|
+
children: startAddon
|
|
25
|
+
}),
|
|
26
|
+
children,
|
|
27
|
+
endAddon && /* @__PURE__ */ jsx(Stack, {
|
|
28
|
+
className: addonClassName,
|
|
29
|
+
"data-position": "end",
|
|
30
|
+
fillChildren: false,
|
|
31
|
+
hAlign: "center",
|
|
32
|
+
hPadding: "x-small",
|
|
33
|
+
inline: true,
|
|
34
|
+
shrink: false,
|
|
35
|
+
vAlign: "center",
|
|
36
|
+
children: endAddon
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { InputControlGroup };
|
|
@@ -1,156 +1 @@
|
|
|
1
|
-
|
|
2
|
-
:scope {
|
|
3
|
-
--button-background: var(--global-primary);
|
|
4
|
-
--button-color: var(--base-1);
|
|
5
|
-
--button-height: var(--space-2x-large);
|
|
6
|
-
--button-padding-inline: var(--space-medium);
|
|
7
|
-
--button-padding-block: var(--space-small);
|
|
8
|
-
--button-spinner-color: currentColor;
|
|
9
|
-
--button-icon-size: 1em;
|
|
10
|
-
|
|
11
|
-
-webkit-touch-callout: none;
|
|
12
|
-
-webkit-user-select: none;
|
|
13
|
-
user-select: none;
|
|
14
|
-
margin: 0;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
font-family: inherit;
|
|
17
|
-
display: inline-flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
min-inline-size: min-content;
|
|
20
|
-
max-block-size: var(--button-height);
|
|
21
|
-
block-size: var(--button-height);
|
|
22
|
-
justify-content: center;
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
white-space: nowrap;
|
|
25
|
-
appearance: button;
|
|
26
|
-
overflow: hidden;
|
|
27
|
-
position: relative;
|
|
28
|
-
padding: var(--button-padding-block) var(--button-padding-inline);
|
|
29
|
-
font-variation-settings: 'wght' 500;
|
|
30
|
-
gap: var(--space-small);
|
|
31
|
-
border: 1px solid transparent;
|
|
32
|
-
background: var(--button-background);
|
|
33
|
-
color: var(--button-color);
|
|
34
|
-
font-size: var(--font-scale-body-medium);
|
|
35
|
-
border-radius: var(--radius-small);
|
|
36
|
-
transition: translate var(--easing-elastic) var(--duration-instant);
|
|
37
|
-
background-clip: padding-box;
|
|
38
|
-
will-change: translate;
|
|
39
|
-
|
|
40
|
-
/* Pressed: nudge label/icon down when enabled */
|
|
41
|
-
&:not(:disabled):active {
|
|
42
|
-
translate: 0 1px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&[data-size='medium'] {
|
|
46
|
-
--button-height: var(--space-x-large);
|
|
47
|
-
--button-padding-inline: var(--space-small);
|
|
48
|
-
--button-padding-block: var(--space-small);
|
|
49
|
-
--button-icon-size: 0.9em;
|
|
50
|
-
gap: var(--space-x-small);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&[data-size='small'] {
|
|
54
|
-
--button-height: var(--space-large);
|
|
55
|
-
--button-padding-inline: var(--space-small);
|
|
56
|
-
--button-padding-block: var(--space-x-small);
|
|
57
|
-
--button-icon-size: 0.9em;
|
|
58
|
-
gap: var(--space-x-small);
|
|
59
|
-
font-size: var(--font-scale-body-small);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&[data-variant='primary'] {
|
|
63
|
-
--button-background: var(--global-primary);
|
|
64
|
-
--button-color: contrast-color(var(--global-primary));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&[data-variant='secondary'] {
|
|
68
|
-
--button-background: var(--global-contrast);
|
|
69
|
-
--button-color: var(--base-6);
|
|
70
|
-
background-clip: unset;
|
|
71
|
-
|
|
72
|
-
&:hover {
|
|
73
|
-
--button-background: oklab(from var(--global-contrast) l a b / calc(alpha + 0.05));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&[data-variant='flat'] {
|
|
78
|
-
--button-background: transparent;
|
|
79
|
-
--button-color: var(--base-5);
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
--button-background: var(--base-1);
|
|
83
|
-
--button-color: var(--base-7);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&[data-variant='destructive'] {
|
|
88
|
-
--button-background: oklab(from var(--highlight-red) l a b / 20%);
|
|
89
|
-
--button-color: var(--highlight-red);
|
|
90
|
-
|
|
91
|
-
&:hover {
|
|
92
|
-
--button-background: oklab(from var(--highlight-red) l a b / 30%);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&[data-icon-position='start'] {
|
|
97
|
-
flex-direction: row;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&[data-icon-position='end'] {
|
|
101
|
-
flex-direction: row-reverse;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&[data-icon-only='true'] {
|
|
105
|
-
gap: 0;
|
|
106
|
-
padding-block: var(--button-padding-block);
|
|
107
|
-
padding-inline: var(--button-padding-block);
|
|
108
|
-
inline-size: var(--button-height);
|
|
109
|
-
min-inline-size: var(--button-height);
|
|
110
|
-
max-inline-size: var(--button-height);
|
|
111
|
-
aspect-ratio: 1 / 1;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* Disabled: override variant/hover tokens; aria-disabled for non-native disabled buttons */
|
|
115
|
-
&:disabled,
|
|
116
|
-
&:disabled:hover,
|
|
117
|
-
&[aria-disabled='true'] {
|
|
118
|
-
--button-background: var(--global-disabled-background);
|
|
119
|
-
--button-color: var(--global-disabled-foreground);
|
|
120
|
-
|
|
121
|
-
cursor: not-allowed;
|
|
122
|
-
box-shadow: none;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&[data-loading='true'][data-disabled] {
|
|
126
|
-
pointer-events: none;
|
|
127
|
-
border: 0;
|
|
128
|
-
box-shadow: none;
|
|
129
|
-
--button-color: var(--base-7);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
> .Content {
|
|
133
|
-
display: inline-grid;
|
|
134
|
-
place-items: center;
|
|
135
|
-
|
|
136
|
-
/* Loading: hide label/icon in Content while SpinnerOverlay stays visible */
|
|
137
|
-
&[data-loading='true'] {
|
|
138
|
-
opacity: 0;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
&:first-child > svg {
|
|
142
|
-
block-size: var(--button-icon-size);
|
|
143
|
-
inline-size: var(--button-icon-size);
|
|
144
|
-
flex-shrink: 0;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
> .SpinnerOverlay {
|
|
149
|
-
position: absolute;
|
|
150
|
-
inset: 0;
|
|
151
|
-
display: grid;
|
|
152
|
-
place-content: center;
|
|
153
|
-
pointer-events: none;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
1
|
+
.button-module_Button_oPhrP{--button-background:var(--global-primary);--button-color:var(--base-1);--button-height:var(--space-2x-large);--button-padding-inline:var(--space-medium);--button-padding-block:var(--space-small);--button-spinner-color:currentColor;--button-icon-size:1.125em;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;margin:0;cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;min-inline-size:min-content;max-block-size:var(--button-height);block-size:var(--button-height);justify-content:center;text-decoration:none;white-space:nowrap;appearance:button;overflow:hidden;position:relative;padding:var(--button-padding-block) var(--button-padding-inline);font-weight:400;font-variation-settings:"wght" 400;gap:var(--space-small);border:1px solid transparent;background:var(--button-background);color:var(--button-color);font-size:var(--font-scale-body-medium);border-radius:var(--radius-small);transition:translate var(--easing-elastic) var(--duration-instant);background-clip:padding-box;will-change:translate;&:not(:disabled):active{translate:0 1px}&[data-size=medium]{--button-height:var(--space-x-large);--button-padding-inline:var(--space-small);--button-padding-block:var(--space-small);--button-icon-size:1.125em;gap:var(--space-x-small)}&[data-size=small]{--button-height:var(--space-large);--button-padding-inline:var(--space-small);--button-padding-block:var(--space-x-small);--button-icon-size:0.9em;gap:var(--space-x-small);font-size:var(--font-scale-body-small)}&[data-variant=primary]{--button-background:var(--global-primary);--button-color:contrast-color(var(--global-primary))}&[data-variant=secondary]{--button-background:var(--global-contrast);--button-color:var(--base-6);background-clip:unset;&:hover{--button-background:oklab(from var(--global-contrast) l a b/calc(alpha + 0.05))}}&[data-variant=flat]{--button-background:transparent;--button-color:var(--base-5);&:hover{--button-background:var(--base-1);--button-color:var(--base-7)}}&[data-variant=destructive]{--button-background:oklab(from var(--highlight-red) l a b/20%);--button-color:var(--highlight-red);&:hover{--button-background:oklab(from var(--highlight-red) l a b/30%)}}&[data-icon-position=start]{flex-direction:row}&[data-icon-position=end]{flex-direction:row-reverse}&[data-icon-only=true]{gap:0;padding-block:var(--button-padding-block);padding-inline:var(--button-padding-block);inline-size:var(--button-height);min-inline-size:var(--button-height);max-inline-size:var(--button-height);aspect-ratio:1/1}&:disabled,&:disabled:hover,&[aria-disabled=true]{--button-background:var(--global-disabled-background);--button-color:var(--global-disabled-foreground);cursor:not-allowed;box-shadow:none}&[data-loading=true][data-disabled]{pointer-events:none;border:0;box-shadow:none;--button-color:var(--base-7)}}.button-module_Content_w-pX-{display:inline-grid;place-items:center;&[data-loading=true]{opacity:0}&:first-child>svg{block-size:var(--button-icon-size);inline-size:var(--button-icon-size);flex-shrink:0}}.button-module_SpinnerOverlay_vKqw1{position:absolute;inset:0;display:grid;place-content:center;pointer-events:none}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button as PrimitiveButton } from '@base-ui/react/button';
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
/**
|
|
6
6
|
* Public Button props.
|
|
7
7
|
*
|