tp-react-elements 3.0.10 → 3.0.12

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,3 +1,3 @@
1
- var InputRangeField = {};
1
+ var DateInput = {};
2
2
 
3
- export { InputRangeField as __exports };
3
+ export { DateInput as __exports };
@@ -1,3 +1,3 @@
1
- var DateInput = {};
1
+ var InputRangeField = {};
2
2
 
3
- export { DateInput as __exports };
3
+ export { InputRangeField as __exports };
@@ -1,3 +1,3 @@
1
- var DateRangePicker = {};
1
+ var DefinedRange = {};
2
2
 
3
- export { DateRangePicker as __exports };
3
+ export { DefinedRange as __exports };
@@ -1,3 +1,3 @@
1
- var Calendar = {};
1
+ var DateRangePicker = {};
2
2
 
3
- export { Calendar as __exports };
3
+ export { DateRangePicker as __exports };
@@ -1,3 +1,3 @@
1
- var DefinedRange = {};
1
+ var Calendar = {};
2
2
 
3
- export { DefinedRange as __exports };
3
+ export { Calendar as __exports };
@@ -1,7 +1,5 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import require$$0__default, { lazy, Suspense } from 'react';
3
- import FormCheckBox from '../FormComponents/FormCheckBox/FormCheckBox.esm.js';
4
- import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
5
3
  import SingleSelect from '../FormComponents/Select/SingleSelect.esm.js';
6
4
  import MultiSelectAutocomplete from '../FormComponents/Select/MultiSelectAutocomplete.esm.js';
7
5
  import SingleSelectNonAutoComplete from '../FormComponents/Select/SingleSelectNonAutoComplete.esm.js';
@@ -13,7 +11,9 @@ import RichTextEditorWrapper from '../FormComponents/RichTextEditor/RichTextEdit
13
11
  import SingleSelectSearchApi from '../FormComponents/Select/SingleSelectSearchApi.esm.js';
14
12
  import DatetimepickerWrapper from '../FormComponents/DatePicker/DatetimepickerWrapper.esm.js';
15
13
  import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
14
+ import FormCheckBox from '../FormComponents/FormCheckBox/FormCheckBox.esm.js';
16
15
  import FormRadioGroup from '../FormComponents/FormRadioGroup/FormRadioGroup.esm.js';
16
+ import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
17
17
  import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
18
18
  import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.esm.js';
19
19
  import PasswordField from '../FormComponents/PasswordField/PasswordField.esm.js';
@@ -57,28 +57,6 @@ const RichTextEditor = ({ props }) => {
57
57
  openSearchDialog: 'ctrl+f',
58
58
  openReplaceDialog: 'ctrl+r',
59
59
  },
60
- events: {
61
- processPaste: (_event, html) => {
62
- const instance = editor.current;
63
- if (instance?.editor) {
64
- const joditEditor = instance.editor;
65
- joditEditor.selection?.insertHTML?.(html);
66
- joditEditor.tempContent = joditEditor.getHTML?.();
67
- }
68
- },
69
- afterPaste: () => {
70
- const instance = editor.current;
71
- if (instance?.editor) {
72
- const joditEditor = instance.editor;
73
- const el = document.createElement('div');
74
- el.innerHTML = joditEditor.tempContent
75
- ? joditEditor.tempContent
76
- : joditEditor.getHTML?.();
77
- joditEditor.setHTML?.(el.innerHTML);
78
- joditEditor.tempContent = null;
79
- }
80
- },
81
- },
82
60
  ...props.item.sx,
83
61
  }),
84
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -11,9 +11,30 @@ import { useWatch } from 'react-hook-form';
11
11
  import FormBottomField from '../FormBottomField/FormBottomField.esm.js';
12
12
  import 'dayjs';
13
13
  import { renderLabel } from '../../../utils/Constants/FormConstants.esm.js';
14
+ import { useOptionalProjectTheme } from '../../../auth/authContext.esm.js';
14
15
 
15
16
  const ITEM_HEIGHT = 36;
16
17
  const ITEM_PADDING_TOP = 2;
