@portnet/ui 0.1.33 → 0.1.34

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,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.symbol.description.js");
3
4
  require("core-js/modules/es.weak-map.js");
4
- require("core-js/modules/web.dom-collections.iterator.js");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- require("core-js/modules/es.symbol.description.js");
10
- var _formik = require("formik");
9
+ require("core-js/modules/web.dom-collections.iterator.js");
10
+ var _react = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var React = _interopRequireWildcard(require("react"));
12
+ var _formik = require("formik");
13
13
  var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
14
14
  var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
15
15
  var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
@@ -17,15 +17,18 @@ var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
17
17
  var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
18
18
  var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
19
19
  var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
20
+ var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
21
+ var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
20
22
  var _jsxRuntime = require("react/jsx-runtime");
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
24
  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); }
22
25
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
26
  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; }
25
27
  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; }
26
28
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
29
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
28
- 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); }
30
+ 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); } // Arrow for collapsed state
31
+ // Arrow for expanded state
29
32
  const PuiStandardSearchPageContainer = _ref => {
30
33
  let {
31
34
  actions,
@@ -61,8 +64,13 @@ const PuiSearchPage = _ref2 => {
61
64
  onReset,
62
65
  onSubmit,
63
66
  children: _children,
64
- additionalActions
67
+ additionalActions,
68
+ collapsibleSearchSection = false // Collapsible by default
65
69
  } = _ref2;
70
+ const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(true);
71
+ const toggleSearchSection = () => {
72
+ setSearchSectionExpanded(prev => !prev);
73
+ };
66
74
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
67
75
  title: title,
68
76
  titleIcon: titleIcon,
@@ -74,98 +82,109 @@ const PuiSearchPage = _ref2 => {
74
82
  retour: retour,
75
83
  onRetour: onRetour,
76
84
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
77
- title: "Param\xE8tres de recherche",
85
+ title: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
86
+ onClick: toggleSearchSection,
87
+ style: {
88
+ display: "flex",
89
+ alignItems: "center",
90
+ cursor: "pointer" // Cursor changes to indicate clickability
91
+ },
92
+ children: [isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
93
+ style: {
94
+ marginLeft: "8px"
95
+ },
96
+ children: "Param\xE8tres de recherche"
97
+ }), " "]
98
+ }),
78
99
  sx: {
79
100
  marginBottom: 2
80
101
  },
81
- children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
82
- initialValues: {}
83
- }, formikProps), {}, {
84
- children: _ref3 => {
85
- let {
86
- resetForm,
87
- submitForm
88
- } = _ref3;
89
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
91
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
92
- container: true,
93
- justifyContent: "end",
94
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
95
- item: true,
96
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
97
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
98
- type: "effacer",
99
- size: "small"
100
- }),
101
- onClick: resetForm,
102
- color: "tertiary",
103
- children: "Effacer"
104
- })
105
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
106
- item: true,
107
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
108
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
109
- type: "rechercher",
110
- size: "small"
111
- }),
112
- onClick: submitForm,
113
- loadingPosition: "start",
114
- children: "Rechercher"
115
- })
116
- }), additionalActions && additionalActions.map((actionItem, index) => {
117
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
102
+ children: isSearchSectionExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
103
+ children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
104
+ initialValues: {}
105
+ }, formikProps), {}, {
106
+ children: _ref3 => {
107
+ let {
108
+ resetForm,
109
+ submitForm
110
+ } = _ref3;
111
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
112
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
113
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
114
+ container: true,
115
+ justifyContent: "end",
116
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
117
+ item: true,
118
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
119
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
120
+ type: "effacer",
121
+ size: "small"
122
+ }),
123
+ onClick: resetForm,
124
+ color: "tertiary",
125
+ children: "Effacer"
126
+ })
127
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
128
+ item: true,
129
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
130
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
131
+ type: "rechercher",
132
+ size: "small"
133
+ }),
134
+ onClick: submitForm,
135
+ loadingPosition: "start",
136
+ children: "Rechercher"
137
+ })
138
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
118
139
  item: true,
119
140
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
120
141
  startIcon: actionItem.icon,
121
142
  onClick: actionItem.action,
122
143
  children: actionItem.name
123
144
  })
124
- }, index);
125
- })]
126
- }),
127
- children: _children
128
- })
129
- });
130
- }
131
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
132
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
133
- container: true,
134
- justifyContent: "end",
135
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
136
- item: true,
137
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
138
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
139
- type: "effacer",
140
- size: "small"
141
- }),
142
- onClick: onReset,
143
- color: "tertiary",
144
- children: "Effacer"
145
- })
146
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
147
- item: true,
148
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
149
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
150
- type: "rechercher",
151
- size: "small"
152
- }),
153
- onClick: onSubmit,
154
- loadingPosition: "start",
155
- children: "Rechercher"
156
- })
157
- }), additionalActions && additionalActions.map((actionItem, index) => {
158
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
145
+ }, index))]
146
+ }),
147
+ children: _children
148
+ })
149
+ });
150
+ }
151
+ })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
152
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
153
+ container: true,
154
+ justifyContent: "end",
155
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
156
+ item: true,
157
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
158
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
159
+ type: "effacer",
160
+ size: "small"
161
+ }),
162
+ onClick: onReset,
163
+ color: "tertiary",
164
+ children: "Effacer"
165
+ })
166
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
167
+ item: true,
168
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
169
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
170
+ type: "rechercher",
171
+ size: "small"
172
+ }),
173
+ onClick: onSubmit,
174
+ loadingPosition: "start",
175
+ children: "Rechercher"
176
+ })
177
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
159
178
  item: true,
160
179
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
161
180
  startIcon: actionItem.icon,
162
181
  onClick: actionItem.action,
163
182
  children: actionItem.name
164
183
  })
165
- }, index);
166
- })]
167
- }),
168
- children: _children
184
+ }, index))]
185
+ }),
186
+ children: _children
187
+ })
169
188
  })
170
189
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
171
190
  paginationMode: "server"
@@ -191,11 +210,13 @@ PuiSearchPage.propTypes = {
191
210
  name: _propTypes.default.string.isRequired,
192
211
  action: _propTypes.default.func.isRequired,
193
212
  icon: _propTypes.default.element
194
- }))
213
+ })),
214
+ collapsibleSearchSection: _propTypes.default.bool // New prop with default value
195
215
  };
196
216
  PuiSearchPage.defaultProps = {
197
217
  formik: true,
198
218
  loading: false,
199
- additionalActions: []
219
+ additionalActions: [],
220
+ collapsibleSearchSection: false // Collapsible by default
200
221
  };
201
222
  var _default = exports.default = PuiSearchPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",