Commit Graph

140 Commits

Author SHA1 Message Date
Nathan Vasse
501ba1a031 🐛(react) fix DatePicker alignments
Due to the previous changes of LabelledBox that allows it to fit dynamic
height containers, we forgot to update the DatePicker resulting in a broken
CSS alignment.
2023-06-19 17:21:29 +02:00
Nathan Vasse
760ffb48e9 🔖(release) version packages
Bump @openfun/cunningham-react to 0.8.0
2023-06-19 15:20:49 +02:00
Nathan Vasse
34d2fe0af3 (react) max width for multi select pills
In order to prevent a pill with a long text to stack below the actions
div we decided to introduce the concept of max-width for pills.
2023-06-19 15:04:05 +02:00
Nathan Vasse
29b58ed1a6 (react) use css float for multi select
Previously the pills were not stacking under the actions div, now we can
do it using the forgotten CSS float feature.
2023-06-19 15:04:05 +02:00
Nathan Vasse
10a28d5e22 📝(react) add multi select to form example
This way we can showcase the multi select in real life conditions.
2023-06-19 15:04:05 +02:00
Nathan Vasse
3ff2ac4a64 📝(react) add multi select doc
Also rename existing doc for the mono select to mono.mdx for homogeneity
purposes.
2023-06-19 15:04:05 +02:00
Nathan Vasse
c8afa105dd (react) add multi select
Adding this new variant makes necessary to reorganize the files to keep
a clear separations of concerns. As of now Select/index.tsx is just an
entrypoint to render either the mono or multi variant of the select.
2023-06-19 15:04:05 +02:00
Nathan Vasse
5a9d77042f ♻️(react) parents of LabelledBox must be flex
Previously we enforced the height of the LabelledBox div with height: 100%, but
if the parent container of LabelledBox had an auto height this wasn't working
anymore. Setting height: 100% to a child works only if its parent has a fixed
height. In our situation we needed the LabelledBox to work for the multi select
which has a auto growing height. To solve this issue we just have to force the
parent containers of LabelledBox to display flex in order for it to stretches
its children to take all of its height, including LabelledBox div.
2023-06-19 15:04:05 +02:00
Nathan Vasse
02aa441b3b (react) add horizontal mode to LabelledBox
This way initially added for the multi select but after some discussions
we decided to keep the label vertical even for the multi select. But this
could be useful in the future.
2023-06-19 15:04:05 +02:00
Lebaud Antoine
be87c97f31 ♻️(react) refactor dupplicated formatter
Make sure every date formatter has the same time zone by encapsulating
it in a factored custom hook. Reorganize component to gain
in readability and improve maintainability.
2023-06-16 17:13:35 +02:00
Lebaud Antoine
76ad5621c6 🐛(react) fix calendar selects initialization and syncing
Select under the calendar component were not properly initialized,
leading to issues. Additionally, syncing the dropdowns with the calendar
state was causing unnecessary renders. Selects now update on user events
triggered by the toggle button, ensuring the selected item remains
up-to-date. The code has been refactored to eliminate duplication
and improve the component's readability and maintainability.
2023-06-16 17:13:35 +02:00
Lebaud Antoine
10fa71e2a7 (react) add DatePicker component
Based on the Figma DS design by Alex, a mono date-picker
component has been added. It uses react-aria headless ui
component capabilities, with downshift headless ui component.
React-aria was not supporting by default dropdown menus to
select months and years. We could not reuse Popover component
from react-aria because we are not using their headless ui
component for the button one. Clicking on the toggle calendar
button triggers both the button and the popover click outside
events. React-aria button uses a custom onPress props that is
disabled by their popover. Instead, I have implemented a simple
custom hook. This is the first acceptable version of the component.
Some minor user interaction are missing. This first component
doesn't support time selection.
2023-06-12 18:57:20 +02:00
Lebaud Antoine
1d1cf81cf6 (react) add a popover component
A design system needs a popover mecanism.
In the select component, this logic is handled by downshift.
We introduce a new component, responsible to open an element in
a popin and close it when the user click outside of it.
2023-06-12 18:57:20 +02:00
Lebaud Antoine
f967775fb6 (react) compute a range of numbers
A new utils function has been added that would allow
developpers to easily compute a range between two
number, with a step of one. This function is inspired
by the python range function.
2023-06-12 18:57:20 +02:00
Lebaud Antoine
60ff04c2d9 📦️(react) add react-aria dependecies
Working on the date picker, we looked for an headless
UI components library. React-aria was chosen to support
the new form's component development. They developped a suite of
headless UI components that seemed quite easy to style.
2023-06-12 18:57:20 +02:00
Lebaud Antoine
6f05995f24 🎨(react) make eof stylesheets consistent
Some older tools misbehave if the last line of data
in a text file is not terminated with a newline.
It makes sure the last line was properly terminated.
2023-06-12 17:08:01 +02:00
Lebaud Antoine
59cf5de66d 📝(react) add missing design tokens on Select's documentation
Design tokens documented in the Select docs should match the available tokens.
This modification offer an exhaustive and complete list of the design
tokens available to customize the select component.
2023-06-12 16:29:26 +02:00
Nathan Vasse
0ad71a8ec1 ♻️((react) migrate DataGrid faker usages to new API
We forgot to migrate those stories when upgrading faker.
2023-06-06 17:10:33 +02:00
Nathan Vasse
787bd3de75 🏷️(react) allow autocompletion for DataGrid's renderCell
Previously the type of the row parameter of renderCell was hardcoded as
Row. This wasn't ideal because the best case scenario we want it to enable
Typescript to use the type of rows props. Now that's the case.

Resolve #62
2023-06-06 17:10:33 +02:00
Nathan Vasse
9127fd803c 🐛(react) support nested field in DataGrid
It was previously needed to use renderCell to be able to use nested
fields, which was not handy.

Resolve #62
2023-06-06 17:10:33 +02:00
Lebaud Antoine
1ff37cf12f 💄(react) improve input component styling configuration
Align design tokens of input component with select component's
design tokens for consistent styling configuration. Having a
transparent background was causing a weird ux.
2023-06-06 12:21:41 +02:00
Lebaud Antoine
38538e354b 💄(react) improve radio input styling configuration
Align design tokens of radio input component with select component's
design tokens for consistent styling configuration.
2023-06-06 12:21:41 +02:00
Lebaud Antoine
8cf2bb28e1 ♻️(react) improve checkbox styling configuration
Align design tokens of checkbox component with select component's
design tokens for consistent styling configuration.
2023-06-06 12:21:41 +02:00
jbpenrath
a0d737aaf8 🍱(react) add storybook favicon
We recently customized Storybook documentation to brand it to Cunningham
 but we forgot to change the favicon.
2023-06-02 11:00:58 +02:00
Lebaud Antoine
fe91471127 💄(react) improve DX when converting px to rem values
It can be tricky, while integrating the figma design file,
to map some small px values to their rem equivalent. Thus,
this PR proposes a new util function converting pixel to rem.
It would ensure that all size values can scale base on the
font-size base, while keeping a good developer experience.
2023-06-01 19:20:05 +02:00
jbpenrath
aa4dcdd800 (react) fix flaky test about Input component
A test of Input component was flaky and raise some `act` warnings.
Forcing the use of testing library 9 seems to fix the issue.
2023-06-01 18:00:36 +02:00
jbpenrath
7144961c50 🍱(react) fix storybook logo link
The storybook logo was broken on the production website. Indeed the link
 was prefixed by a slash.
2023-06-01 18:00:36 +02:00
Nathan Vasse
0153b5043b 📝(react) add forms examples to documentation
We think doing this really illustrates what the design system looks
in real life, all components living together next to each other.
2023-06-01 12:05:32 +02:00
Nathan Vasse
2c6a66b220 💄(react) change pagination border color
The pagination component's border color was different from the one
of other components, especially the DataGrid, which was not really
homogenous.
2023-06-01 12:05:32 +02:00
Nathan Vasse
a869fe51dc 💄(react) reduce inputs borders
We do this in order to have homogenous border accross the entire
library, before we had DataGrid with 1px border and inputs with 2px
borders, which was not really nice to the eye.
2023-06-01 12:05:32 +02:00
Nathan Vasse
1cb1b48c8d (react) add min-width to Field
Without this new property the components using Field ( Input, Select, ... )
would not properly fit by default inside a flex parent.
2023-06-01 12:05:32 +02:00
Nathan Vasse
30d08a956b (react) add fullWidth props to Button
Can be useful in many situations.
2023-06-01 12:05:32 +02:00
jbpenrath
d767d61dd2 📝(react) customize storybook theme
We want to customize our Storybook to market it for Cunningham.
2023-05-31 14:31:53 +02:00
Nathan Vasse
cfdac8dba9 💄(react) migrate to Roboto Flex
Previously we were using standard Roboto Font but we were struggling to
get the same boldness as the ones from the Figma sketches. It appears
that Figma uses Roboto Flex, so by installing it we can now nearly
perfectly align our visuals with the ones form the sketches. I had to
do some custom tweaks with the weights of the font because if we
use exactly the same font-weight as in Figma the render is still different.
2023-05-26 16:39:02 +02:00
Nathan Vasse
bc4638de41 👽️(react) add material-icons class
The upgrade of @fontsource to v5 forces us to include the .material-icons
class on our side.
2023-05-26 16:39:02 +02:00
renovate[bot]
1eda301637 ⬆️(dependencies) update js dependencies 2023-05-26 16:39:02 +02:00
Nathan Vasse
22ad673374 🔖(release) version packages
Bump @openfun/cunningham-react to 0.7.0
2023-05-24 17:10:23 +02:00
Nathan Vasse
ef4ece39b4 🐛(react) fix label color on state disabled ( select, input )
When creating LabelledBox we introduced a bug than overrides the label
colors when inputs are disabled.
2023-05-24 16:49:49 +02:00
Nathan Vasse
bc6d085868 💄(react) change label color on state error ( select, input )
We forgot to implement this during the first PRs.
2023-05-24 16:49:49 +02:00
Nathan Vasse
75c6e2e482 💄(react) change label color when focused ( select, input )
We forgot to implement this behavior when coding these inputs.
2023-05-24 16:49:49 +02:00
Nathan Vasse
d79f01fd93 (react) add the possibility to hide select label
Based on recent feedbacks this feature was needed. It is important for
the label to still be accessible to screen readers, that's why we
introduced the offscreen class.

Resolve #60
2023-05-24 15:58:07 +02:00
Nathan Vasse
c93c8d2a2f (react) add disable property to select option
Based on recent feedbacks, this feature was needed for consumer apps.

Resolve #60
2023-05-24 15:58:07 +02:00
Nathan Vasse
c11727976c (react) add clearable option to Select
Based on a feedback given from another project, we want to be able
to disable the clear feature on the select.

Resolve #60
2023-05-24 15:58:07 +02:00
Nathan Vasse
9065d6c87b 💄(react) change success text color to comply with RGAA
Previsouly we were not matching the 4.5:1 contrast.
2023-05-24 15:37:50 +02:00
Nathan Vasse
9d7ad489ba (react) add Switch component
Implement a shiny new component that can be used as an alternative to
the regular checkbox.
2023-05-24 15:37:50 +02:00
Nathan Vasse
ec8def0cb1 🐛(react) fix Field that can be compact and fullWidth
Being able to define the Field to be compact and fullWidth at the
same time was misleading. We need to be able to set the Switch
component fullWidth if needed, while by default it is compact. This
change makes possible the fullWidth props to override compact mode.
2023-05-24 15:37:50 +02:00
Nathan Vasse
e72606cfcd 💄(react) make inputs labels bolder
The current labels of radio, checkbox and switches were not bold enough
to match the figma sketches.
2023-05-24 15:37:50 +02:00
Nathan Vasse
eb6692bf5e (react) add a design token for checkbox hover background
This was based on recent feedbacks to provide more granularity for
customization.

Resolve #59
2023-05-24 12:00:42 +02:00
Nathan Vasse
527c3fc0c9 (react) set specific cursor on checkbox related components
Even if this is not the default behavior of the native checkbox, based on
recent feedbacks and by comparing what other components libraries do, it
appears that setting a custom cursor on checkbox hover is the most
intuitive thing to do.

Resolve #59
2023-05-24 12:00:42 +02:00
Nathan Vasse
6f77131839 ♻️(react) migration preview.js to preview.ts
Storybook 7 allows to simply use typing inside preview.ts configuration file.
2023-05-24 11:10:13 +02:00