@portnet/ui 2.0.8 → 2.0.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.
@@ -9,81 +9,106 @@ Object.defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
11
  exports.default = void 0;
12
- var _material = require("@mui/material");
13
- var _styles = require("@mui/material/styles");
12
+ var _react = _interopRequireWildcard(require("react"));
14
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
- var React = _interopRequireWildcard(require("react"));
14
+ var _antd = require("antd");
16
15
  var _apperance = require("../../config/apperance");
17
- var _styleUtils = require("../../config/styleUtils");
18
16
  var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
18
  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); }
20
19
  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 && {}.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; }
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
20
  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; }
23
21
  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; }
24
22
  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; }
25
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
26
- 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); }
27
- const StyledMuiPaper = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Paper, _objectSpread({
28
- ref: ref
29
- }, props))))(() => {
30
- return {
31
- "&.MuiPaper-root": _objectSpread({}, (0, _styleUtils.getContainerStyles)({
32
- position: "relative",
33
- backgroundColor: _apperance.palette.gray.light
34
- }))
35
- };
36
- });
37
- const PuiSection = /*#__PURE__*/React.forwardRef((_ref, ref) => {
24
+ 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); } // Style CSS personnalisé pour la section
25
+ const sectionStyles = "\n .pui-section {\n position: relative;\n border-radius: 8px;\n background-color: #f5f5f5;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);\n overflow: visible;\n margin-top: 20px; /* Espace ajust\xE9 pour le titre flottant */\n transition: all 0.3s ease-in-out;\n }\n \n .pui-section:hover {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);\n transform: translateY(-1px);\n }\n \n .pui-section .ant-card-head {\n position: relative;\n min-height: 0;\n padding: 0;\n border-bottom: none;\n }\n \n .pui-section .ant-card-head-title {\n padding: 0;\n }\n \n .pui-section-title {\n position: absolute;\n top: -16px;\n left: 16px;\n padding: 4px 12px;\n background: linear-gradient(145deg, #ffffff, #f8f8f8);\n border-radius: 6px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n z-index: 1;\n display: inline-block;\n line-height: 1.2;\n transition: all 0.2s ease;\n border-left: 3px solid ".concat(_apperance.palette.primary, ";\n }\n \n .pui-section:hover .pui-section-title {\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);\n }\n \n .pui-section .ant-card-body {\n padding: 20px;\n padding-top: 28px; /* Espacement suppl\xE9mentaire pour le titre */\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n \n .pui-section-h1 { \n font-size: 20px; \n font-weight: 600; \n color: rgba(0, 0, 0, 0.85);\n }\n \n .pui-section-h2 { \n font-size: 18px; \n font-weight: 600; \n color: rgba(0, 0, 0, 0.85);\n }\n \n .pui-section-h3 { \n font-size: 16px; \n font-weight: 600; \n color: rgba(0, 0, 0, 0.85);\n }\n \n .pui-section-h4 { \n font-size: 14px; \n font-weight: 500; \n color: rgba(0, 0, 0, 0.8);\n }\n \n .pui-section-h5 { \n font-size: 13px; \n font-weight: 500; \n color: rgba(0, 0, 0, 0.8);\n }\n \n .pui-section-h6 { \n font-size: 12px; \n font-weight: 500; \n color: rgba(0, 0, 0, 0.8);\n }\n \n /* Bordure color\xE9e selon la variante */\n .pui-section-primary .pui-section-title {\n border-left: 3px solid ").concat(_apperance.palette.primary, ";\n }\n \n .pui-section-success .pui-section-title {\n border-left: 3px solid ").concat(_apperance.palette.success, ";\n }\n \n .pui-section-warning .pui-section-title {\n border-left: 3px solid ").concat(_apperance.palette.warning, ";\n }\n \n .pui-section-error .pui-section-title {\n border-left: 3px solid ").concat(_apperance.palette.error, ";\n }\n \n .pui-section-info .pui-section-title {\n border-left: 3px solid ").concat(_apperance.palette.info, ";\n }\n \n /* Style compact */\n .pui-section-compact {\n margin-top: 16px;\n }\n \n .pui-section-compact .ant-card-body {\n padding: 12px 16px;\n padding-top: 20px; /* Espacement r\xE9duit mais suffisant */\n }\n \n .pui-section-compact .pui-section-title {\n top: -13px;\n padding: 2px 8px;\n font-size: 0.9em;\n }\n \n /* Soulignement du contenu */\n .pui-section-underlined .ant-card-body::after {\n content: '';\n display: block;\n margin-top: 12px;\n height: 1px;\n background: linear-gradient(90deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.03) 50%, rgba(0,0,0,0) 100%);\n }\n \n /* Avec bordure */\n .pui-section.ant-card-bordered {\n border: 1px solid #e8e8e8;\n border-radius: 8px;\n }\n \n /* Animation d'entr\xE9e si support\xE9e */\n @keyframes sectionFadeIn {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n .pui-section.with-animation {\n animation: sectionFadeIn 0.3s ease-out forwards;\n }\n");
26
+
27
+ // Fonction pour injecter les styles CSS
28
+ const injectStyles = () => {
29
+ const styleId = 'pui-section-styles';
30
+ if (!document.getElementById(styleId)) {
31
+ const styleElement = document.createElement('style');
32
+ styleElement.id = styleId;
33
+ styleElement.innerHTML = sectionStyles;
34
+ document.head.appendChild(styleElement);
35
+ }
36
+ };
37
+
38
+ // Fonction pour supprimer les styles CSS
39
+ const removeStyles = () => {
40
+ const styleElement = document.getElementById('pui-section-styles');
41
+ if (styleElement) {
42
+ document.head.removeChild(styleElement);
43
+ }
44
+ };
45
+ const PuiSection = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
38
46
  let {
39
47
  id,
40
48
  className,
41
49
  sx,
42
50
  title,
43
51
  titleVariant,
44
- children
52
+ children,
53
+ bordered = false,
54
+ compact = false,
55
+ variant = 'primary',
56
+ underlined = false,
57
+ animated = false
45
58
  } = _ref;
