Commit Graph

551 Commits

Author SHA1 Message Date
Nathan Vasse
48e4e56a44 (react) add select mono option custom render
We want to be able to render the options in a customized manner.
2023-10-19 11:35:19 +02:00
renovate[bot]
611eebf0a4 ⬆️(dependencies) update js dependencies 2023-10-18 15:19:12 +02:00
Nathan Vasse
d39d33d02c 🐛(react) fix inputs overflowing placeholder
The oveflowing labels were spreading on two lines. I had to wrap a
span inside a label in order to be able to deal with the text-oveflow
plus the absolute positionning.
2023-10-16 12:01:35 +02:00
Nathan Vasse
ff2a56af6d 📝(react) update theming doc gif
The gif was broken when deployed on github pages.
2023-10-06 15:42:05 +02:00
Nathan Vasse
c8c8a04832 🔖(release) version packages
Bump @openfun/cunningham-tokens to 2.0.0
Bump @openfun/cunningham-react to 2.0.0
Bump cunningham-demo to 1.0.0
2023-10-06 15:23:47 +02:00
Anthony Le Courric
cf3a589d7f 🩹(react) export Button props
In some cases we need the props of a component to be exported,
to be able to use them in other components. This commit exports
the props of the Button component.
2023-10-05 09:19:26 +02:00
Nathan Vasse
b5c91d429d 🏷️(react) move SelectProps to index.tsx
It makes more sense for this type to be next to the Select component.
2023-10-04 16:02:06 +02:00
Nathan Vasse
1c7a114b6e (react) add ref to Select
We encountered a use-case where we needed to blur the select programatically
but the component wasn't offering any way to do that.
2023-10-04 16:02:06 +02:00
Nathan Vasse
d647a77c58 🐛(react) fix multi select focus
The multi select non searchable was not displaying its blue accent
color when opening the menu by not clicking on the toggle button.
2023-10-04 16:02:06 +02:00
Nathan Vasse
2e644b3c3a 📝(doc) add migration guide
As this new version introduced some breaking changes, this doc was needed.
2023-10-04 15:18:00 +02:00
Nathan Vasse
20e58d0d2b 📝(react) add first step doc
We missed this must-have for some time now.
2023-10-04 15:18:00 +02:00
Nathan Vasse
1b34e11a09 📝(react) add Theming doc
The goal is to showcase how to deal with themes when using Cunningham.
2023-10-04 15:18:00 +02:00
Nathan Vasse
422834e6d2 📝(react) make docs theme compatible
Some docs were using design tokens and classes that were not theme
compliant, rendering ugly colors when switching to dark, it needed to
be aligned. Also update some code example to match the new format.
2023-10-04 15:18:00 +02:00
Nathan Vasse
b0d68becfe ♻️(react) update stories for themes
The stories do not need CunninghamProvider anymore since it is
handled by the configuration for the themes support. Some stories
were also using wrong colors that didn't handle multiple themes.
2023-10-04 15:18:00 +02:00
Nathan Vasse
b94abbd6b3 (react) add themes switching in Storybook
We want to be able to visualize easily themes directly inside
Storybook. This was not a trivial task as there is no centralized
logic to handle Doc / Stories / Manager at the same time.
2023-10-04 15:18:00 +02:00
Nathan Vasse
8b1dbd2f25 (demo) add themes handling
We now can switch theme directly inside the demo app.
2023-10-04 15:18:00 +02:00
Nathan Vasse
bac9e3b802 📦️(react) update tokens
It reflects the new tokens file with the new format.
2023-10-04 15:18:00 +02:00
Nathan Vasse
e2c0d3259b ♻️(react) update token.ts to handles themes
Some components were using wrong design tokens and this was noticed
only when changing themes, like using hard-coded "white" instead of
"greyscale-000".
2023-10-04 15:18:00 +02:00
Nathan Vasse
cce8eccf5b (theme) add themes management
This is made in order to be able to handle natively multiple themes
for the future light/dark themes and also allow consumers to create
their own.
2023-10-04 15:18:00 +02:00
Nathan Vasse
f232ae1e44 🔨(tokens) add Figma to Cunningham script
This script converts Figma's Tokens Studio JSON exports to Cunningham
compatible format. This is just intended to be used by core devs.
2023-10-04 15:18:00 +02:00
Nathan Vasse
7db5bb798c 🔖(release) version packages
Bump @openfun/cunningham-react to 1.3.1
2023-10-04 14:21:25 +02:00
Lebaud Antoine
0c757957a7 🩹(react) export Popover component and its props
Include missing Popover component exports to the React package.
Re-order package exports to be alphabetically sorted.
2023-10-03 13:28:35 +02:00
Nathan Vasse
c370970ec4 📌(deps) pin remark-gfm to 3.0.1
The MDX package is still broken as it does not support the new major
version of remark-gfm.
2023-10-03 11:52:23 +02:00
Lebaud Antoine
539f03eee1 🩹(react) handle possible null date range
Exercise caution when dealing with date range values that may be null.
2023-10-03 11:52:23 +02:00
renovate[bot]
6c3259a4ac ⬆️(dependencies) update js dependencies 2023-10-03 11:52:23 +02:00
Nathan Vasse
a46d28f00a 💄(react) make multi select height homogeneous
Some discussion appeared about the fact the multi select was changing
height when pill were selected, making this input having a bigger
height than others making it looks weird in a form comparing to the
others. Modifying the padding and font size make the input keep the
same height.

