-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(Slug): Add slug
prop to TextInput
, TextArea
, NumberInput
, and DatePicker
, add revert functionality to Slug
#15115
feat(Slug): Add slug
prop to TextInput
, TextArea
, NumberInput
, and DatePicker
, add revert functionality to Slug
#15115
Conversation
✅ Deploy Preview for v11-carbon-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
d6ad6f6
to
f5515ca
Compare
f5515ca
to
b3959d3
Compare
packages/styles/scss/components/fluid-number-input/_fluid-number-input.scss
Outdated
Show resolved
Hide resolved
packages/styles/scss/components/number-input/_number-input.scss
Outdated
Show resolved
Hide resolved
@@ -164,12 +170,26 @@ const TextArea = React.forwardRef((props: TextAreaProps, forwardRef) => { | |||
); | |||
const { current: textAreaInstanceId } = useRef(getInstanceId()); | |||
|
|||
const textareaRef = useRef<HTMLTextAreaElement>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tay1orjones this PR is in a good spot to take a look and see if we should keep going down this route |
@tw15egan I've noticed the formatting inside the callout is off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aagonzales fixed 👍🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me now 👍 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, Firefox doesn't support the
No positioning was touched for |
@alisonjoseph doing a bit of digging, there isn't an alternative selector to Do you think this is fine, given:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's fine @tw15egan
26831fe
…, and `DatePicker`, add revert functionality to `Slug` (carbon-design-system#15115) * feat(TextInput): support slug prop * fix(TextInput): add types for slug prop * refactor(Slug): remove old file, move demo to form story * docs(Storybook): update form story * feat(NumberInput): add slug to NumberInput * refactor(NumberInput): remove pseudo elements and use box-shadow * style(NumberInput): fix issue with z-index, add invalid styles * feat(DatePicker): add slug prop to DatePickerInput * feat(TextArea): add slug prop to TextArea * test(snapshot): update snapshots * fix(TextArea): remove console warning * style(Fluid): adjust styles for fluid inputs * docs(Storybook): fix ids * fix(Slug): adjust positioning, add storybook controls * fix(Storybook): add story styles to form example * fix(Slug): adjust positioning when invalid, warning state * style(Slug): adjust padding when slug is present * docs(Storybook): add examples with revert functionality * fix(NumberInput): fix type error * refactor(storybook): adjust stories * feat(Slug): add revertLabel prop * fix(Undo): replace undo, redo with coreect asset * fix(Slug): adjust revert positioning, remove margin * fix(NumberInput): don't set defaultValue if not provided, remove console * chore(files): add ai-gradient to react package * test(snapshot): update snapshots
…, and `DatePicker`, add revert functionality to `Slug` (carbon-design-system#15115) * feat(TextInput): support slug prop * fix(TextInput): add types for slug prop * refactor(Slug): remove old file, move demo to form story * docs(Storybook): update form story * feat(NumberInput): add slug to NumberInput * refactor(NumberInput): remove pseudo elements and use box-shadow * style(NumberInput): fix issue with z-index, add invalid styles * feat(DatePicker): add slug prop to DatePickerInput * feat(TextArea): add slug prop to TextArea * test(snapshot): update snapshots * fix(TextArea): remove console warning * style(Fluid): adjust styles for fluid inputs * docs(Storybook): fix ids * fix(Slug): adjust positioning, add storybook controls * fix(Storybook): add story styles to form example * fix(Slug): adjust positioning when invalid, warning state * style(Slug): adjust padding when slug is present * docs(Storybook): add examples with revert functionality * fix(NumberInput): fix type error * refactor(storybook): adjust stories * feat(Slug): add revertLabel prop * fix(Undo): replace undo, redo with coreect asset * fix(Slug): adjust revert positioning, remove margin * fix(NumberInput): don't set defaultValue if not provided, remove console * chore(files): add ai-gradient to react package * test(snapshot): update snapshots
Closes #15089
Adds in a
slug
prop forTextInput
,TextArea
,DatePickerInput
, andNumberInput
General usage would look like the following:
Changelog
New
slug
prop added so a user can pass down aSlug
component to be rendered inside a form element<Slug>
has been updated to include two new props,revertActive
andonRevertClick
revertActive
props is to toggle the state of theSlug
onRevertClick
is a callback function so that a user can restore the state of the edited input to whatever the stored AI content isExample usage:
Changed
TextArea
.tsx
file to match the general file structure found in other component files.33%
useEffect
toNumberInput.tsx
to trigger an update when the revert button is clicked to set the value back to thedefaultValue
that was passed in.Removed
Slug.js
file (replaced withindex.js
)redo.svg
andundo.svg
at16
,20
,24
that were being displayed rather than the correct asset, the32
one.Testing / Reviewing
Go to
Form
-->AI Form
to see an example of theSlug
rendered inside the form inputs. This seems like a clean approach that will not expand the surface area too much across the repo and can be achieved with minimal new styles per component.Form
-->Revert Test
is a sandbox to test theonRevertClick
functionality.