allaw-ui 0.0.345 → 0.0.351

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.
@@ -1,11 +1,10 @@
1
1
  .backdrop {
2
- position: absolute;
2
+ position: fixed;
3
3
  top: 0;
4
4
  left: 0;
5
5
  height: 100vh;
6
6
  width: 100vw;
7
- background: linear-gradient(180deg, rgba(26, 50, 56, 0.00) 0%, rgba(2, 9, 11, 0.45) 100%);
8
- z-index: 1000;
7
+ z-index: 4500;
9
8
  }
10
9
 
11
10
  .baseFilter {
@@ -13,6 +12,11 @@
13
12
  width: fit-content;
14
13
  }
15
14
 
15
+ .smallOpenFilter{
16
+ position: relative;
17
+ width: fit-content;
18
+ }
19
+
16
20
  .options {
17
21
  position: absolute;
18
22
  top: 120%;
@@ -77,4 +81,91 @@
77
81
  .item:hover {
78
82
  background-color: #EFF2F5;
79
83
  border-left: 2px solid #25BEEB;
84
+ }
85
+
86
+ .optionsSmall {
87
+ position: fixed;
88
+ right: 0;
89
+ transition: bottom 225ms cubic-bezier(0, 0, 0.2, 1);
90
+ max-height: 90dvh;
91
+ background-color: white;
92
+ width: 100vw;
93
+ display: none;
94
+ border-radius: 8px 8px 0 0;
95
+ padding: 1rem;
96
+ flex-direction: column;
97
+ gap: 2rem;
98
+ }
99
+
100
+ .smallItem {
101
+ background: none;
102
+ border: none;
103
+ display: flex;
104
+ flex-direction: row-reverse;
105
+ align-items: center;
106
+ justify-content: space-between;
107
+ padding: 1.5rem 1rem;
108
+ cursor: pointer;
109
+ border-left: 2px solid #FFF;
110
+ width: 100%;
111
+ color: #0000;
112
+ border-top: 1px solid #e4edf6;
113
+ }
114
+
115
+ .smallItem:first-child {
116
+ border-top: none;
117
+ }
118
+
119
+ .smallItem > span {
120
+ text-wrap: nowrap;
121
+ font-family: var(--font-open-sans);
122
+ font-size: 14px;
123
+ font-weight: 500;
124
+ color: #000;
125
+ }
126
+
127
+ .choices {
128
+ display: flex;
129
+ flex-direction: column;
130
+ }
131
+
132
+ .closeButton {
133
+ height: fit-content;
134
+ border: none;
135
+ background: transparent;
136
+ cursor: pointer;
137
+ width: 20px;
138
+ display: flex;
139
+ align-items: center;
140
+ justify-content: center;
141
+ }
142
+
143
+ .closeButton > i {
144
+ font-size: 16px;
145
+ }
146
+
147
+ .row {
148
+ width: 100%;
149
+ height: fit-content;
150
+ display: flex;
151
+ flex-direction: row;
152
+ justify-content: space-between;
153
+ align-items: center;
154
+ gap: 1rem;
155
+ padding: 1rem 0.5rem;
156
+ }
157
+
158
+ @media screen and (max-width: 800px) {
159
+ .options {
160
+ display: none;
161
+ }
162
+
163
+ .optionsSmall {
164
+ z-index: 5000;
165
+ display: flex;
166
+ }
167
+
168
+ .backdrop {
169
+ background: linear-gradient(180deg, rgba(26, 50, 56, 0.00) 0%, rgba(2, 9, 11, 0.45) 100%);
170
+ }
80
171
  }
@@ -1,22 +1,17 @@
1
- import React from "react";
2
1
  import "./Basefiler.css";
2
+ import React from "react";
3
3
  export type FilterProps = {
4
- tooltipContent: string;
5
- tooltipId: string;
6
- showIcon: boolean;
7
- defaultSelectedValues?: string[];
4
+ defaultSelectedValue?: string;
8
5
  filterData: {
9
6
  value: string;
10
7
  name: string;
11
8
  }[];
12
- setFilters: any;
13
- multiselect?: boolean;
14
- iconName?: string;
15
- children?: any;
16
- props?: any;
9
+ setFilter: (selectedValue: string) => void;
10
+ children?: React.ReactNode;
17
11
  required?: boolean;
18
12
  showNumIndic?: boolean;
13
+ showBackdrop?: boolean;
19
14
  isStatusTag?: boolean;
20
15
  };
21
- declare function BaseFilter({ tooltipContent, tooltipId, showNumIndic, required, isStatusTag, defaultSelectedValues, filterData, multiselect, setFilters, showIcon, iconName, children, ...props }: FilterProps): React.JSX.Element;
16
+ declare const BaseFilter: ({ showNumIndic, required, defaultSelectedValue, filterData, setFilter, showBackdrop, children, ...props }: FilterProps) => React.JSX.Element;
22
17
  export default BaseFilter;
@@ -20,68 +20,51 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
- if (ar || !(i in from)) {
26
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
- ar[i] = from[i];
28
- }
29
- }
30
- return to.concat(ar || Array.prototype.slice.call(from));
31
- };
32
- import React, { useState } from "react";
33
23
  import "./Basefiler.css";
