@povio/ui 2.1.17 → 2.1.19

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.
@@ -51,9 +51,9 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
51
51
  const rect = dialogRef.current?.getBoundingClientRect();
52
52
  if (!rect || oldHeightRef.current === rect.height) return;
53
53
  oldHeightRef.current = rect.height;
54
- if (rect.bottom < viewport.height) {
54
+ if (y.get() < 0) {
55
55
  y.stop();
56
- (0, react_exports.animate)(y, -(rect.height - viewport.height + sheetMarginTop));
56
+ (0, react_exports.animate)(y, 0);
57
57
  }
58
58
  }
59
59
  });
@@ -98,8 +98,14 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
98
98
  minHeight: "100%"
99
99
  },
100
100
  drag: "y",
101
- dragElastic: 1,
102
- dragConstraints: overlayRef,
101
+ dragElastic: {
102
+ top: 0,
103
+ bottom: .5
104
+ },
105
+ dragConstraints: {
106
+ top: 0,
107
+ bottom: 0
108
+ },
103
109
  onUpdate: (latest) => {
104
110
  if (!latest || !footerRef.current) return;
105
111
  footerRef.current?.style.setProperty("--scroll-position", `${(latest.y || 0).toFixed(0)}px`);
@@ -107,7 +113,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
107
113
  onDragStart: () => {
108
114
  if (document.activeElement && DomUtils.isKeyboardInput(document.activeElement)) focusTrapRef.current?.focus();
109
115
  y.animation?.stop();
110
- closeVelocityRef.current = isScrollable ? y.get() >= -10 : true;
116
+ closeVelocityRef.current = true;
111
117
  containerRef.current?.style.setProperty("pointer-events", "none");
112
118
  },
113
119
  onDragEnd: (e, { velocity }) => {
@@ -1,7 +1,10 @@
1
+ import { ArrowDropDownIcon } from "./ArrowDropDown.js";
2
+ import { ArrowDropUpIcon } from "./ArrowDropUp.js";
1
3
  import { ChevronLeftIcon } from "./ChevronLeft.js";
2
4
  import { ChevronRightIcon } from "./ChevronRight.js";
3
5
  import { PillButton } from "./PillButton.js";
4
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { clsx } from "clsx";
5
8
  import { Button, ToggleButtonGroup } from "react-aria-components";
6
9
  import { Time } from "@internationalized/date";
7
10
  import { useDateFormatter } from "@react-aria/i18n";
@@ -29,9 +32,10 @@ const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextB
29
32
  children: [
30
33
  /* @__PURE__ */ jsx("div", {
31
34
  className: "inline-flex h-12 items-center p-3",
32
- children: !toggleState && /* @__PURE__ */ jsx(Button, {
35
+ children: /* @__PURE__ */ jsx(Button, {
33
36
  ...prevButtonProps,
34
- className: "shrink-0 focus-visible:outline-interactive-contained-secondary-focus",
37
+ isDisabled: !!toggleState,
38
+ className: clsx("shrink-0 focus-visible:outline-interactive-contained-secondary-focus", !!toggleState && "opacity-0"),
35
39
  children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-6 text-interactive-text-secondary-idle" })
36
40
  })
37
41
  }),
@@ -40,6 +44,9 @@ const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextB
40
44
  children: [
41
45
  /* @__PURE__ */ jsx(PillButton, {
42
46
  color: "secondary",
47
+ variant: "subtle",
48
+ iconPosition: "right",
49
+ icon: toggleState === "month" ? ArrowDropUpIcon : ArrowDropDownIcon,
43
50
  toggle: true,
44
51
  isSelected: toggleState === "month",
45
52
  onChange: (isSelected) => setToggleState(isSelected ? "month" : null),
@@ -47,6 +54,9 @@ const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextB
47
54
  }),
48
55
  /* @__PURE__ */ jsx(PillButton, {
49
56
  color: "secondary",
57
+ variant: "subtle",
58
+ iconPosition: "right",
59
+ icon: toggleState === "year" ? ArrowDropUpIcon : ArrowDropDownIcon,
50
60
  toggle: true,
51
61
  isSelected: toggleState === "year",
52
62
  onChange: (isSelected) => setToggleState(isSelected ? "year" : null),
@@ -54,6 +64,9 @@ const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextB
54
64
  }),
55
65
  includesTime && /* @__PURE__ */ jsx(PillButton, {
56
66
  color: "secondary",
67
+ variant: "subtle",
68
+ iconPosition: "right",
69
+ icon: toggleState === "time" ? ArrowDropUpIcon : ArrowDropDownIcon,
57
70
  toggle: true,
58
71
  isSelected: toggleState === "time",
59
72
  onChange: (isSelected) => setToggleState(isSelected ? "time" : null),
@@ -63,9 +76,10 @@ const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextB
63
76
  }),
64
77
  /* @__PURE__ */ jsx("div", {
65
78
  className: "inline-flex h-12 items-center p-3",
66
- children: !toggleState && /* @__PURE__ */ jsx(Button, {
79
+ children: /* @__PURE__ */ jsx(Button, {
67
80
  ...nextButtonProps,
68
- className: "shrink-0 focus-visible:outline-interactive-contained-secondary-focus",
81
+ isDisabled: !!toggleState,
82
+ className: clsx("shrink-0 focus-visible:outline-interactive-contained-secondary-focus", !!toggleState && "opacity-0"),
69
83
  children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-6 text-interactive-text-secondary-idle" })
70
84
  })
71
85
  })
@@ -5,11 +5,14 @@ import { ChevronsLeftIcon } from "./ChevronsLeft.js";
5
5
  import { ChevronsRightIcon } from "./ChevronsRight.js";
6
6
  import { InlineIconButton } from "./InlineIconButton.js";
7
7
  import { PillButton } from "./PillButton.js";
8
+ import { ns } from "./i18n.js";
8
9
  import { Select } from "./Select.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  import { useMemo } from "react";
11
12
  import { useDateFormatter } from "@react-aria/i18n";
13
+ import { useTranslation } from "react-i18next";
12
14
  const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset = { months: 0 }, onNavigate, maxDate, minDate }) => {
15
+ const { t } = useTranslation("ui");
13
16
  const displayDate = state.visibleRange.start.add(offset);
14
17
  const currentMonth = displayDate.month - 1;
15
18
  const currentYear = displayDate.year;
@@ -102,13 +105,13 @@ const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled,
102
105
  isDisabled: isPrevYearDisabled,
103
106
  onClick: handlePrevYear,
104
107
  icon: ChevronsLeftIcon,
105
- label: "Previous year"
108
+ label: t(($) => $.ui.datePicker.navigation.previousYear)
106
109
  }), /* @__PURE__ */ jsx(InlineIconButton, {
107
110
  color: "secondary",
108
111
  isDisabled: isPrevMonthDisabled,
109
112
  onClick: handlePrevMonth,
110
113
  icon: ChevronLeftIcon,
111
- label: "Previous month"
114
+ label: t(($) => $.ui.datePicker.navigation.previousMonth)
112
115
  })]
113
116
  }),
114
117
  /* @__PURE__ */ jsxs("div", {
@@ -118,6 +121,7 @@ const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled,
118
121
  hideLabel: true,
119
122
  customTrigger: /* @__PURE__ */ jsx(PillButton, {
120
123
  color: "secondary",
124
+ variant: "subtle",
121
125
  iconPosition: "right",
122
126
  icon: ArrowDropDownIcon,
123
127
  children: MONTHS[currentMonth].slice(0, 3)
@@ -135,6 +139,7 @@ const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled,
135
139
  hideLabel: true,
136
140
  customTrigger: /* @__PURE__ */ jsx(PillButton, {
137
141
  color: "secondary",
142
+ variant: "subtle",
138
143
  iconPosition: "right",
139
144
  icon: ArrowDropDownIcon,
140
145
  children: currentYear.toString()
@@ -155,13 +160,13 @@ const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled,
155
160
  isDisabled: isNextMonthDisabled,
156
161
  onClick: handleNextMonth,
157
162
  icon: ChevronRightIcon,
158
- label: "Next month"
163
+ label: t(($) => $.ui.datePicker.navigation.nextMonth)
159
164
  }), /* @__PURE__ */ jsx(InlineIconButton, {
160
165
  color: "secondary",
161
166
  isDisabled: isNextYearDisabled,
162
167
  onClick: handleNextYear,
163
168
  icon: ChevronsRightIcon,
164
- label: "Next year"
169
+ label: t(($) => $.ui.datePicker.navigation.nextYear)
165
170
  })]
166
171
  })
167
172
  ]
@@ -8,7 +8,7 @@ const ChevronLeftIcon = (props) => /* @__PURE__ */ jsx("svg", {
8
8
  children: /* @__PURE__ */ jsx("path", {
9
9
  fill: "currentColor",
10
10
  fillRule: "evenodd",
11
- d: "M15.707 5.293a1 1 0 0 1 0 1.414L10.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414l-6-6a1 1 0 0 1 0-1.414l6-6a1 1 0 0 1 1.414 0",
11
+ d: "M14.744 6.251a.845.845 0 0 1 0 1.212L10.112 12l4.632 4.537a.845.845 0 0 1 0 1.212.89.89 0 0 1-1.238 0l-5.25-5.143a.845.845 0 0 1 0-1.212l5.25-5.143a.89.89 0 0 1 1.238 0",
12
12
  clipRule: "evenodd"
13
13
  })
14
14
  });
@@ -8,7 +8,7 @@ const ChevronRightIcon = (props) => /* @__PURE__ */ jsx("svg", {
8
8
  children: /* @__PURE__ */ jsx("path", {
9
9
  fill: "currentColor",
10
10
  fillRule: "evenodd",
11
- d: "M8.293 5.293a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414L13.586 12 8.293 6.707a1 1 0 0 1 0-1.414",
11
+ d: "M9.256 6.251a.89.89 0 0 1 1.238 0l5.25 5.143a.845.845 0 0 1 0 1.212l-5.25 5.143a.89.89 0 0 1-1.238 0 .845.845 0 0 1 0-1.212L13.888 12 9.256 7.463a.845.845 0 0 1 0-1.212",
12
12
  clipRule: "evenodd"
13
13
  })
14
14
  });
@@ -11,7 +11,7 @@ import { clsx } from "clsx";
11
11
  import { DropZone, FileTrigger } from "react-aria-components";
12
12
  import { useTranslation } from "react-i18next";
13
13
  const InputUploadContent = (props) => {
14
- const { variant, isDisabled, error,...rest } = props;
14
+ const { variant, isDisabled, error, placeholder, buttonText,...rest } = props;
15
15
  const { t } = useTranslation("ui");
16
16
  const inputSizeCva = UIStyle.useConfig()?.input?.sizeCva ?? inputSize;
17
17
  return /* @__PURE__ */ jsx(FileTrigger, {
@@ -33,18 +33,18 @@ const InputUploadContent = (props) => {
33
33
  size: "label-1",
34
34
  as: "span",
35
35
  className: "min-w-0 flex-fill select-none truncate text-text-default-3",
36
- children: t(($) => $.ui.fileUpload.emptyText)
36
+ children: placeholder ?? t(($) => $.ui.fileUpload.emptyText)
37
37
  }), variant === "nested" && /* @__PURE__ */ jsx(TextButton, {
38
38
  isDisabled,
39
39
  icon: UploadIcon,
40
- children: t(($) => $.ui.fileUpload.upload)
40
+ children: buttonText ?? t(($) => $.ui.fileUpload.upload)
41
41
  })]
42
42
  }), variant !== "nested" && /* @__PURE__ */ jsx(Button$1, {
43
43
  size: "s",
44
44
  width: "hug",
45
45
  isDisabled,
46
46
  className: "truncate",
47
- children: t(($) => $.ui.fileUpload.uploadFile)
47
+ children: buttonText ?? t(($) => $.ui.fileUpload.uploadFile)
48
48
  })]
