Skip to content

enhancement! : remove all field label, field hint, field errors from all possible inputs #1693

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

Merged
merged 30 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7719a44
fix: remove all field label, field hint, field errors from input comp…
madhurisandbhor Apr 16, 2024
b735eff
Merge branch 'releases/2.0.0' into feat/remove-field-comp-wrappers
madhurisandbhor Apr 16, 2024
2192b83
docs: breaking changes updated
madhurisandbhor Apr 17, 2024
96aaf49
fix: remove checkbox error story
madhurisandbhor Apr 17, 2024
b95d012
fix: singleSelectInput renamed to SingleSelect and datepicker props u…
madhurisandbhor Apr 17, 2024
fa8f700
docs: changeset added
madhurisandbhor Apr 17, 2024
7e65b18
docs: checkbox input storybook updated
madhurisandbhor Apr 18, 2024
6511c08
docs: combobox stories updated
madhurisandbhor Apr 18, 2024
127774a
Merge branch 'releases/2.0.0' into feat/remove-field-comp-wrappers
madhurisandbhor Apr 18, 2024
f9b9e9f
docs: minor change
madhurisandbhor Apr 18, 2024
59748f8
docs: stories updated for other inputs
madhurisandbhor Apr 19, 2024
55cf61b
docs: select story updated with field
madhurisandbhor Apr 19, 2024
2ce1bfe
test: fixed by removing labels, labelActions and updating aria props
madhurisandbhor Apr 19, 2024
8d46ef5
Merge branch 'releases/2.0.0' into feat/remove-field-comp-wrappers
madhurisandbhor Apr 22, 2024
b7ee758
fix: types and tests fixed
madhurisandbhor Apr 22, 2024
fd3511f
docs: changeset file updated
madhurisandbhor Apr 22, 2024
ad72989
fix: minor changes, removing unnecessary props, test updated
madhurisandbhor Apr 22, 2024
3de91e0
fix: toggle renamed to toggleInput
madhurisandbhor Apr 22, 2024
f47fde1
docs: shifted inputs out of design system docs
madhurisandbhor Apr 22, 2024
e231cdc
fix: ids are passed as a prop to support fields
madhurisandbhor Apr 22, 2024
287029a
fix: field hint, error separate args added, id prop passed wherever r…
madhurisandbhor Apr 23, 2024
a9e7f5b
Merge branch 'releases/2.0.0' into feat/remove-field-comp-wrappers
madhurisandbhor Apr 23, 2024
aa668af
docs: multi select field story added with focus
madhurisandbhor Apr 23, 2024
81cdc77
test: tests added to check error,hint with label prop are rendered
madhurisandbhor Apr 23, 2024
6dfd761
docs: tiny tweaks
joshuaellis Apr 23, 2024
8887e02
chore: input tweaks
joshuaellis Apr 23, 2024
c3278a3
fix: fields removed from timepicker and datetimepicker
madhurisandbhor Apr 24, 2024
c45e6e6
fix: types fixed, datepicker test case fixed
madhurisandbhor Apr 24, 2024
914f2a2
fix: reverted tests changes
madhurisandbhor Apr 24, 2024
9351af9
Merge branch 'releases/2.0.0' into feat/remove-field-comp-wrappers
madhurisandbhor Apr 24, 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
6 changes: 0 additions & 6 deletions docs/stories/Checkbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ to pursue another action first.

<Canvas of={CheckboxStories.Disabled} />

### Hint

Use hint state to give more information about the purpose of a checkbox.

<Canvas of={CheckboxStories.Hint} />

### Error

Display an error message.
Expand Down
54 changes: 0 additions & 54 deletions docs/stories/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,57 +104,3 @@ export const Disabled = {
},
},
} satisfies Story;

export const Hint = {
render: () => {
const [val, setValue] = React.useState(false);

return (
<Checkbox
hint="Description line lorem ipsum"
name="default"
onValueChange={(value) => setValue(value)}
value={val}
>
Label
</Checkbox>
);
},

name: 'hint',

parameters: {
docs: {
source: {
code: '<Checkbox hint="Description line lorem ipsum">Label</Checkbox>',
},
},
},
} satisfies Story;

