@seed-design/react-field-button 1.0.1 → 1.0.2
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/lib/{FieldButton-12s-CcR1XhHB.js → FieldButton-12s-BzczO8x6.js} +0 -1
- package/lib/{FieldButton-12s-Ctrm9BuF.cjs → FieldButton-12s-CG6rqNcy.cjs} +0 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +2 -2
- package/package.json +1 -1
- package/src/useFieldButton.test.tsx +5 -13
- package/src/useFieldButton.ts +0 -2
|
@@ -112,7 +112,6 @@ function useFieldButton({ values: propValues, onValuesChange, disabled = false,
|
|
|
112
112
|
}
|
|
113
113
|
}),
|
|
114
114
|
clearButtonProps: domUtils.buttonProps({
|
|
115
|
-
...stateProps,
|
|
116
115
|
type: "button",
|
|
117
116
|
disabled: disabled || readOnly,
|
|
118
117
|
onClick: react.useCallback(()=>setValues([]), [
|
package/lib/index.cjs
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldButtonButton, a as FieldButtonClearButton, b as FieldButtonDescription, c as FieldButtonErrorMessage, d as FieldButtonHiddenInput, e as FieldButtonRoot } from './FieldButton-12s-
|
|
2
|
-
export { u as useFieldButtonContext } from './FieldButton-12s-
|
|
1
|
+
import { F as FieldButtonButton, a as FieldButtonClearButton, b as FieldButtonDescription, c as FieldButtonErrorMessage, d as FieldButtonHiddenInput, e as FieldButtonRoot } from './FieldButton-12s-BzczO8x6.js';
|
|
2
|
+
export { u as useFieldButtonContext } from './FieldButton-12s-BzczO8x6.js';
|
|
3
3
|
|
|
4
4
|
var FieldButton_namespace = {
|
|
5
5
|
__proto__: null,
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import "@testing-library/
|
|
2
|
-
import { cleanup, fireEvent, render } from "@testing-library/react";
|
|
1
|
+
import { fireEvent, render } from "@testing-library/react";
|
|
3
2
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import {
|
|
3
|
+
import { describe, expect, it, mock } from "bun:test";
|
|
5
4
|
|
|
6
5
|
import type { ReactElement } from "react";
|
|
7
6
|
|
|
@@ -15,8 +14,6 @@ import {
|
|
|
15
14
|
type FieldButtonRootProps,
|
|
16
15
|
} from "./FieldButton";
|
|
17
16
|
|
|
18
|
-
afterEach(cleanup);
|
|
19
|
-
|
|
20
17
|
function setUp(jsx: ReactElement) {
|
|
21
18
|
return {
|
|
22
19
|
user: userEvent.setup(),
|
|
@@ -39,11 +36,6 @@ function FieldButton(props: FieldButtonRootProps) {
|
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
describe("useFieldButton", () => {
|
|
42
|
-
global.CSS = {
|
|
43
|
-
// @ts-expect-error
|
|
44
|
-
supports: (_k, _v) => true,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
39
|
it("should render the field button correctly", () => {
|
|
48
40
|
const { getByRole } = setUp(<FieldButton />);
|
|
49
41
|
const button = getByRole("button", { name: "Click me" });
|
|
@@ -233,7 +225,7 @@ describe("useFieldButton", () => {
|
|
|
233
225
|
|
|
234
226
|
describe("clear button", () => {
|
|
235
227
|
it("should call onValuesChange when clear button is clicked", async () => {
|
|
236
|
-
const handleValuesChange =
|
|
228
|
+
const handleValuesChange = mock(() => {});
|
|
237
229
|
const { getByRole, user } = setUp(
|
|
238
230
|
<FieldButton values={["value1"]} onValuesChange={handleValuesChange} />,
|
|
239
231
|
);
|
|
@@ -244,7 +236,7 @@ describe("useFieldButton", () => {
|
|
|
244
236
|
});
|
|
245
237
|
|
|
246
238
|
it("should hide clear button when disabled", async () => {
|
|
247
|
-
const handleValuesChange =
|
|
239
|
+
const handleValuesChange = mock(() => {});
|
|
248
240
|
const { getByText, user } = setUp(
|
|
249
241
|
<FieldButton disabled values={["value1"]} onValuesChange={handleValuesChange} />,
|
|
250
242
|
);
|
|
@@ -257,7 +249,7 @@ describe("useFieldButton", () => {
|
|
|
257
249
|
});
|
|
258
250
|
|
|
259
251
|
it("should hide clear button when readOnly", async () => {
|
|
260
|
-
const handleValuesChange =
|
|
252
|
+
const handleValuesChange = mock(() => {});
|
|
261
253
|
const { getByText, user } = setUp(
|
|
262
254
|
<FieldButton readOnly values={["value1"]} onValuesChange={handleValuesChange} />,
|
|
263
255
|
);
|