mautourco-components 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/dist/components/atoms/Avatar/Avatar.d.ts +14 -0
- package/dist/components/atoms/Avatar/Avatar.js +31 -0
- package/dist/components/atoms/Button/Button.d.ts +27 -0
- package/dist/components/atoms/Button/Button.js +35 -0
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +13 -0
- package/dist/components/atoms/Checkbox/Checkbox.js +33 -0
- package/dist/components/atoms/Icon/Icon.d.ts +10 -0
- package/dist/components/atoms/Icon/Icon.js +102 -0
- package/dist/components/atoms/Icon/icons/ArrivalIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ArrivalIcon.js +31 -0
- package/dist/components/atoms/Icon/icons/CalendarIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/CalendarIcon.js +41 -0
- package/dist/components/atoms/Icon/icons/CarIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/CarIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Check.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Check.js +30 -0
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Chevron.d.ts +9 -0
- package/dist/components/atoms/Icon/icons/Chevron.js +54 -0
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Close.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Close.js +30 -0
- package/dist/components/atoms/Icon/icons/DeleteIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/DeleteIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/DepartureIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/DepartureIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/EyeIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/EyeIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/FacebookIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/FacebookIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/InfoIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/InfoIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/LinkedInIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/LinkedInIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/MapPinIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MapPinIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/MautoucoLogo.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MautoucoLogo.js +37 -0
- package/dist/components/atoms/Icon/icons/MenuIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MenuIcon.js +37 -0
- package/dist/components/atoms/Icon/icons/MoreIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MoreIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Search.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Search.js +30 -0
- package/dist/components/atoms/Icon/icons/Settings.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Settings.js +30 -0
- package/dist/components/atoms/Icon/icons/StrollerIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/StrollerIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/TwitterIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/TwitterIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/User.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/User.js +30 -0
- package/dist/components/atoms/Icon/icons/UserIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/UserIcon.js +41 -0
- package/dist/components/atoms/Icon/icons/Youtube.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Youtube.js +36 -0
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.d.ts +12 -0
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.js +53 -0
- package/dist/components/atoms/Inputs/Input/Input.d.ts +15 -0
- package/dist/components/atoms/Inputs/Input/Input.js +27 -0
- package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +14 -0
- package/dist/components/atoms/Inputs/Textarea/Textarea.js +15 -0
- package/dist/components/atoms/Link/Link.d.ts +44 -0
- package/dist/components/atoms/Link/Link.js +76 -0
- package/dist/components/atoms/SelectedValue/SelectedValue.d.ts +11 -0
- package/dist/components/atoms/SelectedValue/SelectedValue.js +29 -0
- package/dist/components/atoms/Spinner/Spinner.d.ts +9 -0
- package/dist/components/atoms/Spinner/Spinner.js +38 -0
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.d.ts +8 -0
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.js +19 -0
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.d.ts +7 -0
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.js +7 -0
- package/dist/components/atoms/Tab/Tab.d.ts +22 -0
- package/dist/components/atoms/Tab/Tab.js +54 -0
- package/dist/components/atoms/Typography/Heading/Heading.d.ts +9 -0
- package/dist/components/atoms/Typography/Heading/Heading.js +25 -0
- package/dist/components/atoms/Typography/Text/Text.d.ts +10 -0
- package/dist/components/atoms/Typography/Text/Text.js +77 -0
- package/dist/components/atoms/Typography/Typography.d.ts +24 -0
- package/dist/components/atoms/Typography/Typography.js +100 -0
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.d.ts +29 -0
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.js +106 -0
- package/dist/components/molecules/UserCard/UserCard.d.ts +20 -0
- package/dist/components/molecules/UserCard/UserCard.js +57 -0
- package/dist/components/organisms/Footer/Footer.d.ts +38 -0
- package/dist/components/organisms/Footer/Footer.js +74 -0
- package/dist/components/organisms/TopNavigation/DesktopNav.d.ts +33 -0
- package/dist/components/organisms/TopNavigation/DesktopNav.js +26 -0
- package/dist/components/organisms/TopNavigation/MobileNav.d.ts +32 -0
- package/dist/components/organisms/TopNavigation/MobileNav.js +45 -0
- package/dist/components/organisms/TopNavigation/TopNavigation.d.ts +33 -0
- package/dist/components/organisms/TopNavigation/TopNavigation.js +20 -0
- package/dist/hooks/useMobile.d.ts +5 -0
- package/dist/hooks/useMobile.js +26 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +28 -0
- package/dist/styles/tokens/tokens.d.ts +3108 -0
- package/dist/styles/tokens/tokens.js +2652 -0
- package/package.json +90 -0
- package/src/components/atoms/Avatar/Avatar.tsx +60 -0
- package/src/components/atoms/Button/Button.css +200 -0
- package/src/components/atoms/Button/Button.tsx +82 -0
- package/src/components/atoms/Checkbox/Checkbox.tsx +69 -0
- package/src/components/atoms/Icon/Icon.tsx +135 -0
- package/src/components/atoms/Icon/icons/ArrivalIcon.tsx +52 -0
- package/src/components/atoms/Icon/icons/CalendarIcon.tsx +63 -0
- package/src/components/atoms/Icon/icons/CarIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/Check.tsx +36 -0
- package/src/components/atoms/Icon/icons/CheckCircleIcon.tsx +48 -0
- package/src/components/atoms/Icon/icons/Chevron.tsx +73 -0
- package/src/components/atoms/Icon/icons/ChevronDownIcon.tsx +46 -0
- package/src/components/atoms/Icon/icons/Close.tsx +40 -0
- package/src/components/atoms/Icon/icons/DeleteIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/DepartureIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/EyeIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/FacebookIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/InfoIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/LinkedInIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/MapPinIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/MautoucoLogo.tsx +93 -0
- package/src/components/atoms/Icon/icons/MenuIcon.tsx +49 -0
- package/src/components/atoms/Icon/icons/MoreIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/Search.tsx +37 -0
- package/src/components/atoms/Icon/icons/Settings.tsx +38 -0
- package/src/components/atoms/Icon/icons/StrollerIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/TwitterIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/User.tsx +37 -0
- package/src/components/atoms/Icon/icons/UserIcon.tsx +63 -0
- package/src/components/atoms/Icon/icons/Youtube.tsx +50 -0
- package/src/components/atoms/Inputs/DropdownInput/DropdownInput.tsx +96 -0
- package/src/components/atoms/Inputs/Input/Input.tsx +66 -0
- package/src/components/atoms/Inputs/Textarea/Textarea.tsx +51 -0
- package/src/components/atoms/Link/Link.tsx +168 -0
- package/src/components/atoms/SelectedValue/SelectedValue.tsx +59 -0
- package/src/components/atoms/Spinner/Spinner.tsx +56 -0
- package/src/components/atoms/Spinner/variants/ButtonSpinner.tsx +37 -0
- package/src/components/atoms/Spinner/variants/LoadingSpinner.tsx +22 -0
- package/src/components/atoms/Tab/Tab.css +147 -0
- package/src/components/atoms/Tab/Tab.tsx +96 -0
- package/src/components/atoms/Typography/Typography.tsx +153 -0
- package/src/components/molecules/MultiSelectDropdown/MultiSelectDropdown.tsx +245 -0
- package/src/components/molecules/UserCard/UserCard.stories.tsx +36 -0
- package/src/components/molecules/UserCard/UserCard.tsx +173 -0
- package/src/components/organisms/Footer/Footer.tsx +290 -0
- package/src/components/organisms/TopNavigation/DesktopNav.tsx +122 -0
- package/src/components/organisms/TopNavigation/MobileNav.tsx +212 -0
- package/src/components/organisms/TopNavigation/TopNavigation.tsx +45 -0
- package/src/styles/components/avatar.css +58 -0
- package/src/styles/components/checkbox.css +132 -0
- package/src/styles/components/dropdown.css +214 -0
- package/src/styles/components/forms.css +147 -0
- package/src/styles/components/multiselect-dropdown.css +231 -0
- package/src/styles/components/organism/footer.css +113 -0
- package/src/styles/components/organism/topnavigation.css +162 -0
- package/src/styles/components/scrollbar.css +63 -0
- package/src/styles/components/selected-value.css +80 -0
- package/src/styles/components/typography.css +251 -0
- package/src/styles/tokens/_tokens.scss +2072 -0
- package/src/styles/tokens/tokens.css +2075 -0
- package/src/styles/tokens/tokens.js +2653 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import Icon from '../../Icon/Icon';
|
|
15
|
+
import Spinner from '../../Spinner/Spinner';
|
|
16
|
+
var DropdownInput = function (_a) {
|
|
17
|
+
var _b = _a.placeholder, placeholder = _b === void 0 ? 'Select item name' : _b, value = _a.value, _c = _a.state, state = _c === void 0 ? 'default' : _c, onClick = _a.onClick, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.options, options = _e === void 0 ? [] : _e, onSelect = _a.onSelect;
|
|
18
|
+
var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
|
|
19
|
+
var handleClick = function () {
|
|
20
|
+
if (state === 'disabled' || state === 'loading')
|
|
21
|
+
return;
|
|
22
|
+
setIsOpen(!isOpen);
|
|
23
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
24
|
+
};
|
|
25
|
+
var handleOptionSelect = function (option) {
|
|
26
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
|
|
27
|
+
setIsOpen(false);
|
|
28
|
+
};
|
|
29
|
+
var getStateClasses = function () {
|
|
30
|
+
var baseClasses = isOpen ? 'dropdown-input--open' : '';
|
|
31
|
+
switch (state) {
|
|
32
|
+
case 'loading':
|
|
33
|
+
return "".concat(baseClasses, " dropdown-input--loading");
|
|
34
|
+
case 'selected':
|
|
35
|
+
return "".concat(baseClasses, " dropdown-input--selected");
|
|
36
|
+
case 'error':
|
|
37
|
+
return "".concat(baseClasses, " dropdown-input--error");
|
|
38
|
+
case 'disabled':
|
|
39
|
+
return "".concat(baseClasses, " dropdown-input--disabled");
|
|
40
|
+
default:
|
|
41
|
+
return "".concat(baseClasses, " dropdown-input--default");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var getIcon = function () {
|
|
45
|
+
if (state === 'loading') {
|
|
46
|
+
return _jsx(Spinner, { size: "sm", className: "dropdown-input__icon" });
|
|
47
|
+
}
|
|
48
|
+
return (_jsx(Icon, { name: isOpen ? 'chevron-up' : 'chevron-down', size: "sm", className: "dropdown-input__icon dropdown-input__icon--chevron" }));
|
|
49
|
+
};
|
|
50
|
+
var displayText = state === 'loading' ? 'Loading...' : (value || placeholder);
|
|
51
|
+
return (_jsxs("div", __assign({ className: "dropdown-container ".concat(className) }, { children: [_jsxs("div", __assign({ className: "dropdown-input ".concat(getStateClasses()), onClick: handleClick }, { children: [_jsx("span", __assign({ className: "dropdown-input__text" }, { children: displayText })), getIcon()] })), isOpen && options.length > 0 && (_jsx("div", __assign({ className: "dropdown-menu" }, { children: options.map(function (option, index) { return (_jsx("div", __assign({ className: "dropdown-option", onClick: function () { return handleOptionSelect(option); } }, { children: option }), index)); }) })))] })));
|
|
52
|
+
};
|
|
53
|
+
export default DropdownInput;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface InputProps {
|
|
3
|
+
variant?: 'default' | 'focus' | 'success' | 'error' | 'disabled';
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
10
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
11
|
+
icon?: 'search' | 'close' | 'settings' | 'user';
|
|
12
|
+
iconPosition?: 'leading' | 'trailing';
|
|
13
|
+
}
|
|
14
|
+
declare const Input: React.FC<InputProps>;
|
|
15
|
+
export default Input;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Icon from '../../Icon/Icon';
|
|
14
|
+
var Input = function (_a) {
|
|
15
|
+
var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Input text' : _c, value = _a.value, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? '' : _e, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, icon = _a.icon, _f = _a.iconPosition, iconPosition = _f === void 0 ? 'trailing' : _f;
|
|
16
|
+
var baseClasses = 'input-field';
|
|
17
|
+
var variantClasses = {
|
|
18
|
+
default: 'input-field--default',
|
|
19
|
+
focus: 'input-field--focus',
|
|
20
|
+
success: 'input-field--success',
|
|
21
|
+
error: 'input-field--error',
|
|
22
|
+
disabled: 'input-field--disabled'
|
|
23
|
+
};
|
|
24
|
+
var inputClasses = "".concat(baseClasses, " ").concat(variantClasses[variant], " ").concat(icon ? "input-field--with-icon input-field--icon-".concat(iconPosition) : '', " ").concat(className).trim();
|
|
25
|
+
return (_jsxs("div", __assign({ className: "input-wrapper ".concat(icon ? 'input-wrapper--with-icon' : '').trim() }, { children: [icon && iconPosition === 'leading' && (_jsx("span", __assign({ className: "input-icon input-icon--leading" }, { children: _jsx(Icon, { name: icon, size: "sm" }) }))), _jsx("input", { type: "text", className: inputClasses, placeholder: placeholder, value: value, disabled: disabled || variant === 'disabled', onChange: onChange, onFocus: onFocus, onBlur: onBlur }), icon && iconPosition === 'trailing' && (_jsx("span", __assign({ className: "input-icon input-icon--trailing" }, { children: _jsx(Icon, { name: icon, size: "sm" }) })))] })));
|
|
26
|
+
};
|
|
27
|
+
export default Input;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TextareaProps {
|
|
3
|
+
variant?: 'default' | 'focus' | 'success' | 'error' | 'disabled';
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
rows?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
10
|
+
onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
11
|
+
onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const Textarea: React.FC<TextareaProps>;
|
|
14
|
+
export default Textarea;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var Textarea = function (_a) {
|
|
3
|
+
var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Enter your text...' : _c, value = _a.value, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.rows, rows = _e === void 0 ? 4 : _e, _f = _a.className, className = _f === void 0 ? '' : _f, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur;
|
|
4
|
+
var baseClasses = 'input-field';
|
|
5
|
+
var variantClasses = {
|
|
6
|
+
default: 'input-field--default',
|
|
7
|
+
focus: 'input-field--focus',
|
|
8
|
+
success: 'input-field--success',
|
|
9
|
+
error: 'input-field--error',
|
|
10
|
+
disabled: 'input-field--disabled'
|
|
11
|
+
};
|
|
12
|
+
var textareaClasses = "".concat(baseClasses, " ").concat(variantClasses[variant], " ").concat(className);
|
|
13
|
+
return (_jsx("textarea", { className: textareaClasses, placeholder: placeholder, value: value, disabled: disabled || variant === 'disabled', rows: rows, onChange: onChange, onFocus: onFocus, onBlur: onBlur }));
|
|
14
|
+
};
|
|
15
|
+
export default Textarea;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface LinkProps {
|
|
3
|
+
/**
|
|
4
|
+
* Le texte du lien
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* L'URL du lien
|
|
9
|
+
*/
|
|
10
|
+
href?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Fonction appelée lors du clic
|
|
13
|
+
*/
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* État du lien
|
|
17
|
+
*/
|
|
18
|
+
state?: 'default' | 'hover' | 'visited' | 'focused';
|
|
19
|
+
/**
|
|
20
|
+
* Thème du lien
|
|
21
|
+
*/
|
|
22
|
+
theme?: 'light' | 'dark' | 'teal';
|
|
23
|
+
/**
|
|
24
|
+
* Si le lien est associé à un radio button
|
|
25
|
+
*/
|
|
26
|
+
withRadio?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Si le radio button est sélectionné
|
|
29
|
+
*/
|
|
30
|
+
radioChecked?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Fonction appelée lors du clic sur le radio button
|
|
33
|
+
*/
|
|
34
|
+
onRadioChange?: (checked: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Classes CSS supplémentaires
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Si le lien est désactivé
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const Link: React.FC<LinkProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Text } from '../Typography/Typography';
|
|
14
|
+
export var Link = function (_a) {
|
|
15
|
+
var children = _a.children, href = _a.href, onClick = _a.onClick, _b = _a.state, state = _b === void 0 ? 'default' : _b, _c = _a.theme, theme = _c === void 0 ? 'light' : _c, _d = _a.withRadio, withRadio = _d === void 0 ? false : _d, _e = _a.radioChecked, radioChecked = _e === void 0 ? false : _e, onRadioChange = _a.onRadioChange, _f = _a.className, className = _f === void 0 ? '' : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g;
|
|
16
|
+
var handleClick = function (e) {
|
|
17
|
+
if (disabled) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
22
|
+
};
|
|
23
|
+
var handleRadioChange = function (e) {
|
|
24
|
+
if (disabled)
|
|
25
|
+
return;
|
|
26
|
+
onRadioChange === null || onRadioChange === void 0 ? void 0 : onRadioChange(e.target.checked);
|
|
27
|
+
};
|
|
28
|
+
var getThemeClasses = function () {
|
|
29
|
+
var baseClasses = 'inline-flex items-center gap-3 transition-all duration-200';
|
|
30
|
+
switch (theme) {
|
|
31
|
+
case 'dark':
|
|
32
|
+
return "".concat(baseClasses, " text-white");
|
|
33
|
+
case 'teal':
|
|
34
|
+
return "".concat(baseClasses, " text-teal-600");
|
|
35
|
+
default: // light
|
|
36
|
+
return "".concat(baseClasses, " text-gray-700");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var getStateClasses = function () {
|
|
40
|
+
if (disabled) {
|
|
41
|
+
return 'opacity-50 cursor-not-allowed';
|
|
42
|
+
}
|
|
43
|
+
switch (state) {
|
|
44
|
+
case 'hover':
|
|
45
|
+
return 'hover:opacity-80';
|
|
46
|
+
case 'visited':
|
|
47
|
+
return theme === 'teal' ? 'text-cyan-400' : 'text-purple-600';
|
|
48
|
+
case 'focused':
|
|
49
|
+
return 'focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-current';
|
|
50
|
+
default:
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var getRadioClasses = function () {
|
|
55
|
+
var baseClasses = 'w-5 h-5 border-2 rounded-sm transition-all duration-200';
|
|
56
|
+
if (disabled) {
|
|
57
|
+
return "".concat(baseClasses, " border-gray-200 bg-gray-100");
|
|
58
|
+
}
|
|
59
|
+
switch (theme) {
|
|
60
|
+
case 'dark':
|
|
61
|
+
return "".concat(baseClasses, " border-white ").concat(radioChecked ? 'bg-transparent' : 'bg-transparent');
|
|
62
|
+
case 'teal':
|
|
63
|
+
return "".concat(baseClasses, " border-teal-600 ").concat(radioChecked ? 'bg-transparent' : 'bg-transparent');
|
|
64
|
+
default: // light
|
|
65
|
+
return "".concat(baseClasses, " border-gray-400 ").concat(radioChecked ? 'bg-transparent' : 'bg-transparent');
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var linkContent = (_jsx(Text, __assign({ as: "span", className: "underline ".concat(getThemeClasses(), " ").concat(getStateClasses(), " ").concat(className), onClick: handleClick }, { children: children })));
|
|
69
|
+
if (withRadio) {
|
|
70
|
+
return (_jsxs("label", __assign({ className: "inline-flex items-center gap-3 cursor-pointer" }, { children: [_jsx("input", { type: "radio", checked: radioChecked, onChange: handleRadioChange, disabled: disabled, className: getRadioClasses(), "aria-label": "S\u00E9lectionner ".concat(children) }), linkContent] })));
|
|
71
|
+
}
|
|
72
|
+
if (href) {
|
|
73
|
+
return (_jsx("a", __assign({ href: href, className: "".concat(getThemeClasses(), " ").concat(getStateClasses(), " ").concat(className), onClick: handleClick, "aria-disabled": disabled }, { children: children })));
|
|
74
|
+
}
|
|
75
|
+
return (_jsx("button", __assign({ type: "button", className: "".concat(getThemeClasses(), " ").concat(getStateClasses(), " ").concat(className), onClick: handleClick, disabled: disabled }, { children: children })));
|
|
76
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SelectedValueProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onRemove?: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
8
|
+
variant?: 'filled' | 'text';
|
|
9
|
+
}
|
|
10
|
+
declare const SelectedValue: React.FC<SelectedValueProps>;
|
|
11
|
+
export default SelectedValue;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Icon from '../Icon/Icon';
|
|
14
|
+
import { Text } from '../Typography/Typography';
|
|
15
|
+
var SelectedValue = function (_a) {
|
|
16
|
+
var value = _a.value, onRemove = _a.onRemove, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.iconSize, iconSize = _c === void 0 ? 'xs' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.variant, variant = _e === void 0 ? 'filled' : _e;
|
|
17
|
+
var handleRemove = function (event) {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
if (onRemove) {
|
|
20
|
+
onRemove();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var classes = "selected-value selected-value--".concat(size, " selected-value--").concat(variant, " ").concat(className).trim();
|
|
24
|
+
var getTextSize = function () {
|
|
25
|
+
return size; // Utilise directement la taille passée en prop
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs("div", __assign({ className: classes }, { children: [_jsx(Text, __assign({ size: getTextSize(), variant: "medium", leading: "4", className: "selected-value__text" }, { children: value })), variant !== 'text' && onRemove && (_jsx("button", __assign({ type: "button", className: "selected-value__remove", onClick: handleRemove, "aria-label": "Remove ".concat(value) }, { children: _jsx(Icon, { name: "close", size: iconSize, className: "selected-value__remove-icon" }) })))] })));
|
|
28
|
+
};
|
|
29
|
+
export default SelectedValue;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
var Spinner = function (_a) {
|
|
14
|
+
var _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, color = _a.color, _d = _a.speed, speed = _d === void 0 ? 'normal' : _d;
|
|
15
|
+
var getSizeClasses = function () {
|
|
16
|
+
switch (size) {
|
|
17
|
+
case 'xs': return 'w-3 h-3';
|
|
18
|
+
case 'sm': return 'w-4 h-4';
|
|
19
|
+
case 'md': return 'w-5 h-5';
|
|
20
|
+
case 'lg': return 'w-6 h-6';
|
|
21
|
+
case 'xl': return 'w-8 h-8';
|
|
22
|
+
default: return 'w-5 h-5';
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var getSpeedClasses = function () {
|
|
26
|
+
switch (speed) {
|
|
27
|
+
case 'slow': return 'animate-spin-slow';
|
|
28
|
+
case 'fast': return 'animate-spin-fast';
|
|
29
|
+
default: return 'animate-spin';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var sizeClasses = getSizeClasses();
|
|
33
|
+
var speedClasses = getSpeedClasses();
|
|
34
|
+
var colorClass = color ? "text-".concat(color) : 'text-current';
|
|
35
|
+
var classes = "".concat(sizeClasses, " ").concat(speedClasses, " ").concat(colorClass, " ").concat(className);
|
|
36
|
+
return (_jsxs("svg", __assign({ className: classes, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, { children: [_jsx("path", { d: "M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12Z", strokeOpacity: "0.25" }), _jsx("path", { d: "M21 12A9 9 0 0 0 3 12" })] })));
|
|
37
|
+
};
|
|
38
|
+
export default Spinner;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ButtonSpinnerProps {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'white';
|
|
6
|
+
}
|
|
7
|
+
declare const ButtonSpinner: React.FC<ButtonSpinnerProps>;
|
|
8
|
+
export default ButtonSpinner;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Spinner from '../Spinner';
|
|
3
|
+
var ButtonSpinner = function (_a) {
|
|
4
|
+
var _b = _a.size, size = _b === void 0 ? 'sm' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.variant, variant = _d === void 0 ? 'white' : _d;
|
|
5
|
+
var getVariantClass = function () {
|
|
6
|
+
switch (variant) {
|
|
7
|
+
case 'primary':
|
|
8
|
+
return 'text-white';
|
|
9
|
+
case 'secondary':
|
|
10
|
+
return 'text-gray-600';
|
|
11
|
+
case 'white':
|
|
12
|
+
return 'text-white';
|
|
13
|
+
default:
|
|
14
|
+
return 'text-white';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(Spinner, { size: size, speed: "fast", className: "".concat(getVariantClass(), " ").concat(className) }));
|
|
18
|
+
};
|
|
19
|
+
export default ButtonSpinner;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Spinner from '../Spinner';
|
|
3
|
+
var LoadingSpinner = function (_a) {
|
|
4
|
+
var _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
|
|
5
|
+
return (_jsx(Spinner, { size: size, speed: "normal", className: "text-blue-500 ".concat(className) }));
|
|
6
|
+
};
|
|
7
|
+
export default LoadingSpinner;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from '../Typography/Typography';
|
|
3
|
+
import './Tab.css';
|
|
4
|
+
type TextComponentProps = React.ComponentProps<typeof Text>;
|
|
5
|
+
export interface TabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
6
|
+
/** Textual content rendered inside the tab */
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** Whether the tab is currently active */
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
/** Visual style family for the tab */
|
|
11
|
+
variant?: 'inline' | 'outline';
|
|
12
|
+
/** Size token used by the selected variant */
|
|
13
|
+
size?: 'sm' | 'lg';
|
|
14
|
+
/** Typography variant when the tab is active */
|
|
15
|
+
activeTextVariant?: TextComponentProps['variant'];
|
|
16
|
+
/** Typography variant when the tab is inactive */
|
|
17
|
+
inactiveTextVariant?: TextComponentProps['variant'];
|
|
18
|
+
/** Typography size applied to the tab label */
|
|
19
|
+
textSize?: TextComponentProps['size'];
|
|
20
|
+
}
|
|
21
|
+
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export default Tab;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { Text } from '../Typography/Typography';
|
|
26
|
+
import './Tab.css';
|
|
27
|
+
var Tab = React.forwardRef(function (_a, ref) {
|
|
28
|
+
var children = _a.children, _b = _a.isActive, isActive = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.variant, variant = _e === void 0 ? 'inline' : _e, _f = _a.size, size = _f === void 0 ? 'lg' : _f, activeTextVariant = _a.activeTextVariant, inactiveTextVariant = _a.inactiveTextVariant, textSize = _a.textSize, rest = __rest(_a, ["children", "isActive", "disabled", "className", "variant", "size", "activeTextVariant", "inactiveTextVariant", "textSize"]);
|
|
29
|
+
var roleProp = rest.role, typeProp = rest.type, buttonRest = __rest(rest, ["role", "type"]);
|
|
30
|
+
var tabClasses = [
|
|
31
|
+
'tab',
|
|
32
|
+
"tab--variant-".concat(variant),
|
|
33
|
+
"tab--size-".concat(size),
|
|
34
|
+
isActive ? 'tab--active' : '',
|
|
35
|
+
disabled ? 'tab--disabled' : '',
|
|
36
|
+
className,
|
|
37
|
+
]
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.join(' ');
|
|
40
|
+
var defaultTypographyVariant = variant === 'outline' ? 'bold' : 'regular';
|
|
41
|
+
var resolvedActiveTextVariant = activeTextVariant !== null && activeTextVariant !== void 0 ? activeTextVariant : defaultTypographyVariant;
|
|
42
|
+
var resolvedInactiveTextVariant = inactiveTextVariant !== null && inactiveTextVariant !== void 0 ? inactiveTextVariant : defaultTypographyVariant;
|
|
43
|
+
var resolvedVariant = isActive
|
|
44
|
+
? resolvedActiveTextVariant
|
|
45
|
+
: resolvedInactiveTextVariant;
|
|
46
|
+
var resolvedTextSize = textSize !== null && textSize !== void 0 ? textSize : (variant === 'outline'
|
|
47
|
+
? 'base'
|
|
48
|
+
: size === 'lg'
|
|
49
|
+
? 'lg'
|
|
50
|
+
: 'base');
|
|
51
|
+
return (_jsx("button", __assign({}, buttonRest, { ref: ref, type: typeProp !== null && typeProp !== void 0 ? typeProp : 'button', role: roleProp !== null && roleProp !== void 0 ? roleProp : 'tab', "aria-selected": isActive, "aria-disabled": disabled || undefined, disabled: disabled, className: tabClasses }, { children: _jsx(Text, __assign({ as: "span", size: resolvedTextSize, variant: resolvedVariant, className: "tab__label" }, { children: children })) })));
|
|
52
|
+
});
|
|
53
|
+
Tab.displayName = 'Tab';
|
|
54
|
+
export default Tab;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface HeadingProps {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
4
|
+
variant?: 'light' | 'regular' | 'medium' | 'bold' | 'black';
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Heading: React.FC<HeadingProps>;
|
|
9
|
+
export default Heading;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
var Heading = function (_a) {
|
|
14
|
+
var _b = _a.size, size = _b === void 0 ? '3xl' : _b, _c = _a.variant, variant = _c === void 0 ? 'regular' : _c, children = _a.children, _d = _a.className, className = _d === void 0 ? '' : _d;
|
|
15
|
+
var sizeClass = "heading-".concat(size);
|
|
16
|
+
var variantClasses = {
|
|
17
|
+
light: "".concat(sizeClass, "--light"),
|
|
18
|
+
regular: "".concat(sizeClass, "--regular"),
|
|
19
|
+
medium: "".concat(sizeClass, "--medium"),
|
|
20
|
+
bold: "".concat(sizeClass, "--bold"),
|
|
21
|
+
black: "".concat(sizeClass, "--black")
|
|
22
|
+
};
|
|
23
|
+
return (_jsx("div", __assign({ className: "".concat(sizeClass, " ").concat(variantClasses[variant], " ").concat(className) }, { children: children })));
|
|
24
|
+
};
|
|
25
|
+
export default Heading;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TextProps {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'base' | 'lg' | 'xl';
|
|
4
|
+
variant?: 'light' | 'regular' | 'medium' | 'bold' | 'black';
|
|
5
|
+
leading?: 'none' | '4' | '5' | '6' | '7';
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Text: React.FC<TextProps>;
|
|
10
|
+
export default Text;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
var Text = function (_a) {
|
|
14
|
+
var _b = _a.size, size = _b === void 0 ? 'base' : _b, _c = _a.variant, variant = _c === void 0 ? 'regular' : _c, _d = _a.leading, leading = _d === void 0 ? 'none' : _d, children = _a.children, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
15
|
+
// Mapping précis pour coller aux classes déclarées dans typography.css
|
|
16
|
+
// xs: body-xs, body-xs-4, body-xs-5 (pas de "none")
|
|
17
|
+
// sm: body-sm-none, body-sm-5, body-sm-6
|
|
18
|
+
// md: body-md-none, body-md-6, body-md-7
|
|
19
|
+
// lg: body-lg-none, body-lg-6, body-lg-7
|
|
20
|
+
// base/xl: pas de suffixe de leading
|
|
21
|
+
var sizeClass;
|
|
22
|
+
switch (size) {
|
|
23
|
+
case 'xs': {
|
|
24
|
+
if (leading === '4' || leading === '5') {
|
|
25
|
+
sizeClass = "body-xs-".concat(leading);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
sizeClass = 'body-xs';
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case 'sm': {
|
|
33
|
+
if (leading === '5' || leading === '6') {
|
|
34
|
+
sizeClass = "body-sm-".concat(leading);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
sizeClass = 'body-sm-none';
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'md': {
|
|
42
|
+
if (leading === '6' || leading === '7') {
|
|
43
|
+
sizeClass = "body-md-".concat(leading);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
sizeClass = 'body-md-none';
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case 'lg': {
|
|
51
|
+
if (leading === '6' || leading === '7') {
|
|
52
|
+
sizeClass = "body-lg-".concat(leading);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
sizeClass = 'body-lg-none';
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case 'base':
|
|
60
|
+
sizeClass = 'body-base';
|
|
61
|
+
break;
|
|
62
|
+
case 'xl':
|
|
63
|
+
sizeClass = 'body-xl';
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
sizeClass = "body-".concat(size);
|
|
67
|
+
}
|
|
68
|
+
var variantClasses = {
|
|
69
|
+
light: "".concat(sizeClass, "--light"),
|
|
70
|
+
regular: "".concat(sizeClass, "--regular"),
|
|
71
|
+
medium: "".concat(sizeClass, "--medium"),
|
|
72
|
+
bold: "".concat(sizeClass, "--bold"),
|
|
73
|
+
black: "".concat(sizeClass, "--black")
|
|
74
|
+
};
|
|
75
|
+
return (_jsx("div", __assign({ className: "".concat(sizeClass, " ").concat(variantClasses[variant], " ").concat(className) }, { children: children })));
|
|
76
|
+
};
|
|
77
|
+
export default Text;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type BodyTokenSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
3
|
+
type BodySizeInput = BodyTokenSize | 'base' | 'xl';
|
|
4
|
+
type Variant = 'light' | 'regular' | 'medium' | 'bold' | 'black';
|
|
5
|
+
type Leading = 'none' | '4' | '5' | '6' | '7';
|
|
6
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
interface BaseProps {
|
|
8
|
+
variant?: Variant;
|
|
9
|
+
leading?: Leading;
|
|
10
|
+
className?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
onClick?: React.MouseEventHandler<Element>;
|
|
13
|
+
}
|
|
14
|
+
interface HeadingProps extends BaseProps {
|
|
15
|
+
level?: HeadingLevel;
|
|
16
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
17
|
+
}
|
|
18
|
+
interface TextProps extends BaseProps {
|
|
19
|
+
size?: BodySizeInput;
|
|
20
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
21
|
+
}
|
|
22
|
+
export declare const Heading: React.FC<HeadingProps>;
|
|
23
|
+
export declare const Text: React.FC<TextProps>;
|
|
24
|
+
export {};
|