cloudmr-ux 1.9.7 → 1.9.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.
package/dist/index.css CHANGED
@@ -65,44 +65,6 @@
65
65
  background-color: transparent !important;
66
66
  }
67
67
 
68
- /* src/CmrComponents/CmrSelect/CmrSelect.css */
69
- .dropdown-select .MuiInputLabel-root {
70
- font-size: 14.4px !important;
71
- }
72
- .dropdown-select .MuiInputLabel-root.Mui-focused {
73
- font-size: 14.4px !important;
74
- }
75
- .dropdown-select .MuiSelect-select {
76
- font-size: 14.4px !important;
77
- }
78
- .dropdown-select .MuiSelect-select:focus {
79
- font-size: 14.4px !important;
80
- }
81
- .custom-dropdown .MuiMenuItem-root {
82
- font-size: 14.4px !important;
83
- }
84
- .dropdown-select .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline {
85
- border-color: #ced4da !important;
86
- }
87
- .dropdown-select .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
88
- border-color: #ced4da !important;
89
- }
90
- .dropdown-select .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
91
- border-color: #ced4da !important;
92
- }
93
- .dropdown-label.Mui-focused {
94
- color: #580f8b !important;
95
- }
96
- .custom-dropdown .MuiMenuItem-root:hover {
97
- background-color: #e6d5f3 !important;
98
- }
99
- .custom-dropdown .MuiMenuItem-root.Mui-selected {
100
- background-color: #e7d4f5 !important;
101
- }
102
- .custom-dropdown .MuiMenuItem-root.Mui-selected:hover {
103
- background-color: #dcbfea !important;
104
- }
105
-
106
68
  /* src/CmrComponents/collapse/Collapse.css */
107
69
  .collapse-bar {
108
70
  margin-bottom: 4px;
package/dist/index.d.ts CHANGED
@@ -47,20 +47,16 @@ interface CmrSelectProps {
47
47
  options: Option[];
48
48
  label: string;
49
49
  disabled?: boolean;
50
- /** Controlled value (optional). If provided, component becomes controlled. */
50
+ /** Controlled usage (optional) */
51
51
  value?: string;
52
- /** Fires when selection changes. For controlled usage, update your state here. */
53
52
  onChange?: (value: string) => void;
54
- /** Initial value for uncontrolled mode. Defaults to ''. */
53
+ /** Uncontrolled usage (optional) */
55
54
  defaultValue?: string;
56
- /** Top placeholder item. Shown as first item; disabled so users must pick another. */
57
- placeholder?: string;
58
- /** Layout helpers */
55
+ /** Layout/Styling */
59
56
  fullWidth?: boolean;
60
- /** Pass-through styling/props */
61
57
  sx?: FormControlProps['sx'];
62
58
  className?: string;
63
- /** Optional passthrough to MUI Select */
59
+ /** Pass-through to MUI Select */
64
60
  SelectProps?: Partial<SelectProps<string>>;
65
61
  }
66
62
  declare const CmrSelect: React__default.FC<CmrSelectProps>;
package/dist/index.js CHANGED
@@ -139,35 +139,29 @@ var CmrSelect = ({
139
139
  label,
140
140
  disabled,
141
141
  value,
142
- // controlled value (optional)
143
142
  onChange,
144
- // callback (optional)
145
143
  defaultValue = "",
146
- // for uncontrolled
147
- placeholder,
148
- // optional top disabled item
149
144
  fullWidth,
150
145
  sx,
151
146
  className,
152
147
  SelectProps: SelectProps2
153
148
  }) => {
154
149
  const isControlled = value !== void 0;
155
- const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue);
156
- const currentValue = isControlled ? value : internalValue;
150
+ const [internal, setInternal] = (0, import_react2.useState)(defaultValue);
151
+ const current = isControlled ? value : internal;
157
152
  (0, import_react2.useEffect)(() => {
158
- if (isControlled) {
159
- setInternalValue(value);
160
- }
153
+ if (isControlled)
154
+ setInternal(value);
161
155
  }, [isControlled, value]);
162
156
  const id = (0, import_react2.useId)();
163
157
  const labelId = `${id}-label`;
164
- const handleChange = (event) => {
165
- const next = event.target.value;
158
+ const selectId = `${id}-select`;
159
+ const handleChange = (e) => {
160
+ const next = e.target.value;
166
161
  if (!isControlled)
167
- setInternalValue(next);
162
+ setInternal(next);
168
163
  onChange == null ? void 0 : onChange(next);
169
164
  };
170
- const items = placeholder ? [{ label: placeholder, value: "", disabled: true }, ...options] : options;
171
165
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
172
166
  import_material5.FormControl,
173
167
  {
@@ -181,12 +175,13 @@ var CmrSelect = ({
181
175
  import_material5.Select,
182
176
  {
183
177
  labelId,
184
- value: currentValue,
185
- onChange: handleChange,
178
+ id: selectId,
179
+ value: current,
186
180
  label,
181
+ onChange: handleChange,
187
182
  MenuProps: { classes: { paper: "custom-dropdown" }, ...SelectProps2 == null ? void 0 : SelectProps2.MenuProps },
188
183
  ...SelectProps2,
189
- children: items.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.MenuItem, { value: opt.value, disabled: !!opt.disabled, children: opt.label }, `${opt.value}-${opt.label}`))
184
+ children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.MenuItem, { value: opt.value, disabled: !!opt.disabled, children: opt.label }, `${opt.value}-${opt.label}`))
190
185
  }
191
186
  )