34
- import { AppointementStatusTag } from "../tags";
35
- import { FilterButtonPrimary } from "../buttons";
36
- function BaseFilter(_a) {
37
- var tooltipContent = _a.tooltipContent, tooltipId = _a.tooltipId, _b = _a.showNumIndic, showNumIndic = _b === void 0 ? true : _b, _c = _a.required, required = _c === void 0 ? true : _c, isStatusTag = _a.isStatusTag, defaultSelectedValues = _a.defaultSelectedValues, filterData = _a.filterData, _d = _a.multiselect, multiselect = _d === void 0 ? false : _d, setFilters = _a.setFilters, showIcon = _a.showIcon, iconName = _a.iconName, children = _a.children, props = __rest(_a, ["tooltipContent", "tooltipId", "showNumIndic", "required", "isStatusTag", "defaultSelectedValues", "filterData", "multiselect", "setFilters", "showIcon", "iconName", "children"]);
24
+ import { FilterButtonPrimary, PrimaryButton } from "../buttons";
25
+ import { TinyInfo } from "../typography";
26
+ import React, { useState } from "react";
27
+ var BaseFilter = function (_a) {
28
+ var _b = _a.showNumIndic, showNumIndic = _b === void 0 ? false : _b, _c = _a.required, required = _c === void 0 ? true : _c, defaultSelectedValue = _a.defaultSelectedValue, filterData = _a.filterData, setFilter = _a.setFilter, _d = _a.showBackdrop, showBackdrop = _d === void 0 ? false : _d, children = _a.children, props = __rest(_a, ["showNumIndic", "required", "defaultSelectedValue", "filterData", "setFilter", "showBackdrop", "children"]);
38
29
  var _e = useState(false), isOpen = _e[0], setIsOpen = _e[1];
39
- var _f = useState(defaultSelectedValues ? defaultSelectedValues : []), selectedValues = _f[0], setSelectedValues = _f[1];
30
+ var _f = useState(defaultSelectedValue || ""), selectedValue = _f[0], setSelectedValue = _f[1];
31
+ var handleClose = function () {
32
+ setFilter(selectedValue);
33
+ setIsOpen(false);
34
+ };
40
35
  var handleButtonTap = function () {
41
36
  isOpen ? handleClose() : setIsOpen(true);
42
37
  };
43
- var selectItem = function (value) {
44
- if (multiselect) {
45
- if (selectedValues &&
46
- selectedValues.length > 0 &&
47
- selectedValues.includes(value)) {
48
- if (required && selectedValues.length == 1) {
49
- return;
50
- }
51
- setSelectedValues(function (prevItems) {
52
- return prevItems.filter(function (item) { return item !== value; });
53
- });
54
- }
55
- else {
56
- setSelectedValues(function (prevItems) { return __spreadArray(__spreadArray([], prevItems, true), [value], false); });
57
- }
58
- }
59
- else {
60
- setSelectedValues(value);
61
- handleClose([value]);
62
- }
63
- };
64
- var handleClose = function (values) {
65
- setFilters(values ? values : selectedValues);
66
- setIsOpen(false);
67
- };
68
38
  var Item = function (_a) {
69
39
  var name = _a.name, value = _a.value;
70
- return (React.createElement("button", { className: "item", onClick: function () { return selectItem(value); } },
40
+ return (React.createElement("button", { className: "item", onClick: function () { setSelectedValue(value); handleClose(); } },
71
41
  React.createElement("div", { className: "round" },
72
- React.createElement("div", { className: (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(value))
73
- ? "selected"
74
- : "notSelected" })),
75
- isStatusTag ? (React.createElement(AppointementStatusTag, { status: value })) : (React.createElement("span", null, name))));
42
+ React.createElement("div", { className: selectedValue === value ? "selected" : "notSelected" })),
43
+ React.createElement("span", null, name)));
44
+ };
45
+ var SmallItem = function (_a) {
46
+ var name = _a.name, value = _a.value;
47
+ return (React.createElement("button", { className: "smallItem", onClick: function () { setSelectedValue(value); } },
48
+ React.createElement("div", { className: "round" },
49
+ React.createElement("div", { className: selectedValue === value ? "selected" : "notSelected" })),
50
+ React.createElement("span", null, name)));
76
51
  };
77
52
  return (React.createElement(React.Fragment, null,
78
53
  React.createElement("div", __assign({ className: "baseFilter" }, props),
79
- React.createElement(FilterButtonPrimary, { onClick: function () { return handleButtonTap(); }, zIndex: isOpen ? "2000" : "+1" },
54
+ React.createElement(FilterButtonPrimary, { onClick: handleButtonTap, zIndex: "2000" },
80
55
  children,
81
- React.createElement("p", { style: { color: "#25BEEB", fontWeight: "600" } }, showNumIndic && "(".concat(selectedValues.length, ")"))),
82
- isOpen && (React.createElement("div", { className: "options" }, filterData &&
83
- (filterData === null || filterData === void 0 ? void 0 : filterData.length) > 0 &&
84
- filterData.map(function (item, idx) { return (React.createElement(Item, { name: item === null || item === void 0 ? void 0 : item.name, value: item === null || item === void 0 ? void 0 : item.value, key: idx })); })))),
85
- isOpen && (React.createElement("div", { className: "backdrop", onClick: function () { return handleClose(); } }))));
86
- }
56
+ React.createElement("p", { style: { color: "#25BEEB", fontWeight: "600" } }, showNumIndic && "(".concat(selectedValue.length, ")"))),
57
+ isOpen && (React.createElement("div", { className: "options" }, filterData && filterData.length > 0 &&
58
+ filterData.map(function (item, idx) { return (React.createElement(Item, { name: item.name, value: item.value, key: idx })); }))),
59
+ React.createElement("div", { className: "optionsSmall", style: { bottom: isOpen ? "0" : "-100%" } },
60
+ React.createElement("div", { className: "row" },
61
+ React.createElement("div", { style: { minWidth: "20px" } }),
62
+ React.createElement(TinyInfo, { text: children, variant: "bold14", color: "noir" }),
63
+ React.createElement("button", { className: "closeButton", onClick: handleClose },
64
+ React.createElement("i", { className: "allaw-icon-close" }))),
65
+ React.createElement("div", { className: "choices" }, filterData && filterData.length > 0 &&
66
+ filterData.map(function (item, idx) { return (React.createElement(SmallItem, { name: item.name, value: item.value, key: idx })); })),
67
+ React.createElement(PrimaryButton, { label: "Voir les r\u00E9sultats", onClick: handleClose }))),
68
+ isOpen && (React.createElement("div", { className: "backdrop", onClick: handleClose }))));
69
+ };
87
70
  export default BaseFilter;
