Skip to content

Commit

Permalink
Merge pull request #133 from Paymium/formIncrease
Browse files Browse the repository at this point in the history
Form increase
  • Loading branch information
lobor authored Jan 3, 2025
2 parents 4d828b4 + 62f2b53 commit b81f356
Show file tree
Hide file tree
Showing 18 changed files with 499 additions and 170 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-jeans-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'crossed-doc': minor
---

add doc checkbox and radio
5 changes: 5 additions & 0 deletions .changeset/famous-goats-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crossed/ui': minor
---

Increase checkbox
5 changes: 5 additions & 0 deletions .changeset/hungry-teachers-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crossed/ui': minor
---

Increase Radio
10 changes: 10 additions & 0 deletions .changeset/polite-beds-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@crossed/next-adapter': patch
'@crossed/primitive': patch
'@crossed/loader': patch
'@crossed/styled': patch
'@crossed/core': patch
'@crossed/ui': patch
---

clean peerdependencies
30 changes: 24 additions & 6 deletions apps/doc/src/@crossed-ui/Forms/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,38 @@ const meta: Meta<typeof Checkbox> = {
defaultChecked: { control: 'boolean' },
},
args: { onChecked: fn() },
render(e) {
return <Checkbox {...e}>My label</Checkbox>;
},
};

export default meta;
type Story = StoryObj<typeof Checkbox>;

export const Primary: Story = {
args: {
children: 'My label',
},
args: {},
};

export const DefaultChecked: Story = {
args: {
...Primary.args,
defaultChecked: true,
args: { ...Primary.args, defaultChecked: true },
};

export const Disabled: Story = {
args: { ...Primary.args, disabled: true },
};

export const NoThumb: Story = {
args: { ...Primary.args, noThumb: true },
};

export const CustomPlacementThumb: Story = {
args: { ...Primary.args, noThumb: true },
render(e) {
return (
<Checkbox {...e}>
My label
<Checkbox.Thumb />
</Checkbox>
);
},
};
8 changes: 8 additions & 0 deletions apps/doc/src/@crossed-ui/Forms/Radio.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ export const Primary: Story = {
children: 'My label',
},
};

export const Disabled: Story = {
args: { ...Primary.args, disabled: true },
};

export const DisabledChecked: Story = {
args: { ...Primary.args, disabled: true, defaultChecked: true },
};
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"typescript": "5.4.2"
},
"peerDependencies": {
"react": "^18.3.1",
"react-native": "^0.73.6"
"react": "*",
"react-native": "*"
},
"files": [
"lib/",
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"typescript": "^5.4.2"
},
"peerDependencies": {
"@crossed/styled": "0.14.3",
"@crossed/styled": "*",
"@crossed/theme": "workspace:^"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"type-check": "tsc --noEmit"
},
"peerDependencies": {
"react": "18.3.1"
"react": "*"
},
"husky": {
"hooks": {
Expand Down
8 changes: 6 additions & 2 deletions packages/primitive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
},
"devDependencies": {
"@crossed/build": "*",
"@crossed/core": "0.8.2",
"@crossed/test": "0.13.0",
"@gorhom/portal": "^1.0.14",
"@testing-library/jest-dom": "^6.5.0",
"@types/jest": "^29.5.13",
"@types/react": "^18.3.3",
Expand All @@ -46,15 +48,17 @@
"tsconfig": "*"
},
"dependencies": {
"@crossed/core": "0.8.2",
"@gorhom/portal": "^1.0.14",
"@react-native-aria/focus": "^0.2.8",
"@react-native-aria/interactions": "^0.2.10",
"react-aria": "^3.27.0",
"react-focus-lock": "^2.11.2",
"react-focus-on": "^3.9.2",
"react-remove-scroll": "^2.5.6"
},
"peerDependencies": {
"@crossed/core": "*",
"@gorhom/portal": "*"
},
"files": [
"lib/",
"src/"
Expand Down
8 changes: 2 additions & 6 deletions packages/styled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,17 @@
"@types/jest": "^29.5.13",
"@types/node": "^20.14.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"csstype": "3.1.3",
"jest-bench": "^29.7.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-native": "^0.73.6",
"react-native-web": "^0.19.10",
"ts-loader": "^9.5.1",
"typescript": "^5.4.2"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-native": "^0.73.6",
"react-native-web": "^0.19.10"
"react": "*",
"react-native": "*"
},
"dependencies": {
"@crossed/core": "^0.8.2",
Expand Down
14 changes: 6 additions & 8 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@
"type-check": "tsc --noEmit"
},
"peerDependencies": {
"@crossed/build": "*",
"@crossed/core": "0.8.2",
"@crossed/primitive": "1.9.1",
"@crossed/styled": "workspace:^",
"@crossed/core": "*",
"@crossed/primitive": "*",
"@crossed/styled": "*",
"@crossed/theme": "workspace:^",
"@crossed/unicons": "3.0.1",
"@devvie/bottom-sheet": "0.3.0",
"react-native": "^0.73.6",
"react-native-gesture-handler": "~2.21.2",
"react-native-reanimated": "^3.10.1"
"react-native": "*",
"react-native-gesture-handler": "*",
"react-native-reanimated": "*"
},
"devDependencies": {
"@crossed/build": "*",
Expand Down
35 changes: 35 additions & 0 deletions packages/ui/src/forms/Checkbox/__tests__/Checkbox.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) Paymium.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root of this projects source tree.
*/

import { Checkbox } from '../index';
import { screen, render, fireEvent } from '@crossed/test';

describe('Checkbox', () => {
test('Simple render', () => {
const onPress = jest.fn();
render(<Checkbox onPress={onPress}>Simple</Checkbox>);
const checkbox = screen.getByRole('checkbox');
expect(checkbox).toHaveAttribute('aria-checked', 'false');
fireEvent.click(checkbox);
expect(checkbox).toHaveAttribute('aria-checked', 'true');
expect(onPress).toHaveBeenCalled();
});

test('Disabled', () => {
const onPress = jest.fn();
render(
<Checkbox onPress={onPress} disabled>
Simple
</Checkbox>
);
const checkbox = screen.getByRole('checkbox');
expect(checkbox).toHaveAttribute('aria-checked', 'false');
fireEvent.click(checkbox);
expect(checkbox).toHaveAttribute('aria-checked', 'false');
expect(onPress).not.toHaveBeenCalled();
});
});
Loading

0 comments on commit b81f356

Please sign in to comment.