@sikka/hawa 0.24.8-next → 0.24.11-next

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.
@@ -135,8 +135,10 @@ var Radio = ({
135
135
  width = "default",
136
136
  size = "default",
137
137
  orientation = "horizontal",
138
+ name,
138
139
  labelProps,
139
140
  tabsContainerClassName,
141
+ onChange,
140
142
  ...props
141
143
  }) => {
142
144
  var _a, _b, _c;
@@ -170,6 +172,14 @@ var Radio = ({
170
172
  setParentDirection(dir);
171
173
  }
172
174
  });
175
+ const handleChange = (opt) => {
176
+ setSelectedOption(opt.value);
177
+ if (onChange) {
178
+ onChange(opt.value);
179
+ } else {
180
+ console.log("onChange was not provided");
181
+ }
182
+ };
173
183
  switch (design) {
174
184
  case "tabs":
175
185
  return /* @__PURE__ */ import_react2.default.createElement(
@@ -188,14 +198,7 @@ var Radio = ({
188
198
  "li",
189
199
  {
190
200
  "aria-current": "page",
191
- onClick: () => {
192
- setSelectedOption(opt.value);
193
- if (props.onChangeTab) {
194
- props.onChangeTab(opt);
195
- } else {
196
- console.log("onChangeTab was not provided");
197
- }
198
- },
201
+ onClick: () => handleChange(opt),
199
202
  className: cn(
200
203
  "hawa-w-full hawa-cursor-pointer ",
201
204
  orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
@@ -216,7 +219,7 @@ var Radio = ({
216
219
  "div",
217
220
  {
218
221
  key: i,
219
- className: "hawa-rounded hawa-border hawa-border-gray-200 "
222
+ className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
220
223
  },
221
224
  /* @__PURE__ */ import_react2.default.createElement(
222
225
  "div",
@@ -234,7 +237,8 @@ var Radio = ({
234
237
  id: opt.value.toString(),
235
238
  type: "radio",
236
239
  value: opt.value,
237
- name: "bordered-radio"
240
+ name,
241
+ onChange: () => handleChange(opt)
238
242
  }
239
243
  ),
240
244
  /* @__PURE__ */ import_react2.default.createElement(
@@ -242,7 +246,7 @@ var Radio = ({
242
246
  {
243
247
  htmlFor: opt.value.toString(),
244
248
  className: cn(
245
- "hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
249
+ "hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
246
250
  opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
247
251
  )
248
252
  },
@@ -251,12 +255,12 @@ var Radio = ({
251
255
  )
252
256
  )));
253
257
  case "cards":
254
- return /* @__PURE__ */ import_react2.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react2.default.createElement("li", { key: o }, /* @__PURE__ */ import_react2.default.createElement(
258
+ return /* @__PURE__ */ import_react2.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react2.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react2.default.createElement(
255
259
  "input",
256
260
  {
257
261
  type: "radio",
258
262
  id: opt.value.toString(),
259
- name: "cards-radio",
263
+ name,
260
264
  value: opt.value.toString(),
261
265
  className: "hawa-peer hawa-hidden",
262
266
  required: true,
@@ -290,15 +294,8 @@ var Radio = ({
290
294
  id: opt.value.toString(),
291
295
  type: "radio",
292
296
  value: opt.value,
293
- name: "default-radio",
294
- onChange: () => {
295
- setSelectedOption(opt.value);
296
- if (props.onChangeTab) {
297
- props.onChangeTab(opt);
298
- } else {
299
- console.log("onChangeTab was not provided");
300
- }
301
- }
297
+ name,
298
+ onChange: () => handleChange(opt)
302
299
  }
303
300
  ),
304
301
  /* @__PURE__ */ import_react2.default.createElement(
@@ -96,8 +96,10 @@ var Radio = ({
96
96
  width = "default",
97
97
  size = "default",
98
98
  orientation = "horizontal",
99
+ name,
99
100
  labelProps,
100
101
  tabsContainerClassName,
102
+ onChange,
101
103
  ...props
102
104
  }) => {
103
105
  var _a, _b, _c;
@@ -131,6 +133,14 @@ var Radio = ({
131
133
  setParentDirection(dir);
132
134
  }
133
135
  });
136
+ const handleChange = (opt) => {
137
+ setSelectedOption(opt.value);
138
+ if (onChange) {
139
+ onChange(opt.value);
140
+ } else {
141
+ console.log("onChange was not provided");
142
+ }
143
+ };
134
144
  switch (design) {
135
145
  case "tabs":
136
146
  return /* @__PURE__ */ React3.createElement(
@@ -149,14 +159,7 @@ var Radio = ({
149
159
  "li",
150
160
  {
151
161
  "aria-current": "page",
152
- onClick: () => {
153
- setSelectedOption(opt.value);
154
- if (props.onChangeTab) {
155
- props.onChangeTab(opt);
156
- } else {
157
- console.log("onChangeTab was not provided");
158
- }
159
- },
162
+ onClick: () => handleChange(opt),
160
163
  className: cn(
161
164
  "hawa-w-full hawa-cursor-pointer ",
162
165
  orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
@@ -177,7 +180,7 @@ var Radio = ({
177
180
  "div",
178
181
  {
179
182
  key: i,
180
- className: "hawa-rounded hawa-border hawa-border-gray-200 "
183
+ className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
181
184
  },
182
185
  /* @__PURE__ */ React3.createElement(
183
186
  "div",
@@ -195,7 +198,8 @@ var Radio = ({
195
198
  id: opt.value.toString(),
196
199
  type: "radio",
197
200
  value: opt.value,
198
- name: "bordered-radio"
201
+ name,
202
+ onChange: () => handleChange(opt)
199
203
  }
200
204
  ),
201
205
  /* @__PURE__ */ React3.createElement(
@@ -203,7 +207,7 @@ var Radio = ({
203
207
  {
204
208
  htmlFor: opt.value.toString(),
205
209
  className: cn(
206
- "hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
210
+ "hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
207
211
  opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
208
212
  )
209
213
  },
@@ -212,12 +216,12 @@ var Radio = ({
212
216
  )
213
217
  )));
214
218
  case "cards":
215
- return /* @__PURE__ */ React3.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React3.createElement("li", { key: o }, /* @__PURE__ */ React3.createElement(
219
+ return /* @__PURE__ */ React3.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React3.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React3.createElement(
216
220
  "input",
217
221
  {
218
222
  type: "radio",
219
223
  id: opt.value.toString(),
220
- name: "cards-radio",
224
+ name,
221
225
  value: opt.value.toString(),
222
226
  className: "hawa-peer hawa-hidden",
223
227
  required: true,
@@ -251,15 +255,8 @@ var Radio = ({
251
255
  id: opt.value.toString(),
252
256
  type: "radio",
253
257
  value: opt.value,
254
- name: "default-radio",
255
- onChange: () => {
256
- setSelectedOption(opt.value);
257
- if (props.onChangeTab) {
258
- props.onChangeTab(opt);
259
- } else {
260
- console.log("onChangeTab was not provided");
261
- }
262
- }
258
+ name,
259
+ onChange: () => handleChange(opt)
263
260
  }
264
261
  ),
265
262
  /* @__PURE__ */ React3.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.24.8-next",
3
+ "version": "0.24.11-next",
4
4
  "description": "Modern UI Kit made with Tailwind",
5
5
  "author": {
6
6
  "name": "Sikka Software",