@warp-ds/elements 2.9.1-next.4 → 2.9.1-next.5
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/packages/button/button.react.stories.d.ts +8 -2
- package/dist/packages/button/button.react.test.d.ts +1 -0
- package/dist/packages/button/button.react.test.js +16 -0
- package/dist/packages/button/react.d.ts +5 -1
- package/dist/packages/button/react.js +8 -1
- package/dist/packages/select/select.react.stories.d.ts +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,14 @@ import React from 'react';
|
|
|
3
3
|
import { Button } from './react';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
render(args: Omit<React.HTMLAttributes<import("./button").WarpButton>, "value" | "form" | "small" | "name" | "disabled" | "type" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "target" | "rel" | "variant" | "quiet" | "href" | "fullWidth" | "iconOnly" | "loading" | "buttonClass" | "ariaValueTextLoading" | "_handleButtonClick"> & {} & Partial<Omit<import("./button").WarpButton, keyof HTMLElement>> & React.RefAttributes<import("./button").WarpButton>
|
|
7
|
-
|
|
6
|
+
render(args: Omit<Omit<Omit<React.HTMLAttributes<import("./button").WarpButton>, "value" | "form" | "small" | "name" | "disabled" | "type" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "target" | "rel" | "variant" | "quiet" | "href" | "fullWidth" | "iconOnly" | "loading" | "buttonClass" | "ariaValueTextLoading" | "_handleButtonClick"> & {} & Partial<Omit<import("./button").WarpButton, keyof HTMLElement>> & React.RefAttributes<import("./button").WarpButton>, "ref">, "full-width" | "icon-only"> & {
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
iconOnly?: boolean;
|
|
9
|
+
} & React.RefAttributes<import("./button").WarpButton>): React.JSX.Element;
|
|
10
|
+
component: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<import("./button").WarpButton>, "value" | "form" | "small" | "name" | "disabled" | "type" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "target" | "rel" | "variant" | "quiet" | "href" | "fullWidth" | "iconOnly" | "loading" | "buttonClass" | "ariaValueTextLoading" | "_handleButtonClick"> & {} & Partial<Omit<import("./button").WarpButton, keyof HTMLElement>> & React.RefAttributes<import("./button").WarpButton>, "ref">, "full-width" | "icon-only"> & {
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
iconOnly?: boolean;
|
|
13
|
+
} & React.RefAttributes<import("./button").WarpButton>>;
|
|
8
14
|
};
|
|
9
15
|
export default _default;
|
|
10
16
|
export type Story = StoryObj<typeof Button>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderToString } from 'react-dom/server';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
import { Button } from './react.js';
|
|
5
|
+
describe('Button React SSR', () => {
|
|
6
|
+
test('renders fullWidth as the full-width attribute', () => {
|
|
7
|
+
const html = renderToString(React.createElement(Button, { fullWidth: true }, 'Full width'));
|
|
8
|
+
expect(html).toContain('full-width');
|
|
9
|
+
expect(html).not.toContain('fullWidth');
|
|
10
|
+
});
|
|
11
|
+
test('renders iconOnly as the icon-only attribute', () => {
|
|
12
|
+
const html = renderToString(React.createElement(Button, { iconOnly: true }, 'Icon only'));
|
|
13
|
+
expect(html).toContain('icon-only');
|
|
14
|
+
expect(html).not.toContain('iconOnly');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { WarpButton } from './button.js';
|
|
2
|
-
export declare const Button:
|
|
3
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpButton>, "value" | "form" | "small" | "name" | "disabled" | "type" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "target" | "rel" | "variant" | "quiet" | "href" | "fullWidth" | "iconOnly" | "loading" | "buttonClass" | "ariaValueTextLoading" | "_handleButtonClick"> & {} & Partial<Omit<WarpButton, keyof HTMLElement>> & React.RefAttributes<WarpButton>, "ref">, "full-width" | "icon-only"> & {
|
|
4
|
+
fullWidth?: boolean;
|
|
5
|
+
iconOnly?: boolean;
|
|
6
|
+
} & React.RefAttributes<WarpButton>>;
|
|
@@ -4,8 +4,15 @@ import React from 'react';
|
|
|
4
4
|
// decouple from CDN by providing a dummy class
|
|
5
5
|
class Component extends LitElement {
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
const BaseButton = createComponent({
|
|
8
8
|
tagName: 'w-button',
|
|
9
9
|
elementClass: Component,
|
|
10
10
|
react: React,
|
|
11
11
|
});
|
|
12
|
+
export const Button = React.forwardRef(({ fullWidth, iconOnly, ...props }, ref) => React.createElement(BaseButton, {
|
|
13
|
+
...props,
|
|
14
|
+
...(fullWidth ? { 'full-width': true } : {}),
|
|
15
|
+
...(iconOnly ? { 'icon-only': true } : {}),
|
|
16
|
+
ref,
|
|
17
|
+
}));
|
|
18
|
+
Button.displayName = 'Button';
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Select } from './react';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
render(args: Omit<React.HTMLAttributes<import("./select").WarpSelect>, "value" | "form" | "label" | "name" | "disabled" | "invalid" | "helpText" | "readOnly" | "readonly" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onchange" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "autoFocus" | "onChange" | "
|
|
6
|
+
render(args: Omit<React.HTMLAttributes<import("./select").WarpSelect>, "value" | "form" | "label" | "name" | "disabled" | "invalid" | "helpText" | "readOnly" | "readonly" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "onchange" | "updated" | "firstUpdated" | "resetFormControl" | "render" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "renderOptions" | "autoFocus" | "onChange" | "hint" | "optional" | "willUpdate" | "formStateRestoreCallback" | "always" | "_options" | "_setValue" | "handleKeyDown"> & {
|
|
7
7
|
onChange?: (e: Event) => void;
|
|
8
8
|
onchange?: (e: Event) => void;
|
|
9
9
|
} & Partial<Omit<import("./select").WarpSelect, keyof HTMLElement>> & React.RefAttributes<import("./select").WarpSelect>): React.JSX.Element;
|
package/dist/web-types.json
CHANGED