diff --git a/.changeset/quick-singers-poke.md b/.changeset/quick-singers-poke.md new file mode 100644 index 0000000..37cdad9 --- /dev/null +++ b/.changeset/quick-singers-poke.md @@ -0,0 +1,5 @@ +--- +"@openfun/cunningham-react": minor +--- + +add Checkbox component diff --git a/packages/react/src/components/Forms/Checkbox/checkmark.svg b/packages/react/src/components/Forms/Checkbox/checkmark.svg new file mode 100644 index 0000000..bd271cd --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/checkmark.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/react/src/components/Forms/Checkbox/index.scss b/packages/react/src/components/Forms/Checkbox/index.scss new file mode 100644 index 0000000..f068e89 --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/index.scss @@ -0,0 +1,125 @@ +.c__checkbox__group { + + &__list { + display: flex; + flex-direction: column; + align-items: flex-start; + } + + .c__field__footer { + padding: 0.25rem 0 0 calc(2rem); + } +} + +.c__checkbox { + display: inline-flex; + $padding: 0.25rem; + padding: $padding; + border-radius: 2px; + box-sizing: border-box; + border-style: solid; + border-color: transparent; + // To automatically align the checkbox to the left side. + margin-left: -1 * $padding; + + &:hover, &:focus-within { + background-color: var(--c--theme--colors--greyscale-200); + } + + &:focus-within { + outline: 0; + border-color: var(--c--theme--colors--primary-600); + } + + &__container { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + color: var(--c--components--forms-checkbox--color); + } + + .c__field__footer { + padding: 0.25rem 0 0 calc(2rem); + } + + &__wrapper { + position: relative; + $clipPathShow: inset(0 0 0 0); + $clipPathHide: inset(0 100% 0 0); + + input { + appearance: none; + margin: 0; + background-color: white; + width: var(--c--components--forms-checkbox--size); + height: var(--c--components--forms-checkbox--size); + border: 1.5px solid var(--c--components--forms-checkbox--border-color); + border-radius: var(--c--components--forms-checkbox--border-radius); + display: block; + + &:focus { + outline: none; + } + + &:not(:checked) { + ~ .checkmark { + clip-path: $clipPathHide; + } + ~ .indeterminate { + clip-path: $clipPathHide; + } + } + + &:checked { + ~ .checkmark { + clip-path: $clipPathShow; + } + ~ .indeterminate { + clip-path: $clipPathHide; + } + } + + &:indeterminate { + ~ .indeterminate { + clip-path: $clipPathShow; + } + ~ .checkmark { + clip-path: $clipPathHide; + } + } + } + + svg { + clip-path: $clipPathHide; + transition: var(--c--theme--transitions--duration) var(--c--theme--transitions--ease-out); + position: absolute; + top: 0; + left: 0; + color: var(--c--components--forms-checkbox--accent-color); + } + } + + &__label { + font-size: var(--c--components--forms-checkbox--font-size); + font-weight: var(--c--components--forms-checkbox--font-weight); + } + + &--disabled { + border-color: transparent; + color: var(--c--theme--colors--greyscale-600); + + svg { + color: var(--c--theme--colors--greyscale-400); + } + + &:hover { + background-color: transparent; + } + + .c__checkbox__label { + color: var(--c--theme--colors--greyscale-600); + } + } +} + diff --git a/packages/react/src/components/Forms/Checkbox/index.spec.tsx b/packages/react/src/components/Forms/Checkbox/index.spec.tsx new file mode 100644 index 0000000..9b8dd3a --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/index.spec.tsx @@ -0,0 +1,109 @@ +import userEvent from "@testing-library/user-event"; +import React from "react"; +import { render, screen } from "@testing-library/react"; +import { Checkbox, CheckboxGroup } from "components/Forms/Checkbox/index"; + +describe("", () => { + it("renders and can be checked", async () => { + const user = userEvent.setup(); + render(); + const input: HTMLInputElement = screen.getByRole("checkbox", { + name: "Agree", + }); + expect(input.checked).toEqual(false); + await user.click(input); + expect(input.checked).toEqual(true); + }); + it("renders with default value and can be unchecked", async () => { + const user = userEvent.setup(); + render(); + const input: HTMLInputElement = screen.getByRole("checkbox", { + name: "Agree", + }); + expect(input.checked).toEqual(true); + await user.click(input); + expect(input.checked).toEqual(false); + }); + it("renders with indeterminate state", async () => { + render(); + expect(document.querySelector("svg.indeterminate")).toBeInTheDocument(); + }); + it("renders disabled", async () => { + render(); + expect(screen.getByRole("checkbox", { name: "Agree" })).toBeDisabled(); + // Click and expect the checkbox does not get checked + const user = userEvent.setup(); + const input: HTMLInputElement = screen.getByRole("checkbox", { + name: "Agree", + }); + expect(input.checked).toEqual(false); + await user.click(input); + expect(input.checked).toEqual(false); + }); + it("renders with text", async () => { + render(); + expect(screen.getByText("Text")).toBeInTheDocument(); + }); + it("renders with state=success", async () => { + render(); + expect(screen.getByText("Success text")).toBeInTheDocument(); + expect( + document.querySelector(".c__field.c__field--success") + ).toBeInTheDocument(); + }); + it("renders with state=error", async () => { + render(); + expect(screen.getByText("Error text")).toBeInTheDocument(); + expect( + document.querySelector(".c__field.c__field--error") + ).toBeInTheDocument(); + }); + + it("renders with group", async () => { + render( + + + + + ); + screen.getByRole("checkbox", { + name: "Agree", + }); + screen.getByRole("checkbox", { + name: "Disagree", + }); + }); + it("renders with group text", async () => { + render( + + + + + ); + expect(screen.getByText("Text")).toBeInTheDocument(); + }); + it("renders with group state=success", async () => { + render( + + + + + ); + expect(screen.getByText("Success text")).toBeInTheDocument(); + expect( + document.querySelector(".c__checkbox__group.c__field.c__field--success") + ).toBeInTheDocument(); + }); + it("renders with group state=error", async () => { + render( + + + + + ); + expect(screen.getByText("Error text")).toBeInTheDocument(); + expect( + document.querySelector(".c__checkbox__group.c__field.c__field--error") + ).toBeInTheDocument(); + }); +}); diff --git a/packages/react/src/components/Forms/Checkbox/index.stories.mdx b/packages/react/src/components/Forms/Checkbox/index.stories.mdx new file mode 100644 index 0000000..145b60a --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/index.stories.mdx @@ -0,0 +1,110 @@ +import { Canvas, Meta, Story, Source, ArgsTable } from '@storybook/addon-docs'; +import { Checkbox } from "./index"; + + + +# Checkbox + +Cunningham provides a versatile Checkbox component that you can use in your forms. + + + + + +## Label + +The `label` props is optional, but you can use it to provide a description of the checkbox. + +**Without label** + + + + + +**With label** + + + + + +## Value + +You can set the value of the checkbox in 3 different ways. + + + + + + + +## Texts + +As the component uses [Field](?path=/story/components-forms-field-doc--page), you can use the `text` props to provide a description of the checkbox. + + + + + +## Disabled + +As a regular checkbox, you can disable it by using the `disabled` props. + + + + + +## States + +You can use the following props to change the state of the Input component by using the `state` props. + + + + + + + + + + + + + +## Group + +It will happen often that you will need to use multiple grouped checkboxes. You can use the `CheckboxGroup` component to do so. + + + + + +You can also define `state`, `text` props on the group component + + + + + + +## Design tokens + +Here are available custom design tokens. + +| Token | Description | +|--------------- |----------------------------- | +| font-size | Label font size ( shared with radio ) | +| font-weight | Label font weight ( shared with radio ) | +| color | Label color ( shared with radio ) | +| border-color | Border color of the checkbox | +| border-radius | Border radius of the checkbox | +| accent-color | Color of the checkmark and the indeterminate mark | +| width | Width of the checkbox | +| height | Height of the checkbox | + +See also [Field](?path=/story/components-forms-field-doc--page) + +## + + + +## + + \ No newline at end of file diff --git a/packages/react/src/components/Forms/Checkbox/index.stories.tsx b/packages/react/src/components/Forms/Checkbox/index.stories.tsx index 014bd1b..f314055 100644 --- a/packages/react/src/components/Forms/Checkbox/index.stories.tsx +++ b/packages/react/src/components/Forms/Checkbox/index.stories.tsx @@ -1,9 +1,9 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import React from "react"; -import { Checkbox } from "components/Forms/Checkbox/index"; +import { Checkbox, CheckboxGroup } from "components/Forms/Checkbox/index"; export default { - title: "Components/Forms (WIP)/Checkbox", + title: "Components/Forms/Checkbox", component: Checkbox, } as ComponentMeta; @@ -14,12 +14,98 @@ const Template: ComponentStory = (args) => ( export const Default = Template.bind({}); Default.args = {}; +export const Checked = Template.bind({}); +Checked.args = { + checked: true, +}; + export const Indeterminate = Template.bind({}); Indeterminate.args = { indeterminate: true, }; -export const Checked = Template.bind({}); -Checked.args = { - checked: true, +export const WithLabel = Template.bind({}); +WithLabel.args = { + label: "Label", }; + +export const LabelChecked = Template.bind({}); +LabelChecked.args = { + checked: true, + label: "Label", +}; + +export const WithTexts = Template.bind({}); +WithTexts.args = { + checked: true, + label: "Label", + text: "This is an optional text", +}; + +export const Disabled = Template.bind({}); +Disabled.args = { + disabled: true, + label: "Label", +}; + +export const DisabledChecked = Template.bind({}); +DisabledChecked.args = { + checked: true, + disabled: true, + label: "Label", +}; + +export const Error = Template.bind({}); +Error.args = { + checked: true, + label: "Label", + text: "This is an optional text", + state: "error", +}; + +export const Success = Template.bind({}); +Success.args = { + checked: true, + label: "Label", + text: "This is an optional text", + state: "success", +}; + +export const Group = () => ( + + Your offices + + + + + + + + +); + +export const GroupError = () => ( + + Your offices + + + + + + + + +); + +export const GroupSuccess = () => ( + + Your offices + + + + + + + + +); diff --git a/packages/react/src/components/Forms/Checkbox/index.tsx b/packages/react/src/components/Forms/Checkbox/index.tsx index 820c028..0cef1bd 100644 --- a/packages/react/src/components/Forms/Checkbox/index.tsx +++ b/packages/react/src/components/Forms/Checkbox/index.tsx @@ -1,17 +1,112 @@ -import React, { HTMLProps, useEffect, useRef } from "react"; +import React, { + InputHTMLAttributes, + PropsWithChildren, + useEffect, + useRef, + useState, +} from "react"; +import classNames from "classnames"; +import { Field, FieldProps } from "components/Forms/Field"; + +type Props = InputHTMLAttributes & + FieldProps & { + indeterminate?: boolean; + label?: string; + }; export const Checkbox = ({ indeterminate, className = "", - ...rest -}: { indeterminate?: boolean } & HTMLProps) => { - const ref = useRef(null!); + checked, + label, + text, + rightText, + state, + ...props +}: Props) => { + const inputRef = useRef(null); + const [value, setValue] = useState(!!checked); useEffect(() => { - if (typeof indeterminate === "boolean") { - ref.current.indeterminate = !rest.checked && indeterminate; - } - }, [ref, indeterminate]); + setValue(!!checked); + }, [checked]); - return ; + useEffect(() => { + if (inputRef.current) { + inputRef.current.indeterminate = !!indeterminate; + } + }, [indeterminate]); + + return ( + + + + + setValue(e.target.checked)} + {...props} + checked={value} + ref={inputRef} + /> + + + + {label && {label}} + + + + ); }; + +export const CheckboxGroup = ({ + children, + state, + text, + rightText, +}: PropsWithChildren & FieldProps) => { + return ( + + {children} + + ); +}; + +const Checkmark = () => ( + + + +); + +const Indeterminate = () => ( + + + +); diff --git a/packages/react/src/components/Forms/Checkbox/resources/dd_1.svg b/packages/react/src/components/Forms/Checkbox/resources/dd_1.svg new file mode 100644 index 0000000..4742c73 --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/resources/dd_1.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/react/src/components/Forms/Checkbox/resources/dd_2.svg b/packages/react/src/components/Forms/Checkbox/resources/dd_2.svg new file mode 100644 index 0000000..6f8e2a6 --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/resources/dd_2.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/react/src/components/Forms/Checkbox/tokens.ts b/packages/react/src/components/Forms/Checkbox/tokens.ts new file mode 100644 index 0000000..f771372 --- /dev/null +++ b/packages/react/src/components/Forms/Checkbox/tokens.ts @@ -0,0 +1,11 @@ +import { DefaultTokens } from "@openfun/cunningham-tokens"; + +export const tokens = (defaults: DefaultTokens) => ({ + "font-size": defaults.theme.font.sizes.m, + "font-weight": defaults.theme.font.weights.medium, + color: defaults.theme.colors["greyscale-900"], + "border-color": defaults.theme.colors["greyscale-300"], + "border-radius": "2px", + "accent-color": defaults.theme.colors["success-700"], + size: "1.5rem", +}); diff --git a/packages/react/src/cunningham-tokens.css b/packages/react/src/cunningham-tokens.css index 98d5b9a..c4b039e 100644 --- a/packages/react/src/cunningham-tokens.css +++ b/packages/react/src/cunningham-tokens.css @@ -96,6 +96,8 @@ --c--theme--transitions--ease-out: cubic-bezier(0.33, 1, 0.68, 1); --c--theme--transitions--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); --c--theme--transitions--duration: 250ms; + --c--components--forms-radio--border-color: #E7E8EA; + --c--components--forms-radio--check-color: #419A14; --c--components--forms-input--font-weight: 400; --c--components--forms-input--font-size: 1rem; --c--components--forms-input--border-radius: 8px; @@ -110,6 +112,13 @@ --c--components--forms-field--width: 292px; --c--components--forms-field--font-size: 0.6875rem; --c--components--forms-field--color: #79818A; + --c--components--forms-checkbox--font-size: 0.8125rem; + --c--components--forms-checkbox--font-weight: 400; + --c--components--forms-checkbox--color: #0C1A2B; + --c--components--forms-checkbox--border-color: #E7E8EA; + --c--components--forms-checkbox--border-radius: 2px; + --c--components--forms-checkbox--accent-color: #419A14; + --c--components--forms-checkbox--size: 1.5rem; --c--components--button--border-radius: 8px; --c--components--button--border-radius--active: 2px; --c--components--button--medium-height: 48px; diff --git a/packages/react/src/cunningham-tokens.js b/packages/react/src/cunningham-tokens.js index 38932f7..961ffca 100644 --- a/packages/react/src/cunningham-tokens.js +++ b/packages/react/src/cunningham-tokens.js @@ -1 +1 @@ -export const tokens = {"theme":{"colors":{"primary-text":"#FFFFFF","primary-100":"#EBF2FC","primary-200":"#8CB5EA","primary-300":"#5894E1","primary-400":"#377FDB","primary-500":"#055FD2","primary-600":"#0556BF","primary-700":"#044395","primary-800":"#033474","primary-900":"#022858","secondary-text":"#555F6B","secondary-100":"#F2F7FC","secondary-200":"#EBF3FA","secondary-300":"#E2EEF8","secondary-400":"#DDEAF7","secondary-500":"#D4E5F5","secondary-600":"#C1D0DF","secondary-700":"#97A3AE","secondary-800":"#757E87","secondary-900":"#596067","greyscale-000":"#FFFFFF","greyscale-100":"#FAFAFB","greyscale-200":"#F3F4F4","greyscale-300":"#E7E8EA","greyscale-400":"#C2C6CA","greyscale-500":"#9EA3AA","greyscale-600":"#79818A","greyscale-700":"#555F6B","greyscale-800":"#303C4B","greyscale-900":"#0C1A2B","success-text":"#FFFFFF","success-100":"#EFFCD3","success-200":"#DBFAA9","success-300":"#BEF27C","success-400":"#A0E659","success-500":"#76D628","success-600":"#5AB81D","success-700":"#419A14","success-800":"#2C7C0C","success-900":"#1D6607","info-text":"#FFFFFF","info-100":"#EBF2FC","info-200":"#8CB5EA","info-300":"#5894E1","info-400":"#377FDB","info-500":"#055FD2","info-600":"#0556BF","info-700":"#044395","info-800":"#033474","info-900":"#022858","warning-text":"#FFFFFF","warning-100":"#FFF8CD","warning-200":"#FFEF9B","warning-300":"#FFE469","warning-400":"#FFDA43","warning-500":"#FFC805","warning-600":"#DBA603","warning-700":"#B78702","warning-800":"#936901","warning-900":"#7A5400","danger-text":"#FFFFFF","danger-100":"#F4B0B0","danger-200":"#EE8A8A","danger-300":"#E65454","danger-400":"#E13333","danger-500":"#DA0000","danger-600":"#C60000","danger-700":"#9B0000","danger-800":"#780000","danger-900":"#5C0000"},"font":{"sizes":{"h1":"1.75rem","h2":"1.375rem","h3":"1.125rem","h4":"0.8125rem","h5":"0.625rem","h6":"0.5rem","l":"1rem","m":"0.8125rem","s":"0.6875rem"},"weights":{"thin":100,"regular":300,"medium":400,"bold":500,"extrabold":700,"black":900},"families":{"base":"Roboto","accent":"Roboto"}},"spacings":{"xl":"4rem","l":"3rem","b":"1.625rem","s":"1rem","t":"0.5rem","st":"0.25rem"},"transitions":{"ease-in":"cubic-bezier(0.32, 0, 0.67, 0)","ease-out":"cubic-bezier(0.33, 1, 0.68, 1)","ease-in-out":"cubic-bezier(0.65, 0, 0.35, 1)","duration":"250ms"}},"components":{"forms-input":{"font-weight":400,"font-size":"1rem","border-radius":"8px","border-radius--hover":"2px","border-radius--focus":"2px","border-width":"2px","border-color":"#E7E8EA","border-color--hover":"#9EA3AA","border-color--focus":"#0556BF","border-style":"solid","color":"#303C4B"},"forms-field":{"width":"292px","font-size":"0.6875rem","color":"#79818A"},"button":{"border-radius":"8px","border-radius--active":"2px","medium-height":"48px","small-height":"32px","medium-font-size":"1rem","small-font-size":"0.8125rem","font-weight":400}}}; +export const tokens = {"theme":{"colors":{"primary-text":"#FFFFFF","primary-100":"#EBF2FC","primary-200":"#8CB5EA","primary-300":"#5894E1","primary-400":"#377FDB","primary-500":"#055FD2","primary-600":"#0556BF","primary-700":"#044395","primary-800":"#033474","primary-900":"#022858","secondary-text":"#555F6B","secondary-100":"#F2F7FC","secondary-200":"#EBF3FA","secondary-300":"#E2EEF8","secondary-400":"#DDEAF7","secondary-500":"#D4E5F5","secondary-600":"#C1D0DF","secondary-700":"#97A3AE","secondary-800":"#757E87","secondary-900":"#596067","greyscale-000":"#FFFFFF","greyscale-100":"#FAFAFB","greyscale-200":"#F3F4F4","greyscale-300":"#E7E8EA","greyscale-400":"#C2C6CA","greyscale-500":"#9EA3AA","greyscale-600":"#79818A","greyscale-700":"#555F6B","greyscale-800":"#303C4B","greyscale-900":"#0C1A2B","success-text":"#FFFFFF","success-100":"#EFFCD3","success-200":"#DBFAA9","success-300":"#BEF27C","success-400":"#A0E659","success-500":"#76D628","success-600":"#5AB81D","success-700":"#419A14","success-800":"#2C7C0C","success-900":"#1D6607","info-text":"#FFFFFF","info-100":"#EBF2FC","info-200":"#8CB5EA","info-300":"#5894E1","info-400":"#377FDB","info-500":"#055FD2","info-600":"#0556BF","info-700":"#044395","info-800":"#033474","info-900":"#022858","warning-text":"#FFFFFF","warning-100":"#FFF8CD","warning-200":"#FFEF9B","warning-300":"#FFE469","warning-400":"#FFDA43","warning-500":"#FFC805","warning-600":"#DBA603","warning-700":"#B78702","warning-800":"#936901","warning-900":"#7A5400","danger-text":"#FFFFFF","danger-100":"#F4B0B0","danger-200":"#EE8A8A","danger-300":"#E65454","danger-400":"#E13333","danger-500":"#DA0000","danger-600":"#C60000","danger-700":"#9B0000","danger-800":"#780000","danger-900":"#5C0000"},"font":{"sizes":{"h1":"1.75rem","h2":"1.375rem","h3":"1.125rem","h4":"0.8125rem","h5":"0.625rem","h6":"0.5rem","l":"1rem","m":"0.8125rem","s":"0.6875rem"},"weights":{"thin":100,"regular":300,"medium":400,"bold":500,"extrabold":700,"black":900},"families":{"base":"Roboto","accent":"Roboto"}},"spacings":{"xl":"4rem","l":"3rem","b":"1.625rem","s":"1rem","t":"0.5rem","st":"0.25rem"},"transitions":{"ease-in":"cubic-bezier(0.32, 0, 0.67, 0)","ease-out":"cubic-bezier(0.33, 1, 0.68, 1)","ease-in-out":"cubic-bezier(0.65, 0, 0.35, 1)","duration":"250ms"}},"components":{"forms-radio":{"border-color":"#E7E8EA","accent-color":"#419A14"},"forms-input":{"font-weight":400,"font-size":"1rem","border-radius":"8px","border-radius--hover":"2px","border-radius--focus":"2px","border-width":"2px","border-color":"#E7E8EA","border-color--hover":"#9EA3AA","border-color--focus":"#0556BF","border-style":"solid","color":"#303C4B"},"forms-field":{"width":"292px","font-size":"0.6875rem","color":"#79818A"},"forms-checkbox":{"font-size":"0.8125rem","font-weight":400,"color":"#0C1A2B","border-color":"#E7E8EA","border-radius":"2px","accent-color":"#419A14","size":"1.5rem"},"button":{"border-radius":"8px","border-radius--active":"2px","medium-height":"48px","small-height":"32px","medium-font-size":"1rem","small-font-size":"0.8125rem","font-weight":400}}}; diff --git a/packages/react/src/cunningham-tokens.ts b/packages/react/src/cunningham-tokens.ts index 38932f7..961ffca 100644 --- a/packages/react/src/cunningham-tokens.ts +++ b/packages/react/src/cunningham-tokens.ts @@ -1 +1 @@ -export const tokens = {"theme":{"colors":{"primary-text":"#FFFFFF","primary-100":"#EBF2FC","primary-200":"#8CB5EA","primary-300":"#5894E1","primary-400":"#377FDB","primary-500":"#055FD2","primary-600":"#0556BF","primary-700":"#044395","primary-800":"#033474","primary-900":"#022858","secondary-text":"#555F6B","secondary-100":"#F2F7FC","secondary-200":"#EBF3FA","secondary-300":"#E2EEF8","secondary-400":"#DDEAF7","secondary-500":"#D4E5F5","secondary-600":"#C1D0DF","secondary-700":"#97A3AE","secondary-800":"#757E87","secondary-900":"#596067","greyscale-000":"#FFFFFF","greyscale-100":"#FAFAFB","greyscale-200":"#F3F4F4","greyscale-300":"#E7E8EA","greyscale-400":"#C2C6CA","greyscale-500":"#9EA3AA","greyscale-600":"#79818A","greyscale-700":"#555F6B","greyscale-800":"#303C4B","greyscale-900":"#0C1A2B","success-text":"#FFFFFF","success-100":"#EFFCD3","success-200":"#DBFAA9","success-300":"#BEF27C","success-400":"#A0E659","success-500":"#76D628","success-600":"#5AB81D","success-700":"#419A14","success-800":"#2C7C0C","success-900":"#1D6607","info-text":"#FFFFFF","info-100":"#EBF2FC","info-200":"#8CB5EA","info-300":"#5894E1","info-400":"#377FDB","info-500":"#055FD2","info-600":"#0556BF","info-700":"#044395","info-800":"#033474","info-900":"#022858","warning-text":"#FFFFFF","warning-100":"#FFF8CD","warning-200":"#FFEF9B","warning-300":"#FFE469","warning-400":"#FFDA43","warning-500":"#FFC805","warning-600":"#DBA603","warning-700":"#B78702","warning-800":"#936901","warning-900":"#7A5400","danger-text":"#FFFFFF","danger-100":"#F4B0B0","danger-200":"#EE8A8A","danger-300":"#E65454","danger-400":"#E13333","danger-500":"#DA0000","danger-600":"#C60000","danger-700":"#9B0000","danger-800":"#780000","danger-900":"#5C0000"},"font":{"sizes":{"h1":"1.75rem","h2":"1.375rem","h3":"1.125rem","h4":"0.8125rem","h5":"0.625rem","h6":"0.5rem","l":"1rem","m":"0.8125rem","s":"0.6875rem"},"weights":{"thin":100,"regular":300,"medium":400,"bold":500,"extrabold":700,"black":900},"families":{"base":"Roboto","accent":"Roboto"}},"spacings":{"xl":"4rem","l":"3rem","b":"1.625rem","s":"1rem","t":"0.5rem","st":"0.25rem"},"transitions":{"ease-in":"cubic-bezier(0.32, 0, 0.67, 0)","ease-out":"cubic-bezier(0.33, 1, 0.68, 1)","ease-in-out":"cubic-bezier(0.65, 0, 0.35, 1)","duration":"250ms"}},"components":{"forms-input":{"font-weight":400,"font-size":"1rem","border-radius":"8px","border-radius--hover":"2px","border-radius--focus":"2px","border-width":"2px","border-color":"#E7E8EA","border-color--hover":"#9EA3AA","border-color--focus":"#0556BF","border-style":"solid","color":"#303C4B"},"forms-field":{"width":"292px","font-size":"0.6875rem","color":"#79818A"},"button":{"border-radius":"8px","border-radius--active":"2px","medium-height":"48px","small-height":"32px","medium-font-size":"1rem","small-font-size":"0.8125rem","font-weight":400}}}; +export const tokens = {"theme":{"colors":{"primary-text":"#FFFFFF","primary-100":"#EBF2FC","primary-200":"#8CB5EA","primary-300":"#5894E1","primary-400":"#377FDB","primary-500":"#055FD2","primary-600":"#0556BF","primary-700":"#044395","primary-800":"#033474","primary-900":"#022858","secondary-text":"#555F6B","secondary-100":"#F2F7FC","secondary-200":"#EBF3FA","secondary-300":"#E2EEF8","secondary-400":"#DDEAF7","secondary-500":"#D4E5F5","secondary-600":"#C1D0DF","secondary-700":"#97A3AE","secondary-800":"#757E87","secondary-900":"#596067","greyscale-000":"#FFFFFF","greyscale-100":"#FAFAFB","greyscale-200":"#F3F4F4","greyscale-300":"#E7E8EA","greyscale-400":"#C2C6CA","greyscale-500":"#9EA3AA","greyscale-600":"#79818A","greyscale-700":"#555F6B","greyscale-800":"#303C4B","greyscale-900":"#0C1A2B","success-text":"#FFFFFF","success-100":"#EFFCD3","success-200":"#DBFAA9","success-300":"#BEF27C","success-400":"#A0E659","success-500":"#76D628","success-600":"#5AB81D","success-700":"#419A14","success-800":"#2C7C0C","success-900":"#1D6607","info-text":"#FFFFFF","info-100":"#EBF2FC","info-200":"#8CB5EA","info-300":"#5894E1","info-400":"#377FDB","info-500":"#055FD2","info-600":"#0556BF","info-700":"#044395","info-800":"#033474","info-900":"#022858","warning-text":"#FFFFFF","warning-100":"#FFF8CD","warning-200":"#FFEF9B","warning-300":"#FFE469","warning-400":"#FFDA43","warning-500":"#FFC805","warning-600":"#DBA603","warning-700":"#B78702","warning-800":"#936901","warning-900":"#7A5400","danger-text":"#FFFFFF","danger-100":"#F4B0B0","danger-200":"#EE8A8A","danger-300":"#E65454","danger-400":"#E13333","danger-500":"#DA0000","danger-600":"#C60000","danger-700":"#9B0000","danger-800":"#780000","danger-900":"#5C0000"},"font":{"sizes":{"h1":"1.75rem","h2":"1.375rem","h3":"1.125rem","h4":"0.8125rem","h5":"0.625rem","h6":"0.5rem","l":"1rem","m":"0.8125rem","s":"0.6875rem"},"weights":{"thin":100,"regular":300,"medium":400,"bold":500,"extrabold":700,"black":900},"families":{"base":"Roboto","accent":"Roboto"}},"spacings":{"xl":"4rem","l":"3rem","b":"1.625rem","s":"1rem","t":"0.5rem","st":"0.25rem"},"transitions":{"ease-in":"cubic-bezier(0.32, 0, 0.67, 0)","ease-out":"cubic-bezier(0.33, 1, 0.68, 1)","ease-in-out":"cubic-bezier(0.65, 0, 0.35, 1)","duration":"250ms"}},"components":{"forms-radio":{"border-color":"#E7E8EA","accent-color":"#419A14"},"forms-input":{"font-weight":400,"font-size":"1rem","border-radius":"8px","border-radius--hover":"2px","border-radius--focus":"2px","border-width":"2px","border-color":"#E7E8EA","border-color--hover":"#9EA3AA","border-color--focus":"#0556BF","border-style":"solid","color":"#303C4B"},"forms-field":{"width":"292px","font-size":"0.6875rem","color":"#79818A"},"forms-checkbox":{"font-size":"0.8125rem","font-weight":400,"color":"#0C1A2B","border-color":"#E7E8EA","border-radius":"2px","accent-color":"#419A14","size":"1.5rem"},"button":{"border-radius":"8px","border-radius--active":"2px","medium-height":"48px","small-height":"32px","medium-font-size":"1rem","small-font-size":"0.8125rem","font-weight":400}}}; diff --git a/packages/react/src/index.scss b/packages/react/src/index.scss index 4ad9252..9076a24 100644 --- a/packages/react/src/index.scss +++ b/packages/react/src/index.scss @@ -3,6 +3,7 @@ @import './components/Accessibility'; @import './components/Button'; @import './components/DataGrid'; +@import './components/Forms/Checkbox'; @import './components/Forms/Field'; @import './components/Forms/Input'; @import './components/Loader';