46
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMuiPaper, {
47
- id: id,
48
- className: className,
49
- sx: _objectSpread({
50
- padding: 2
51
- }, sx),
52
- ref: ref,
53
- elevation: 1,
54
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
55
- sx: {
56
- position: "absolute",
57
- top: "-1px",
58
- left: "30px",
59
- transform: "translate(0,-50%)"
60
- },
61
- children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
62
- sx: {
63
- transform: "translateY(-50%)",
64
- top: "50%",
65
- zIndex: "-1",
66
- position: "absolute",
67
- width: "100%",
68
- height: "4px",
69
- backgroundColor: _apperance.palette.gray.light
59
+ // Injection des styles CSS
60
+ (0, _react.useEffect)(() => {
61
+ injectStyles();
62
+ return () => removeStyles();
63
+ }, []);
64
+
65
+ // Construction des styles
66
+ const containerStyle = _objectSpread({}, sx || {});
67
+
68
+ // Construction de la classe pour le titre selon la variante
69
+ const titleClass = "pui-section-".concat(titleVariant);
70
+
71
+ // Classes additionnelles basées sur les props
72
+ const variantClass = "pui-section-".concat(variant);
73
+ const underlinedClass = underlined ? 'pui-section-underlined' : '';
74
+ const animatedClass = animated ? 'with-animation' : '';
75
+
76
+ // Rendu du composant
77
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider, {
78
+ theme: {
79
+ components: {
80
+ Card: {
81
+ headerBg: 'transparent',
82
+ colorBorderSecondary: bordered ? '#f0f0f0' : 'transparent',
83
+ colorBgContainer: '#f5f5f5'
70
84
  }
71
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
72
- variant: titleVariant,
73
- sx: _objectSpread({}, (0, _styleUtils.getHeaderStyles)({
74
- textAlign: "center",
75
- paddingX: 1,
76
- backgroundColor: "transparent",
77
- borderBottom: "none",
78
- minHeight: "auto",
79
- textTransform: "none",
80
- fontSize: "1.2rem"
81
- })),
82
- children: title
85
+ }
86
+ },
87
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Card, {
88
+ id: id,
89
+ ref: ref,
90
+ className: "pui-section ".concat(compact ? 'pui-section-compact' : '', " ").concat(variantClass, " ").concat(underlinedClass, " ").concat(animatedClass, " ").concat(className || ''),
91
+ style: containerStyle,
92
+ bordered: bordered,
93
+ headStyle: {
94
+ padding: 0,
95
+ minHeight: 0
96
+ },
97
+ bodyStyle: {
98
+ padding: compact ? '12px 16px 12px 16px' : '20px 20px 20px 20px',
99
+ paddingTop: compact ? '20px' : '28px'
100
+ },
101
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
102
+ className: "pui-section-title",
103
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Typography.Text, {
104
+ className: titleClass,
105
+ strong: true,
106
+ children: title
107
+ })
108
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
109
+ children: children
83
110
  })]
84
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
85
- children: children
86
- })]
111
+ })
87
112
  });
88
113
  });
89
114
  PuiSection.propTypes = {
@@ -91,9 +116,19 @@ PuiSection.propTypes = {
91
116
  className: _propTypes.default.string,
92
117
  sx: _propTypes.default.object,
93
118
  title: _propTypes.default.string,
94
- titleVariant: _propTypes.default.oneOf(["h1", "h2", "h3", "h4", "h5", "h6"])
119
+ titleVariant: _propTypes.default.oneOf(["h1", "h2", "h3", "h4", "h5", "h6"]),
120
+ bordered: _propTypes.default.bool,
121
+ compact: _propTypes.default.bool,
122
+ variant: _propTypes.default.oneOf(["primary", "success", "warning", "error", "info"]),
123
+ underlined: _propTypes.default.bool,
124
+ animated: _propTypes.default.bool
95
125
  };
96
126
  PuiSection.defaultProps = {
97
- titleVariant: "h2"
127
+ titleVariant: "h2",
128
+ bordered: false,
129
+ compact: false,
130
+ variant: "primary",
131
+ underlined: false,
132
+ animated: false
98
133
  };
99
134
  var _default = exports.default = PuiSection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",