See #114
2023-10-03 11:18:56 +02:00
Nathan Vasse
a1e8f46368 🐛(react) fix checkbox double onChange
When clicking on the checkmark it was trigerring two onChange on parent
elements, thus causing double toggling ( which means revert to the initial
value ) in some controlled way approaches ( see the added test ).

Fixes #175
2023-10-02 11:53:04 +02:00
Nathan Vasse
e15586da9b 🐛(react) fix missing mono-simple useEffect dep
A recent rebased cause one the dep to be removed.
2023-09-28 15:43:24 +02:00
Nathan Vasse
fe5daa918f 📌(deps) set @testing-library/dom as resolution
The renovate PR made the tests fail due to lots of new warnings.
This kind of warning: update not wrapped inside act ...
They were mainly throwed from user event API calls, but internally
this library already calls act() so it is not supposed to happen.
In reality it happen when different versions of @testing-library/dom
are used by the framework wrapper and the main one loaded by our
project.

See https://github.com/testing-library/user-event/discussions/906
2023-09-28 11:05:51 +02:00
Nathan Vasse
3e2d5994f3 ⬇️(deps) downgrade @types/react to 18.2.21
It was causing compilation issue when using React.StrictMode, see this
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/66841
2023-09-28 11:05:51 +02:00
Nathan Vasse
9c8331be5b ⬇️(react) downgrade remark-gfm to 3.0.1
It was causing crashes because the other MDX deps are not already
up-to-date to support remark-gfm 4.0.0 for now. See
https://github.com/remarkjs/remark-gfm/issues/57
2023-09-28 11:05:51 +02:00
renovate[bot]
f82aeee9ac ⬆️(dependencies) update js dependencies 2023-09-28 11:05:51 +02:00
Romain Le Cellier
859a75cebe 🩹(frontend) fix react userEffect
in Select/mono-simple

The whole downshiftProps object change every time a update is made on it.
By observing only initialSelectedItem prop, we reduce the amount of call
of this useEffect.
2023-09-27 15:38:48 +02:00
Romain Le Cellier
3a6028f0ba 🐛(rect) fix rhf select example
clearing the select trigger a infinit loop
2023-09-27 15:38:48 +02:00
Romain Le Cellier
034e299407 ♻️(react) fix rhf reset with Input
when using reset(), Input field value wasn't updated
2023-09-27 15:38:48 +02:00
Nathan Vasse
e2738495dc 🔖(release) version packages
Bump @openfun/cunningham-react to 1.3.0
2023-09-25 16:24:56 +02:00
Anthony Le Courric
3fc464bb8c 🐛(react) fix some edge cases with searchable Select
- rerender mutated options when the menu is opened
- keep the filter value when the menu is opened and rerender
by a mutated options
2023-09-25 16:10:39 +02:00
Nathan Vasse
4e1d0f0bc7 (react) rework the behavior of the Select component
We decided to change a bit the behavior of the Select:
- Do not trigger onChange on first render if value is defined
- Show all options on searchable select menu  opening even if there is an
  existing value.
