react-better-html 1.1.146 → 1.1.148

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.d.mts CHANGED
@@ -371,7 +371,7 @@ type ChipProps = {
371
371
  type ChipComponentType = {
372
372
  (props: ComponentPropWithRef<HTMLDivElement, ChipProps>): React.ReactElement;
373
373
  colored: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps, "color" | "backgroundColor"> & {
374
- color?: Color;
374
+ color?: string;
375
375
  }>) => React.ReactElement;
376
376
  };
377
377
  declare const ChipComponent: ChipComponentType;
@@ -490,6 +490,7 @@ type InternalToggleInputProps<Value> = {
490
490
  label?: string;
491
491
  labelColor?: string;
492
492
  text?: string;
493
+ textAdvanced?: React.ReactNode;
493
494
  errorText?: string;
494
495
  infoText?: string;
495
496
  value?: Value;
package/dist/index.d.ts CHANGED
@@ -371,7 +371,7 @@ type ChipProps = {
371
371
  type ChipComponentType = {
372
372
  (props: ComponentPropWithRef<HTMLDivElement, ChipProps>): React.ReactElement;
373
373
  colored: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps, "color" | "backgroundColor"> & {
374
- color?: Color;
374
+ color?: string;
375
375
  }>) => React.ReactElement;
376
376
  };
377
377
  declare const ChipComponent: ChipComponentType;
@@ -490,6 +490,7 @@ type InternalToggleInputProps<Value> = {
490
490
  label?: string;
491
491
  labelColor?: string;
492
492
  text?: string;
493
+ textAdvanced?: React.ReactNode;
493
494
  errorText?: string;
494
495
  infoText?: string;
495
496
  value?: Value;
package/dist/index.js CHANGED
@@ -3909,7 +3909,7 @@ var Chip_default = Chip2;
3909
3909
 
3910
3910
  // src/components/InputField.tsx
3911
3911
  var import_react20 = require("react");
3912
- var import_styled_components10 = __toESM(require("styled-components"));
3912
+ var import_styled_components11 = __toESM(require("styled-components"));
3913
3913
 
3914
3914
  // src/constants/countries.ts
3915
3915
  var countries = [
@@ -5813,6 +5813,7 @@ var Dropdown_default = Dropdown2;
5813
5813
 
5814
5814
  // src/components/Calendar.tsx
5815
5815
  var import_react19 = require("react");
5816
+ var import_styled_components10 = __toESM(require("styled-components"));
5816
5817
  var import_jsx_runtime17 = require("react/jsx-runtime");
5817
5818
  var getMonthName = (month, short = false) => {
5818
5819
  return [
@@ -5842,6 +5843,16 @@ var getWeekDayName = (day, short = false) => {
5842
5843
  ][day];
5843
5844
  };
5844
5845
  var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
5846
+ var yearsRange = Array.from({ length: 100 + 1 + 50 }, (_, index) => index + (/* @__PURE__ */ new Date()).getFullYear() - 100);
5847
+ var SelectComponent = import_styled_components10.default.select.withConfig({
5848
+ shouldForwardProp: (prop) => !["normalStyle", "hoverStyle"].includes(prop)
5849
+ })`
5850
+ position: absolute;
5851
+ top: 50%;
5852
+ right: 0;
5853
+ transform: translateY(-50%);
5854
+ opacity: 0;
5855
+ `;
5845
5856
  function Calendar({ value, minDate, maxDate, onChange }) {
5846
5857
  const theme2 = useTheme();
5847
5858
  const [currentDate, setCurrentDate] = (0, import_react19.useState)(value ? new Date(value) : void 0);
@@ -5882,6 +5893,9 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5882
5893
  `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
5883
5894
  );
5884
5895
  }, [onChange]);
5896
+ const onChangeYearSelect = (0, import_react19.useCallback)((event) => {
5897
+ setCurrentYear(parseInt(event.target.value));
5898
+ }, []);
5885
5899
  const firstDayOfMonth = (0, import_react19.useMemo)(() => {
5886
5900
  const day = new Date(currentYear, currentMonth, 1).getDay();
5887
5901
  return day === 0 ? 6 : day - 1;
@@ -5906,10 +5920,13 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5906
5920
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
5907
5921
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
5908
5922
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
5909
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { fontWeight: 700, children: [
5910
- getMonthName(currentMonth),
5911
- " ",
5912
- currentYear
5923
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: 4, children: [
5924
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { fontWeight: 700, children: getMonthName(currentMonth) }),
5925
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
5926
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { fontWeight: 700, children: currentYear }),
5927
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "chevronDown", size: 12 }),
5928
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectComponent, { theme: theme2, value: currentYear, onChange: onChangeYearSelect, children: yearsRange.map((year) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: year, children: year }, year)) })
5929
+ ] })
5913
5930
  ] }),
5914
5931
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
5915
5932
  ] }),
@@ -5996,7 +6013,7 @@ var buttonWidth = 50;
5996
6013
  var colorPickerSpacing = 4;
5997
6014
  var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5998
6015
  var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5999
- var InputElement = import_styled_components10.default.input.withConfig({
6016
+ var InputElement = import_styled_components11.default.input.withConfig({
6000
6017
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6001
6018
  })`
6002
6019
  position: relative;
@@ -6040,6 +6057,7 @@ var InputElement = import_styled_components10.default.input.withConfig({
6040
6057
  &[type="date"],
6041
6058
  &[type="datetime-local"],
6042
6059
  &[type="time"] {
6060
+ min-height: 48px;
6043
6061
  -webkit-appearance: none;
6044
6062
  -moz-appearance: textfield;
6045
6063
 
@@ -6103,7 +6121,7 @@ var InputElement = import_styled_components10.default.input.withConfig({
6103
6121
  ${(props) => props.hoverStyle}
6104
6122
  }
6105
6123
  `;
6106
- var TextareaElement = import_styled_components10.default.textarea.withConfig({
6124
+ var TextareaElement = import_styled_components11.default.textarea.withConfig({
6107
6125
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6108
6126
  })`
6109
6127
  width: 100%;
@@ -6869,12 +6887,12 @@ var InputField_default = InputField2;
6869
6887
 
6870
6888
  // src/components/ToggleInput.tsx
6871
6889
  var import_react21 = require("react");
6872
- var import_styled_components11 = __toESM(require("styled-components"));
6890
+ var import_styled_components12 = __toESM(require("styled-components"));
6873
6891
  var import_jsx_runtime19 = require("react/jsx-runtime");
6874
6892
  var componentSize = 26;
6875
6893
  var switchComponentBallGap = 3;
6876
6894
  var switchComponentMouseDownDifference = 4;
6877
- var InputElement2 = import_styled_components11.default.input.withConfig({
6895
+ var InputElement2 = import_styled_components12.default.input.withConfig({
6878
6896
  shouldForwardProp: (prop) => !["theme", "normalStyle", "hoverStyle"].includes(prop)
6879
6897
  })`
6880
6898
  position: relative;
@@ -6910,7 +6928,7 @@ var InputElement2 = import_styled_components11.default.input.withConfig({
6910
6928
  ${(props) => props.hoverStyle}
6911
6929
  }
6912
6930
  `;
6913
- var SwitchElement = import_styled_components11.default.div.withConfig({
6931
+ var SwitchElement = import_styled_components12.default.div.withConfig({
6914
6932
  shouldForwardProp: (prop) => !["theme", "checked", "disabled", "isMouseDown", "normalStyle", "hoverStyle"].includes(prop)
6915
6933
  })`
6916
6934
  --width: ${(props) => componentSize * 2 - props.theme.styles.gap / 2}px;
@@ -6967,6 +6985,7 @@ var ToggleInputComponent = (0, import_react21.forwardRef)(function ToggleInput({
6967
6985
  label,
6968
6986
  labelColor,
6969
6987
  text,
6988
+ textAdvanced,
6970
6989
  errorText,
6971
6990
  infoText,
6972
6991
  value,
@@ -7048,13 +7067,19 @@ var ToggleInputComponent = (0, import_react21.forwardRef)(function ToggleInput({
7048
7067
  }
7049
7068
  ) : void 0
7050
7069
  ] }),
7051
- text && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
7070
+ text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
7052
7071
  text,
7053
7072
  required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
7054
7073
  " ",
7055
7074
  "*"
7056
7075
  ] })
7057
- ] })
7076
+ ] }) : textAdvanced ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
7077
+ textAdvanced,
7078
+ required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
7079
+ " ",
7080
+ "*"
7081
+ ] })
7082
+ ] }) : void 0
7058
7083
  ] }),
7059
7084
  (errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7060
7085
  Text_default,
@@ -7112,7 +7137,9 @@ var ToggleInput_default = {
7112
7137
  {
7113
7138
  alignItems: "center",
7114
7139
  gap: theme2.styles.gap,
7140
+ borderRadius: 999,
7115
7141
  isTabAccessed: true,
7142
+ onClick: onClickElement,
7116
7143
  onMouseDown: setIsMouseDown.setTrue,
7117
7144
  onMouseUp: setIsMouseDown.setFalse,
7118
7145
  onMouseOut: setIsMouseDown.setFalse,
@@ -7126,7 +7153,6 @@ var ToggleInput_default = {
7126
7153
  checked,
7127
7154
  disabled: disabled ?? false,
7128
7155
  isMouseDown,
7129
- onClick: onClickElement,
7130
7156
  id: readyId,
7131
7157
  role: "switch",
7132
7158
  "aria-checked": checked,
@@ -7400,11 +7426,11 @@ var ColorThemeSwitch_default = ColorThemeSwitch2;
7400
7426
 
7401
7427
  // src/components/Table.tsx
7402
7428
  var import_react25 = require("react");
7403
- var import_styled_components12 = __toESM(require("styled-components"));
7429
+ var import_styled_components13 = __toESM(require("styled-components"));
7404
7430
  var import_jsx_runtime23 = require("react/jsx-runtime");
7405
7431
  var defaultImageWidth = 160;
7406
7432
  var maximumVisiblePages = 11;
7407
- var TableStyledComponent = import_styled_components12.default.table.withConfig({
7433
+ var TableStyledComponent = import_styled_components13.default.table.withConfig({
7408
7434
  shouldForwardProp: (prop) => ![
7409
7435
  "isStriped",
7410
7436
  "withHover",
@@ -7484,13 +7510,13 @@ var TableStyledComponent = import_styled_components12.default.table.withConfig({
7484
7510
  }
7485
7511
  }
7486
7512
 
7487
- ${(props) => props.isStriped ? import_styled_components12.css`
7513
+ ${(props) => props.isStriped ? import_styled_components13.css`
7488
7514
  &:nth-child(even) {
7489
7515
  background-color: ${props.theme.colors.backgroundSecondary};
7490
7516
  }
7491
7517
  ` : ""}
7492
7518
 
7493
- ${(props) => props.withHover ? import_styled_components12.css`
7519
+ ${(props) => props.withHover ? import_styled_components13.css`
7494
7520
  transition: ${props.theme.styles.transition};
7495
7521
 
7496
7522
  &:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
@@ -7519,7 +7545,7 @@ var TableStyledComponent = import_styled_components12.default.table.withConfig({
7519
7545
  }
7520
7546
  }
7521
7547
  `;
7522
- var ThStyledComponent = import_styled_components12.default.th.withConfig({
7548
+ var ThStyledComponent = import_styled_components13.default.th.withConfig({
7523
7549
  shouldForwardProp: (prop) => !["width", "minWidth", "maxWidth", "textAlign"].includes(prop)
7524
7550
  })`
7525
7551
  ${(props) => props.width ? `width: ${props.width}px;` : ""}
@@ -7527,7 +7553,7 @@ var ThStyledComponent = import_styled_components12.default.th.withConfig({
7527
7553
  ${(props) => props.maxWidth ? `max-width: ${props.maxWidth}px;` : ""}
7528
7554
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
7529
7555
  `;
7530
- var TdStyledComponent = import_styled_components12.default.td.withConfig({
7556
+ var TdStyledComponent = import_styled_components13.default.td.withConfig({
7531
7557
  shouldForwardProp: (prop) => !["width", "textAlign"].includes(prop)
7532
7558
  })`
7533
7559
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
@@ -8237,61 +8263,61 @@ var Table_default = Table2;
8237
8263
 
8238
8264
  // src/components/Tooltip.tsx
8239
8265
  var import_react26 = require("react");
8240
- var import_styled_components13 = __toESM(require("styled-components"));
8266
+ var import_styled_components14 = __toESM(require("styled-components"));
8241
8267
  var import_jsx_runtime24 = require("react/jsx-runtime");
8242
8268
  var tooltipContainerStyle = (props) => ({
8243
- top: import_styled_components13.css`
8269
+ top: import_styled_components14.css`
8244
8270
  bottom: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8245
8271
  ${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"}
8246
8272
  `,
8247
- bottom: import_styled_components13.css`
8273
+ bottom: import_styled_components14.css`
8248
8274
  top: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8249
8275
  ${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"};
8250
8276
  `,
8251
- left: import_styled_components13.css`
8277
+ left: import_styled_components14.css`
8252
8278
  ${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
8253
8279
  right: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8254
8280
  `,
8255
- right: import_styled_components13.css`
8281
+ right: import_styled_components14.css`
8256
8282
  ${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
8257
8283
  left: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8258
8284
  `
8259
8285
  });
8260
8286
  var tooltipPositionStyle = (props) => ({
8261
8287
  top: {
8262
- opened: import_styled_components13.css`
8288
+ opened: import_styled_components14.css`
8263
8289
  transform: translateX(${props.align === "center" ? "-50%" : "0"});
8264
8290
  `,
8265
- closed: import_styled_components13.css`
8291
+ closed: import_styled_components14.css`
8266
8292
  transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(${props.theme.styles.gap}px);
8267
8293
  `
8268
8294
  },
8269
8295
  bottom: {
8270
- opened: import_styled_components13.css`
8296
+ opened: import_styled_components14.css`
8271
8297
  transform: translateX(${props.align === "center" ? "-50%" : "0"});
8272
8298
  `,
8273
- closed: import_styled_components13.css`
8299
+ closed: import_styled_components14.css`
8274
8300
  transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(-${props.theme.styles.gap}px);
8275
8301
  `
8276
8302
  },
8277
8303
  left: {
8278
- opened: import_styled_components13.css`
8304
+ opened: import_styled_components14.css`
8279
8305
  transform: translateY(${props.align === "center" ? "-50%" : "0"});
8280
8306
  `,
8281
- closed: import_styled_components13.css`
8307
+ closed: import_styled_components14.css`
8282
8308
  transform: translateX(${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
8283
8309
  `
8284
8310
  },
8285
8311
  right: {
8286
- opened: import_styled_components13.css`
8312
+ opened: import_styled_components14.css`
8287
8313
  transform: translateY(${props.align === "center" ? "-50%" : "0"});
8288
8314
  `,
8289
- closed: import_styled_components13.css`
8315
+ closed: import_styled_components14.css`
8290
8316
  transform: translateX(-${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
8291
8317
  `
8292
8318
  }
8293
8319
  });
8294
- var TooltipContainer = import_styled_components13.default.div.withConfig({
8320
+ var TooltipContainer = import_styled_components14.default.div.withConfig({
8295
8321
  shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
8296
8322
  })`
8297
8323
  position: absolute;