609 Commits

Author SHA1 Message Date
Lebaud Antoine
114d0b5f2e ♻️(react) refactor DatePicker component
Refactor the original DatePicker component to utilize the newly created shared
common DatePickerAux component. This modification enhances code consistency,
and promotes the reuse of the DatePickerAux across date inputs variants.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
0d6b98ee1f (react) introduce DateRangePicker component
Introduce a flexible and reusable DateRangePicker component to facilitate the
selection of date ranges in the design system.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
0775490a60 (react) introduce a reusable common DatePicker component
For both mono date and range date selection, create a versatile
DatePickerAux component that shares common logics, between both
selection mode.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
0dae71aa92 ♻️(react) extract duplicated utility functions and types
DateRangePicker and DatePicker would share quite a lot of
common logics. Make sure the code elements are factorised
easily reusable in each components.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
d16ada2825 ♻️(react) make datefield inputs reusable
Refactor the date field input to ensure the inclusion of two identical
and reusable date field inputs in the future DateRangePicker component.
By factoring out the common logic and structure, we can create a more efficient
and easily reusable component for selecting date ranges.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
3631367e14 (react) extend Calendar functionalities with range selection
Extend the functionality of the DatePicker component to include support
for a range calendar. This enhancement allows users to select a date
range spanning multiple calendar cells, enabling more flexible date
selection.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
219d08c82e 🐛(react) prevent ENTER event being triggered twice on calendar grid-cell
iThe Button component is not utilizing the headless UI Button from react-aria.
When pressing ENTER on calendar grid cells, the onClick event handler is
being called twice. This issue remained unnoticed when the date picker only
selected a single date and closed. However, when selecting a range of dates,
this double triggering becomes problematic.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
2886f0c992 💄(react) add styling for range selection on a cell
Integrate new styling classes for grid-cells to facilitate range selection
in the DatePicker component. This implementation improves the visual
representation and user experience of selecting a range. In addition,
outside-month cells are now hidden, to avoid having a range selection
that contains outside-month cells.
2023-07-10 22:05:33 +02:00
Lebaud Antoine
87ec3a5061 ♻️(react) revamp clear date picker button
Revamp DatePicker component to enhance range functionalities by elevating
the clear button, resulting in the utilization of a single button across
multiple DateField inputs.
2023-07-10 22:05:33 +02:00
Nathan Vasse
0378b3fa0c 🔖(release) version packages
Bump cunningham-demo to 0.1.0
Bump @openfun/cunningham-react to 0.9.0
Bump @openfun/cunningham-tokens to 0.6.0
2023-07-07 15:28:01 +02:00
Nathan Vasse
a526243667 ♻️(demo) demonstrate token references
Demonstrate the use of token references by editing the greyscale
color which is used by lots of components.
2023-07-07 15:06:18 +02:00
Nathan Vasse
672f4be4d4 (react) make use of tokens references
We want to leverage the use of references inside our tokens definitions.
2023-07-07 15:06:18 +02:00
Nathan Vasse
f36cc07f1b (tokens) add token references
Previously we were not fully using CSS variables as values used in
CSS were hard-coded one. It wasn't keeping the variable references.
This was causing issues when customizing the theme, because editing
colors was not enough, it was needed to customize also the tokens
using these variables. Now by introducing ref() we can delegate how
to deal with these directly to the generators themselves.
2023-07-07 15:06:18 +02:00
jbpenrath
6aca0a3d85 💚(ci) fix performance issue of test job
Currently the test job seems to hit the maximum CPU resource available.
In order to prevent that we try to run tests on several workers.
2023-07-04 17:08:11 +02:00
Nathan Vasse
d05e38520b 🐛(react) avoid storybook errors
Since our upgrade from Typescript 5.0.4 to 5.1.3 some errors started to
occur when running yarn build in .stories.tsx files. Please see the
related issue: https://github.com/storybookjs/storybook/issues/23249.
Adding this ignore clause partitions the storybook compilation and the
package compilation which represents how things really work together,
thus making the irrelevant errors to be removed.

Fixes #109
2023-06-30 17:38:47 +02:00
Nathan Vasse
ef344e0aee 📝(react) add FileUploader to example
The goal is to give a real-life showcase of our components.
2023-06-28 16:20:17 +02:00
Nathan Vasse
80e8dc45eb (react) add file uploader
Add mono and multi file uploader according to sketches.
2023-06-28 16:20:17 +02:00
Nathan Vasse
af3caed43f (react) improve loader
Add small size to the loader for the file uploader.
2023-06-28 16:20:17 +02:00
renovate[bot]
93bfaae502 ⬆️(dependencies) update js dependencies 2023-06-27 17:15:59 +02:00
Lebaud Antoine
2a5533962d 💄(demo) update default cunningham tokens
Update default demo app design tokens to
avoid unnecessary changes unrelated to branch work.
2023-06-27 11:03:57 +02:00
Nathan Vasse
16463c6c83 🔖(release) version packages
Bump @openfun/cunningham-react to 0.8.2
Bump @openfun/cunningham-tokens to 0.5.0
2023-06-23 14:52:12 +02:00
Lebaud Antoine
c160359045 🐛(react) export DatePicker components
Date picker elements were not exported in the global `index.ts`
2023-06-23 12:50:54 +02:00
Nathan Vasse
d618a1805e 🔖(release) version packages
Bump @openfun/cunningham-react to 0.8.1
2023-06-19 17:59:05 +02:00
Nathan Vasse
4c5129e660 💄(react) reduce border of DatePicker
To make the DatePicker looks the same as other form inputs.
2023-06-19 17:21:29 +02:00
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