@viraui/react 0.0.16 → 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 -157
- package/dist/components/button/button.d.ts +2 -3
- package/dist/components/button/button.js +100 -55
- 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 -145
- 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 -137
- 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 +6 -2
- 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.css +1 -1
- package/package.json +10 -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
|
@@ -1,62 +1,107 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button as PrimitiveButton } from '@base-ui/react/button';
|
|
4
|
-
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
-
import { Spinner } from '../../components/spinner/index.js';
|
|
6
|
-
import { extractIntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
7
|
-
import { clsx } from 'clsx';
|
|
8
|
-
import * as React from 'react';
|
|
9
1
|
import './button.css';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
4
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
5
|
+
import button_module_default from "./button.module.js";
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Button } from "@base-ui/react/button";
|
|
11
|
+
//#region src/components/button/button.tsx
|
|
12
|
+
var spinnerDimensionsBySize = {
|
|
13
|
+
small: "small",
|
|
14
|
+
medium: "small",
|
|
15
|
+
big: "regular"
|
|
14
16
|
};
|
|
15
17
|
function usesButtonPrimitiveRender(render) {
|
|
16
|
-
|
|
18
|
+
return render === void 0 || React.isValidElement(render) && render.type === "button";
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
var ButtonRenderRoot = ({ isDisabled, ref, render, rootProps }) => {
|
|
21
|
+
const { onClick, ...restRootProps } = rootProps;
|
|
22
|
+
return useRender({
|
|
23
|
+
defaultTagName: "button",
|
|
24
|
+
render,
|
|
25
|
+
ref,
|
|
26
|
+
state: { disabled: isDisabled },
|
|
27
|
+
props: {
|
|
28
|
+
...restRootProps,
|
|
29
|
+
onClick: (event) => {
|
|
30
|
+
if (isDisabled) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
onClick?.(event);
|
|
35
|
+
},
|
|
36
|
+
...isDisabled ? { "aria-disabled": true } : {}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
37
39
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
var ButtonRoot = ({ children, className, intrinsicAttributes, isDisabled, isIconOnly, icon, iconPosition, loading, passThroughProps, ref, render, size, variant }) => {
|
|
41
|
+
const rootProps = {
|
|
42
|
+
...passThroughProps,
|
|
43
|
+
...intrinsicAttributes,
|
|
44
|
+
"aria-busy": loading || void 0,
|
|
45
|
+
children,
|
|
46
|
+
className: clsx(button_module_default.Button, className),
|
|
47
|
+
"data-loading": loading ? "true" : "false",
|
|
48
|
+
"data-size": size,
|
|
49
|
+
"data-icon-only": isIconOnly ? "true" : void 0,
|
|
50
|
+
"data-icon-position": icon && !isIconOnly ? iconPosition : void 0,
|
|
51
|
+
"data-variant": variant
|
|
52
|
+
};
|
|
53
|
+
if (usesButtonPrimitiveRender(render)) return /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
...rootProps,
|
|
55
|
+
render,
|
|
56
|
+
ref,
|
|
57
|
+
disabled: isDisabled,
|
|
58
|
+
focusableWhenDisabled: loading
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ jsx(ButtonRenderRoot, {
|
|
61
|
+
isDisabled,
|
|
62
|
+
ref,
|
|
63
|
+
render,
|
|
64
|
+
rootProps
|
|
65
|
+
});
|
|
55
66
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
var Button$1 = ({ children, className, disabled, icon, iconPosition = "start", loading = false, size = "medium", variant = "primary", ...otherProps }) => {
|
|
68
|
+
const isDisabled = disabled || loading;
|
|
69
|
+
const isIconOnly = Boolean(icon) && (children == null || children === "");
|
|
70
|
+
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
71
|
+
const { render, ref, ...passThroughProps } = componentProps;
|
|
72
|
+
return /* @__PURE__ */ jsxs(ButtonRoot, {
|
|
73
|
+
className,
|
|
74
|
+
intrinsicAttributes,
|
|
75
|
+
isDisabled,
|
|
76
|
+
isIconOnly,
|
|
77
|
+
icon,
|
|
78
|
+
iconPosition,
|
|
79
|
+
loading,
|
|
80
|
+
passThroughProps,
|
|
81
|
+
ref,
|
|
82
|
+
render,
|
|
83
|
+
size,
|
|
84
|
+
variant,
|
|
85
|
+
children: [isIconOnly ? /* @__PURE__ */ jsx("span", {
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
className: button_module_default.Content,
|
|
88
|
+
"data-loading": loading ? "true" : "false",
|
|
89
|
+
children: icon
|
|
90
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [icon && /* @__PURE__ */ jsx("span", {
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
className: button_module_default.Content,
|
|
93
|
+
"data-loading": loading ? "true" : "false",
|
|
94
|
+
children: icon
|
|
95
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: button_module_default.Content,
|
|
97
|
+
"data-loading": loading ? "true" : "false",
|
|
98
|
+
children
|
|
99
|
+
})] }), loading ? /* @__PURE__ */ jsx("span", {
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
className: button_module_default.SpinnerOverlay,
|
|
102
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: spinnerDimensionsBySize[size] })
|
|
103
|
+
}) : null]
|
|
104
|
+
});
|
|
62
105
|
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { Button$1 as Button };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Button } from './button
|
|
2
|
-
export type { ButtonProps } from './button
|
|
1
|
+
export { Button } from './button';
|
|
2
|
+
export type { ButtonProps } from './button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.checkbox-module_Checkbox_3oGip{--checkbox-size:var(--space-medium);--checkbox-radius:var(--radius-x-small);--checkbox-background:var(--global-contrast);--checkbox-border-color:transparent;--checkbox-indicator-color:contrast-color(var(--global-primary));&:has([required]) [data-field-label]:after{content:" *";color:var(--highlight-red)}}.checkbox-module_CheckboxRoot_PeyF5{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;appearance:none;border:0;box-shadow:inset 0 0 0 1px var(--checkbox-border-color);inline-size:var(--checkbox-size);block-size:var(--checkbox-size);background:var(--checkbox-background);border-radius:var(--checkbox-radius);&[data-size=regular]{--checkbox-size:var(--space-large);--checkbox-radius:var(--radius-small)}&[data-checked]:not([data-disabled]):not([data-invalid]),&[data-indeterminate]:not([data-disabled]):not([data-invalid]){--checkbox-background:var(--global-primary);--checkbox-border-color:var(--global-primary);box-shadow:none}&[data-invalid]:not([data-disabled]),.checkbox-module_Checkbox_3oGip[data-invalid]>&:not([data-disabled]){--checkbox-border-color:var(--highlight-red);--checkbox-indicator-color:var(--highlight-red);box-shadow:inset 0 0 0 1px var(--highlight-red);outline-color:oklab(from var(--highlight-red) l a b/.5)}&[data-disabled],.checkbox-module_Checkbox_3oGip[data-disabled]>&{--checkbox-background:var(--global-disabled-background);--checkbox-border-color:transparent;--checkbox-indicator-color:var(--global-disabled-foreground);box-shadow:none}}.checkbox-module_Indicator_C-k-l{display:inline-flex;align-items:center;justify-content:center;color:var(--checkbox-indicator-color)}.checkbox-module_Icon_926Sa{stroke:currentColor}.checkbox-module_CheckboxRoot_PeyF5:not([data-indeterminate]) .checkbox-module_MinusIcon_Q57pY,.checkbox-module_CheckboxRoot_PeyF5[data-indeterminate] .checkbox-module_CheckIcon_XqUcs{display:none}.checkbox-module_CheckboxRoot_PeyF5[data-indeterminate] .checkbox-module_MinusIcon_Q57pY{display:inline-flex}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CheckboxRoot, FieldRoot } from '@base-ui/react';
|
|
2
|
+
import { StackProps } from '..';
|
|
3
|
+
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
4
|
+
import type * as React from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Public Checkbox props.
|
|
7
|
+
*
|
|
8
|
+
* Includes Base UI checkbox props such as `checked`, `defaultChecked`, `indeterminate`,
|
|
9
|
+
* `disabled`, and change handlers, plus optional field copy rendered with the shared Vira
|
|
10
|
+
* field label/helper pattern.
|
|
11
|
+
*
|
|
12
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
13
|
+
*/
|
|
14
|
+
export type CheckboxProps = CheckboxRoot.Props & Omit<FieldRoot.Props, 'ref'> & {
|
|
15
|
+
/**
|
|
16
|
+
* Adds `data-grow="false"` to the field root when false.
|
|
17
|
+
*
|
|
18
|
+
* @default The field root does not render a grow attribute.
|
|
19
|
+
*/
|
|
20
|
+
grow?: IntrinsicViraProps['grow'];
|
|
21
|
+
/**
|
|
22
|
+
* Adds `data-shrink="false"` to the field root when false.
|
|
23
|
+
*
|
|
24
|
+
* @default The field root does not render a shrink attribute.
|
|
25
|
+
*/
|
|
26
|
+
shrink?: IntrinsicViraProps['shrink'];
|
|
27
|
+
/**
|
|
28
|
+
* Visible label rendered with shared internal `FieldLabel`.
|
|
29
|
+
*
|
|
30
|
+
* @default No label is rendered.
|
|
31
|
+
*/
|
|
32
|
+
label?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Helper copy rendered with `Field.Description` and `Text` while the field is valid.
|
|
35
|
+
*
|
|
36
|
+
* @default No description is rendered.
|
|
37
|
+
*/
|
|
38
|
+
description?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Error copy rendered with `Field.Error` and `Text` in the same slot as `description`.
|
|
41
|
+
* Replaces description while the field is invalid.
|
|
42
|
+
*
|
|
43
|
+
* @default No static error copy is rendered.
|
|
44
|
+
*/
|
|
45
|
+
error?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Controls the visual checkbox size.
|
|
48
|
+
*
|
|
49
|
+
* @default 'small'
|
|
50
|
+
*/
|
|
51
|
+
size?: 'regular' | 'small';
|
|
52
|
+
/**
|
|
53
|
+
* Sets block padding using one token for both sides or a `[start, end]` tuple.
|
|
54
|
+
*
|
|
55
|
+
* @default No block padding.
|
|
56
|
+
*/
|
|
57
|
+
vPadding?: StackProps['vPadding'];
|
|
58
|
+
/**
|
|
59
|
+
* Sets inline padding using one token for both sides or a `[start, end]` tuple.
|
|
60
|
+
*
|
|
61
|
+
* @default No inline padding.
|
|
62
|
+
*/
|
|
63
|
+
hPadding?: StackProps['hPadding'];
|
|
64
|
+
};
|
|
65
|
+
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Checkbox",
|
|
3
|
+
"summary": "Field-wrapped checkbox control with optional field copy.",
|
|
4
|
+
"whenToUse": [
|
|
5
|
+
"Single or multi-select boolean choices with optional label and helper text",
|
|
6
|
+
"Invalid and disabled states with Switch-parity focus treatment"
|
|
7
|
+
],
|
|
8
|
+
"whenNotToUse": [
|
|
9
|
+
"Unlabeled checkbox without aria-label on the root",
|
|
10
|
+
"Mutually exclusive options in a set (use radio pattern instead)"
|
|
11
|
+
],
|
|
12
|
+
"accessibility": [
|
|
13
|
+
"Provide visible label or aria-label so the checkbox has an accessible name",
|
|
14
|
+
"Checked and indeterminate states must map to native checkbox semantics exposed by the control",
|
|
15
|
+
"Surface invalid state and error copy through the shared field pattern"
|
|
16
|
+
],
|
|
17
|
+
"antiPatterns": [
|
|
18
|
+
"Rendering a checkbox without label and without aria-label",
|
|
19
|
+
"Expecting description to stay visible when invalid without an error message"
|
|
20
|
+
],
|
|
21
|
+
"related": ["Switch", "Stack", "Text"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import './checkbox.css';
|
|
2
|
+
"use client";
|
|
3
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
4
|
+
import { FieldHelperCopy } from "../basic-input/field-helper-copy.js";
|
|
5
|
+
import { FieldLabel } from "../basic-input/field-label.js";
|
|
6
|
+
import { Stack } from "../stack/stack.js";
|
|
7
|
+
import checkbox_module_default from "./checkbox.module.js";
|
|
8
|
+
import { Icon } from "../icon/icon.js";
|
|
9
|
+
import { clsx } from "clsx";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Checkbox, Field } from "@base-ui/react";
|
|
12
|
+
//#region src/components/checkbox/checkbox.tsx
|
|
13
|
+
var Checkbox$1 = ({ className, description, dirty, disabled, error, invalid, label, name, ref, size = "small", vPadding, hPadding, touched, validate, validationDebounceTime, validationMode, ...checkboxRootProps }) => {
|
|
14
|
+
const hasTextDescription = Boolean(description || error);
|
|
15
|
+
const iconSize = size === "small" ? 12 : 16;
|
|
16
|
+
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(checkboxRootProps);
|
|
17
|
+
return /* @__PURE__ */ jsx(Field.Root, {
|
|
18
|
+
...intrinsicAttributes,
|
|
19
|
+
className: checkbox_module_default.Checkbox,
|
|
20
|
+
dirty,
|
|
21
|
+
disabled,
|
|
22
|
+
invalid,
|
|
23
|
+
name,
|
|
24
|
+
touched,
|
|
25
|
+
validate,
|
|
26
|
+
validationDebounceTime,
|
|
27
|
+
validationMode,
|
|
28
|
+
render: /* @__PURE__ */ jsx(Stack, {
|
|
29
|
+
direction: "row",
|
|
30
|
+
columnGap: size === "small" ? "small" : "medium",
|
|
31
|
+
fillChildren: false,
|
|
32
|
+
vAlign: hasTextDescription ? "start" : "center"
|
|
33
|
+
}),
|
|
34
|
+
children: /* @__PURE__ */ jsx(Field.Label, { children: /* @__PURE__ */ jsxs(Stack, {
|
|
35
|
+
direction: "row",
|
|
36
|
+
columnGap: size === "small" ? "small" : "medium",
|
|
37
|
+
fillChildren: false,
|
|
38
|
+
vAlign: hasTextDescription ? "start" : "center",
|
|
39
|
+
...hPadding !== void 0 ? { hPadding } : {},
|
|
40
|
+
...vPadding !== void 0 ? { vPadding } : {},
|
|
41
|
+
children: [/* @__PURE__ */ jsx(Checkbox.Root, {
|
|
42
|
+
...componentProps,
|
|
43
|
+
className: clsx(checkbox_module_default.CheckboxRoot, className),
|
|
44
|
+
"data-size": size,
|
|
45
|
+
disabled,
|
|
46
|
+
name,
|
|
47
|
+
ref,
|
|
48
|
+
children: /* @__PURE__ */ jsxs(Checkbox.Indicator, {
|
|
49
|
+
className: checkbox_module_default.Indicator,
|
|
50
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
51
|
+
className: clsx(checkbox_module_default.Icon, checkbox_module_default.CheckIcon),
|
|
52
|
+
name: "Check",
|
|
53
|
+
size: iconSize
|
|
54
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
55
|
+
className: clsx(checkbox_module_default.Icon, checkbox_module_default.MinusIcon),
|
|
56
|
+
name: "Minus",
|
|
57
|
+
size: iconSize
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
}), label || description || error ? /* @__PURE__ */ jsxs(Stack, {
|
|
61
|
+
direction: "column",
|
|
62
|
+
fillChildren: false,
|
|
63
|
+
rowGap: size === "small" ? "2x-small" : "x-small",
|
|
64
|
+
children: [label && /* @__PURE__ */ jsx(FieldLabel, { children: label }), /* @__PURE__ */ jsx(FieldHelperCopy, {
|
|
65
|
+
description,
|
|
66
|
+
error
|
|
67
|
+
})]
|
|
68
|
+
}) : null]
|
|
69
|
+
}) })
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Checkbox$1 as Checkbox };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var checkbox_module_default = {
|
|
2
|
+
Checkbox: "checkbox-module_Checkbox_3oGip",
|
|
3
|
+
CheckboxRoot: "checkbox-module_CheckboxRoot_PeyF5",
|
|
4
|
+
Indicator: "checkbox-module_Indicator_C-k-l",
|
|
5
|
+
Icon: "checkbox-module_Icon_926Sa",
|
|
6
|
+
MinusIcon: "checkbox-module_MinusIcon_Q57pY",
|
|
7
|
+
CheckIcon: "checkbox-module_CheckIcon_XqUcs"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { checkbox_module_default as default };
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
:scope {
|
|
3
|
-
display: -webkit-box;
|
|
4
|
-
-webkit-line-clamp: var(--clamp-text-rows, 1);
|
|
5
|
-
-webkit-box-orient: vertical;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
|
|
8
|
-
&[data-clamp-text-inline='true'] {
|
|
9
|
-
display: -webkit-inline-box;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
.clamp-text-module_ClampText_Whnkd{display:-webkit-box;-webkit-line-clamp:var(--clamp-text-rows,1);-webkit-box-orient:vertical;overflow:hidden;&[data-clamp-text-inline=true]{display:-webkit-inline-box}}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
2
3
|
import type * as React from 'react';
|
|
3
|
-
import './clamp-text.css';
|
|
4
|
-
import type { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
5
4
|
/**
|
|
6
5
|
* Public ClampText props.
|
|
7
6
|
*
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import { extractIntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
1
|
import './clamp-text.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
4
|
+
import clamp_text_module_default from "./clamp-text.module.js";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
//#region src/components/clamp-text/clamp-text.tsx
|
|
9
|
+
var ClampText = ({ className, inline = false, ref, render, rows = 1, style, ...otherProps }) => {
|
|
10
|
+
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
11
|
+
const dynamicStyle = useMemo(() => ({ "--clamp-text-rows": rows }), [rows]);
|
|
12
|
+
return useRender({
|
|
13
|
+
defaultTagName: "span",
|
|
14
|
+
render,
|
|
15
|
+
ref,
|
|
16
|
+
props: {
|
|
17
|
+
...componentProps,
|
|
18
|
+
...intrinsicAttributes,
|
|
19
|
+
"data-clamp-text-inline": inline ? "true" : "false",
|
|
20
|
+
className: clsx(clamp_text_module_default.ClampText, className),
|
|
21
|
+
style: {
|
|
22
|
+
...dynamicStyle,
|
|
23
|
+
...style
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
24
27
|
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ClampText };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ClampText } from './clamp-text
|
|
2
|
-
export type { ClampTextProps } from './clamp-text
|
|
1
|
+
export { ClampText } from './clamp-text';
|
|
2
|
+
export type { ClampTextProps } from './clamp-text';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ElevationDirection, ElevationLevel, ElevationShadowColor } from '../../core/elevation/elevation-types';
|
|
2
|
+
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
1
3
|
import type * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export { ELEVATION_DEFAULTS } from '../../core/elevation/elevation-types.js';
|
|
6
|
-
export { getElevationProps } from '../../core/elevation/get-elevation-props.js';
|
|
4
|
+
export type { ElevationDirection, ElevationLevel, ElevationShadowColor, } from '../../core/elevation/elevation-types';
|
|
5
|
+
export { ELEVATION_DEFAULTS } from '../../core/elevation/elevation-types';
|
|
6
|
+
export { getElevationProps } from '../../core/elevation/get-elevation-props';
|
|
7
7
|
/**
|
|
8
8
|
* Public Elevator props.
|
|
9
9
|
*
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
2
|
+
import "../../core/elevation/elevation-types.js";
|
|
3
|
+
import { getElevationProps } from "../../core/elevation/get-elevation-props.js";
|
|
4
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
5
|
+
//#region src/components/elevator/elevator.tsx
|
|
6
|
+
var mergeChildStyle = (childStyle, elevationStyle) => ({
|
|
7
|
+
...childStyle ?? {},
|
|
8
|
+
...elevationStyle
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
});
|
|
10
|
+
var Elevator = ({ children, resting, hover, direction, shadowColor, extraShadow, ...otherProps }) => {
|
|
11
|
+
const { intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
12
|
+
const elevation = getElevationProps({
|
|
13
|
+
resting,
|
|
14
|
+
...hover !== void 0 ? { hover } : {},
|
|
15
|
+
...direction !== void 0 ? { direction } : {},
|
|
16
|
+
...shadowColor !== void 0 ? { shadowColor } : {},
|
|
17
|
+
...extraShadow !== void 0 ? { extraShadow } : {}
|
|
18
|
+
});
|
|
19
|
+
return Children.map(children, (child) => {
|
|
20
|
+
if (!isValidElement(child)) return child;
|
|
21
|
+
return cloneElement(child, {
|
|
22
|
+
...intrinsicAttributes,
|
|
23
|
+
...elevation.attributes,
|
|
24
|
+
style: mergeChildStyle(child.props.style, elevation.style)
|
|
25
|
+
});
|
|
26
|
+
});
|
|
29
27
|
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Elevator };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ELEVATION_DEFAULTS, Elevator, getElevationProps } from './elevator
|
|
2
|
-
export type { ElevationDirection, ElevationLevel, ElevationShadowColor, ElevatorProps } from './elevator
|
|
1
|
+
export { ELEVATION_DEFAULTS, Elevator, getElevationProps } from './elevator';
|
|
2
|
+
export type { ElevationDirection, ElevationLevel, ElevationShadowColor, ElevatorProps } from './elevator';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
3
|
-
import type { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
1
|
+
import { GeneratedIconName, GeneratedIconVariant } from '../../../dist/internal-icons/icon-registry.js';
|
|
2
|
+
import { IntrinsicViraProps } from '../../core/props/intrinsic-vira-props';
|
|
4
3
|
export type IconName = GeneratedIconName;
|
|
5
4
|
export type IconVariant = GeneratedIconVariant;
|
|
6
5
|
export type IconProps = React.ComponentProps<'svg'> & IntrinsicViraProps & {
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { generatedDefaultIconVariant, generatedIconRegistry } from '#internal-icons/icon-registry';
|
|
3
|
-
import { extractIntrinsicViraProps } from '../../core/props/intrinsic-vira-props.js';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
1
|
import './icon.css';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { extractIntrinsicViraProps } from "../../core/props/intrinsic-vira-props.js";
|
|
3
|
+
import icon_module_default from "./icon.module.js";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { generatedDefaultIconVariant, generatedIconRegistry } from "#internal-icons/icon-registry";
|
|
7
|
+
//#region src/components/icon/icon.tsx
|
|
8
|
+
var Icon = ({ className, name, size = 24, variant = generatedDefaultIconVariant, ...otherProps }) => {
|
|
9
|
+
const ResolvedIcon = generatedIconRegistry[generatedIconRegistry[variant] ? variant : generatedDefaultIconVariant][name];
|
|
10
|
+
const { componentProps, intrinsicAttributes } = extractIntrinsicViraProps(otherProps);
|
|
11
|
+
return /* @__PURE__ */ jsx(ResolvedIcon, {
|
|
12
|
+
...componentProps,
|
|
13
|
+
...intrinsicAttributes,
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
className: clsx(icon_module_default.Icon, className),
|
|
16
|
+
size
|
|
17
|
+
});
|
|
11
18
|
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Icon };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Icon } from './icon
|
|
2
|
-
export type { IconProps } from './icon
|
|
1
|
+
export { Icon } from './icon';
|
|
2
|
+
export type { IconProps } from './icon';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Button } from "../button/button.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/icon-button/icon-button.tsx
|
|
4
|
+
var IconButton = ({ icon, size = "medium", ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
5
|
+
icon,
|
|
6
|
+
size,
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { IconButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IconButton } from './icon-button
|
|
2
|
-
export type { IconButtonProps } from './icon-button
|
|
1
|
+
export { IconButton } from './icon-button';
|
|
2
|
+
export type { IconButtonProps } from './icon-button';
|