-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: update styled-components to 6 & update DS to 2.0.0-beta.3 (#2…
…0260) * chore: update styled-components to 6 * chore: update admin * chore: update CM * chore: update ctb * chore: update other plugin packages * chore: update content-releases * chore: update user-permissions * chore: update upload * chore: update fields to be dot notation * chore: update tests * chore: update yarn.lock * chore: update snapshots * chore: update deps * chore: update snapshots * fix: left menu * test: add label prop to NavLink test * chore: PR tweaks
- Loading branch information
1 parent
7a6d9a2
commit b7c6256
Showing
375 changed files
with
6,775 additions
and
9,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
examples/getstarted/src/plugins/local-plugin/admin/src/components/PluginIcon/index.jsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
examples/plugins/workspace-plugin/admin/src/components/PluginIcon/index.jsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 30 additions & 32 deletions
62
packages/core/admin/admin/src/components/FormInputs/Boolean.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,43 @@ | ||
import { forwardRef } from 'react'; | ||
|
||
import { ToggleInput, useComposedRefs } from '@strapi/design-system'; | ||
import { Toggle, useComposedRefs, Field } from '@strapi/design-system'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import { useFocusInputField } from '../../hooks/useFocusInputField'; | ||
import { useField } from '../Form'; | ||
|
||
import { InputProps } from './types'; | ||
|
||
const BooleanInput = forwardRef<HTMLInputElement, InputProps>((props, ref) => { | ||
const { formatMessage } = useIntl(); | ||
const field = useField<boolean | null>(props.name); | ||
const fieldRef = useFocusInputField(props.name); | ||
const BooleanInput = forwardRef<HTMLInputElement, InputProps>( | ||
({ name, required, label, hint, labelAction, ...props }, ref) => { | ||
const { formatMessage } = useIntl(); | ||
const field = useField<boolean | null>(name); | ||
const fieldRef = useFocusInputField<HTMLInputElement>(name); | ||
|
||
const composedRefs = useComposedRefs<HTMLInputElement | null>(ref, fieldRef); | ||
const composedRefs = useComposedRefs(ref, fieldRef); | ||
|
||
return ( | ||
// @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS. | ||
<ToggleInput | ||
ref={composedRefs} | ||
checked={field.value === null ? null : field.value || false} | ||
error={field.error} | ||
/** | ||
* TODO: reintroduce labelActions | ||
*/ | ||
// labelAction={labelAction} | ||
offLabel={formatMessage({ | ||
id: 'app.components.ToggleCheckbox.off-label', | ||
defaultMessage: 'False', | ||
})} | ||
onLabel={formatMessage({ | ||
id: 'app.components.ToggleCheckbox.on-label', | ||
defaultMessage: 'True', | ||
})} | ||
onChange={field.onChange} | ||
onClear={() => { | ||
field.onChange(props.name, null); | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}); | ||
return ( | ||
<Field.Root error={field.error} name={name} hint={hint} required={required} maxWidth="320px"> | ||
<Field.Label action={labelAction}>{label}</Field.Label> | ||
<Toggle | ||
ref={composedRefs} | ||
checked={field.value === null ? null : field.value || false} | ||
offLabel={formatMessage({ | ||
id: 'app.components.ToggleCheckbox.off-label', | ||
defaultMessage: 'False', | ||
})} | ||
onLabel={formatMessage({ | ||
id: 'app.components.ToggleCheckbox.on-label', | ||
defaultMessage: 'True', | ||
})} | ||
onChange={field.onChange} | ||
{...props} | ||
/> | ||
<Field.Hint /> | ||
<Field.Error /> | ||
</Field.Root> | ||
); | ||
} | ||
); | ||
|
||
export { BooleanInput }; |
38 changes: 22 additions & 16 deletions
38
packages/core/admin/admin/src/components/FormInputs/Checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
import { forwardRef } from 'react'; | ||
|
||
import { Checkbox, useComposedRefs } from '@strapi/design-system'; | ||
import { Checkbox, useComposedRefs, Field } from '@strapi/design-system'; | ||
|
||
import { useFocusInputField } from '../../hooks/useFocusInputField'; | ||
import { useField } from '../Form'; | ||
|
||
import { InputProps } from './types'; | ||
|
||
const CheckboxInput = forwardRef<HTMLInputElement, InputProps>((props, ref) => { | ||
const field = useField<boolean>(props.name); | ||
const fieldRef = useFocusInputField(props.name); | ||
const CheckboxInput = forwardRef<HTMLInputElement, InputProps>( | ||
({ name, required, label, hint, ...props }, ref) => { | ||
const field = useField<boolean>(name); | ||
const fieldRef = useFocusInputField<HTMLInputElement>(name); | ||
|
||
const composedRefs = useComposedRefs<HTMLInputElement | null>(ref, fieldRef); | ||
const composedRefs = useComposedRefs(ref, fieldRef); | ||
|
||
return ( | ||
<Checkbox | ||
onValueChange={(checked) => field.onChange(props.name, checked)} | ||
ref={composedRefs} | ||
value={field.value} | ||
{...props} | ||
> | ||
{props.label || props['aria-label']} | ||
</Checkbox> | ||
); | ||
}); | ||
return ( | ||
<Field.Root error={field.error} name={name} hint={hint} required={required}> | ||
<Checkbox | ||
onValueChange={(checked) => field.onChange(name, checked)} | ||
ref={composedRefs} | ||
value={field.value} | ||
{...props} | ||
> | ||
{label || props['aria-label']} | ||
</Checkbox> | ||
<Field.Hint /> | ||
<Field.Error /> | ||
</Field.Root> | ||
); | ||
} | ||
); | ||
|
||
export { CheckboxInput }; |
Oops, something went wrong.