ublo-lib 1.44.4 → 1.44.6

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 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/controls.js"],"names":[],"mappings":"AAQA;;;4CAiCC"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/controls.js"],"names":[],"mappings":"AAQA;;;4CAmCC"}
@@ -18,5 +18,5 @@ export default function Controls({ barRef, distance }) {
18
18
  bar.scrollLeft = currentScroll + distance;
19
19
  }
20
20
  };
21
- return (_jsxs("div", { className: css.controls, children: [_jsx(Button, { variant: "transparent", className: css.control, onClick: scrollTo(LEFT), "aria-label": "Previous", children: _jsx(Icons.ArrowLeft, { className: css.icon }) }), _jsx(Button, { variant: "transparent", className: css.control, onClick: scrollTo(RIGHT), "aria-label": "Next", children: _jsx(Icons.ArrowRight, { className: css.icon }) })] }));
21
+ return (_jsxs("div", { className: css.controls, "data-controls": "", children: [_jsx(Button, { variant: "transparent", className: css.control, onClick: scrollTo(LEFT), "aria-label": "Previous", "data-control": "prev", children: _jsx(Icons.ArrowLeft, { className: css.icon }) }), _jsx(Button, { variant: "transparent", className: css.control, onClick: scrollTo(RIGHT), "aria-label": "Next", "data-control": "next", children: _jsx(Icons.ArrowRight, { className: css.icon }) })] }));
22
22
  }
