allaw-ui 4.2.1 → 4.2.3
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/dist/components/molecules/modal/Modal.d.ts +1 -0
- package/dist/components/molecules/modal/Modal.js +2 -2
- package/dist/components/molecules/segmentedControl/SegmentedControl.d.ts +20 -0
- package/dist/components/molecules/segmentedControl/SegmentedControl.js +128 -0
- package/dist/components/molecules/segmentedControl/index.d.ts +2 -0
- package/dist/components/molecules/segmentedControl/index.js +1 -0
- package/dist/components/molecules/segmentedControl/segmentedControl.module.css +112 -0
- package/dist/components/molecules/segmentedControl/segmentedControl.stories.d.ts +70 -0
- package/dist/components/molecules/segmentedControl/segmentedControl.stories.js +185 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
|
26
26
|
import Heading from "../../atoms/typography/Heading";
|
|
27
27
|
import Paragraph from "../../atoms/typography/Paragraph";
|
|
28
28
|
var Modal = function (_a) {
|
|
29
|
-
var show = _a.show, title = _a.title, description = _a.description, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, onConfirm = _a.onConfirm, onCancel = _a.onCancel, _b = _a.isDanger, isDanger = _b === void 0 ? false : _b, _c = _a.confirmIconName, confirmIconName = _c === void 0 ? "allaw-icon-check" : _c, imageConfig = _a.imageConfig, children = _a.children, customContent = _a.customContent, renderContent = _a.renderContent, maxWidthConfig = _a.maxWidthConfig, verticalOffset = _a.verticalOffset, horizontalOffset = _a.horizontalOffset;
|
|
29
|
+
var show = _a.show, title = _a.title, description = _a.description, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, onConfirm = _a.onConfirm, onCancel = _a.onCancel, _b = _a.isDanger, isDanger = _b === void 0 ? false : _b, _c = _a.confirmIconName, confirmIconName = _c === void 0 ? "allaw-icon-check" : _c, imageConfig = _a.imageConfig, children = _a.children, customContent = _a.customContent, renderContent = _a.renderContent, maxWidthConfig = _a.maxWidthConfig, verticalOffset = _a.verticalOffset, horizontalOffset = _a.horizontalOffset, confirmDisabled = _a.confirmDisabled;
|
|
30
30
|
var _d = useState(false), isVisible = _d[0], setIsVisible = _d[1];
|
|
31
31
|
var _e = useState(false), imgError = _e[0], setImgError = _e[1];
|
|
32
32
|
var portalContainerRef = useRef(null);
|
|
@@ -106,7 +106,7 @@ var Modal = function (_a) {
|
|
|
106
106
|
React.createElement("img", { src: imageConfig.url, alt: imageConfig.alt || "", width: imageConfig.width, height: imageConfig.height, onError: handleImageError, className: style.modalImage })))),
|
|
107
107
|
React.createElement("footer", { className: style.modalFooter },
|
|
108
108
|
cancelLabel && (React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true })),
|
|
109
|
-
React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, startIconName: confirmIconName, startIcon: true }))));
|
|
109
|
+
React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, startIconName: confirmIconName, startIcon: true, disabled: confirmDisabled }))));
|
|
110
110
|
};
|
|
111
111
|
// Générer les styles pour la largeur maximale responsive
|
|
112
112
|
var getMaxWidthStyles = function () {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Option {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
shortLabel?: string;
|
|
6
|
+
icon?: React.ReactNode | ((size: number) => React.ReactNode) | string;
|
|
7
|
+
iconClass?: string;
|
|
8
|
+
iconSize?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SegmentedControlProps {
|
|
11
|
+
options: Option[];
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (id: string) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
size?: "sm" | "md" | "lg";
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const SegmentedControl: React.FC<SegmentedControlProps>;
|
|
20
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import React, { useRef, useEffect } from "react";
|
|
11
|
+
import styles from "./segmentedControl.module.css";
|
|
12
|
+
var MAX_OPTIONS = 5;
|
|
13
|
+
var minWidths = { sm: 56, md: 80, lg: 104 };
|
|
14
|
+
var SegmentedControl = function (_a) {
|
|
15
|
+
var options = _a.options, value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.fullWidth, fullWidth = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? "" : _e;
|
|
16
|
+
var displayedOptions = options.length > MAX_OPTIONS
|
|
17
|
+
? (console.warn("SegmentedControl: maximum 5 options supportées. Les options supplémentaires seront ignorées."),
|
|
18
|
+
options.slice(0, MAX_OPTIONS))
|
|
19
|
+
: options;
|
|
20
|
+
var containerRef = useRef(null);
|
|
21
|
+
var segmentRefs = useRef([]);
|
|
22
|
+
var _f = React.useState(false), vertical = _f[0], setVertical = _f[1];
|
|
23
|
+
var _g = React.useState(displayedOptions.findIndex(function (o) { return o.id === value; })), focusIndex = _g[0], setFocusIndex = _g[1];
|
|
24
|
+
var _h = React.useState(function () {
|
|
25
|
+
return displayedOptions.map(function () { return false; });
|
|
26
|
+
}), showShortLabel = _h[0], setShowShortLabel = _h[1];
|
|
27
|
+
// Responsive: vertical si largeur < 480px et !fullWidth
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
if (!fullWidth) {
|
|
30
|
+
var handleResize_1 = function () {
|
|
31
|
+
setVertical(window.innerWidth < 400);
|
|
32
|
+
};
|
|
33
|
+
handleResize_1();
|
|
34
|
+
window.addEventListener("resize", handleResize_1);
|
|
35
|
+
return function () { return window.removeEventListener("resize", handleResize_1); };
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
setVertical(false);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}, [fullWidth]);
|
|
42
|
+
// ResizeObserver pour chaque segment (label court/long)
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (typeof window === "undefined" || !window.ResizeObserver)
|
|
45
|
+
return;
|
|
46
|
+
var observers = [];
|
|
47
|
+
displayedOptions.forEach(function (_, i) {
|
|
48
|
+
var el = segmentRefs.current[i];
|
|
49
|
+
if (!el)
|
|
50
|
+
return;
|
|
51
|
+
var observer = new ResizeObserver(function (entries) {
|
|
52
|
+
var _loop_1 = function (entry) {
|
|
53
|
+
var minWidth = minWidths[size];
|
|
54
|
+
setShowShortLabel(function (prev) {
|
|
55
|
+
var next = __spreadArray([], prev, true);
|
|
56
|
+
next[i] = entry.contentRect.width < minWidth;
|
|
57
|
+
return next;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
61
|
+
var entry = entries_1[_i];
|
|
62
|
+
_loop_1(entry);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
observer.observe(el);
|
|
66
|
+
observers.push(observer);
|
|
67
|
+
});
|
|
68
|
+
return function () { return observers.forEach(function (o) { return o.disconnect(); }); };
|
|
69
|
+
}, [displayedOptions, size]);
|
|
70
|
+
// Gestion clavier
|
|
71
|
+
var handleKeyDown = function (e) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if (disabled)
|
|
74
|
+
return;
|
|
75
|
+
var idx = focusIndex;
|
|
76
|
+
if (e.key === "ArrowRight" || (vertical && e.key === "ArrowDown")) {
|
|
77
|
+
idx = (idx + 1) % displayedOptions.length;
|
|
78
|
+
setFocusIndex(idx);
|
|
79
|
+
(_a = segmentRefs.current[idx]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
}
|
|
82
|
+
else if (e.key === "ArrowLeft" || (vertical && e.key === "ArrowUp")) {
|
|
83
|
+
idx = (idx - 1 + displayedOptions.length) % displayedOptions.length;
|
|
84
|
+
setFocusIndex(idx);
|
|
85
|
+
(_b = segmentRefs.current[idx]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
else if (e.key === " " || e.key === "Enter") {
|
|
89
|
+
onChange(displayedOptions[idx].id);
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
// Focus cyclique/tabIndex
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
setFocusIndex(displayedOptions.findIndex(function (o) { return o.id === value; }));
|
|
96
|
+
}, [value, displayedOptions]);
|
|
97
|
+
return (React.createElement("div", { ref: containerRef, className: [
|
|
98
|
+
styles.container,
|
|
99
|
+
vertical ? styles.vertical : "",
|
|
100
|
+
fullWidth ? styles.fullWidth : "",
|
|
101
|
+
className,
|
|
102
|
+
]
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.join(" "), role: "radiogroup", "aria-disabled": disabled, tabIndex: -1, onKeyDown: handleKeyDown }, displayedOptions.map(function (opt, i) { return (React.createElement("button", { key: opt.id, ref: function (el) { return (segmentRefs.current[i] = el); }, type: "button", className: [
|
|
105
|
+
styles.segment,
|
|
106
|
+
styles[size],
|
|
107
|
+
value === opt.id ? styles.selected : "",
|
|
108
|
+
disabled ? styles.disabled : "",
|
|
109
|
+
focusIndex === i ? styles.focus : "",
|
|
110
|
+
]
|
|
111
|
+
.filter(Boolean)
|
|
112
|
+
.join(" "), role: "radio", "aria-checked": value === opt.id, tabIndex: value === opt.id ? 0 : -1, disabled: disabled, onClick: function () { return !disabled && onChange(opt.id); } },
|
|
113
|
+
opt.icon && (React.createElement("span", { className: styles["segmented-control-icon"], style: { fontSize: opt.iconSize || 24 } }, typeof opt.icon === "function" ? (opt.icon(opt.iconSize || 24)) : typeof opt.icon === "string" ? (opt.icon === "allaw-icon-google" ? (React.createElement("span", { className: "allaw-icon-google" },
|
|
114
|
+
React.createElement("span", { className: "path1" }),
|
|
115
|
+
React.createElement("span", { className: "path2" }),
|
|
116
|
+
React.createElement("span", { className: "path3" }),
|
|
117
|
+
React.createElement("span", { className: "path4" }))) : opt.icon === "allaw-icon-google-calendar" ? (React.createElement("span", { className: "allaw-icon-google-calendar" },
|
|
118
|
+
React.createElement("span", { className: "path1" }),
|
|
119
|
+
React.createElement("span", { className: "path2" }),
|
|
120
|
+
React.createElement("span", { className: "path3" }),
|
|
121
|
+
React.createElement("span", { className: "path4" }),
|
|
122
|
+
React.createElement("span", { className: "path5" }),
|
|
123
|
+
React.createElement("span", { className: "path6" }),
|
|
124
|
+
React.createElement("span", { className: "path7" }),
|
|
125
|
+
React.createElement("span", { className: "path8" }))) : opt.icon.startsWith("allaw-icon-") ? (React.createElement("i", { className: opt.icon })) : null) : (opt.icon))),
|
|
126
|
+
React.createElement("span", { className: styles["segmented-control-label"] }, showShortLabel[i] && opt.shortLabel ? opt.shortLabel : opt.label))); })));
|
|
127
|
+
};
|
|
128
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SegmentedControl } from "./SegmentedControl";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
gap: 0;
|
|
5
|
+
background: #f6f7fa;
|
|
6
|
+
border: 1px solid #e6e8ec;
|
|
7
|
+
border-radius: 14px;
|
|
8
|
+
padding: 2px;
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.segment {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: flex-start;
|
|
16
|
+
border: 1.5px solid transparent;
|
|
17
|
+
outline: none;
|
|
18
|
+
background: transparent;
|
|
19
|
+
color: #7d8597;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-size: 16px;
|
|
22
|
+
height: 48px;
|
|
23
|
+
padding: 0 24px;
|
|
24
|
+
border-radius: 12px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
transition: background 150ms, color 150ms, box-shadow 150ms, border 150ms;
|
|
27
|
+
position: relative;
|
|
28
|
+
z-index: 1;
|
|
29
|
+
box-shadow: none;
|
|
30
|
+
user-select: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.selected {
|
|
34
|
+
background: #fff;
|
|
35
|
+
color: #171e25;
|
|
36
|
+
box-shadow: 0 2px 8px 0 rgba(31, 41, 55, 0.06);
|
|
37
|
+
border: 1.5px solid #e6e8ec;
|
|
38
|
+
z-index: 2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.segment:not(.selected):hover:not(.disabled) {
|
|
42
|
+
background: rgba(230, 232, 236, 0.18);
|
|
43
|
+
color: #171e25;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.focus {
|
|
47
|
+
/* outline: 2px solid #25beeb; */
|
|
48
|
+
outline-offset: 0;
|
|
49
|
+
border-radius: 12px;
|
|
50
|
+
z-index: 3;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.disabled {
|
|
54
|
+
opacity: 0.5;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vertical {
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
border-radius: 12px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Tailles */
|
|
65
|
+
.sm {
|
|
66
|
+
height: 32px;
|
|
67
|
+
padding: 0 12px;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
}
|
|
70
|
+
.md {
|
|
71
|
+
height: 48px;
|
|
72
|
+
padding: 0 20px;
|
|
73
|
+
font-size: 16px;
|
|
74
|
+
}
|
|
75
|
+
.lg {
|
|
76
|
+
height: 48px;
|
|
77
|
+
padding: 0 28px;
|
|
78
|
+
font-size: 18px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.fullWidth {
|
|
82
|
+
width: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.segmented-control-icon {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
margin-right: 10px;
|
|
89
|
+
color: inherit;
|
|
90
|
+
font-size: 18px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.segmented-control-label {
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
color: inherit;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media (max-width: 400px) {
|
|
101
|
+
.container {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
width: 100%;
|
|
105
|
+
flex-wrap: nowrap;
|
|
106
|
+
border-radius: 14px;
|
|
107
|
+
}
|
|
108
|
+
.segment {
|
|
109
|
+
width: 100%;
|
|
110
|
+
border-radius: 14px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export let title: string;
|
|
3
|
+
export { SegmentedControl as component };
|
|
4
|
+
export let tags: string[];
|
|
5
|
+
export namespace argTypes {
|
|
6
|
+
namespace size {
|
|
7
|
+
namespace control {
|
|
8
|
+
let type: string;
|
|
9
|
+
let options: string[];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
namespace fullWidth {
|
|
13
|
+
let control_1: string;
|
|
14
|
+
export { control_1 as control };
|
|
15
|
+
}
|
|
16
|
+
namespace disabled {
|
|
17
|
+
let control_2: string;
|
|
18
|
+
export { control_2 as control };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default _default;
|
|
23
|
+
export const Small: any;
|
|
24
|
+
export const Medium: any;
|
|
25
|
+
export const Large: any;
|
|
26
|
+
export const FullWidth: any;
|
|
27
|
+
export const Disabled: any;
|
|
28
|
+
export function Responsive(args: any): React.JSX.Element;
|
|
29
|
+
export namespace Responsive {
|
|
30
|
+
namespace args {
|
|
31
|
+
export { baseOptions as options };
|
|
32
|
+
export let value: string;
|
|
33
|
+
let size_1: string;
|
|
34
|
+
export { size_1 as size };
|
|
35
|
+
let fullWidth_1: boolean;
|
|
36
|
+
export { fullWidth_1 as fullWidth };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const CalendarIcons: any;
|
|
40
|
+
export const ContentWidth: any;
|
|
41
|
+
export const Default: any;
|
|
42
|
+
export function ResponsiveColumn(args: any): React.JSX.Element;
|
|
43
|
+
export namespace ResponsiveColumn {
|
|
44
|
+
export namespace args_1 {
|
|
45
|
+
let options_1: {
|
|
46
|
+
id: string;
|
|
47
|
+
label: string;
|
|
48
|
+
icon: string;
|
|
49
|
+
iconSize: number;
|
|
50
|
+
shortLabel: string;
|
|
51
|
+
}[];
|
|
52
|
+
export { options_1 as options };
|
|
53
|
+
let value_1: string;
|
|
54
|
+
export { value_1 as value };
|
|
55
|
+
let size_2: string;
|
|
56
|
+
export { size_2 as size };
|
|
57
|
+
let fullWidth_2: boolean;
|
|
58
|
+
export { fullWidth_2 as fullWidth };
|
|
59
|
+
}
|
|
60
|
+
export { args_1 as args };
|
|
61
|
+
}
|
|
62
|
+
import SegmentedControl from "./SegmentedControl";
|
|
63
|
+
import React from "react";
|
|
64
|
+
declare const baseOptions: {
|
|
65
|
+
id: string;
|
|
66
|
+
label: string;
|
|
67
|
+
icon: string;
|
|
68
|
+
iconSize: number;
|
|
69
|
+
shortLabel: string;
|
|
70
|
+
}[];
|
|
@@ -0,0 +1,185 @@
|
|
|
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 React, { useState } from "react";
|
|
13
|
+
import SegmentedControl from "./SegmentedControl";
|
|
14
|
+
import "../../../styles/global.css";
|
|
15
|
+
export default {
|
|
16
|
+
title: "Components/Molecules/SegmentedControl",
|
|
17
|
+
component: SegmentedControl,
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
argTypes: {
|
|
20
|
+
size: { control: { type: "select", options: ["sm", "md", "lg"] } },
|
|
21
|
+
fullWidth: { control: "boolean" },
|
|
22
|
+
disabled: { control: "boolean" },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
var baseOptions = [
|
|
26
|
+
{
|
|
27
|
+
id: "google",
|
|
28
|
+
label: "Google",
|
|
29
|
+
icon: "allaw-icon-google",
|
|
30
|
+
iconSize: 24,
|
|
31
|
+
shortLabel: "G",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "linkedin",
|
|
35
|
+
label: "LinkedIn",
|
|
36
|
+
icon: "allaw-icon-linkedin",
|
|
37
|
+
iconSize: 24,
|
|
38
|
+
shortLabel: "In",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "user",
|
|
42
|
+
label: "Utilisateur",
|
|
43
|
+
icon: "allaw-icon-user",
|
|
44
|
+
iconSize: 24,
|
|
45
|
+
shortLabel: "U",
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
var calendarOptions = [
|
|
49
|
+
{
|
|
50
|
+
id: "googlecal",
|
|
51
|
+
label: "Google Calendar",
|
|
52
|
+
icon: "allaw-icon-google-calendar",
|
|
53
|
+
iconSize: 24,
|
|
54
|
+
shortLabel: "GCal",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "microsoft",
|
|
58
|
+
label: "Microsoft",
|
|
59
|
+
icon: "allaw-icon-microsoft",
|
|
60
|
+
iconSize: 24,
|
|
61
|
+
shortLabel: "MS",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "user",
|
|
65
|
+
label: "Utilisateur",
|
|
66
|
+
icon: "allaw-icon-user",
|
|
67
|
+
iconSize: 24,
|
|
68
|
+
shortLabel: "U",
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
var Template = function (args) {
|
|
72
|
+
var _a = useState(args.value || args.options[0].id), value = _a[0], setValue = _a[1];
|
|
73
|
+
return React.createElement(SegmentedControl, __assign({}, args, { value: value, onChange: setValue }));
|
|
74
|
+
};
|
|
75
|
+
export var Small = Template.bind({});
|
|
76
|
+
Small.args = {
|
|
77
|
+
options: baseOptions,
|
|
78
|
+
value: "google",
|
|
79
|
+
size: "sm",
|
|
80
|
+
};
|
|
81
|
+
export var Medium = Template.bind({});
|
|
82
|
+
Medium.args = {
|
|
83
|
+
options: baseOptions,
|
|
84
|
+
value: "linkedin",
|
|
85
|
+
size: "md",
|
|
86
|
+
};
|
|
87
|
+
export var Large = Template.bind({});
|
|
88
|
+
Large.args = {
|
|
89
|
+
options: baseOptions,
|
|
90
|
+
value: "user",
|
|
91
|
+
size: "lg",
|
|
92
|
+
};
|
|
93
|
+
export var FullWidth = Template.bind({});
|
|
94
|
+
FullWidth.args = {
|
|
95
|
+
options: baseOptions,
|
|
96
|
+
value: "google",
|
|
97
|
+
size: "md",
|
|
98
|
+
fullWidth: true,
|
|
99
|
+
};
|
|
100
|
+
export var Disabled = Template.bind({});
|
|
101
|
+
Disabled.args = {
|
|
102
|
+
options: baseOptions,
|
|
103
|
+
value: "google",
|
|
104
|
+
size: "md",
|
|
105
|
+
disabled: true,
|
|
106
|
+
};
|
|
107
|
+
export var Responsive = function (args) {
|
|
108
|
+
var _a = useState(args.value || args.options[0].id), value = _a[0], setValue = _a[1];
|
|
109
|
+
return (React.createElement("div", { style: { maxWidth: 280, border: "1px dashed #ccc", padding: 8 } },
|
|
110
|
+
React.createElement(SegmentedControl, __assign({}, args, { value: value, onChange: setValue }))));
|
|
111
|
+
};
|
|
112
|
+
Responsive.args = {
|
|
113
|
+
options: baseOptions,
|
|
114
|
+
value: "google",
|
|
115
|
+
size: "md",
|
|
116
|
+
fullWidth: false,
|
|
117
|
+
};
|
|
118
|
+
export var CalendarIcons = Template.bind({});
|
|
119
|
+
CalendarIcons.args = {
|
|
120
|
+
options: calendarOptions,
|
|
121
|
+
value: "googlecal",
|
|
122
|
+
size: "md",
|
|
123
|
+
};
|
|
124
|
+
export var ContentWidth = Template.bind({});
|
|
125
|
+
ContentWidth.args = {
|
|
126
|
+
options: baseOptions,
|
|
127
|
+
value: "google",
|
|
128
|
+
size: "md",
|
|
129
|
+
fullWidth: false,
|
|
130
|
+
};
|
|
131
|
+
export var Default = Template.bind({});
|
|
132
|
+
Default.args = {
|
|
133
|
+
options: [
|
|
134
|
+
{
|
|
135
|
+
id: "googlecal",
|
|
136
|
+
label: "Google Calendar",
|
|
137
|
+
icon: "allaw-icon-google-calendar",
|
|
138
|
+
iconSize: 24,
|
|
139
|
+
shortLabel: "GCal",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: "microsoft",
|
|
143
|
+
label: "Microsoft Outlook",
|
|
144
|
+
icon: "allaw-icon-microsoft-outlook",
|
|
145
|
+
iconSize: 24,
|
|
146
|
+
shortLabel: "Outlook",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
value: "googlecal",
|
|
150
|
+
size: "md",
|
|
151
|
+
fullWidth: false,
|
|
152
|
+
};
|
|
153
|
+
export var ResponsiveColumn = function (args) {
|
|
154
|
+
var _a = React.useState(args.value || args.options[0].id), value = _a[0], setValue = _a[1];
|
|
155
|
+
return (React.createElement("div", { style: { maxWidth: 350, border: "1px dashed #ccc", padding: 8 } },
|
|
156
|
+
React.createElement(SegmentedControl, __assign({}, args, { value: value, onChange: setValue }))));
|
|
157
|
+
};
|
|
158
|
+
ResponsiveColumn.args = {
|
|
159
|
+
options: [
|
|
160
|
+
{
|
|
161
|
+
id: "googlecal",
|
|
162
|
+
label: "Google Calendar",
|
|
163
|
+
icon: "allaw-icon-google-calendar",
|
|
164
|
+
iconSize: 24,
|
|
165
|
+
shortLabel: "GCal",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "microsoft",
|
|
169
|
+
label: "Microsoft Outlook",
|
|
170
|
+
icon: "allaw-icon-microsoft-outlook",
|
|
171
|
+
iconSize: 24,
|
|
172
|
+
shortLabel: "Outlook",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "user",
|
|
176
|
+
label: "Utilisateur",
|
|
177
|
+
icon: "allaw-icon-user",
|
|
178
|
+
iconSize: 24,
|
|
179
|
+
shortLabel: "U",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
value: "googlecal",
|
|
183
|
+
size: "md",
|
|
184
|
+
fullWidth: false,
|
|
185
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { default as Button, default as PrimaryButton, } from "./components/atoms
|
|
|
12
12
|
export { default as SecondaryButton } from "./components/atoms/buttons/SecondaryButton";
|
|
13
13
|
export { default as TabNavigation } from "./components/atoms/buttons/TabNavigation";
|
|
14
14
|
export { default as TertiaryButton } from "./components/atoms/buttons/TertiaryButton";
|
|
15
|
+
export { default as SegmentedControl } from "./components/molecules/segmentedControl/SegmentedControl";
|
|
16
|
+
export type { SegmentedControlProps } from "./components/molecules/segmentedControl/SegmentedControl";
|
|
15
17
|
export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
|
|
16
18
|
export { default as Fitler } from "./components/atoms/filter/Filter";
|
|
17
19
|
export { default as Input } from "./components/atoms/inputs/Input";
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { default as Button, default as PrimaryButton, } from "./components/atoms
|
|
|
12
12
|
export { default as SecondaryButton } from "./components/atoms/buttons/SecondaryButton";
|
|
13
13
|
export { default as TabNavigation } from "./components/atoms/buttons/TabNavigation";
|
|
14
14
|
export { default as TertiaryButton } from "./components/atoms/buttons/TertiaryButton";
|
|
15
|
+
export { default as SegmentedControl } from "./components/molecules/segmentedControl/SegmentedControl";
|
|
15
16
|
// Checkboxes
|
|
16
17
|
export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
|
|
17
18
|
// Fitler
|