export const Error = {
render: () => {
const [val, setValue] = React.useState(false);

return (
<Checkbox
error="Description line lorem ipsum"
name="default"
onValueChange={(value) => setValue(value)}
value={val}
>
Label
</Checkbox>
);
},

name: 'error',

parameters: {
docs: {
source: {
code: '<Checkbox error="Description line lorem ipsum">Label</Checkbox>',
},
},
},
} satisfies Story;
19 changes: 3 additions & 16 deletions docs/stories/Combobox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ export const Controlled = {
const [value, setValue] = React.useState('');

return (
<Combobox
placeholder="My favourite fruit is..."
label="Fruits"
value={value}
onChange={setValue}
onClear={() => setValue('')}
>
<Combobox placeholder="My favourite fruit is..." value={value} onChange={setValue} onClear={() => setValue('')}>
<ComboboxOption value="apple">Apple</ComboboxOption>
<ComboboxOption value="avocado">Avocado</ComboboxOption>
<ComboboxOption value="banana">Banana</ComboboxOption>
Expand Down Expand Up @@ -96,13 +90,7 @@ export const Loading = {
}, [isLoading]);

return (
<Combobox
label="Async Fruits"
placeholder="My favourite fruit is..."
loading={isLoading}
onLoadMore={handleLoadMore}
hasMoreItems
>
<Combobox placeholder="My favourite fruit is..." loading={isLoading} onLoadMore={handleLoadMore} hasMoreItems>
<ComboboxOption value="apple">Apple</ComboboxOption>
<ComboboxOption value="avocado">Avocado</ComboboxOption>
<ComboboxOption value="banana">Banana</ComboboxOption>
Expand Down Expand Up @@ -166,7 +154,7 @@ export const Creatable = {

return (
<CreatableCombobox
label="Fruits"
aria-describedby="creatable component description"
placeholder="My favourite fruit is..."
value={value}
onChange={setValue}
Expand Down Expand Up @@ -201,7 +189,6 @@ export const Autocomplete = {
<Flex direction="column" alignItems="stretch" gap={11}>
<Combobox
placeholder="My favourite fruit is..."
label="Fruits"
value={value}
onChange={setValue}
autocomplete={autocompleteMode}
Expand Down
34 changes: 25 additions & 9 deletions docs/stories/JSONInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as React from 'react';

import { Meta, StoryObj } from '@storybook/react';
import { JSONInput } from '@strapi/design-system';
import { FieldLabel, JSONInput } from '@strapi/design-system';

const meta: Meta<typeof JSONInput> = {
title: 'Design System/Components/JSONInput',
Expand All @@ -19,14 +21,28 @@ export const Base = {
} satisfies Story;

export const Editable = {
render: () => (
<JSONInput
value={'[\n {\n "a":3,\n "b":4\n },\n {\n "a":5,\n "b":6\n }\n]'}
label="JSON"
hint="Description Text"
minHeight="235px"
/>
),
render: () => {
const editorRef = React.useRef<HTMLInputElement | null>(null);

return (
<>
<FieldLabel
onClick={() => {
(editorRef.current as HTMLInputElement)?.focus();
}}
>
JSON
</FieldLabel>
<JSONInput
value={'[\n {\n "a":3,\n "b":4\n },\n {\n "a":5,\n "b":6\n }\n]'}
label="JSON"
hint="Description Text"
minHeight="235px"
ref={editorRef}
/>
</>
);
},

name: 'editable',
} satisfies Story;
Expand Down
12 changes: 0 additions & 12 deletions docs/stories/NumberInput.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,12 @@ import { NumberInput } from '@strapi/design-system';

<Canvas of={NumberInputStories.Base} />

### Without label

`NumberInput` can be used without a label.

<Canvas of={NumberInputStories.WithoutLabel} />

### Size S

`NumberInput` can be displayed in a smaller size.

<Canvas of={NumberInputStories.SizeS} />

### Required

`NumberInput` required field.

<Canvas of={NumberInputStories.Required} />

### Disabled

`NumberInput` disabled field.
Expand Down
121 changes: 3 additions & 118 deletions docs/stories/NumberInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react';

import { Meta, StoryObj } from '@storybook/react';
import { NumberInput, Box, Tooltip, Typography } from '@strapi/design-system';
import { Information } from '@strapi/icons';
import { NumberInput, Box, Typography } from '@strapi/design-system';

const meta: Meta<typeof NumberInput> = {
title: 'Design System/Components/NumberInput',
Expand All @@ -14,48 +13,6 @@ export default meta;
type Story = StoryObj<typeof NumberInput>;

export const Base = {
render: () => {
const [content, setContent] = React.useState(3.14159265359);

return (
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
labelAction={
<Tooltip description="Content of the tooltip">
<button
aria-label="Information about the email"
style={{
border: 'none',
padding: 0,
background: 'transparent',
}}
>
<Information aria-hidden />
</button>
</Tooltip>
}
/>
<Box as="p" padding={4} background="neutral100">
<Typography>{`The value is ${content}`}</Typography>
</Box>
<button>
<Typography>Escape</Typography>
</button>
</Box>
);
},

name: 'base',
} satisfies Story;

export const WithoutLabel = {
render: () => {
const [content, setContent] = React.useState(0);

Expand All @@ -69,20 +26,6 @@ export const WithoutLabel = {
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
labelAction={
<Tooltip description="Content of the tooltip">
<button
aria-label="Information about the email"
style={{
border: 'none',
padding: 0,
background: 'transparent',
}}
>
<Information aria-hidden />
</button>
</Tooltip>
}
/>
<Box as="p" padding={4} background="neutral100">
<Typography>{`The value is ${content}`}</Typography>
Expand All @@ -94,7 +37,7 @@ export const WithoutLabel = {
);
},

name: 'withoutLabel',
name: 'base',
} satisfies Story;

export const SizeS = {
Expand All @@ -105,27 +48,12 @@ export const SizeS = {
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
size="S"
labelAction={
<Tooltip description="Content of the tooltip">
<button
aria-label="Information about the email"
style={{
border: 'none',
padding: 0,
background: 'transparent',
}}
>
<Information aria-hidden />
</button>
</Tooltip>
}
/>
<Box as="p" padding={4} background="neutral100">
<Typography>{`The value is ${content}`}</Typography>
Expand All @@ -140,29 +68,6 @@ export const SizeS = {
name: 'size S',
} satisfies Story;

export const Required = {
render: () => {
const [content, setContent] = React.useState();

return (
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
required
/>
</Box>
);
},

name: 'required',
} satisfies Story;

export const Disabled = {
render: () => {
const [content, setContent] = React.useState();
Expand All @@ -171,9 +76,7 @@ export const Disabled = {
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
Expand All @@ -186,6 +89,7 @@ export const Disabled = {
name: 'disabled',
} satisfies Story;

//TODO: fix error prop, as FieldInput needs to update to reflect error styles
export const Error = {
render: () => {
const [content, setContent] = React.useState();
Expand All @@ -194,9 +98,7 @@ export const Error = {
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
onValueChange={(value) => setContent(value)}
value={content}
error="Wrong value"
Expand All @@ -216,26 +118,10 @@ export const WithInitialEmpty = {
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
hint="Description line"
error={undefined}
onValueChange={(value) => setContent(value)}
value={content}
labelAction={
<Tooltip description="Content of the tooltip">
<button
aria-label="Information about the email"
style={{
border: 'none',
padding: 0,
background: 'transparent',
}}
>
<Information aria-hidden />
</button>
</Tooltip>
}
/>
<Box as="p" padding={4} background="neutral100">
<Typography>{`The value is ${content}`}</Typography>
Expand All @@ -258,7 +144,6 @@ export const Locale = {
<Box padding={10}>
<NumberInput
placeholder="This is a content placeholder"
label="Content"
name="content"
locale="de"
onValueChange={(value) => setContent(value)}
Expand Down
Loading