49
49
  })
50
50
  });
@@ -73,7 +73,7 @@ const SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvali
73
73
  className: clsx("group/select-content relative flex px-0!", isSearchable && "cursor-text", className)
74
74
  }),
75
75
  "data-rac": "",
76
- "data-disabled": isDisabled,
76
+ "data-disabled": isDisabled || void 0,
77
77
  "data-hovered": isHovered || void 0,
78
78
  "data-focused": isOpen || isFocused || void 0,
79
79
  "data-focus-within": isFocused || void 0,
@@ -110,7 +110,7 @@ const SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvali
110
110
  }), isSearchable && /* @__PURE__ */ jsx(Input, {
111
111
  placeholder,
112
112
  onBlur,
113
- className: clsx("flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", !showTags && inputSizeCva({
113
+ className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", !showTags && inputSizeCva({
114
114
  size,
115
115
  ...props,
116
116
  className: "rounded-input-rounding-default"
@@ -28,5 +28,7 @@ export type InputUploadBaseProps = {
28
28
  ref?: Ref<HTMLElement>;
29
29
  label?: string;
30
30
  className?: string;
31
+ placeholder?: string;
32
+ buttonText?: string;
31
33
  } & FormFieldProps & InputUploadButtonProps & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple"> & Omit<DropZoneProps, "children" | "onDrop"> & GroupedFileUploadProps;
32
34
  export type InputUploadProps<TFieldValues extends FieldValues = FieldValues> = InputUploadBaseProps & GroupedFileUploadControlProps<TFieldValues>;
@@ -32,6 +32,12 @@ export declare const resources: {
32
32
  thisAndLastYear: string;
33
33
  soFar: string;
34
34
  };
35
+ navigation: {
36
+ previousMonth: string;
37
+ nextMonth: string;
38
+ previousYear: string;
39
+ nextYear: string;
40
+ };
35
41
  errors: {
36
42
  endDateBeforeStart: string;
37
43
  };
@@ -191,6 +197,12 @@ export declare const resources: {
191
197
  thisAndLastYear: string;
192
198
  soFar: string;
193
199
  };
200
+ navigation: {
201
+ previousMonth: string;
202
+ nextMonth: string;
203
+ previousYear: string;
204
+ nextYear: string;
205
+ };
194
206
  errors: {
195
207
  endDateBeforeStart: string;
196
208
  };
@@ -27,6 +27,12 @@ var translation_default = {
27
27
  "thisAndLastYear": "This & Last year",
28
28
  "soFar": "So far"
29
29
  },
30
+ "navigation": {
31
+ "previousMonth": "Previous month",
32
+ "nextMonth": "Next month",
33
+ "previousYear": "Previous year",
34
+ "nextYear": "Next year"
35
+ },
30
36
  "errors": { "endDateBeforeStart": "End date cannot be before start date" }
31
37
  },
32
38
  "modal": { "closeBtn": "Close" },
@@ -27,6 +27,12 @@ var translation_default = {
27
27
  "thisAndLastYear": "Ta in prejšnje leto",
28
28
  "soFar": "Od začetka"
29
29
  },
30
+ "navigation": {
31
+ "previousMonth": "Prejšnji mesec",
32
+ "nextMonth": "Naslednji mesec",
33
+ "previousYear": "Prejšnje leto",
34
+ "nextYear": "Naslednje leto"
35
+ },
30
36
  "errors": { "endDateBeforeStart": "Datum konca ne more biti pred datumom začetka" }
31
37
  },
32
38
  "modal": { "closeBtn": "Zapri" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",