Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ref and element attribute #124

Closed
Closed
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3cf9b28
Accordion allows attributes of the detail element
8845musign Jul 25, 2024
81a51ba
Allow attributes of div in ActionHalfModal
8845musign Jul 25, 2024
9f1fee4
Allow attributes of div in ActionModal
8845musign Jul 25, 2024
4c32ac9
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
d07e710
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
f748334
Allow span attributes in Color
8845musign Jul 25, 2024
b30f197
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
f9d971f
Allows fieldset attributes in CheckboxGroup
8845musign Jul 25, 2024
5384bcd
Allow attributes of p in ErrorMessage
8845musign Jul 25, 2024
878b8ea
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
b864321
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
45b89e0
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
5f96b9f
Delete unnecessary type
8845musign Jul 25, 2024
d36459d
Allow refs to HelperMesssage and p attributes
8845musign Jul 25, 2024
26830ee
Allow refs in icons and allow svg attributes
8845musign Jul 25, 2024
4cf695c
Correction of errors in the text
8845musign Jul 25, 2024
3904cb8
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
51e2f61
Allow attributes of the a element in LinkCards
8845musign Jul 25, 2024
9e289be
fix type error
8845musign Jul 25, 2024
7b5740e
Allow the attribute of the div in MessageHalfModal to receive the ref
8845musign Jul 25, 2024
4d04b74
Conditional Branch Merged
8845musign Jul 25, 2024
c5c9232
receive a ref
8845musign Jul 25, 2024
83f717c
Allows attributes of divs in MessageModal
8845musign Jul 25, 2024
b802964
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
3c0d3c4
Disallowed className
8845musign Jul 25, 2024
b4e5a6b
Standardized to ComponentPropsWithRef
8845musign Jul 25, 2024
1ddc805
Add ref test
8845musign Aug 1, 2024
f560546
Allows attributes of fieldset in RadiGroup
8845musign Aug 1, 2024
a4bb83e
Allows attributes of select element in Select Component
8845musign Aug 1, 2024
622a2c9
Allows attributes of textarea element in Textarea Component
8845musign Aug 1, 2024
348f11f
Prohibits the specification of components to as
8845musign Aug 1, 2024
c2e168a
Add snapshot tests
8845musign Aug 2, 2024
ac33853
Release attributes and ref
8845musign Aug 2, 2024
0cb84bc
Add Snapshot Tests
8845musign Aug 2, 2024
e2d29b5
Fix Test
8845musign Aug 2, 2024
7acbf47
More detailed comment
8845musign Aug 2, 2024
a7809c4
default as value was not inferred.
8845musign Aug 2, 2024
a084acb
Add ref to the test code so that you can detect type errors
8845musign Aug 2, 2024
5d3f852
Release attributes and ref
8845musign Aug 2, 2024
baf454d
Release attributes
8845musign Aug 2, 2024
83e3608
Add snapshot tests
8845musign Aug 2, 2024
0f15a78
delete extra test
8845musign Aug 2, 2024
a84d990
Release attributes & ref
8845musign Aug 2, 2024
4455523
Enhanced explanation of as
8845musign Aug 2, 2024
5e4c927
update snapshots
8845musign Aug 2, 2024
7cdcaf5
fix markup error
8845musign Aug 8, 2024
7fc1206
update snapshot
8845musign Aug 8, 2024
92b034e
support ref
8845musign Aug 8, 2024
19b1e31
improve types
8845musign Aug 8, 2024
e6ad183
not allow className
8845musign Aug 8, 2024
d4f99dd
not allow className
8845musign Aug 8, 2024
7001b27
value isn't required
8845musign Aug 8, 2024
806623c
Allow refs and attributes
8845musign Aug 8, 2024
90754bb
Allow refs and attributes
8845musign Aug 8, 2024
919c665
delete extra comments
8845musign Aug 8, 2024
432c927
allow attributes
8845musign Aug 8, 2024
b555b91
fix lint errors
8845musign Aug 8, 2024
1460050
Added warning if an unexpected as value is specified.
8845musign Aug 8, 2024
e0c0d53
add prop comment
8845musign Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Standardized to ComponentPropsWithRef
8845musign committed Jul 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b80296405abff6e5a6cc40cb54a6a8bdb592df4c
2 changes: 1 addition & 1 deletion src/components/Pre/Pre.spec.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { Pre } from './Pre';

describe('<Pre>', () => {
it('receives data attributes', () => {
render(<Pre data-testid="pre" />);
render(<Pre data-testid="pre">lorem ipsum</Pre>);
const pre = screen.getByTestId('pre');

expect(pre).toBeInTheDocument();
11 changes: 6 additions & 5 deletions src/components/Pre/Pre.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use client';

import { clsx } from 'clsx';
import { CSSProperties, forwardRef, type HTMLAttributes, type PropsWithChildren } from 'react';
import { ComponentPropsWithRef, CSSProperties, forwardRef, type PropsWithChildren, ReactNode } from 'react';
import styles from './Pre.module.css';

type AllowedSpanAttributes = Omit<HTMLAttributes<HTMLSpanElement>, 'className'>;

type Props = {
type PreProps = {
children: ReactNode;
/**
* 折り返しや空白、改行の扱い
* @default 'pre-line'
@@ -17,7 +16,9 @@ type Props = {
* @default false
*/
inline?: boolean;
} & AllowedSpanAttributes;
};

type Props = PreProps & Omit<ComponentPropsWithRef<'span'>, keyof PreProps | 'className'>;

export const Pre = forwardRef<HTMLSpanElement, PropsWithChildren<Props>>(
({ children, whiteSpace = 'pre-line', inline = false, ...rest }, ref) => {

Unchanged files with check annotations Beta

return <Color {...args}>色</Color>;
},
args: {
'data-test-id': 'some-id',

Check failure on line 59 in src/components/Color/Color.stories.tsx

GitHub Actions / Lint and Test

Type '{ 'data-test-id': string; }' is not assignable to type 'Partial<Omit<Props, "ref"> & RefAttributes<HTMLSpanElement>>'.
},
};
export const CustomDataAttribute: Story = {
args: {
'data-test-id': 'helper-message-custom-attribute',

Check failure on line 17 in src/stories/HelperMessage.stories.tsx

GitHub Actions / Lint and Test

Type '{ 'data-test-id': string; }' is not assignable to type 'Partial<Omit<Props, "ref"> & RefAttributes<HTMLParagraphElement>>'.
},
render: (args) => <HelperMessage {...args}>This is a custom data attribute example</HelperMessage>,
};
export const CustomDataAttribute: Story = {
args: {
'data-test-id': 'input-custom-attribute',

Check failure on line 137 in src/stories/Input.stories.tsx

GitHub Actions / Lint and Test

Type '{ 'data-test-id': string; }' is not assignable to type 'Partial<Omit<Props, "ref"> & RefAttributes<HTMLInputElement>>'.
},
render: (args) => <Input {...args} />,
};