@@ -1,7 +1,8 @@
1
- export default function PeriodPicker({ setClosed, force, onChange, hidePastDates, ubloContext, }: {
1
+ export default function PeriodPicker({ className, setClosed, onChange, force, hidePastDates, ubloContext, }: {
2
+ className?: any;
2
3
  setClosed?: any;
3
- force?: boolean;
4
4
  onChange?: any;
5
+ force?: boolean;
5
6
  hidePastDates?: boolean;
6
7
  ubloContext?: {};
7
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"period-picker.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/period-picker.js"],"names":[],"mappings":"AA2BA;;;;;;4CA2MC"}
1
+ {"version":3,"file":"period-picker.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/period-picker.js"],"names":[],"mappings":"AA2BA;;;;;;;4CA4MC"}
@@ -18,7 +18,7 @@ const { publicRuntimeConfig } = getConfig();
18
18
  const { start, end, forceSeasonSwitch = false, extend, } = publicRuntimeConfig.season;
19
19
  const WEEK_STORAGE = "stayWeek";
20
20
  const EXTEND_STAY_PICKER_APPEARANCE_DELAY = 1000;
21
- export default function PeriodPicker({ setClosed = undefined, force = false, onChange = undefined, hidePastDates = false, ubloContext = {}, }) {
21
+ export default function PeriodPicker({ className = undefined, setClosed = undefined, onChange = undefined, force = false, hidePastDates = false, ubloContext = {}, }) {
22
22
  const ref = React.useRef(null);
23
23
  const { lang, cmsMode, metadata, path } = {
24
24
  ...ubloContext,
@@ -36,7 +36,7 @@ export default function PeriodPicker({ setClosed = undefined, force = false, onC
36
36
  const beginWeek = weeks[0];
37
37
  const endWeek = weeks[weeks.length - 1];
38
38
  const showDialog = force && selected === null;
39
- const pickerClasses = classNames(css.picker, {
39
+ const pickerClasses = classNames(css.picker, className, {
40
40
  [css.pickerDialogOpened]: showDialog && mustFilterSections,
41
41
  [css.pickerEditing]: !mustFilterSections,
42
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"weeks.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/weeks.js"],"names":[],"mappings":";AAWA,+EA6CG;uBAxDoB,OAAO"}
1
+ {"version":3,"file":"weeks.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/weeks.js"],"names":[],"mappings":";AAWA,+EAiDG;uBA5DoB,OAAO"}
@@ -10,14 +10,16 @@ const { publicRuntimeConfig } = getConfig();
10
10
  const { periods } = publicRuntimeConfig.season || {};
11
11
  const Weeks = React.forwardRef(({ weeks, lang, ...props }, ref) => {
12
12
  React.useEffect(() => {
13
- const bar = ref.current;
14
- if (props.selected === undefined || !bar)
15
- return;
16
- const selectedItem = bar.querySelector(`.${css.itemSelected}`);
17
- if (!selectedItem)
18
- return;
19
- const { clientWidth, offsetLeft } = selectedItem;
20
- bar.scrollLeft = offsetLeft - clientWidth * 1.5;
13
+ window.requestAnimationFrame(() => {
14
+ const bar = ref.current;
15
+ if (bar) {
16
+ const selectedItem = bar.querySelector(`.${css.itemSelected}`);
17
+ if (selectedItem) {
18
+ const { clientWidth, offsetLeft } = selectedItem;
19
+ bar.scrollLeft = offsetLeft - clientWidth * 1.5;
20
+ }
21
+ }
22
+ });
21
23
  }, [props.selected, ref]);
22
24
  const classes = classNames(css.weeks, {
23
25
  [css.withPeriods]: periods,
@@ -27,23 +29,12 @@ const Weeks = React.forwardRef(({ weeks, lang, ...props }, ref) => {
27
29
  Weeks.displayName = "Weeks";
28
30
  export default Weeks;
29
31
  function Week({ lang, week, beginWeek, endWeek, selected, select, forceSeasonSwitch, openExtendedPicker, hidePastDates, }) {
30
- const ref = React.useRef(null);
31
32
  const now = new Date();
32
33
  const prevDate = Dates.weekToDate(week - 1, endWeek, forceSeasonSwitch);
33
34
  const currDate = Dates.weekToDate(week, endWeek, forceSeasonSwitch);
34
35
  const nextDate = Dates.weekToDate(week + 1, endWeek, forceSeasonSwitch);
35
36
  const isSelected = selected === week;
36
37
  const isPast = now.getTime() > nextDate.getTime();
37
- React.useEffect(() => {
38
- const target = ref.current;
39
- if (target && isSelected) {
40
- target.scrollIntoView({
41
- behavior: "smooth",
42
- block: "start",
43
- inline: "start",
44
- });
45
- }
46
- }, [isSelected]);
47
38
  if (hidePastDates && isPast)
48
39
  return null;
49
40
  const isFirst = week === beginWeek;
@@ -69,5 +60,5 @@ function Week({ lang, week, beginWeek, endWeek, selected, select, forceSeasonSwi
69
60
  select(week);
70
61
  openExtendedPicker();
71
62
  };
72
- return (_jsxs("div", { ref: ref, className: weekClasses, children: [_jsx(Button, { className: css.button, onClick: selectWeek, "aria-label": `${Dates.weekToLongDate(week)} - ${Dates.weekToLongDate(week + 1)}`, disabled: isPast }), _jsxs("div", { className: css.date, children: [_jsx("div", { className: css.dateFrom, children: Dates.formatShort(currDate) }), isLast && (_jsx("div", { className: css.dateTo, children: Dates.formatShort(nextDate) }))] }), showMonth && (_jsxs("span", { className: css.month, children: [formattedMonth, " ", showYear && _jsx("b", { className: css.year, children: currYear })] }))] }));
63
+ return (_jsxs("div", { className: weekClasses, children: [_jsx(Button, { className: css.button, onClick: selectWeek, "aria-label": `${Dates.weekToLongDate(week)} - ${Dates.weekToLongDate(week + 1)}`, disabled: isPast }), _jsxs("div", { className: css.date, children: [_jsx("div", { className: css.dateFrom, children: Dates.formatShort(currDate) }), isLast && (_jsx("div", { className: css.dateTo, children: Dates.formatShort(nextDate) }))] }), showMonth && (_jsxs("span", { className: css.month, children: [formattedMonth, " ", showYear && _jsx("b", { className: css.year, children: currYear })] }))] }));
73
64
  }
@@ -28,6 +28,7 @@
28
28
  --item-height: 20px;
29
29
 
30
30
  padding: 0 26px;
31
+ scrollbar-width: none;
31
32
  }
32
33
  }
33
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.44.4",
3
+ "version": "1.44.6",
4
4
  "peerDependencies": {
5
5
  "classnames": "^2.5.1",
6
6
  "dt-design-system": "^3.12.0",