@tanishqkancharla/maui 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Code.d.ts +5 -1
- package/dist/components/Code.js +5 -2
- package/dist/components/Input.js +3 -3
- package/dist/maui.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Code.tsx +19 -2
- package/src/components/Input.tsx +12 -9
- package/src/maui.ts +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
type CodeProps = React.HTMLAttributes<HTMLElement>;
|
|
3
|
+
export type KbdVariant = "default" | "quiet";
|
|
4
|
+
export type KbdProps = CodeProps & {
|
|
5
|
+
variant?: KbdVariant;
|
|
6
|
+
};
|
|
3
7
|
export declare function Code({ className, children, ...props }: CodeProps): React.JSX.Element;
|
|
4
|
-
export declare function Kbd({ className, children, ...props }:
|
|
8
|
+
export declare function Kbd({ className, children, variant, ...props }: KbdProps): React.JSX.Element;
|
|
5
9
|
export {};
|
package/dist/components/Code.js
CHANGED
|
@@ -22,12 +22,15 @@ const kbdClass = style(text({ size: "xs", fontWeight: 400, color: "lowContrast"
|
|
|
22
22
|
paddingBlock: 0,
|
|
23
23
|
whiteSpace: "nowrap",
|
|
24
24
|
});
|
|
25
|
+
const quietKbdClass = style(kbdClass, {
|
|
26
|
+
backgroundColor: "transparent",
|
|
27
|
+
});
|
|
25
28
|
export function Code({ className, children, ...props }) {
|
|
26
29
|
const codeClassName = useStyles(codeClass);
|
|
27
30
|
return (_jsx("code", { ...props, className: joinClassNames(codeClassName, className), children: children }));
|
|
28
31
|
}
|
|
29
|
-
export function Kbd({ className, children, ...props }) {
|
|
30
|
-
const kbdClassName = useStyles(kbdClass);
|
|
32
|
+
export function Kbd({ className, children, variant = "default", ...props }) {
|
|
33
|
+
const kbdClassName = useStyles(variant === "quiet" ? quietKbdClass : kbdClass);
|
|
31
34
|
return (_jsx("kbd", { ...props, className: joinClassNames(kbdClassName, className), children: children }));
|
|
32
35
|
}
|
|
33
36
|
function joinClassNames(...classNames) {
|
package/dist/components/Input.js
CHANGED
|
@@ -12,7 +12,7 @@ import { radius } from "../tokens/radius";
|
|
|
12
12
|
import { shadow, shadowVars } from "../tokens/shadow";
|
|
13
13
|
import { controlSize, iconSizeValues } from "../tokens/sizing";
|
|
14
14
|
import { spacing } from "../tokens/spacing";
|
|
15
|
-
import { text } from "../tokens/text";
|
|
15
|
+
import { monospace, text } from "../tokens/text";
|
|
16
16
|
import { Kbd } from "./Code";
|
|
17
17
|
import { Icons } from "./Icons";
|
|
18
18
|
const inputText = text({ size: "sm", fontWeight: 400, color: "highContrast" });
|
|
@@ -46,7 +46,7 @@ const inputFrameClass = style({
|
|
|
46
46
|
const inputWithHintClass = style({
|
|
47
47
|
paddingRight: "28px",
|
|
48
48
|
});
|
|
49
|
-
const keyboardHintClass = style({
|
|
49
|
+
const keyboardHintClass = style(monospace, {
|
|
50
50
|
position: "absolute",
|
|
51
51
|
top: "50%",
|
|
52
52
|
right: spacing.value(4),
|
|
@@ -65,7 +65,7 @@ function useKeyboardHint() {
|
|
|
65
65
|
}
|
|
66
66
|
function KeyboardHint(props) {
|
|
67
67
|
const className = useStyles(keyboardHintClass);
|
|
68
|
-
return (_jsx(Kbd, { className: className, "aria-hidden": "true", children: props.children }));
|
|
68
|
+
return (_jsx(Kbd, { variant: "quiet", className: className, "aria-hidden": "true", children: props.children }));
|
|
69
69
|
}
|
|
70
70
|
export function TextField(props) {
|
|
71
71
|
const { keyboardHint, ...fieldProps } = props;
|
package/dist/maui.d.ts
CHANGED
|
@@ -45,6 +45,6 @@ export { Flex, Gap, Spacer, Divider, type FlexShadow, type FlexRadius, type Flex
|
|
|
45
45
|
export { Text, type TextProps } from "./components/Text";
|
|
46
46
|
export { H1, H2, H3, H4, P, Label, labelText, Blockquote, Ul, Ol, Li, Link, } from "./components/Typography";
|
|
47
47
|
export { CodeBlock } from "./components/CodeBlock";
|
|
48
|
-
export { Code, Kbd } from "./components/Code";
|
|
48
|
+
export { Code, Kbd, type KbdProps, type KbdVariant } from "./components/Code";
|
|
49
49
|
export { CollectionPopover, type CollectionPopoverProps, } from "./components/CollectionPopover";
|
|
50
50
|
export { navigationItem } from "./components/navigationItem";
|
package/package.json
CHANGED
package/src/components/Code.tsx
CHANGED
|
@@ -7,6 +7,12 @@ import { monospace, text } from "../tokens/text"
|
|
|
7
7
|
|
|
8
8
|
type CodeProps = React.HTMLAttributes<HTMLElement>
|
|
9
9
|
|
|
10
|
+
export type KbdVariant = "default" | "quiet"
|
|
11
|
+
|
|
12
|
+
export type KbdProps = CodeProps & {
|
|
13
|
+
variant?: KbdVariant
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
const codeClass = style(
|
|
11
17
|
monospace,
|
|
12
18
|
radius.sm,
|
|
@@ -36,6 +42,10 @@ const kbdClass = style(
|
|
|
36
42
|
},
|
|
37
43
|
)
|
|
38
44
|
|
|
45
|
+
const quietKbdClass = style(kbdClass, {
|
|
46
|
+
backgroundColor: "transparent",
|
|
47
|
+
})
|
|
48
|
+
|
|
39
49
|
export function Code({ className, children, ...props }: CodeProps) {
|
|
40
50
|
const codeClassName = useStyles(codeClass)
|
|
41
51
|
|
|
@@ -46,8 +56,15 @@ export function Code({ className, children, ...props }: CodeProps) {
|
|
|
46
56
|
)
|
|
47
57
|
}
|
|
48
58
|
|
|
49
|
-
export function Kbd({
|
|
50
|
-
|
|
59
|
+
export function Kbd({
|
|
60
|
+
className,
|
|
61
|
+
children,
|
|
62
|
+
variant = "default",
|
|
63
|
+
...props
|
|
64
|
+
}: KbdProps) {
|
|
65
|
+
const kbdClassName = useStyles(
|
|
66
|
+
variant === "quiet" ? quietKbdClass : kbdClass,
|
|
67
|
+
)
|
|
51
68
|
|
|
52
69
|
return (
|
|
53
70
|
<kbd {...props} className={joinClassNames(kbdClassName, className)}>
|
package/src/components/Input.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import { radius } from "../tokens/radius"
|
|
|
21
21
|
import { shadow, shadowVars } from "../tokens/shadow"
|
|
22
22
|
import { controlSize, iconSizeValues } from "../tokens/sizing"
|
|
23
23
|
import { spacing } from "../tokens/spacing"
|
|
24
|
-
import { text } from "../tokens/text"
|
|
24
|
+
import { monospace, text } from "../tokens/text"
|
|
25
25
|
import { Kbd } from "./Code"
|
|
26
26
|
import { Icons } from "./Icons"
|
|
27
27
|
|
|
@@ -79,13 +79,16 @@ const inputWithHintClass = style({
|
|
|
79
79
|
paddingRight: "28px",
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
const keyboardHintClass = style(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
const keyboardHintClass = style(
|
|
83
|
+
monospace,
|
|
84
|
+
{
|
|
85
|
+
position: "absolute",
|
|
86
|
+
top: "50%",
|
|
87
|
+
right: spacing.value(4),
|
|
88
|
+
transform: "translateY(-50%)",
|
|
89
|
+
pointerEvents: "none",
|
|
90
|
+
},
|
|
91
|
+
)
|
|
89
92
|
|
|
90
93
|
function useKeyboardHint() {
|
|
91
94
|
const [isFocused, setIsFocused] = useState(false)
|
|
@@ -101,7 +104,7 @@ function useKeyboardHint() {
|
|
|
101
104
|
function KeyboardHint(props: { children: string }) {
|
|
102
105
|
const className = useStyles(keyboardHintClass)
|
|
103
106
|
return (
|
|
104
|
-
<Kbd className={className} aria-hidden="true">
|
|
107
|
+
<Kbd variant="quiet" className={className} aria-hidden="true">
|
|
105
108
|
{props.children}
|
|
106
109
|
</Kbd>
|
|
107
110
|
)
|
package/src/maui.ts
CHANGED
|
@@ -168,7 +168,7 @@ export {
|
|
|
168
168
|
Link,
|
|
169
169
|
} from "./components/Typography"
|
|
170
170
|
export { CodeBlock } from "./components/CodeBlock"
|
|
171
|
-
export { Code, Kbd } from "./components/Code"
|
|
171
|
+
export { Code, Kbd, type KbdProps, type KbdVariant } from "./components/Code"
|
|
172
172
|
export {
|
|
173
173
|
CollectionPopover,
|
|
174
174
|
type CollectionPopoverProps,
|