192
187
  ]
package/dist/index.mjs CHANGED
@@ -96,35 +96,29 @@ var CmrSelect = ({
96
96
  label,
97
97
  disabled,
98
98
  value,
99
- // controlled value (optional)
100
99
  onChange,
101
- // callback (optional)
102
100
  defaultValue = "",
103
- // for uncontrolled
104
- placeholder,
105
- // optional top disabled item
106
101
  fullWidth,
107
102
  sx,
108
103
  className,
109
104
  SelectProps: SelectProps2
110
105
  }) => {
111
106
  const isControlled = value !== void 0;
112
- const [internalValue, setInternalValue] = useState2(defaultValue);
113
- const currentValue = isControlled ? value : internalValue;
107
+ const [internal, setInternal] = useState2(defaultValue);
108
+ const current = isControlled ? value : internal;
114
109
  useEffect(() => {
115
- if (isControlled) {
116
- setInternalValue(value);
117
- }
110
+ if (isControlled)
111
+ setInternal(value);
118
112
  }, [isControlled, value]);
119
113
  const id = useId();
120
114
  const labelId = `${id}-label`;
121
- const handleChange = (event) => {
122
- const next = event.target.value;
115
+ const selectId = `${id}-select`;
116
+ const handleChange = (e) => {
117
+ const next = e.target.value;
123
118
  if (!isControlled)
124
- setInternalValue(next);
119
+ setInternal(next);
125
120
  onChange == null ? void 0 : onChange(next);
126
121
  };
127
- const items = placeholder ? [{ label: placeholder, value: "", disabled: true }, ...options] : options;
128
122
  return /* @__PURE__ */ jsxs2(
129
123
  FormControl2,
130
124
  {
@@ -138,12 +132,13 @@ var CmrSelect = ({
138
132
  Select,
139
133
  {
140
134
  labelId,
141
- value: currentValue,
142
- onChange: handleChange,
135
+ id: selectId,
136
+ value: current,
143
137
  label,
138
+ onChange: handleChange,
144
139
  MenuProps: { classes: { paper: "custom-dropdown" }, ...SelectProps2 == null ? void 0 : SelectProps2.MenuProps },
145
140
  ...SelectProps2,
146
- children: items.map((opt) => /* @__PURE__ */ jsx5(MenuItem, { value: opt.value, disabled: !!opt.disabled, children: opt.label }, `${opt.value}-${opt.label}`))
141
+ children: options.map((opt) => /* @__PURE__ */ jsx5(MenuItem, { value: opt.value, disabled: !!opt.disabled, children: opt.label }, `${opt.value}-${opt.label}`))
147
142
  }
148
143
  )
149
144
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",