allaw-ui 3.2.0 → 3.2.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/dist/components/atoms/selects/ComboBox.css +12 -0
- package/dist/components/atoms/selects/ComboBox.d.ts +1 -0
- package/dist/components/atoms/selects/ComboBox.js +11 -11
- package/dist/components/atoms/selects/ComboBox.stories.d.ts +22 -0
- package/dist/components/atoms/selects/ComboBox.stories.js +14 -0
- package/package.json +1 -1
|
@@ -15,6 +15,18 @@
|
|
|
15
15
|
color: var(--dark-grey, #456073);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
.combo-box-title-medium {
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.combo-box-title-semiBold {
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.combo-box-title-bold {
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
.combo-box-input-container {
|
|
19
31
|
display: flex;
|
|
20
32
|
align-items: center;
|
|
@@ -5,24 +5,24 @@ import TinyInfo from "../typography/TinyInfo";
|
|
|
5
5
|
import Paragraph from "../typography/Paragraph";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
function ComboBox(_a, ref) {
|
|
8
|
-
var items = _a.items, selectedItem = _a.selectedItem, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner..." : _b, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, _d = _a.showError, showError = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, onSelect = _a.onSelect, onChange = _a.onChange, onError = _a.onError, _f = _a.openOnMount, openOnMount = _f === void 0 ? true : _f, title = _a.title;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
8
|
+
var items = _a.items, selectedItem = _a.selectedItem, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner..." : _b, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, _d = _a.showError, showError = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, onSelect = _a.onSelect, onChange = _a.onChange, onError = _a.onError, _f = _a.openOnMount, openOnMount = _f === void 0 ? true : _f, title = _a.title, _g = _a.titleStyle, titleStyle = _g === void 0 ? "semiBold" : _g;
|
|
9
|
+
var _h = useState(openOnMount), isOpen = _h[0], setIsOpen = _h[1];
|
|
10
|
+
var _j = useState(""), inputValue = _j[0], setInputValue = _j[1];
|
|
11
|
+
var _k = useState(items), filteredItems = _k[0], setFilteredItems = _k[1];
|
|
12
|
+
var _l = useState(""), error = _l[0], setError = _l[1];
|
|
13
|
+
var _m = useState(false), isHovered = _m[0], setIsHovered = _m[1];
|
|
14
|
+
var _o = useState(-1), selectedIndex = _o[0], setSelectedIndex = _o[1];
|
|
15
15
|
var comboBoxRef = useRef(null);
|
|
16
16
|
var inputContainerRef = useRef(null);
|
|
17
17
|
var listRef = useRef(null);
|
|
18
18
|
var inputRef = useRef(null);
|
|
19
19
|
var chevronRef = useRef(null);
|
|
20
|
-
var
|
|
21
|
-
var
|
|
20
|
+
var _p = useState(true), isInputValid = _p[0], setIsInputValid = _p[1];
|
|
21
|
+
var _q = useState({
|
|
22
22
|
top: 0,
|
|
23
23
|
left: 0,
|
|
24
24
|
width: 0,
|
|
25
|
-
}), listPosition =
|
|
25
|
+
}), listPosition = _q[0], setListPosition = _q[1];
|
|
26
26
|
useEffect(function () {
|
|
27
27
|
if (selectedItem) {
|
|
28
28
|
var selectedItemData = items.find(function (item) { return item.value === selectedItem; });
|
|
@@ -150,7 +150,7 @@ function ComboBox(_a, ref) {
|
|
|
150
150
|
}, [isOpen, filteredItems, selectedIndex]);
|
|
151
151
|
return (React.createElement("div", { ref: comboBoxRef, className: "combo-box-container ".concat(isOpen ? "combo-box-pressed" : "", " ").concat(isHovered ? "combo-box-hovered" : ""), style: { width: "".concat(width, "%") }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
|
|
152
152
|
title && (React.createElement("div", { className: "combo-box-title-container" },
|
|
153
|
-
React.createElement(Paragraph, { variant:
|
|
153
|
+
React.createElement(Paragraph, { variant: titleStyle, color: "noir", text: title }),
|
|
154
154
|
isRequired && (React.createElement("span", { className: "combo-box-required" },
|
|
155
155
|
"\u00A0",
|
|
156
156
|
"*")))),
|
|
@@ -61,6 +61,26 @@ declare namespace _default {
|
|
|
61
61
|
export { control_6 as control };
|
|
62
62
|
}
|
|
63
63
|
export { title_1 as title };
|
|
64
|
+
export namespace titleStyle {
|
|
65
|
+
export let options: string[];
|
|
66
|
+
export namespace control_7 {
|
|
67
|
+
let type_7: string;
|
|
68
|
+
export { type_7 as type };
|
|
69
|
+
}
|
|
70
|
+
export { control_7 as control };
|
|
71
|
+
export let description: string;
|
|
72
|
+
export namespace table_1 {
|
|
73
|
+
export namespace type_8 {
|
|
74
|
+
let summary: string;
|
|
75
|
+
}
|
|
76
|
+
export { type_8 as type };
|
|
77
|
+
export namespace defaultValue {
|
|
78
|
+
let summary_1: string;
|
|
79
|
+
export { summary_1 as summary };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export { table_1 as table };
|
|
83
|
+
}
|
|
64
84
|
}
|
|
65
85
|
export namespace parameters {
|
|
66
86
|
namespace backgrounds {
|
|
@@ -91,4 +111,6 @@ export const Pressed: any;
|
|
|
91
111
|
export const Required: any;
|
|
92
112
|
export const CustomWidth: any;
|
|
93
113
|
export const OpenOnMount: any;
|
|
114
|
+
export const TitleMedium: any;
|
|
115
|
+
export const TitleBold: any;
|
|
94
116
|
import ComboBox from "./ComboBox";
|
|
@@ -63,6 +63,15 @@ export default {
|
|
|
63
63
|
type: "text",
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
|
+
titleStyle: {
|
|
67
|
+
options: ["medium", "semiBold", "bold"],
|
|
68
|
+
control: { type: "select" },
|
|
69
|
+
description: "Style du titre (graisse de police)",
|
|
70
|
+
table: {
|
|
71
|
+
type: { summary: "string" },
|
|
72
|
+
defaultValue: { summary: "semiBold" },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
66
75
|
},
|
|
67
76
|
parameters: {
|
|
68
77
|
backgrounds: {
|
|
@@ -111,6 +120,7 @@ Default.args = {
|
|
|
111
120
|
width: 100,
|
|
112
121
|
openOnMount: true,
|
|
113
122
|
title: "Sélectionnez une date",
|
|
123
|
+
titleStyle: "semiBold",
|
|
114
124
|
};
|
|
115
125
|
export var Pressed = Template.bind({});
|
|
116
126
|
Pressed.args = __assign(__assign({}, Default.args), { selectedItem: "lundi-12-aout" });
|
|
@@ -120,3 +130,7 @@ export var CustomWidth = Template.bind({});
|
|
|
120
130
|
CustomWidth.args = __assign(__assign({}, Default.args), { width: 50 });
|
|
121
131
|
export var OpenOnMount = Template.bind({});
|
|
122
132
|
OpenOnMount.args = __assign(__assign({}, Default.args), { openOnMount: true });
|
|
133
|
+
export var TitleMedium = Template.bind({});
|
|
134
|
+
TitleMedium.args = __assign(__assign({}, Default.args), { titleStyle: "medium" });
|
|
135
|
+
export var TitleBold = Template.bind({});
|
|
136
|
+
TitleBold.args = __assign(__assign({}, Default.args), { titleStyle: "bold" });
|