@portnet/ui 2.0.2 → 2.0.4

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.
@@ -13,15 +13,13 @@ require("core-js/modules/web.dom-collections.iterator.js");
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
  var _formik = require("formik");
16
- var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
17
16
  var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
18
- var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
19
17
  var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
20
- var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
21
18
  var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
22
19
  var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
23
- var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
24
- var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
20
+ var _styleUtils = require("../../../../config/styleUtils");
21
+ var _antd = require("antd");
22
+ var _icons = require("@ant-design/icons");
25
23
  var _jsxRuntime = require("react/jsx-runtime");
26
24
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -30,23 +28,55 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
30
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
29
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
32
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
33
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Container for search form and actions
31
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Ant Design imports
32
+ const {
33
+ Title,
34
+ Text
35
+ } = _antd.Typography;
36
+ const {
37
+ Panel
38
+ } = _antd.Collapse;
39
+
40
+ // Définition des styles locaux pour éviter les problèmes d'importation
41
+ const styles = {
42
+ colors: {
43
+ headerBackground: '#f5f8fa',
44
+ rowBackgroundOdd: '#ffffff',
45
+ rowBackgroundEven: '#F6F9FF',
46
+ borderLight: 'rgba(224, 224, 224, 0.3)',
47
+ borderMedium: 'rgba(224, 224, 224, 0.5)'
48
+ },
49
+ sizes: {
50
+ borderRadius: '8px'
51
+ }
52
+ };
53
+
54
+ // Container pour le formulaire de recherche avec design Ant
34
55
  const PuiStandardSearchPageContainer = _ref => {
35
56
  let {
36
57
  actions,
37
58
  children
38
59
  } = _ref;
39
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
40
- container: true,
41
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
42
- item: true,
43
- xs: 12,
44
- children: children
45
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
46
- item: true,
47
- xs: 12,
48
- children: actions
49
- })]
60
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Card, {
62
+ bodyStyle: {
63
+ padding: '16px',
64
+ backgroundColor: '#fff'
65
+ },
66
+ children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Divider, {
67
+ style: {
68
+ margin: '16px 0'
69
+ }
70
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Row, {
71
+ justify: "end",
72
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
73
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
74
+ size: "middle",
75
+ children: actions
76
+ })
77
+ })
78
+ })]
79
+ })
50
80
  });
51
81
  };
52
82
  const PuiSearchPage = _ref2 => {
@@ -68,13 +98,18 @@ const PuiSearchPage = _ref2 => {
68
98
  children,
69
99
  additionalActions,
70
100
  collapsibleSearchSection = true,
71
- // Collapsible by default
72
101
  alwaysVisibleFields = null,
73
- // Champs toujours visibles
74
- collapsibleFields = null // Champs collapsibles
102
+ collapsibleFields = null
75
103
  } = _ref2;
76
104
  const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
77
105
 
106
+ // Ensure tableProps is properly initialized
107
+ (0, _react.useEffect)(() => {
108
+ if (!tableProps) {
109
+ console.warn('tableProps is undefined in PuiSearchPage');
110
+ }
111
+ }, [tableProps]);
112
+
78
113
  // Si des champs spécifiques sont définis comme collapsibles
79
114
  const hasCollapsibleFields = collapsibleFields !== null;
80
115
  // Si des champs sont toujours visibles
@@ -115,27 +150,47 @@ const PuiSearchPage = _ref2 => {
115
150
  const renderToggleButton = () => {
116
151
  if (!hasCollapsibleFields) return null;
117
152
  if (isSearchSectionExpanded) {
118
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
119
- item: true,
120
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
121
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}),
122
- onClick: toggleSearchSection,
123
- color: "tertiary",
124
- children: "Moins d'options"
125
- })
153
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
154
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {}),
155
+ onClick: toggleSearchSection,
156
+ type: "link",
157
+ children: "Moins d'options"
126
158
  });
127
159
  } else {
128
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
129
- item: true,
130
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
131
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}),
132
- onClick: toggleSearchSection,
133
- color: "tertiary",
134
- children: "Plus d'options"
135
- })
160
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
161
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {}),
162
+ onClick: toggleSearchSection,
163
+ type: "link",
164
+ children: "Plus d'options"
136
165
  });
137
166
  }
138
167
  };