18
+ /**
19
+ * Base shape shared by both states of the themed option glyph — only the border/background
20
+ * (checked vs unchecked) differ, passed in by the caller via `Checkbox`'s own `icon` and
21
+ * `checkedIcon` props. Kept as plain style objects (not a component) so the existing
22
+ * `<Checkbox>` stays the single source of truth for check state/interaction; this only
23
+ * reskins what it renders.
24
+ */
25
+ const themedGlyphSx = {
26
+ width: 15,
27
+ height: 15,
28
+ borderRadius: '4px',
29
+ display: 'flex',
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ fontSize: 10,
33
+ fontWeight: 800,
34
+ color: '#fff',
35
+ border: '1.5px solid',
36
+ lineHeight: 1,
37
+ };
17
38
  const extractValuesToArray = (inputString) => {
18
39
  if (!inputString)
19
40
  return [];
@@ -23,6 +44,7 @@ function MultiSelectV1({ props, variant, }) {
23
44
  const [searchText, setSearchText] = useState('');
24
45
  const options = props.item?.options || [];
25
46
  const textfieldRef = useRef(null);
47
+ const multiSelectTheme = useOptionalProjectTheme()?.Styles?.Component?.TPMultiSelect;
26
48
  // Ref to capture the width of the Select container
27
49
  const containerRef = useRef(null);
28
50
  const fieldValue = useWatch({ control: props.control, name: props.item.name });
@@ -111,15 +133,29 @@ function MultiSelectV1({ props, variant, }) {
111
133
  whiteSpace: 'normal',
112
134
  wordBreak: 'break-all',
113
135
  alignItems: 'center',
114
- py: 0.5,
115
- px: 2,
136
+ py: multiSelectTheme ? 1 : 0.5,
137
+ px: multiSelectTheme ? 1.25 : 2,
116
138
  minHeight: ITEM_HEIGHT,
117
- }, children: [jsx(Checkbox, { checked: isChecked, size: "small", sx: { p: 1, mr: 1, pointerEvents: 'none' } }), jsx(ListItemText, { className: 'Mui-multi-select-option', primary: option.label, primaryTypographyProps: {
118
- fontSize: props.item?.optionFontSize || '13px',
139
+ ...(multiSelectTheme && {
140
+ mx: 0.5,
141
+ borderRadius: '6px',
142
+ '&.Mui-selected, &.Mui-selected:hover': {
143
+ backgroundColor: multiSelectTheme.selectedRowBg ?? '#F4F8FC',
144
+ },
145
+ }),
146
+ }, children: [jsx(Checkbox, { checked: isChecked, size: "small", sx: multiSelectTheme ? { p: 0, mr: 1.25, pointerEvents: 'none' } : { p: 1, mr: 1, pointerEvents: 'none' }, ...(multiSelectTheme && {
147
+ icon: (jsx(Box, { component: "span", sx: { ...themedGlyphSx, borderColor: multiSelectTheme.uncheckedBorderColor ?? '#C9D3E0', background: '#fff' } })),
148
+ checkedIcon: (jsx(Box, { component: "span", sx: { ...themedGlyphSx, borderColor: multiSelectTheme.checkedColor ?? '#073B6D', background: multiSelectTheme.checkedColor ?? '#073B6D' }, children: "\u2713" })),
149
+ }) }), jsx(ListItemText, { className: 'Mui-multi-select-option', primary: option.label, primaryTypographyProps: {
150
+ fontSize: multiSelectTheme ? 12.5 : (props.item?.optionFontSize || '13px'),
119
151
  sx: {
120
152
  whiteSpace: 'normal',
121
153
  wordBreak: 'break-all',
122
- lineHeight: '1.2'
154
+ lineHeight: multiSelectTheme ? 1.35 : '1.2',
155
+ ...(multiSelectTheme && {
156
+ fontWeight: 600,
157
+ color: isChecked ? (multiSelectTheme.checkedColor ?? '#073B6D') : '#42536B',
158
+ }),
123
159
  }
124
160
  } })] }, option.value));
125
161
  })) : (jsx(MenuItem, { disabled: true, children: "No data Found" }))] }), jsx(FormBottomField, { ...props })] }) }, props.item.name));
@@ -1,13 +1,13 @@
1
- export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
2
1
  export { default as SingleSelect } from './Select/SingleSelect.esm.js';
3
2
  export { default as SingleSelectNonAutoComplete } from './Select/SingleSelectNonAutoComplete.esm.js';
4
3
  export { default as SingleSelectSearchApi } from './Select/SingleSelectSearchApi.esm.js';
5
4
  export { default as MultiSelectV1 } from './Select/MultiSelectv1.esm.js';
6
5
  export { default as MultiSelectTable } from './Select/MultiSelectTable.esm.js';
7
6
  export { default as SearchableSelect } from './Select/SearchableSelect.esm.js';
8
- export { default as FormCheckBoxGroup } from './FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
9
7
  export { default as DatepickerWrapperV2 } from './DatePicker/DatepickerWrapperV2.esm.js';
