@progress/kendo-react-buttons 14.5.0-develop.1 → 14.5.0-develop.11

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.
@@ -5,69 +5,93 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { Popup as W } from "@progress/kendo-react-popup";
9
8
  import * as e from "react";
10
- import { ToolbarSeparator as S } from "./ToolbarSeparator.mjs";
11
- import { Button as M } from "../../Button.mjs";
12
- import { moreHorizontalIcon as I } from "@progress/kendo-svg-icons";
13
- import { useLocalization as O } from "@progress/kendo-react-intl";
14
- import { moreButtonTitle as d, messages as A } from "../messages/index.mjs";
15
- import { kendoThemeMaps as F } from "@progress/kendo-react-common";
16
- const U = (h) => {
17
- var m;
18
- const { toolbarRef: o, children: b, fillMode: R, size: g } = h, [u, k] = e.useState(!1), c = e.useRef(
19
- e.Children.toArray(b).filter((t) => e.isValidElement(t)).map((t, r) => e.cloneElement(t, { key: t.key || r }))
20
- ), l = e.useRef([]), a = e.useRef(0), T = e.useRef(null), w = e.useRef(null), v = O(), [N, E] = e.useReducer((t) => t + 1, 0), f = () => {
21
- if (!o.current)
9
+ import { Popup as V } from "@progress/kendo-react-popup";
10
+ import { moreHorizontalIcon as _ } from "@progress/kendo-svg-icons";
11
+ import { useLocalization as $ } from "@progress/kendo-react-intl";
12
+ import { kendoThemeMaps as H } from "@progress/kendo-react-common";
13
+ import { ToolbarSeparator as U } from "./ToolbarSeparator.mjs";
14
+ import { moreButtonTitle as y, messages as j } from "../messages/index.mjs";
15
+ import { Button as q } from "../../Button.mjs";
16
+ const tt = (M) => {
17
+ var T;
18
+ const { toolbarRef: i, children: O, fillMode: S, size: F } = M, [g, L] = e.useState(!1), l = e.useRef(
19
+ e.Children.toArray(O).filter((t) => e.isValidElement(t)).map((t, r) => e.cloneElement(t, { key: t.key || r }))
20
+ ), o = e.useRef([]), h = e.useRef(0), W = e.useRef(null), R = e.useRef(null), N = $(), [D, p] = e.useReducer((t) => t + 1, 0), w = () => {
21
+ const t = i.current;
22
+ if (!t)
23
+ return null;
24
+ const r = t.clientWidth, n = parseInt(window.getComputedStyle(t).gap || "0", 10), c = Array.from(t.children), m = c.map((s) => Math.ceil(s.clientWidth)), a = m.reduce((s, b) => s + b, 0) + c.length * n + n * 2;
25
+ return { toolbarWidth: r, gap: n, childWidths: m, totalInnerWidth: a };
26
+ }, P = () => {
27
+ var k, E, C, z, I;
28
+ const t = w();
29
+ if (!t)
22
30
  return;
23
- let t = 0;
24
- const r = o.current.clientWidth, i = parseInt(window.getComputedStyle(o.current).gap || "0", 10), C = Array.from(o.current.children).reduce((n, s, P) => (n += Math.ceil(s.clientWidth), n), 0), p = Array.from(o.current.children).length, y = i * 2;
25
- if (t = C + p * i + y, t > r) {
26
- const n = [...c.current], s = n.pop();
27
- a.current = r, c.current = n, s && (l.current = [s, ...l.current]);
28
- } else if (r > a.current + i * p) {
29
- const n = [...l.current], s = n.shift();
30
- l.current = n, s && (c.current = [...c.current, s]), a.current = r;
31
+ const { toolbarWidth: r, gap: n, childWidths: c, totalInnerWidth: m } = t;
32
+ let a = m, s = !1;
33
+ const b = o.current.length > 0, d = [...l.current], v = [...o.current];
34
+ for (; a > r && d.length > 0; ) {
35
+ const u = d.pop(), f = d.length;
36
+ if (u && v.unshift(u), f < c.length && (a -= c[f] + n), !s && !b) {
37
+ const A = Math.ceil((E = (k = R.current) == null ? void 0 : k.offsetWidth) != null ? E : 0), B = Math.ceil((I = (z = (C = W.current) == null ? void 0 : C.element) == null ? void 0 : z.offsetWidth) != null ? I : 0);
38
+ a += A + B + n * 2;
39
+ }
40
+ s = !0;
41
+ }
42
+ if (s) {
43
+ l.current = d, o.current = v, h.current = r, p();
44
+ return;
45
+ }
46
+ if (o.current.length > 0 && r > h.current + n * c.length) {
47
+ const u = [...o.current], f = u.shift();
48
+ o.current = u, f && (l.current = [...l.current, f]), h.current = r, p();
31
49
  }
32
- E();
33
50
  };
34
51
  e.useEffect(() => {
35
- f();
36
- const t = new ResizeObserver(f), r = o.current;
52
+ const t = new ResizeObserver(P), r = i.current;
37
53
  return r && t.observe(r), () => {
38
54
  r && t.unobserve(r);
39
55
  };
40
- }, []);
41
- const z = () => {
42
- k(!u);
56
+ }, []), e.useLayoutEffect(() => {
57
+ if (!i.current || o.current.length === 0 || l.current.length === 0)
58
+ return;
59
+ const t = w();
60
+ if (!t || t.totalInnerWidth <= t.toolbarWidth)
61
+ return;
62
+ const r = [...l.current], n = r.pop();
63
+ h.current = t.toolbarWidth, l.current = r, n && (o.current = [n, ...o.current]), p();
64
+ });
65
+ const x = () => {
66
+ L(!g);
43
67
  };
44
- return /* @__PURE__ */ e.createElement(e.Fragment, null, c.current.length > 0 && c.current, l.current.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(S, { _ref: w, className: "k-toolbar-button-separator" }), /* @__PURE__ */ e.createElement(
45
- M,
68
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, l.current.length > 0 && l.current, o.current.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(U, { _ref: R, className: "k-toolbar-button-separator" }), /* @__PURE__ */ e.createElement(
69
+ q,
46
70
  {
47
- ref: T,
71
+ ref: W,
48
72
  className: "k-toolbar-overflow-button",
49
73
  fillMode: "flat",
50
- svgIcon: I,
51
- title: v.toLanguageString(d, A[d]),
52
- onClick: z
74
+ svgIcon: _,
75
+ title: N.toLanguageString(y, j[y]),
76
+ onClick: x
53
77
  }
54
78
  ), /* @__PURE__ */ e.createElement(
55
- W,
79
+ V,
56
80
  {
57
- anchor: o.current,
58
- show: u,
81
+ anchor: i.current,
82
+ show: g,
59
83
  popupClass: "k-toolbar-popup",
60
- style: { width: (m = o.current) == null ? void 0 : m.offsetWidth }
84
+ style: { width: (T = i.current) == null ? void 0 : T.offsetWidth }
61
85
  },
62
86
  /* @__PURE__ */ e.createElement(
63
87
  "span",
64
88
  {
65
- className: `k-toolbar-items-list k-toolbar-items-list-${F.sizeMap[g]} k-toolbar-items-list-${R}`
89
+ className: `k-toolbar-items-list k-toolbar-items-list-${H.sizeMap[F]} k-toolbar-items-list-${S}`
66
90
  },
67
- l.current.length > 0 && l.current
91
+ o.current.length > 0 && o.current
68
92
  )
69
93
  )));
70
94
  };
71
95
  export {
72
- U as ToolbarOverflowSection
96
+ tt as ToolbarOverflowSection
73
97
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),l=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-intl"),r=require("../messages/index.js"),s=require("@progress/kendo-svg-icons");function f(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const e=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,e.get?e:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=f(p),S=t=>{const n=m.useLocalization(),{disabled:o,type:e,scrollContentRef:c,buttonScrollSpeed:a,prevButton:u,nextButton:d}=t,b=v=>{c&&c.current&&a&&c.current.scrollBy({left:e==="next"?a:-a,behavior:"smooth"})},g=e==="prev"?u||"span":d||"span";return i.createElement(g,{className:l.classNames("k-button","k-icon-button",`k-toolbar-${e}`,{"k-disabled":o}),title:`${e==="prev"?n.toLanguageString(r.prevArrowTitle,r.messages[r.prevArrowTitle]):n.toLanguageString(r.nextArrowTitle,r.messages[r.nextArrowTitle])}`,"aria-hidden":!0,tabIndex:o?-1:void 0,onClick:b},i.createElement(l.SvgIcon,{icon:e==="prev"?s.caretAltLeftIcon:s.caretAltRightIcon,className:"k-button-icon"}))};exports.ToolbarScrollButton=S;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),l=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-intl"),r=require("../messages/index.js"),s=require("@progress/kendo-svg-icons");function f(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const e=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,e.get?e:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=f(p),v=t=>{const n=m.useLocalization(),{disabled:o,type:e,scrollContentRef:c,buttonScrollSpeed:a,prevButton:u,nextButton:d}=t,b=S=>{c&&c.current&&a&&c.current.scrollBy({left:e==="next"?a:-a,behavior:"smooth"})},g=e==="prev"?u||"span":d||"span";return i.createElement(g,{className:l.classNames("k-button","k-icon-button",`k-toolbar-${e}`,{"k-disabled":o}),title:`${e==="prev"?n.toLanguageString(r.prevArrowTitle,r.messages[r.prevArrowTitle]):n.toLanguageString(r.nextArrowTitle,r.messages[r.nextArrowTitle])}`,"aria-hidden":!0,tabIndex:o?-1:void 0,onClick:b},i.createElement(l.SvgIcon,{icon:e==="prev"?s.chevronLeftIcon:s.chevronRightIcon,className:"k-button-icon"}))};exports.ToolbarScrollButton=v;
@@ -6,12 +6,12 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as a from "react";
9
- import { classNames as d, SvgIcon as f } from "@progress/kendo-react-common";
10
- import { useLocalization as g } from "@progress/kendo-react-intl";
11
- import { prevArrowTitle as l, messages as c, nextArrowTitle as i } from "../messages/index.mjs";
12
- import { caretAltLeftIcon as v, caretAltRightIcon as S } from "@progress/kendo-svg-icons";
13
- const I = (s) => {
14
- const n = g(), { disabled: r, type: t, scrollContentRef: o, buttonScrollSpeed: e, prevButton: m, nextButton: p } = s, u = (k) => {
9
+ import { classNames as d, SvgIcon as v } from "@progress/kendo-react-common";
10
+ import { useLocalization as f } from "@progress/kendo-react-intl";
11
+ import { prevArrowTitle as c, messages as l, nextArrowTitle as i } from "../messages/index.mjs";
12
+ import { chevronLeftIcon as g, chevronRightIcon as h } from "@progress/kendo-svg-icons";
13
+ const L = (s) => {
14
+ const n = f(), { disabled: r, type: t, scrollContentRef: o, buttonScrollSpeed: e, prevButton: m, nextButton: p } = s, u = (S) => {
15
15
  o && o.current && e && o.current.scrollBy({
16
16
  left: t === "next" ? e : -e,
17
17
  behavior: "smooth"
@@ -26,15 +26,15 @@ const I = (s) => {
26
26
  className: d("k-button", "k-icon-button", `k-toolbar-${t}`, {
27
27
  "k-disabled": r
28
28
  }),
29
- title: `${t === "prev" ? n.toLanguageString(l, c[l]) : n.toLanguageString(i, c[i])}`,
29
+ title: `${t === "prev" ? n.toLanguageString(c, l[c]) : n.toLanguageString(i, l[i])}`,
30
30
  "aria-hidden": !0,
31
31
  tabIndex: r ? -1 : void 0,
32
32
  onClick: u
33
33
  },
34
- /* @__PURE__ */ a.createElement(f, { icon: t === "prev" ? v : S, className: "k-button-icon" })
34
+ /* @__PURE__ */ a.createElement(v, { icon: t === "prev" ? g : h, className: "k-button-icon" })
35
35
  )
36
36
  );
37
37
  };
38
38
  export {
39
- I as ToolbarScrollButton
39
+ L as ToolbarScrollButton
40
40
  };