allaw-ui 2.9.7 → 2.9.9

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.
@@ -5,6 +5,26 @@
5
5
  row-gap: 1.5rem;
6
6
  }
7
7
 
8
+ /* Styles pour la taille small */
9
+ .tab-navigation.small {
10
+ width: 100%;
11
+ overflow-x: auto;
12
+ flex-wrap: nowrap;
13
+ white-space: nowrap;
14
+ justify-content: flex-start;
15
+ padding-bottom: 4px; /* Pour éviter que la barre de défilement ne coupe le contenu */
16
+ -ms-overflow-style: none; /* IE and Edge */
17
+ scrollbar-width: none; /* Firefox */
18
+ }
19
+
20
+ .tab-navigation.small::-webkit-scrollbar {
21
+ display: none; /* Cache la barre de défilement pour Chrome, Safari, etc. */
22
+ }
23
+
24
+ .tab-navigation.small .tab-item {
25
+ flex: 0 0 auto;
26
+ }
27
+
8
28
  .tab-navigation.small .tab-label {
9
29
  font-size: 14px;
10
30
  }
@@ -24,22 +44,48 @@
24
44
  position: relative;
25
45
  }
26
46
 
47
+ .tab-navigation.small .tab-item {
48
+ display: flex;
49
+ padding: 0px 12px 8px 12px;
50
+ justify-content: center;
51
+ align-items: center;
52
+ gap: 6px;
53
+ cursor: pointer;
54
+ position: relative;
55
+ }
56
+
27
57
  .tab-navigation.normal .tab-item.active {
28
58
  border-bottom: 3px solid #000;
29
59
  padding-bottom: 10px;
30
60
  color: var(--Primary-Mid-black, var(--primary-black, #171e25));
31
61
  }
32
62
 
63
+ .tab-navigation.small .tab-item.active {
64
+ border-bottom: 2px solid #000;
65
+ padding-bottom: 8px;
66
+ color: var(--Primary-Mid-black, var(--primary-black, #171e25));
67
+ }
68
+
33
69
  .tab-navigation.normal .tab-item.inactive {
34
70
  border-bottom: 3px solid var(--grey-venom, #e6edf5);
35
71
  color: var(--Tags-Mid-grey, var(--light-grey, #728ea7));
36
72
  }
37
73
 
74
+ .tab-navigation.small .tab-item.inactive {
75
+ border-bottom: 2px solid var(--grey-venom, #e6edf5);
76
+ color: var(--Tags-Mid-grey, var(--light-grey, #728ea7));
77
+ }
78
+
38
79
  .tab-navigation.normal .tab-item.inactive:hover {
39
80
  border-bottom: 3px solid var(--venom-grey-dark, #d1dce8);
40
81
  color: var(--Tags-Mid-grey, var(--dark-grey, #456073));
41
82
  }
42
83
 
84
+ .tab-navigation.small .tab-item.inactive:hover {
85
+ border-bottom: 2px solid var(--venom-grey-dark, #d1dce8);
86
+ color: var(--Tags-Mid-grey, var(--dark-grey, #456073));
87
+ }
88
+
43
89
  /* Style round */
44
90
  .tab-navigation.tab-navigation--round {
45
91
  padding: 4px;
@@ -58,6 +104,10 @@
58
104
  border-radius: 6px;
59
105
  }
60
106
 
107
+ .tab-navigation.tab-navigation--round.small .tab-item {
108
+ padding: 6px 12px;
109
+ }
110
+
61
111
  .tab-navigation.tab-navigation--round .tab-item.active {
62
112
  background: var(--dark-grey, #456073);
63
113
  color: var(--pure-white, #fff);
@@ -67,6 +117,12 @@
67
117
  border: 1px solid var(--dark-grey, #456073);
68
118
  }
69
119
 
120
+ .tab-navigation.tab-navigation--round.small .tab-item.active {
121
+ height: 28px;
122
+ padding: 8px 16px;
123
+ border-radius: 14px;
124
+ }
125
+
70
126
  .tab-navigation.tab-navigation--round .tab-item.active:hover {
71
127
  background: #3c5364;
72
128
  color: var(--pure-white, #fff);
@@ -81,13 +137,18 @@
81
137
  border: 1px solid var(--grey-venom, #e6edf5);
82
138
  }
83
139
 
140
+ .tab-navigation.tab-navigation--round.small .tab-item.inactive {
141
+ height: 28px;
142
+ padding: 8px 16px;
143
+ border-radius: 14px;
144
+ }
145
+
84
146
  .tab-navigation.tab-navigation--round .tab-item.inactive:hover {
85
147
  background: #e6edf5;
86
148
  }
87
149
 
88
150
  .tab-label {
89
151
  font-family: "Open Sans", sans-serif;
90
- font-size: 14px;
91
152
  font-style: normal;
92
153
  font-weight: 500;
93
154
  line-height: 1;
@@ -107,6 +168,17 @@
107
168
  top: 7px;
108
169
  }
109
170
 
171
+ .tab-navigation.small .tab-notification-dot {
172
+ top: 5px;
173
+ right: 8px;
174
+ width: 4px;
175
+ height: 4px;
176
+ }
177
+
110
178
  .tab-navigation.tab-navigation--round .tab-notification-dot {
111
179
  top: 15px;
112
180
  }
181
+
182
+ .tab-navigation.tab-navigation--round.small .tab-notification-dot {
183
+ top: 10px;
184
+ }
@@ -1,9 +1,27 @@
1
- import React from "react";
1
+ import React, { useRef, useEffect, useState } from "react";
2
2
  import "./TabNavigation.css";
3
3
  import "../../../styles/global.css";
4
4
  var TabNavigation = function (_a) {
5
5
  var tabs = _a.tabs, onTabClick = _a.onTabClick, _b = _a.size, size = _b === void 0 ? "normal" : _b, _c = _a.variant, variant = _c === void 0 ? "normal" : _c;
6
- return (React.createElement("div", { className: "tab-navigation ".concat(size, " ").concat(variant === "round" ? "tab-navigation--round" : "") }, tabs.map(function (tab, index) { return (React.createElement("div", { key: index, className: "tab-item ".concat(tab.isActive ? "active" : "inactive"), onClick: function () { return onTabClick(index); } },
6
+ var navRef = useRef(null);
7
+ var _d = useState(null), activeTabElement = _d[0], setActiveTabElement = _d[1];
8
+ // Scroll to active tab when it changes
9
+ useEffect(function () {
10
+ if (size === "small" && navRef.current && activeTabElement) {
11
+ var navWidth = navRef.current.offsetWidth;
12
+ var tabOffset = activeTabElement.offsetLeft;
13
+ var tabWidth = activeTabElement.offsetWidth;
14
+ // Center the active tab in the navigation
15
+ navRef.current.scrollLeft = tabOffset - navWidth / 2 + tabWidth / 2;
16
+ }
17
+ }, [activeTabElement, size]);
18
+ // Set active tab element reference
19
+ var setTabRef = function (element, isActive) {
20
+ if (element && isActive) {
21
+ setActiveTabElement(element);
22
+ }
23
+ };
24
+ return (React.createElement("div", { ref: navRef, className: "tab-navigation ".concat(size, " ").concat(variant === "round" ? "tab-navigation--round" : "") }, tabs.map(function (tab, index) { return (React.createElement("div", { key: index, ref: function (el) { return setTabRef(el, tab.isActive); }, className: "tab-item ".concat(tab.isActive ? "active" : "inactive"), onClick: function () { return onTabClick(index); } },
7
25
  React.createElement("span", { className: "tab-label" }, tab.label),
8
26
  tab.hasNotification && React.createElement("span", { className: "tab-notification-dot" }))); })));
9
27
  };
@@ -35,10 +35,45 @@ declare namespace _default {
35
35
  value: string;
36
36
  }[];
37
37
  }
38
+ namespace viewport {
39
+ namespace viewports {
40
+ namespace mobile {
41
+ let name: string;
42
+ namespace styles {
43
+ let width: string;
44
+ let height: string;
45
+ }
46
+ }
47
+ namespace tablet {
48
+ let name_1: string;
49
+ export { name_1 as name };
50
+ export namespace styles_1 {
51
+ let width_1: string;
52
+ export { width_1 as width };
53
+ let height_1: string;
54
+ export { height_1 as height };
55
+ }
56
+ export { styles_1 as styles };
57
+ }
58
+ namespace desktop {
59
+ let name_2: string;
60
+ export { name_2 as name };
61
+ export namespace styles_2 {
62
+ let width_2: string;
63
+ export { width_2 as width };
64
+ let height_2: string;
65
+ export { height_2 as height };
66
+ }
67
+ export { styles_2 as styles };
68
+ }
69
+ }
70
+ }
38
71
  }
39
72
  }
40
73
  export default _default;
41
74
  export const Default: any;
75
+ export const Small: any;
42
76
  export const Round: any;
43
77
  export const SmallRound: any;
78
+ export const ManyTabsSmall: any;
44
79
  import TabNavigation from "./TabNavigation";
@@ -45,6 +45,31 @@ export default {
45
45
  { name: "dark", value: "#171e25" },
46
46
  ],
47
47
  },
48
+ viewport: {
49
+ viewports: {
50
+ mobile: {
51
+ name: "Mobile",
52
+ styles: {
53
+ width: "375px",
54
+ height: "667px",
55
+ },
56
+ },
57
+ tablet: {
58
+ name: "Tablet",
59
+ styles: {
60
+ width: "768px",
61
+ height: "1024px",
62
+ },
63
+ },
64
+ desktop: {
65
+ name: "Desktop",
66
+ styles: {
67
+ width: "1280px",
68
+ height: "800px",
69
+ },
70
+ },
71
+ },
72
+ },
48
73
  },
49
74
  };
50
75
  var Template = function (args) { return React.createElement(TabNavigation, __assign({}, args)); };
@@ -60,7 +85,40 @@ Default.args = {
60
85
  size: "normal",
61
86
  variant: "normal",
62
87
  };
88
+ export var Small = Template.bind({});
89
+ Small.args = __assign(__assign({}, Default.args), { size: "small" });
90
+ Small.parameters = {
91
+ viewport: {
92
+ defaultViewport: "mobile",
93
+ },
94
+ };
63
95
  export var Round = Template.bind({});
64
96
  Round.args = __assign(__assign({}, Default.args), { variant: "round" });
65
97
  export var SmallRound = Template.bind({});
66
98
  SmallRound.args = __assign(__assign({}, Default.args), { size: "small", variant: "round" });
99
+ SmallRound.parameters = {
100
+ viewport: {
101
+ defaultViewport: "mobile",
102
+ },
103
+ };
104
+ // Démonstration avec beaucoup d'onglets pour montrer le défilement horizontal
105
+ export var ManyTabsSmall = Template.bind({});
106
+ ManyTabsSmall.args = {
107
+ tabs: [
108
+ { label: "Tous", isActive: true, hasNotification: false },
109
+ { label: "Notes", isActive: false, hasNotification: false },
110
+ { label: "Documents", isActive: false, hasNotification: true },
111
+ { label: "Factures", isActive: false, hasNotification: false },
112
+ { label: "Messages", isActive: false, hasNotification: false },
113
+ { label: "Contrats", isActive: false, hasNotification: false },
114
+ { label: "Clients", isActive: false, hasNotification: false },
115
+ ],
116
+ onTabClick: function (index) { return console.log("Tab ".concat(index, " cliqu\u00E9")); },
117
+ size: "small",
118
+ variant: "normal",
119
+ };
120
+ ManyTabsSmall.parameters = {
121
+ viewport: {
122
+ defaultViewport: "mobile",
123
+ },
124
+ };
@@ -9,6 +9,7 @@ export interface LinkProps {
9
9
  className?: string;
10
10
  onClick?: () => void;
11
11
  isUnderline?: boolean;
12
+ hasHoverColor?: boolean;
12
13
  }
13
14
  declare const Link: React.FC<LinkProps>;
14
15
  export default Link;
@@ -13,7 +13,7 @@ import React from "react";
13
13
  import styles from "./Link.module.css";
14
14
  import { convertToHtml } from "../../../utils/utils";
15
15
  var Link = function (_a) {
16
- var variant = _a.variant, color = _a.color, text = _a.text, maxLines = _a.maxLines, maxChars = _a.maxChars, _b = _a.size, size = _b === void 0 ? "default" : _b, className = _a.className, onClick = _a.onClick, _c = _a.isUnderline, isUnderline = _c === void 0 ? false : _c;
16
+ var variant = _a.variant, color = _a.color, text = _a.text, maxLines = _a.maxLines, maxChars = _a.maxChars, _b = _a.size, size = _b === void 0 ? "default" : _b, className = _a.className, onClick = _a.onClick, _c = _a.isUnderline, isUnderline = _c === void 0 ? false : _c, _d = _a.hasHoverColor, hasHoverColor = _d === void 0 ? false : _d;
17
17
  var truncateText = function (text, maxChars) {
18
18
  if (text.length <= maxChars)
19
19
  return text;
@@ -23,7 +23,7 @@ var Link = function (_a) {
23
23
  var truncatedText = maxChars ? truncateText(htmlText, maxChars) : htmlText;
24
24
  var isClickable = typeof onClick === "function";
25
25
  var colorClassName = color ? "color-".concat(color) : "";
26
- return (React.createElement("div", { className: "".concat(styles.link, " ").concat(styles[variant], " ").concat(size === "small" ? styles["link-small"] : "", " ").concat(className || "", " ").concat(isClickable ? styles.pointer : "", " ").concat(styles[colorClassName], " ").concat(isUnderline ? styles.underline : ""), style: __assign({ whiteSpace: "pre-line" }, (maxLines
26
+ return (React.createElement("div", { className: "".concat(styles.link, " ").concat(styles[variant], " ").concat(size === "small" ? styles["link-small"] : "", " ").concat(className || "", " ").concat(isClickable ? styles.pointer : "", " ").concat(styles[colorClassName], " ").concat(isUnderline ? styles.underline : "", " ").concat(hasHoverColor ? styles.hoverColor : ""), style: __assign({ whiteSpace: "pre-line" }, (maxLines
27
27
  ? {
28
28
  WebkitLineClamp: maxLines,
29
29
  display: "-webkit-box",
@@ -61,6 +61,17 @@
61
61
 
62
62
  .underline:hover {
63
63
  text-decoration: underline;
64
+ text-underline-offset: 5px;
65
+ text-decoration-thickness: 1px;
66
+ }
67
+
68
+ .hoverColor:hover {
69
+ color: var(--bleu-allaw, #25beeb) !important;
70
+ }
71
+
72
+ .hoverColor.underline:hover {
73
+ text-decoration: underline;
74
+ text-decoration-color: var(--bleu-allaw, #25beeb);
64
75
  text-underline-offset: 7px;
65
76
  text-decoration-thickness: 1px;
66
77
  }
@@ -36,6 +36,12 @@ declare namespace _default {
36
36
  export { control_4 as control };
37
37
  export let description: string;
38
38
  }
39
+ namespace hasHoverColor {
40
+ let control_5: string;
41
+ export { control_5 as control };
42
+ let description_1: string;
43
+ export { description_1 as description };
44
+ }
39
45
  namespace onClick {
40
46
  let action: string;
41
47
  }
@@ -61,4 +67,6 @@ export const MediumSmall: any;
61
67
  export const ClickableLink: any;
62
68
  export const UnderlinedLink: any;
63
69
  export const ClickableUnderlinedLink: any;
70
+ export const HoverColorLink: any;
71
+ export const HoverColorUnderlinedLink: any;
64
72
  import Link from "./Link";
@@ -42,6 +42,10 @@ export default {
42
42
  control: "boolean",
43
43
  description: "Ajoute un soulignement au survol",
44
44
  },
45
+ hasHoverColor: {
46
+ control: "boolean",
47
+ description: "Change la couleur du texte en bleu au survol",
48
+ },
45
49
  onClick: { action: "clicked" },
46
50
  },
47
51
  parameters: {
@@ -64,6 +68,7 @@ Bold.args = {
64
68
  text: "Open Sans - Bold - 16px",
65
69
  size: "default",
66
70
  isUnderline: false,
71
+ hasHoverColor: false,
67
72
  };
68
73
  export var SemiBold = Template.bind({});
69
74
  SemiBold.args = {
@@ -72,6 +77,7 @@ SemiBold.args = {
72
77
  text: "Open Sans - SemiBold - 16px",
73
78
  size: "default",
74
79
  isUnderline: false,
80
+ hasHoverColor: false,
75
81
  };
76
82
  export var Medium = Template.bind({});
77
83
  Medium.args = {
@@ -80,6 +86,7 @@ Medium.args = {
80
86
  text: "Open Sans - Medium - 16px",
81
87
  size: "default",
82
88
  isUnderline: false,
89
+ hasHoverColor: false,
83
90
  };
84
91
  export var BoldSmall = Template.bind({});
85
92
  BoldSmall.args = {
@@ -88,6 +95,7 @@ BoldSmall.args = {
88
95
  text: "Open Sans - Bold - 12px",
89
96
  size: "small",
90
97
  isUnderline: false,
98
+ hasHoverColor: false,
91
99
  };
92
100
  export var SemiBoldSmall = Template.bind({});
93
101
  SemiBoldSmall.args = {
@@ -96,6 +104,7 @@ SemiBoldSmall.args = {
96
104
  text: "Open Sans - SemiBold - 12px",
97
105
  size: "small",
98
106
  isUnderline: false,
107
+ hasHoverColor: false,
99
108
  };
100
109
  export var MediumSmall = Template.bind({});
101
110
  MediumSmall.args = {
@@ -104,6 +113,7 @@ MediumSmall.args = {
104
113
  text: "Open Sans - Medium - 12px",
105
114
  size: "small",
106
115
  isUnderline: false,
116
+ hasHoverColor: false,
107
117
  };
108
118
  export var ClickableLink = Template.bind({});
109
119
  ClickableLink.args = {
@@ -113,6 +123,7 @@ ClickableLink.args = {
113
123
  size: "small",
114
124
  onClick: function () { return console.log("Linke cliqué"); },
115
125
  isUnderline: false,
126
+ hasHoverColor: false,
116
127
  };
117
128
  export var UnderlinedLink = Template.bind({});
118
129
  UnderlinedLink.args = {
@@ -121,6 +132,7 @@ UnderlinedLink.args = {
121
132
  text: "Survolez-moi pour voir le soulignement",
122
133
  size: "default",
123
134
  isUnderline: true,
135
+ hasHoverColor: false,
124
136
  };
125
137
  export var ClickableUnderlinedLink = Template.bind({});
126
138
  ClickableUnderlinedLink.args = {
@@ -130,4 +142,23 @@ ClickableUnderlinedLink.args = {
130
142
  size: "small",
131
143
  onClick: function () { return console.log("Lien cliqué"); },
132
144
  isUnderline: true,
145
+ hasHoverColor: false,
146
+ };
147
+ export var HoverColorLink = Template.bind({});
148
+ HoverColorLink.args = {
149
+ variant: "semiBold",
150
+ color: "mid-grey",
151
+ text: "Survolez-moi pour changer la couleur",
152
+ size: "default",
153
+ isUnderline: false,
154
+ hasHoverColor: true,
155
+ };
156
+ export var HoverColorUnderlinedLink = Template.bind({});
157
+ HoverColorUnderlinedLink.args = {
158
+ variant: "semiBold",
159
+ color: "dark-grey",
160
+ text: "Survolez-moi pour changer la couleur et voir le soulignement",
161
+ size: "default",
162
+ isUnderline: true,
163
+ hasHoverColor: true,
133
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.9.7",
3
+ "version": "2.9.9",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",