168
+
169
+ // Fonction sécurisée pour appeler une action
170
+ const handleAction = (action, row) => {
171
+ if (typeof action === 'function') {
172
+ return action(row);
173
+ }
174
+ console.warn('Action is not a function', action);
175
+ };
176
+
177
+ // Vérification de sécurité pour tableProps
178
+ const safeTableProps = tableProps || {
179
+ rows: [],
180
+ columns: []
181
+ };
182
+
183
+ // Calcul du titre du panel de recherche avec l'icône
184
+ const searchPanelHeader = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
185
+ onClick: collapsibleSearchSection ? toggleSearchSection : undefined,
186
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space, {
187
+ align: "center",
188
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SettingOutlined, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Text, {
189
+ strong: true,
190
+ children: "Param\xE8tres de recherche"
191
+ }), collapsibleSearchSection && (isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {}))]
192
+ })
193
+ });
139
194
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
140
195
  title: title,
141
196
  titleIcon: titleIcon,
@@ -146,114 +201,89 @@ const PuiSearchPage = _ref2 => {
146
201
  loading: loading,
147
202
  retour: retour,
148
203
  onRetour: onRetour,
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
150
- title: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
151
- onClick: collapsibleSearchSection ? toggleSearchSection : undefined,
152
- style: {
153
- display: "flex",
154
- alignItems: "center",
155
- cursor: collapsibleSearchSection ? "pointer" : "default"
156
- },
157
- children: [collapsibleSearchSection && (isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
158
- style: {
159
- marginLeft: collapsibleSearchSection ? "8px" : "0px"
160
- },
161
- children: "Param\xE8tres de recherche"
162
- })]
163
- }),
164
- sx: {
165
- marginBottom: 2
204
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Collapse, {
205
+ defaultActiveKey: ['searchPanel'],
206
+ ghost: true,
207
+ expandIconPosition: "end",
208
+ style: {
209
+ marginBottom: 16
166
210
  },
167
- children: shouldRenderSearchContent() && (formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
168
- initialValues: {}
169
- }, formikProps), {}, {
170
- children: _ref3 => {
171
- let {
172
- resetForm,
173
- submitForm
174
- } = _ref3;
175
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
176
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
177
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
178
- container: true,
179
- justifyContent: "end",
180
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
181
- item: true,
182
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
183
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
184
- type: "effacer",
185
- size: "small"
186
- }),
187
- onClick: resetForm,
188
- color: "tertiary",
189
- children: "Effacer"
190
- })
191
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
192
- item: true,
193
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
194
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
195
- type: "rechercher",
196
- size: "small"
197
- }),
198
- onClick: submitForm,
199
- loadingPosition: "start",
200
- children: "Rechercher"
201
- })
202
- }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
203
- item: true,
204
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
205
- startIcon: actionItem.icon,
206
- onClick: actionItem.action,
207
- children: actionItem.name
208
- })
209
- }, index)), hasCollapsibleFields && renderToggleButton()]
210
- }),
211
- children: renderSearchFields()
212
- })
213
- });
214
- }
215
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
216
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
217
- container: true,
218
- justifyContent: "end",
219
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
220
- item: true,
221
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
222
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
223
- type: "effacer",
224
- size: "small"
225
- }),
226
- onClick: onReset,
227
- color: "tertiary",
228
- children: "Effacer"
229
- })
230
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
231
- item: true,
232
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
233
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
234
- type: "rechercher",
235
- size: "small"
236
- }),
237
- onClick: onSubmit,
238
- loadingPosition: "start",
239
- children: "Rechercher"
240
- })
241
- }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
242
- item: true,
243
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
244
- startIcon: actionItem.icon,
245
- onClick: actionItem.action,
246
- children: actionItem.name
247
- })
248
- }, index)), hasCollapsibleFields && renderToggleButton()]
249
- }),
250
- children: renderSearchFields()
211
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Panel, {
212
+ header: searchPanelHeader,
213
+ children: shouldRenderSearchContent() && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
214
+ children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
215
+ initialValues: (formikProps === null || formikProps === void 0 ? void 0 : formikProps.initialValues) || {}
216
+ }, formikProps), {}, {
217
+ children: _ref3 => {
218
+ let {
219
+ resetForm,
220
+ submitForm
221
+ } = _ref3;
222
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
223
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
224
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
225
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
226
+ title: "Effacer",
227
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
228
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ClearOutlined, {}),
229
+ onClick: resetForm,
230
+ children: "Effacer"
231
+ })
232
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
233
+ title: "Rechercher",
234
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
235
+ type: "primary",
236
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SearchOutlined, {}),
237
+ onClick: submitForm,
238
+ loading: loading,
239
+ children: "Rechercher"
240
+ })
241
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
242
+ icon: actionItem.icon,
243
+ onClick: () => handleAction(actionItem.action),
244
+ children: actionItem.name
245
+ }, index)), hasCollapsibleFields && renderToggleButton()]
246
+ }),
247
+ children: renderSearchFields()
248
+ })
249
+ });
250
+ }
251
+ })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
252
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
253
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
254
+ title: "Effacer",
255
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
256
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ClearOutlined, {}),
257
+ onClick: onReset,
258
+ children: "Effacer"
259
+ })
260
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
261
+ title: "Rechercher",
262
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
263
+ type: "primary",
264
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SearchOutlined, {}),
265
+ onClick: onSubmit,
266
+ loading: loading,
267
+ children: "Rechercher"
268
+ })
269
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
270
+ icon: actionItem.icon,
271
+ onClick: () => handleAction(actionItem.action),
272
+ children: actionItem.name
273
+ }, index)), hasCollapsibleFields && renderToggleButton()]
274
+ }),
275
+ children: renderSearchFields()
276
+ })
277
+ })
278
+ }, "searchPanel")
279
+ }), tableProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Card, {
280
+ style: {
281
+ marginTop: 16
282
+ },
283
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({}, tableProps), {}, {
284
+ loading: loading
251
285
  }))