- Clear the input field if no choice are selected
- Clear the added text to the input field when a value is already selected
2023-09-22 14:18:01 +02:00
Nathan Vasse
732183420d 🐛(react) fix select pills submiting form
We found out that clicking on the delete button of the pill in example
forms were triggering form submit.
2023-09-22 12:07:00 +02:00
Nathan Vasse
a07b461621 🔖(release) version packages
Bump @openfun/cunningham-react to 1.2.0
2023-09-19 09:57:36 +02:00
Nathan Vasse
8470126b1f 🐛(react) fix failing selection of last removed item
Previsouly when selecting item A and then removing it, it was impossible
to select it again. This was caused by the internal memory of useSelect
that only provides undefined selectedItem inside the onStateChange callback
when the item has not changed. So by forcing it everytime to null it is
now providing it everytime.
2023-09-18 17:01:21 +02:00
Nathan Vasse
111bb677c4 ♻️(react) improve select element keys
It was considered as a bad practice to include array indexes in list
elements keys even though it was made this way in the documentation. We
removed them and also decided to drop the use of options value in the
keys too to the profit of optionToValue which can never be undefined or null.
This changes caused test crashing due to the fact that it made the useSelect
onStateChange trigger a onBlur event that was causing the first option of the
list to be selected automatically, which was a really weird behavior. Before
it was not happening because newSelectedItem was not defined, using the
new keys made it defined, we don't 100% understand why yet.
2023-09-18 17:01:21 +02:00
Nathan Vasse
fd988c03e1 🐛(react) fix controlled searchable select
Changing the controlled value was setting triggering immediately an
onChange event with undefined value. This was due to the fact that when
the controlled value was changed SelectMonoAux was searching only in
options displayed, where it should in reality be searching accross all
options.

fixes #162
2023-09-15 15:11:43 +02:00
Nathan Vasse
4616ad9ffb (react) add select menu empty placeholder
Previously if the menu was opened and no there were no options to be
displayed it was just showing a tiny empty menu, this commit adds an
empty placeholder in order to make it clearer that the list is empty.
2023-09-13 17:28:58 +02:00
renovate[bot]
be5559d9fe ⬆️(dependencies) update js dependencies 2023-09-12 15:28:58 +02:00
Nathan Vasse
5bf2bc7e6f 🔖(release) version packages
Bump @openfun/cunningham-react to 1.1.0
Bump @openfun/cunningham-tokens to 1.0.1
2023-09-11 16:43:27 +02:00
Anthony Le Courric
e251bbb438 🚨(eslint-config-custom) prob order with windows
With Windows the order of the imports was not the same as with Linux,
this was causing the linter to fail with CI.
We force the import starting with ":" to the internal group to fix this
issue.
2023-09-11 16:15:13 +02:00
Anthony Le Courric
c7000f37d2 🐛(react) fix props not recognized on the input element
The props propagation was adding unknown props to the input element,
which was causing an error warning to be displayed in the console.
2023-09-11 16:15:13 +02:00
Nathan Vasse
8086a48672 📝(react) improve form examples
We decided to improve the examples to fit better the guidelines of the
design-system.
2023-09-11 12:07:49 +02:00
Nathan Vasse
8fd34add8a 🐛(react) fix Radio, Checkbox fullWidth
The fullWidth was buggy for those components, the label was floating
in the middle of the empty space where it feels correct to keep it
aligned on the left.
2023-09-11 12:07:49 +02:00