10
8
  export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
9
+ export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
10
+ export { default as FormCheckBoxGroup } from './FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
11
11
  export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
12
12
  export { default as FormNumberField } from './FormNumberField/FormNumberField.esm.js';
13
13
  export { default as FormNumberFieldDecimal } from './FormNumberField/FormNumberFieldDecimal.esm.js';
@@ -76,8 +76,27 @@ const extractSxColors = (sx) => {
76
76
  }
77
77
  return { background, text };
78
78
  };
79
- /** Converts a `#RRGGBB` hex string to the 8-char ARGB xlsx-js-style expects. Returns `undefined` for anything else. */
80
- const hexToArgb = (hex) => hex?.startsWith('#') ? 'FF' + hex.slice(1).toUpperCase().padEnd(6, '0') : undefined;
79
+ /**
80
+ * Converts a hex colour string to the 8-char ARGB `xlsx-js-style` expects.
81
+ * Handles both `#RRGGBB` and CSS shorthand `#RGB` (each digit doubled, e.g.
82
+ * `#fff` → `ffffff`) — shorthand was previously padded with trailing zeros
83
+ * instead of expanded, silently turning `#fff` into a bright yellow
84
+ * (`FFFFF000`) instead of white. An 8-digit `#RRGGBBAA` has its alpha
85
+ * channel dropped (this export always renders fully opaque). Returns
86
+ * `undefined` for anything else (non-hex/theme-token colours, etc.).
87
+ */
88
+ const hexToArgb = (hex) => {
89
+ if (!hex?.startsWith('#'))
90
+ return undefined;
91
+ let digits = hex.slice(1);
92
+ if (digits.length === 3 || digits.length === 4) {
93
+ digits = digits.slice(0, 3).split('').map((c) => c + c).join('');
94
+ }
95
+ else {
96
+ digits = digits.slice(0, 6);
97
+ }
98
+ return 'FF' + digits.toUpperCase().padEnd(6, '0');
99
+ };
81
100
  /**
82
101
  * Header overrides applied via GlobalStyles (literal prop values).
83
102
  * MRT sets `backgroundColor: 'inherit'` and fixed density padding — must use !important.
@@ -1,4 +1,4 @@
1
- import { __exports as Calendar } from '../../../../../_virtual/index.esm6.js';
1
+ import { __exports as Calendar } from '../../../../../_virtual/index.esm7.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireDayCell } from '../DayCell/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DateInput } from '../../../../../_virtual/index.esm13.js';
1
+ import { __exports as DateInput } from '../../../../../_virtual/index.esm12.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm5.js';
1
+ import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm6.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireDateRange } from '../DateRange/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DefinedRange } from '../../../../../_virtual/index.esm7.js';
1
+ import { __exports as DefinedRange } from '../../../../../_virtual/index.esm5.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireStyles } from '../../styles.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as InputRangeField } from '../../../../../_virtual/index.esm12.js';
1
+ import { __exports as InputRangeField } from '../../../../../_virtual/index.esm13.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
 
@@ -21,11 +21,24 @@ export interface ProjectComponentTPToggleSwitch {
21
21
  export interface ProjectComponentTPRadioGroup {
22
22
  checkedColor?: string;
23
23
  }
24
+ /**
25
+ * Optional row/checkbox styling for `multiselect` (`MultiSelectV1`)'s dropdown options. Omitted
26
+ * entirely = the existing stock MUI `Checkbox` + default `MenuItem` selected-row tint are
27
+ * unchanged for every current consumer. Providing this swaps the checkbox for a compact
28
+ * rounded-square box and restyles the option row (padding/radius/selected background/text
29
+ * weight) to match a flatter, more custom design language.
30
+ */
31
+ export interface ProjectComponentTPMultiSelect {
32
+ checkedColor?: string;
33
+ uncheckedBorderColor?: string;
34
+ selectedRowBg?: string;
35
+ }
24
36
  export interface ProjectComponentStyles {
25
37
  TPButton: ProjectComponentTPButton[];
26
38
  TPButtonCommonSx: SxProps<Theme>;
27
39
  TPToggleSwitch?: ProjectComponentTPToggleSwitch;
28
40
  TPRadioGroup?: ProjectComponentTPRadioGroup;
41
+ TPMultiSelect?: ProjectComponentTPMultiSelect;
29
42
  }
30
43
  export interface ProjectThemeStyles {
31
44
  Component: ProjectComponentStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tp-react-elements",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "React form components library built with React Hook Form and Yup",