@@ -1,2 +1,2 @@
1
- export { default } from "./Filter";
1
+ export { default as Filter } from "./Filter";
2
2
  export type { FilterProps } from "./Filter";
@@ -1 +1 @@
1
- export { default } from "./Filter";
1
+ export { default as Filter } from "./Filter";
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { default as TabNavigation } from "./components/atoms/buttons/TabNavigati
10
10
  export { default as TertiaryButton } from "./components/atoms/buttons/TertiaryButton";
11
11
  export { default as OAuthProviderButton } from "./components/atoms/buttons/OAuthProviderButton";
12
12
  export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
13
- export { default as Filter } from "./components/atoms/filter/Filter";
13
+ export { default as BaseFilter } from "./components/atoms/filter/Filter";
14
14
  export { default as Input } from "./components/atoms/inputs/Input";
15
15
  export type { InputProps, InputRef } from "./components/atoms/inputs/Input";
16
16
  export { default as SearchBar } from "./components/atoms/inputs/SearchBar";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ export { default as OAuthProviderButton } from "./components/atoms/buttons/OAuth
14
14
  // Checkboxes
15
15
  export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
16
16
  // Checkboxes
17
- export { default as Filter } from "./components/atoms/filter/Filter";
17
+ export { default as BaseFilter } from "./components/atoms/filter/Filter";
18
18
  // Inputs
19
19
  export { default as Input } from "./components/atoms/inputs/Input";
20
20
  export { default as SearchBar } from "./components/atoms/inputs/SearchBar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "0.0.345",
3
+ "version": "0.0.351",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -40,6 +40,7 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
+ "allaw-ui": "^0.0.39",
43
44
  "next": "14.2.5",
44
45
  "react": "^17.0.0 || ^18.0.0",
45
46
  "react-dom": "^17.0.0 || ^18.0.0",
File without changes
File without changes