@vector-im/compound-web 8.2.1 → 8.2.3
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/Button/UnstyledButton.cjs +2 -2
- package/dist/components/Button/UnstyledButton.cjs.map +1 -1
- package/dist/components/Button/UnstyledButton.d.ts.map +1 -1
- package/dist/components/Button/UnstyledButton.js +2 -2
- package/dist/components/Button/UnstyledButton.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Button/UnstyledButton.tsx +5 -4
|
@@ -32,13 +32,13 @@ const UnstyledButton = React.forwardRef(function UnstyledButton2({
|
|
|
32
32
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
33
|
Component,
|
|
34
34
|
{
|
|
35
|
-
...restProps,
|
|
36
35
|
ref,
|
|
37
36
|
className,
|
|
38
37
|
role: as === "a" ? "link" : "button",
|
|
39
38
|
tabIndex: 0,
|
|
40
|
-
...eventHandlers,
|
|
41
39
|
"aria-disabled": disabled,
|
|
40
|
+
...restProps,
|
|
41
|
+
...eventHandlers,
|
|
42
42
|
children
|
|
43
43
|
}
|
|
44
44
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnstyledButton.cjs","sources":["../../../src/components/Button/UnstyledButton.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type PropsWithChildren,\n forwardRef,\n type ForwardedRef,\n type Ref,\n} from \"react\";\n\ninterface ButtonComponent {\n // With the explicit `as` prop\n <C extends React.ElementType>(\n props: { as: C } & UnstyledButtonPropsFor<C>,\n ): React.ReactElement;\n // Without the explicit `as` prop, defaulting to a <button>\n (props: UnstyledButtonPropsFor<\"button\">): React.ReactElement;\n}\n\ntype UnstyledButtonProps = PropsWithChildren<{\n /**\n * Note that disabled attribute is not added to buttons, so that disabled buttons are discoverable by keyboard.\n * `aria-disabled` attribute is used to indicate button is disabled.\n * Event handlers are not passed to disabled buttons (onClick, onSubmit, etc.)\n */\n disabled?: boolean;\n}>;\n\nexport type UnstyledButtonPropsFor<C extends React.ElementType> =\n UnstyledButtonProps &\n Omit<\n React.ComponentPropsWithoutRef<C>,\n keyof UnstyledButtonProps | \"as\"\n > & {\n ref?: React.Ref<React.ComponentRef<C>>;\n };\n\n/**\n * Unstyled button component. Can be disabled and optionally rendered as an anchor.\n * Intended to be wrapped with styles and exported as new button type - eg `IconButton` or `Button`.\n *\n * Not to be used externally.\n */\nexport const UnstyledButton = forwardRef(function UnstyledButton<\n C extends React.ElementType = \"button\",\n>(\n {\n as,\n children,\n className,\n disabled,\n ...props\n }: UnstyledButtonPropsFor<C> & { as?: C },\n ref: ForwardedRef<C>,\n): React.ReactElement {\n const Component = as || (\"button\" as const);\n\n const {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n ...restProps\n } = props;\n const eventHandlers = disabled\n ? {}\n : {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n };\n\n return (\n <Component\n
|
|
1
|
+
{"version":3,"file":"UnstyledButton.cjs","sources":["../../../src/components/Button/UnstyledButton.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type PropsWithChildren,\n forwardRef,\n type ForwardedRef,\n type Ref,\n} from \"react\";\n\ninterface ButtonComponent {\n // With the explicit `as` prop\n <C extends React.ElementType>(\n props: { as: C } & UnstyledButtonPropsFor<C>,\n ): React.ReactElement;\n // Without the explicit `as` prop, defaulting to a <button>\n (props: UnstyledButtonPropsFor<\"button\">): React.ReactElement;\n}\n\ntype UnstyledButtonProps = PropsWithChildren<{\n /**\n * Note that disabled attribute is not added to buttons, so that disabled buttons are discoverable by keyboard.\n * `aria-disabled` attribute is used to indicate button is disabled.\n * Event handlers are not passed to disabled buttons (onClick, onSubmit, etc.)\n */\n disabled?: boolean;\n}>;\n\nexport type UnstyledButtonPropsFor<C extends React.ElementType> =\n UnstyledButtonProps &\n Omit<\n React.ComponentPropsWithoutRef<C>,\n keyof UnstyledButtonProps | \"as\"\n > & {\n ref?: React.Ref<React.ComponentRef<C>>;\n };\n\n/**\n * Unstyled button component. Can be disabled and optionally rendered as an anchor.\n * Intended to be wrapped with styles and exported as new button type - eg `IconButton` or `Button`.\n *\n * Not to be used externally.\n */\nexport const UnstyledButton = forwardRef(function UnstyledButton<\n C extends React.ElementType = \"button\",\n>(\n {\n as,\n children,\n className,\n disabled,\n ...props\n }: UnstyledButtonPropsFor<C> & { as?: C },\n ref: ForwardedRef<C>,\n): React.ReactElement {\n const Component = as || (\"button\" as const);\n\n const {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n ...restProps\n } = props;\n const eventHandlers = disabled\n ? {}\n : {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n };\n\n return (\n <Component\n ref={ref as Ref<C>}\n className={className}\n // The elements roles should be set to button default, or link in the case of anchors.\n // This should be overridable by props, say for example if you want to use a button as an option within a listbox.\n // Hence it taking precedence over restProps.\n role={as === \"a\" ? \"link\" : \"button\"}\n tabIndex={0}\n aria-disabled={disabled}\n {...restProps}\n {...eventHandlers}\n >\n {children}\n </Component>\n );\n}) as ButtonComponent;\n"],"names":["forwardRef","UnstyledButton","jsx"],"mappings":";;;;AA+CO,MAAM,iBAAiBA,MAAAA,WAAW,SAASC,gBAGhD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACoB;AACpB,QAAM,YAAY,MAAO;AAEzB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,gBAAgB,WAClB,KACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGN,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MAIA,MAAM,OAAO,MAAM,SAAS;AAAA,MAC5B,UAAU;AAAA,MACV,iBAAe;AAAA,MACd,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnstyledButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/UnstyledButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AAEf,UAAU,eAAe;IAEvB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,EAC1B,KAAK,EAAE;QAAE,EAAE,EAAE,CAAC,CAAA;KAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,GAC3C,KAAK,CAAC,YAAY,CAAC;IAEtB,CAAC,KAAK,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC;CAC/D;AAED,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAC5D,mBAAmB,GACjB,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EACjC,MAAM,mBAAmB,GAAG,IAAI,CACjC,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAEN;;;;;GAKG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"UnstyledButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/UnstyledButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AAEf,UAAU,eAAe;IAEvB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,EAC1B,KAAK,EAAE;QAAE,EAAE,EAAE,CAAC,CAAA;KAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,GAC3C,KAAK,CAAC,YAAY,CAAC;IAEtB,CAAC,KAAK,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC;CAC/D;AAED,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAC5D,mBAAmB,GACjB,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EACjC,MAAM,mBAAmB,GAAG,IAAI,CACjC,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAEN;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAoDrB,eAAe,CAAC"}
|
|
@@ -30,13 +30,13 @@ const UnstyledButton = forwardRef(function UnstyledButton2({
|
|
|
30
30
|
return /* @__PURE__ */ jsx(
|
|
31
31
|
Component,
|
|
32
32
|
{
|
|
33
|
-
...restProps,
|
|
34
33
|
ref,
|
|
35
34
|
className,
|
|
36
35
|
role: as === "a" ? "link" : "button",
|
|
37
36
|
tabIndex: 0,
|
|
38
|
-
...eventHandlers,
|
|
39
37
|
"aria-disabled": disabled,
|
|
38
|
+
...restProps,
|
|
39
|
+
...eventHandlers,
|
|
40
40
|
children
|
|
41
41
|
}
|
|
42
42
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnstyledButton.js","sources":["../../../src/components/Button/UnstyledButton.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type PropsWithChildren,\n forwardRef,\n type ForwardedRef,\n type Ref,\n} from \"react\";\n\ninterface ButtonComponent {\n // With the explicit `as` prop\n <C extends React.ElementType>(\n props: { as: C } & UnstyledButtonPropsFor<C>,\n ): React.ReactElement;\n // Without the explicit `as` prop, defaulting to a <button>\n (props: UnstyledButtonPropsFor<\"button\">): React.ReactElement;\n}\n\ntype UnstyledButtonProps = PropsWithChildren<{\n /**\n * Note that disabled attribute is not added to buttons, so that disabled buttons are discoverable by keyboard.\n * `aria-disabled` attribute is used to indicate button is disabled.\n * Event handlers are not passed to disabled buttons (onClick, onSubmit, etc.)\n */\n disabled?: boolean;\n}>;\n\nexport type UnstyledButtonPropsFor<C extends React.ElementType> =\n UnstyledButtonProps &\n Omit<\n React.ComponentPropsWithoutRef<C>,\n keyof UnstyledButtonProps | \"as\"\n > & {\n ref?: React.Ref<React.ComponentRef<C>>;\n };\n\n/**\n * Unstyled button component. Can be disabled and optionally rendered as an anchor.\n * Intended to be wrapped with styles and exported as new button type - eg `IconButton` or `Button`.\n *\n * Not to be used externally.\n */\nexport const UnstyledButton = forwardRef(function UnstyledButton<\n C extends React.ElementType = \"button\",\n>(\n {\n as,\n children,\n className,\n disabled,\n ...props\n }: UnstyledButtonPropsFor<C> & { as?: C },\n ref: ForwardedRef<C>,\n): React.ReactElement {\n const Component = as || (\"button\" as const);\n\n const {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n ...restProps\n } = props;\n const eventHandlers = disabled\n ? {}\n : {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n };\n\n return (\n <Component\n
|
|
1
|
+
{"version":3,"file":"UnstyledButton.js","sources":["../../../src/components/Button/UnstyledButton.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type PropsWithChildren,\n forwardRef,\n type ForwardedRef,\n type Ref,\n} from \"react\";\n\ninterface ButtonComponent {\n // With the explicit `as` prop\n <C extends React.ElementType>(\n props: { as: C } & UnstyledButtonPropsFor<C>,\n ): React.ReactElement;\n // Without the explicit `as` prop, defaulting to a <button>\n (props: UnstyledButtonPropsFor<\"button\">): React.ReactElement;\n}\n\ntype UnstyledButtonProps = PropsWithChildren<{\n /**\n * Note that disabled attribute is not added to buttons, so that disabled buttons are discoverable by keyboard.\n * `aria-disabled` attribute is used to indicate button is disabled.\n * Event handlers are not passed to disabled buttons (onClick, onSubmit, etc.)\n */\n disabled?: boolean;\n}>;\n\nexport type UnstyledButtonPropsFor<C extends React.ElementType> =\n UnstyledButtonProps &\n Omit<\n React.ComponentPropsWithoutRef<C>,\n keyof UnstyledButtonProps | \"as\"\n > & {\n ref?: React.Ref<React.ComponentRef<C>>;\n };\n\n/**\n * Unstyled button component. Can be disabled and optionally rendered as an anchor.\n * Intended to be wrapped with styles and exported as new button type - eg `IconButton` or `Button`.\n *\n * Not to be used externally.\n */\nexport const UnstyledButton = forwardRef(function UnstyledButton<\n C extends React.ElementType = \"button\",\n>(\n {\n as,\n children,\n className,\n disabled,\n ...props\n }: UnstyledButtonPropsFor<C> & { as?: C },\n ref: ForwardedRef<C>,\n): React.ReactElement {\n const Component = as || (\"button\" as const);\n\n const {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n ...restProps\n } = props;\n const eventHandlers = disabled\n ? {}\n : {\n onClick,\n onSubmit,\n onPointerDown,\n onPointerUp,\n onKeyDown,\n onKeyUp,\n onKeyPress,\n };\n\n return (\n <Component\n ref={ref as Ref<C>}\n className={className}\n // The elements roles should be set to button default, or link in the case of anchors.\n // This should be overridable by props, say for example if you want to use a button as an option within a listbox.\n // Hence it taking precedence over restProps.\n role={as === \"a\" ? \"link\" : \"button\"}\n tabIndex={0}\n aria-disabled={disabled}\n {...restProps}\n {...eventHandlers}\n >\n {children}\n </Component>\n );\n}) as ButtonComponent;\n"],"names":["UnstyledButton"],"mappings":";;AA+CO,MAAM,iBAAiB,WAAW,SAASA,gBAGhD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACoB;AACpB,QAAM,YAAY,MAAO;AAEzB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,gBAAgB,WAClB,KACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGN,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MAIA,MAAM,OAAO,MAAM,SAAS;AAAA,MAC5B,UAAU;AAAA,MACV,iBAAe;AAAA,MACd,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vector-im/compound-web",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.3",
|
|
4
4
|
"description": "Compound components for the Web",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@floating-ui/react": "^0.27.0",
|
|
105
|
-
"@radix-ui/react-context-menu": "^2.2.
|
|
105
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
106
106
|
"@radix-ui/react-dropdown-menu": "^2.1.1",
|
|
107
107
|
"@radix-ui/react-form": "^0.1.0",
|
|
108
108
|
"@radix-ui/react-progress": "^1.1.0",
|
|
@@ -83,15 +83,16 @@ export const UnstyledButton = forwardRef(function UnstyledButton<
|
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<Component
|
|
86
|
-
{...restProps}
|
|
87
86
|
ref={ref as Ref<C>}
|
|
88
87
|
className={className}
|
|
89
|
-
//
|
|
90
|
-
//
|
|
88
|
+
// The elements roles should be set to button default, or link in the case of anchors.
|
|
89
|
+
// This should be overridable by props, say for example if you want to use a button as an option within a listbox.
|
|
90
|
+
// Hence it taking precedence over restProps.
|
|
91
91
|
role={as === "a" ? "link" : "button"}
|
|
92
92
|
tabIndex={0}
|
|
93
|
-
{...eventHandlers}
|
|
94
93
|
aria-disabled={disabled}
|
|
94
|
+
{...restProps}
|
|
95
|
+
{...eventHandlers}
|
|
95
96
|
>
|
|
96
97
|
{children}
|
|
97
98
|
</Component>
|