@pagamio/frontend-commons-lib 0.8.220 → 0.8.222

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.
@@ -23,7 +23,7 @@ const AppSidebarMenu = () => {
23
23
  return _jsx(AppSidebarItem, { ...itemProps }, getItemKey(item, index));
24
24
  }) }) }));
25
25
  };
26
- const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown, collapsible = true, showSeparator = false, isSectionHeader = false, }) => {
26
+ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown, collapsible = true, showSeparator = false, isSectionHeader = false, comingSoon = false, }) => {
27
27
  const { pathname, linkComponent: Link, desktop } = useAppSidebarContext();
28
28
  const { t } = useTranslation();
29
29
  // Handle section headers - render as a non-interactive label (hide when collapsed)
@@ -32,7 +32,7 @@ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown
32
32
  if (desktop.isCollapsed) {
33
33
  return null;
34
34
  }
35
- return (_jsxs("div", { className: "pt-4 pb-1 px-3 first:pt-0", children: [showSeparator && _jsx("hr", { className: "mb-3 border-t border-gray-200 dark:border-gray-700" }), _jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: t(label) })] }));
35
+ return (_jsxs("div", { className: "pt-3 first:pt-0", children: [_jsx("hr", { className: "mb-2 border-t border-gray-200 dark:border-gray-700" }), _jsx("span", { className: "px-3 text-[10px] font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-400", children: t(label) })] }));
36
36
  }
37
37
  // Check if current path matches this item or any of its descendants
38
38
  const isParentActive = href ? pathname === href || pathname.startsWith(`${href}/`) : false;
@@ -97,6 +97,14 @@ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown
97
97
  if (!href) {
98
98
  return (_jsx(Sidebar.Item, { icon: icon, label: badge && t(badge), className: twMerge('text-gray-600 hover:text-primary-700 hover:bg-primary-50/70', 'dark:text-gray-400 dark:hover:text-primary-300 dark:hover:bg-primary-900/30', 'cursor-default'), children: t(label) }));
99
99
  }
100
+ // Handle coming soon items - disabled with badge
101
+ if (comingSoon) {
102
+ return (_jsx(Sidebar.Item, { icon: icon, label: _jsx("span", { className: "inline-flex items-center rounded-md px-1.5 py-0.5 text-[9px] font-medium", style: {
103
+ backgroundColor: 'rgb(254 243 199)', // amber-100
104
+ color: 'rgb(180 83 9)', // amber-700
105
+ border: '1px solid rgb(252 211 77)', // amber-300
106
+ }, children: t('sidebar.comingSoon', 'Soon') }), className: twMerge('text-gray-400 cursor-not-allowed', 'dark:text-gray-500'), children: t(label) }));
107
+ }
100
108
  return (_jsx(Sidebar.Item, { as: Link, href: href, target: target, icon: icon, label: badge && t(badge), className: twMerge('text-gray-600 hover:text-primary-700 hover:bg-primary-50/70', 'dark:text-gray-400 dark:hover:text-primary-300 dark:hover:bg-primary-900/30', isParentActive &&
101
109
  'text-primary-700 bg-primary-100/80 hover:bg-primary-100/80 dark:text-primary-300 dark:bg-primary-900/40 dark:hover:bg-primary-900/40'), children: t(label) }));
102
110
  };
@@ -29,6 +29,10 @@ interface AppSidebarPageItem {
29
29
  * Used for visual grouping in flat sidebar structures.
30
30
  */
31
31
  isSectionHeader?: boolean;
32
+ /**
33
+ * When true, shows "Coming Soon" badge and disables navigation.
34
+ */
35
+ comingSoon?: boolean;
32
36
  }
33
37
  /**
34
38
  * Props for the AppSidebarContext
@@ -99,12 +99,19 @@ const DrawerContent = ({ fields, onSubmit, isOpen, initialValues, submitButtonTe
99
99
  }
100
100
  }
101
101
  }, [isOpen, reset, persistenceKey, clearPersistedData]);
102
- // Reset form when initialValues change
102
+ // Reset form when initialValues change, but preserve current form values
103
103
  useEffect(() => {
104
104
  if (isOpen && initialValues) {
105
- reset(initialValues);
105
+ const currentValues = getValues();
106
+ // Only reset if initialValues have actually changed (comparing keys and values)
107
+ const hasInitialValuesChanged = Object.keys(initialValues).some((key) => initialValues[key] !== currentValues[key] && currentValues[key] === undefined);
108
+ if (hasInitialValuesChanged) {
109
+ // Merge initialValues with current form values to preserve user input
110
+ const mergedValues = { ...initialValues, ...currentValues };
111
+ reset(mergedValues);
112
+ }
106
113
  }
107
- }, [initialValues, isOpen, reset]);
114
+ }, [initialValues, isOpen, reset, getValues]);
108
115
  const handleCancel = () => {
109
116
  if (checkUnsavedChanges()) {
110
117
  setShowCancelConfirmModal(true);
@@ -14,11 +14,13 @@ const FormEngineDrawer = ({ title, cancelButtonText = 'Cancel', submitButtonText
14
14
  return initialFields.map((newField) => {
15
15
  const existingField = existingFieldsMap.get(newField.name);
16
16
  if (existingField) {
17
+ // Preserve existing field configuration but update options if provided
17
18
  return {
18
19
  ...existingField,
19
20
  ...newField,
20
- options: existingField.options || newField.options,
21
- label: existingField.label || newField.label,
21
+ // Keep the new options if provided, otherwise keep existing
22
+ options: newField.options && newField.options.length > 0 ? newField.options : existingField.options,
23
+ label: newField.label || existingField.label,
22
24
  };
23
25
  }
24
26
  return newField;
package/lib/styles.css CHANGED
@@ -2853,6 +2853,10 @@ input[type="range"]::-ms-fill-lower {
2853
2853
  padding-left: 0px;
2854
2854
  padding-right: 0px;
2855
2855
  }
2856
+ .px-1\.5 {
2857
+ padding-left: 0.375rem;
2858
+ padding-right: 0.375rem;
2859
+ }
2856
2860
  .px-12 {
2857
2861
  padding-left: 3rem;
2858
2862
  padding-right: 3rem;
@@ -2928,9 +2932,6 @@ input[type="range"]::-ms-fill-lower {
2928
2932
  .pb-0 {
2929
2933
  padding-bottom: 0px;
2930
2934
  }
2931
- .pb-1 {
2932
- padding-bottom: 0.25rem;
2933
- }
2934
2935
  .pb-2\.5 {
2935
2936
  padding-bottom: 0.625rem;
2936
2937
  }
@@ -3046,12 +3047,18 @@ input[type="range"]::-ms-fill-lower {
3046
3047
  .text-\[1\.5rem\] {
3047
3048
  font-size: 1.5rem;
3048
3049
  }
3050
+ .text-\[10px\] {
3051
+ font-size: 10px;
3052
+ }
3049
3053
  .text-\[15px\] {
3050
3054
  font-size: 15px;
3051
3055
  }
3052
3056
  .text-\[1em\] {
3053
3057
  font-size: 1em;
3054
3058
  }
3059
+ .text-\[9px\] {
3060
+ font-size: 9px;
3061
+ }
3055
3062
  .text-base {
3056
3063
  font-size: 1rem;
3057
3064
  line-height: 1.5rem;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagamio/frontend-commons-lib",
3
3
  "description": "Pagamio library for Frontend reusable components like the form engine and table container",
4
- "version": "0.8.220",
4
+ "version": "0.8.222",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false