252
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({
253
- paginationMode: "server"
254
- }, tableProps), {}, {
255
- pinnedColumns: tableProps.pinnedColumns // Added pinnedColumns
256
- }))]
286
+ })]
257
287
  });
258
288
  };
259
289
  PuiSearchPage.propTypes = {
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _styles = require("@mui/material/styles");
9
+ var _CssBaseline = _interopRequireDefault(require("@mui/material/CssBaseline"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _theme = require("./theme");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ /**
15
+ * Fournisseur de thème pour l'application
16
+ * Enveloppe les composants avec le thème personnalisé
17
+ */const ThemeProvider = _ref => {
18
+ let {
19
+ children
20
+ } = _ref;
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledEngineProvider, {
22
+ injectFirst: true,
23
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ThemeProvider, {
24
+ theme: _theme.theme,
25
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CssBaseline.default, {}), children]
26
+ })
27
+ });
28
+ };
29
+ ThemeProvider.propTypes = {
30
+ children: _propTypes.default.node.isRequired
31
+ };
32
+ var _default = exports.default = ThemeProvider;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/esnext.iterator.constructor.js");
4
+ require("core-js/modules/esnext.iterator.filter.js");
5
+ require("core-js/modules/esnext.iterator.for-each.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.getStripedRowStyles = exports.getLoadingStyles = exports.getHeaderStyles = exports.getFormElementStyles = exports.getContainerStyles = exports.getActionStyles = exports.applyImprovedStyles = void 0;
10
+ var _theme = require("./theme");
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // styleUtils.js - Utilitaires pour appliquer les styles communs à différents composants
16
+ /**
17
+ * Génère des styles pour les éléments de type conteneur (Card, Paper, Section, etc.)
18
+ */
19
+ const getContainerStyles = exports.getContainerStyles = function getContainerStyles() {
20
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
+ return _objectSpread({
22
+ borderRadius: _theme.commonStyles.sizes.borderRadius,
23
+ border: "1px solid ".concat(_theme.commonStyles.colors.borderMedium),
24
+ boxShadow: _theme.commonStyles.shadows.elevation,
25
+ overflow: 'hidden'
26
+ }, additionalStyles);
27
+ };
28
+
29
+ /**
30
+ * Génère des styles pour les en-têtes de composants
31
+ */
32
+ const getHeaderStyles = exports.getHeaderStyles = function getHeaderStyles() {
33
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34
+ return _objectSpread({
35
+ backgroundColor: _theme.commonStyles.colors.headerBackground,
36
+ padding: '12px 16px',
37
+ fontWeight: 600,
38
+ fontSize: _theme.commonStyles.typography.fontSizeMedium,
39
+ textTransform: 'uppercase',
40
+ letterSpacing: _theme.commonStyles.typography.letterSpacing,
41
+ borderBottom: "1px solid ".concat(_theme.commonStyles.colors.borderLight),
42
+ minHeight: _theme.commonStyles.sizes.headerHeight,
43
+ display: 'flex',
44
+ alignItems: 'center'
45
+ }, additionalStyles);
46
+ };
47
+
48
+ /**
49
+ * Génère des styles pour les boutons et éléments d'action
50
+ */
51
+ const getActionStyles = exports.getActionStyles = function getActionStyles() {
52
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
+ return _objectSpread({
54
+ borderRadius: '4px',
55
+ transition: _theme.commonStyles.transitions.hover,
56
+ fontSize: _theme.commonStyles.typography.fontSizeDefault,
57
+ padding: '6px 12px',
58
+ textTransform: 'none'
59
+ }, additionalStyles);
60
+ };
61
+
62
+ /**
63
+ * Génère des styles pour les lignes alternées (données tabulaires, listes, etc.)
64
+ */
65
+ const getStripedRowStyles = exports.getStripedRowStyles = function getStripedRowStyles() {
66
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
67
+ return _objectSpread({
68
+ transition: _theme.commonStyles.transitions.hover,
69
+ '&:nth-of-type(odd)': {
70
+ backgroundColor: _theme.commonStyles.colors.rowBackgroundOdd
71
+ },
72
+ '&:nth-of-type(even)': {
73
+ backgroundColor: _theme.commonStyles.colors.rowBackgroundEven
74
+ },
75
+ '&:hover': {
76
+ backgroundColor: _theme.commonStyles.colors.hoverBackground,
77
+ boxShadow: "inset 0 0 0 1px ".concat(_theme.commonStyles.colors.borderFocus)
78
+ }
79
+ }, additionalStyles);
80
+ };
81
+
82
+ /**
83
+ * Génère des styles pour les éléments de formulaire
84
+ */
85
+ const getFormElementStyles = exports.getFormElementStyles = function getFormElementStyles() {
86
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
+ return _objectSpread({
88
+ fontSize: _theme.commonStyles.typography.fontSizeDefault,
89
+ borderRadius: _theme.commonStyles.sizes.borderRadius,
90
+ '&:focus': {
91
+ boxShadow: "0 0 0 2px ".concat(_theme.commonStyles.colors.borderFocus)
92
+ }
93
+ }, additionalStyles);
94
+ };
95
+
96
+ /**
97
+ * Génère des styles pour les états de chargement
98
+ */
99
+ const getLoadingStyles = exports.getLoadingStyles = function getLoadingStyles() {
100
+ let additionalStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
101
+ return _objectSpread({
102
+ animation: 'fadeIn 0.3s ease-in-out',
103
+ '@keyframes fadeIn': {
104
+ '0%': {
105
+ opacity: 0.7
106
+ },
107
+ '100%': {
108
+ opacity: 1
109
+ }
110
+ }
111
+ }, additionalStyles);
112
+ };
113
+
114
+ /**
115
+ * Utilitaire pour appliquer les styles améliorés à un composant styled existant
116
+ */
117
+ const applyImprovedStyles = (originalStyles, componentType) => {
118
+ switch (componentType) {
119
+ case 'container':
120
+ return _objectSpread(_objectSpread({}, originalStyles), getContainerStyles());
121
+ case 'header':
122
+ return _objectSpread(_objectSpread({}, originalStyles), getHeaderStyles());
123
+ case 'action':
124
+ return _objectSpread(_objectSpread({}, originalStyles), getActionStyles());
125
+ case 'row':
126
+ return _objectSpread(_objectSpread({}, originalStyles), getStripedRowStyles());
127
+ case 'form':
128
+ return _objectSpread(_objectSpread({}, originalStyles), getFormElementStyles());
129
+ case 'loading':
130
+ return _objectSpread(_objectSpread({}, originalStyles), getLoadingStyles());
131
+ default:
132
+ return originalStyles;
133
+ }
134
+ };
135
+ exports.applyImprovedStyles = applyImprovedStyles;