@progress/kendo-react-layout 8.1.0-develop.2 → 8.1.0-develop.20

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/stepper/Step.mjs CHANGED
@@ -8,79 +8,79 @@
8
8
  "use client";
9
9
  import * as e from "react";
10
10
  import a from "prop-types";
11
- import { StepperContext as Z } from "./context/StepperContext.mjs";
12
- import { focusFirstFocusableChild as ee, dispatchEvent as L, classNames as te, IconWrap as O, toIconName as ae } from "@progress/kendo-react-common";
13
- import { useLocalization as se } from "@progress/kendo-react-intl";
14
- import { checkOutlineIcon as ne, exclamationCircleIcon as oe } from "@progress/kendo-svg-icons";
15
- import { DEFAULT_ANIMATION_DURATION as ce, NO_ANIMATION as le } from "./contants.mjs";
16
- import { messages as ie, optionalText as re } from "./messages/index.mjs";
17
- const E = e.forwardRef((R, V) => {
11
+ import { StepperContext as Y } from "./context/StepperContext.mjs";
12
+ import { focusFirstFocusableChild as Z, dispatchEvent as T, classNames as ee, IconWrap as L, toIconName as te } from "@progress/kendo-react-common";
13
+ import { useLocalization as ae } from "@progress/kendo-react-intl";
14
+ import { checkOutlineIcon as se, exclamationCircleIcon as oe } from "@progress/kendo-svg-icons";
15
+ import { DEFAULT_ANIMATION_DURATION as ne, NO_ANIMATION as ce } from "./contants.mjs";
16
+ import { messages as le, optionalText as ie } from "./messages/index.mjs";
17
+ const x = e.forwardRef((O, R) => {
18
18
  const {
19
19
  // content
20
- children: z,
21
- className: h,
20
+ children: V,
21
+ className: E,
22
22
  current: d,
23
- disabled: n,
24
- focused: u,
23
+ disabled: o,
24
+ focused: h,
25
25
  icon: r,
26
26
  svgIcon: C,
27
27
  index: s,
28
28
  isValid: t,
29
- label: o,
29
+ label: n,
30
30
  optional: m,
31
31
  style: y,
32
- tabIndex: S,
33
- text: F,
34
- ...D
35
- } = R, {
36
- animationDuration: k,
37
- isVertical: b,
38
- item: H,
39
- linear: P,
40
- mode: A,
32
+ tabIndex: me,
33
+ text: S,
34
+ ...z
35
+ } = O, {
36
+ animationDuration: u,
37
+ isVertical: k,
38
+ item: D,
39
+ linear: H,
40
+ mode: F,
41
41
  numOfSteps: c,
42
42
  value: l,
43
- onChange: f,
44
- onFocus: I,
45
- successIcon: _,
46
- errorIcon: w,
47
- successSVGIcon: B,
48
- errorSVGIcon: G
49
- } = e.useContext(Z), p = e.useRef(null), M = e.useCallback(
43
+ onChange: b,
44
+ onFocus: f,
45
+ successIcon: P,
46
+ errorIcon: _,
47
+ successSVGIcon: w,
48
+ errorSVGIcon: B
49
+ } = e.useContext(Y), p = e.useRef(null), A = e.useCallback(
50
50
  () => {
51
- p.current && ee(p.current);
51
+ p.current && Z(p.current);
52
52
  },
53
53
  []
54
54
  ), v = e.useCallback(
55
55
  () => ({
56
56
  element: p.current,
57
- focus: M
57
+ focus: A
58
58
  }),
59
- [M]
59
+ [A]
60
60
  );
61
- e.useImperativeHandle(V, v);
62
- const N = !P || s === l - 1 || s === l || s === l + 1, x = A === "labels" || !!r && !!o, U = se(), W = ((i) => U.toLanguageString(i, ie[i]))(re), $ = typeof k == "number" ? k : k !== !1 ? ce : le, j = e.useCallback(
61
+ e.useImperativeHandle(R, v);
62
+ const I = !H || s === l - 1 || s === l || s === l + 1, N = F === "labels" || !!r && !!n, G = ae(), U = ((i) => G.toLanguageString(i, le[i]))(ie), W = typeof u == "number" ? u : u !== !1 ? ne : ce, $ = e.useCallback(
63
63
  (i) => {
64
- f && !n && L(
65
- f,
64
+ b && !o && T(
65
+ b,
66
66
  i,
67
67
  v(),
68
68
  { value: s }
69
69
  );
70
70
  },
71
- [f, l, n]
72
- ), K = e.useCallback(
71
+ [b, l, o]
72
+ ), j = e.useCallback(
73
73
  (i) => {
74
- I && !n && L(
75
- I,
74
+ f && !o && T(
75
+ f,
76
76
  i,
77
77
  v(),
78
78
  void 0
79
79
  );
80
80
  },
81
- [I, n]
82
- ), q = e.useMemo(
83
- () => te(
81
+ [f, o]
82
+ ), K = e.useMemo(
83
+ () => ee(
84
84
  "k-step",
85
85
  {
86
86
  "k-step-first": s === 0,
@@ -89,70 +89,67 @@ const E = e.forwardRef((R, V) => {
89
89
  "k-step-current": d,
90
90
  "k-step-optional": m,
91
91
  "k-step-error": t !== void 0 && !t,
92
- "k-step-success": t
92
+ "k-step-success": t,
93
+ "k-disabled": o,
94
+ "k-focus": h
93
95
  },
94
- {
95
- "k-disabled": n,
96
- "k-focus": u
97
- },
98
- h
96
+ E
99
97
  ),
100
- [s, c, l, d, m, n, u, t, h]
101
- ), J = e.useMemo(
98
+ [s, c, l, d, m, o, h, t, E]
99
+ ), q = e.useMemo(
102
100
  () => ({
103
- maxWidth: b ? void 0 : `calc(100% / ${c})`,
104
- maxHeight: b ? `calc(100% / ${c})` : void 0,
105
- pointerEvents: N ? void 0 : "none",
101
+ maxWidth: k ? void 0 : `calc(100% / ${c})`,
102
+ maxHeight: k ? `calc(100% / ${c})` : void 0,
103
+ pointerEvents: I ? void 0 : "none",
106
104
  ...y
107
105
  }),
108
- [b, c, y, N]
109
- ), T = t ? _ : w, g = T ? /* @__PURE__ */ e.createElement(
106
+ [k, c, y, I]
107
+ ), M = t ? P : _, g = M ? /* @__PURE__ */ e.createElement(
110
108
  "span",
111
109
  {
112
- className: "k-step-indicator-icon " + T,
110
+ className: "k-step-indicator-icon " + M,
113
111
  "aria-hidden": "true"
114
112
  }
115
113
  ) : /* @__PURE__ */ e.createElement(
116
- O,
114
+ L,
117
115
  {
118
116
  className: "k-step-indicator-icon",
119
117
  name: t ? "check-circle" : "exclamation-circle",
120
- icon: t ? B || ne : G || oe
118
+ icon: t ? w || se : B || oe
121
119
  }
122
- ), Q = /* @__PURE__ */ e.createElement(e.Fragment, null, A !== "labels" ? /* @__PURE__ */ e.createElement(
120
+ ), J = /* @__PURE__ */ e.createElement(e.Fragment, null, F !== "labels" ? /* @__PURE__ */ e.createElement(
123
121
  "span",
124
122
  {
125
123
  className: "k-step-indicator",
126
124
  "aria-hidden": !0,
127
- style: { transitionDuration: $ + "ms" }
125
+ style: { transitionDuration: W + "ms" }
128
126
  },
129
- r || C ? !x && t !== void 0 ? g : /* @__PURE__ */ e.createElement(O, { className: "k-step-indicator-icon", name: r && ae(r), icon: C }) : t !== void 0 ? g : /* @__PURE__ */ e.createElement("span", { className: "k-step-indicator-text" }, F || s + 1)
130
- ) : null), X = (o || x || m) && /* @__PURE__ */ e.createElement("span", { className: "k-step-label" }, o && /* @__PURE__ */ e.createElement("span", { className: "k-step-text" }, o), x && t !== void 0 && g, m && /* @__PURE__ */ e.createElement("span", { className: "k-step-label-optional" }, W)), Y = /* @__PURE__ */ e.createElement(e.Fragment, null, Q, X);
127
+ r || C ? !N && t !== void 0 ? g : /* @__PURE__ */ e.createElement(L, { className: "k-step-indicator-icon", name: r && te(r), icon: C }) : t !== void 0 ? g : /* @__PURE__ */ e.createElement("span", { className: "k-step-indicator-text" }, S || s + 1)
128
+ ) : null), Q = (n || N || m) && /* @__PURE__ */ e.createElement("span", { className: "k-step-label" }, n && /* @__PURE__ */ e.createElement("span", { className: "k-step-text" }, n), N && t !== void 0 && g, m && /* @__PURE__ */ e.createElement("span", { className: "k-step-label-optional" }, U)), X = /* @__PURE__ */ e.createElement(e.Fragment, null, J, Q);
131
129
  return /* @__PURE__ */ e.createElement(
132
130
  "li",
133
131
  {
134
132
  ref: p,
135
- className: q,
136
- style: J,
137
- ...D
133
+ className: K,
134
+ style: q,
135
+ ...z
138
136
  },
139
137
  /* @__PURE__ */ e.createElement(
140
138
  "a",
141
139
  {
142
140
  className: "k-step-link",
143
- title: o || void 0,
144
- onClick: j,
145
- onFocus: K,
146
- tabIndex: S || (u ? 0 : -1),
147
- "aria-current": d,
148
- "aria-disabled": n || !N || void 0,
141
+ title: n || void 0,
142
+ onClick: $,
143
+ onFocus: j,
144
+ "aria-current": d ? "step" : void 0,
145
+ "aria-disabled": o || !I || void 0,
149
146
  "aria-invalid": t !== void 0 && !t || void 0
150
147
  },
151
- H ? z : Y
148
+ D ? V : X
152
149
  )
153
150
  );
154
151
  });
155
- E.propTypes = {
152
+ x.propTypes = {
156
153
  children: a.any,
157
154
  className: a.string,
158
155
  // content: PropTypes.any,
@@ -167,11 +164,11 @@ E.propTypes = {
167
164
  tabIndex: a.number,
168
165
  text: a.string
169
166
  };
170
- const me = {
167
+ const re = {
171
168
  tabIndex: 0
172
169
  };
173
- E.defaultProps = me;
174
- E.displayName = "KendoStep";
170
+ x.defaultProps = re;
171
+ x.displayName = "KendoStep";
175
172
  export {
176
- E as Step
173
+ x as Step
177
174
  };
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),r=require("prop-types"),$=require("./context/StepperContext.js"),o=require("@progress/kendo-react-common"),ee=require("./Step.js"),te=require("@progress/kendo-react-progressbars"),K=require("./contants.js"),se=require("../package-metadata.js"),ae=require("@progress/kendo-react-intl"),N=require("./messages/index.js");function ne(i){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const u in i)if(u!=="default"){const v=Object.getOwnPropertyDescriptor(i,u);Object.defineProperty(b,u,v.get?v:{enumerable:!0,get:()=>i[u]})}}return b.default=i,Object.freeze(b)}const a=ne(Z),I=a.forwardRef((i,b)=>{o.validatePackage(se.packageMetadata);const{animationDuration:u,children:v,className:O,disabled:f,errorIcon:A,errorSVGIcon:F,item:P,items:m,linear:g,mode:L,orientation:S,style:w,successIcon:V,successSVGIcon:j,onChange:h,onFocus:E}=i,z=ae.useLocalization().toLanguageString(N.progBarAriaLabel,N.messages[N.progBarAriaLabel]),k=a.useRef(null),T=a.useCallback(()=>{k.current&&o.focusFirstFocusableChild(k.current)},[]),R=a.useCallback(()=>({element:k.current,focus:T}),[T]);a.useImperativeHandle(b,R);const l=i.value||M.value,[y,c]=a.useState(l),p=m?m.length:0,n=S==="vertical",D=o.useRtl(k,i.dir),_=typeof u=="number"?u:u!==!1?K.DEFAULT_ANIMATION_DURATION:K.NO_ANIMATION;a.useEffect(()=>{c(l)},[l]);const C=a.useCallback((t,s)=>{const e=s===l-1,d=s===l,Y=s===l+1;l!==s&&h&&!f&&(!g||e||d||Y)&&(o.dispatchEvent(h,t,R(),{value:s}),c(s))},[l,g,h,f,c]),G=a.useCallback(t=>{let s=t.value,e=t.syntheticEvent;C(e,s)},[C]),B=a.useCallback(t=>{E&&!f&&o.dispatchEvent(E,t.syntheticEvent,R(),void 0)},[E,f]),q=a.useCallback(t=>{C(t,y)},[C,y]),H=a.useCallback(t=>{const s=D==="rtl",e=y,d=m.length-1;switch(t.keyCode){case o.Keys.left:t.preventDefault(),!s&&e>0&&c(e-1),s&&e<d&&c(e+1);break;case o.Keys.right:t.preventDefault(),!s&&e<d&&c(e+1),s&&e>0&&c(e-1);break;case o.Keys.up:t.preventDefault(),!s&&e>0&&c(e-1),s&&e>0&&c(e-1);break;case o.Keys.down:t.preventDefault(),!s&&e<d&&c(e+1),s&&e<d&&c(e+1);break;case o.Keys.home:t.preventDefault(),c(0);break;case o.Keys.end:t.preventDefault(),c(d);break;case o.Keys.space:t.preventDefault();break;case o.Keys.enter:t.preventDefault(),m[e].disabled||q(t);break}},[m,c,y,D,q]),U=a.useMemo(()=>o.classNames("k-stepper",{"k-stepper-linear":g},O),[g,O]),J=a.useMemo(()=>({display:"grid",gridTemplateColumns:n?void 0:"repeat("+p*2+", 1fr)",gridTemplateRows:n?"repeat("+p+", 1fr)":void 0,...w}),[n,p,w]),Q=a.useMemo(()=>o.classNames("k-step-list",{"k-step-list-horizontal":!n,"k-step-list-vertical":n}),[n]),W=a.useMemo(()=>({gridColumnStart:n?void 0:1,gridColumnEnd:n?void 0:-1,gridRowStart:n?1:void 0,gridRowEnd:n?-1:void 0}),[n]),X=a.useMemo(()=>({gridColumnStart:n?void 0:2,gridColumnEnd:n?void 0:p*2,gridRowStart:n?1:void 0,gridRowEnd:n?p:void 0,top:n?17:void 0}),[n,p]),x=m&&m.map((t,s)=>{const e={index:s,disabled:f||t.disabled,focused:s===y,current:s===l,...t},d=P||ee.Step;return a.createElement(d,{key:s,...e})});return a.createElement($.StepperContext.Provider,{value:{animationDuration:u,isVertical:n,item:P,linear:g,mode:L,numOfSteps:p,value:l,successIcon:V,successSVGIcon:j,errorIcon:A,errorSVGIcon:F,onChange:G,onFocus:B}},a.createElement("nav",{className:U,style:J,dir:D,onKeyDown:H},a.createElement("ol",{className:Q,style:W},x||v),a.createElement(te.ProgressBar,{style:X,labelPlacement:"start",animation:{duration:_},ariaLabel:z,"aria-hidden":!0,max:p-1,labelVisible:!1,orientation:S,reverse:S==="vertical",value:l,disabled:f,tabIndex:-1})))});I.propTypes={animationDuration:r.oneOfType([r.bool,r.number]),children:r.any,className:r.string,dir:r.string,disabled:r.bool,errorIcon:r.string,errorSVGIcon:o.svgIconPropType,item:r.any,items:r.any,linear:r.bool,mode:r.oneOf(["steps","labels"]),orientation:r.oneOf(["horizontal","vertical"]),style:r.object,successIcon:r.string,successSVGIcon:o.svgIconPropType,value:r.number.isRequired,onChange:r.func,onFocus:r.func};const M={value:0};I.defaultProps=M;I.displayName="KendoStepper";exports.Stepper=I;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),l=require("prop-types"),$=require("./context/StepperContext.js"),d=require("@progress/kendo-react-common"),ee=require("./Step.js"),te=require("@progress/kendo-react-progressbars"),q=require("./contants.js"),se=require("../package-metadata.js"),ne=require("@progress/kendo-react-intl"),D=require("./messages/index.js");function oe(p){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const f in p)if(f!=="default"){const I=Object.getOwnPropertyDescriptor(p,f);Object.defineProperty(y,f,I.get?I:{enumerable:!0,get:()=>p[f]})}}return y.default=p,Object.freeze(y)}const o=oe(Z),O=o.forwardRef((p,y)=>{d.validatePackage(se.packageMetadata);const{animationDuration:f,children:I,className:w,disabled:g,errorIcon:F,errorSVGIcon:L,item:P,items:b,linear:k,mode:z,orientation:S,style:R,successIcon:V,successSVGIcon:j,value:u=0,onChange:h,onFocus:x}=p,_=ne.useLocalization().toLanguageString(D.progBarAriaLabel,D.messages[D.progBarAriaLabel]),v=o.useRef(null),T=o.useCallback(()=>{v.current&&d.focusFirstFocusableChild(v.current)},[]),C=o.useCallback(()=>({element:v.current,focus:T}),[T]);o.useImperativeHandle(y,C);const[K,c]=o.useState(u),m=b?b.length:0,s=S==="vertical",N=d.useDir(v,p.dir),G=typeof f=="number"?f:f!==!1?q.DEFAULT_ANIMATION_DURATION:q.NO_ANIMATION;o.useEffect(()=>{c(u)},[u]);const A=o.useCallback((r,i)=>{const e=i===u-1,t=i===u,a=i===u+1;u!==i&&h&&!g&&(!k||e||t||a)&&(d.dispatchEvent(h,r,C(),{value:i}),c(i))},[u,k,h,g,c]),B=o.useCallback(r=>{let i=r.value,e=r.syntheticEvent;A(e,i)},[A]),H=o.useCallback(r=>{x&&!g&&d.dispatchEvent(x,r.syntheticEvent,C(),void 0)},[x,g]),E=o.useMemo(()=>{const r=N==="rtl",i=b.length-1;return new d.Navigation({root:v,selectors:["ol.k-step-list li.k-step a.k-step-link"],tabIndex:0,keyboardEvents:{keydown:{ArrowLeft:(e,t,a)=>{a.preventDefault();const n=t.elements.indexOf(e);!s&&!r&&n>0?(t.focusPrevious(e),c(n-1)):!s&&r&&n<i&&(t.focusNext(e),c(n+1))},ArrowRight:(e,t,a)=>{a.preventDefault();const n=t.elements.indexOf(e);!s&&!r&&n<i?(t.focusNext(e),c(n+1)):!s&&r&&n>0&&(t.focusPrevious(e),c(n-1))},ArrowUp:(e,t,a)=>{a.preventDefault();const n=t.elements.indexOf(e);s&&!r&&n>0?(t.focusPrevious(e),c(n-1)):s&&r&&n>0&&(t.focusPrevious(e),c(n+1))},ArrowDown:(e,t,a)=>{a.preventDefault();const n=t.elements.indexOf(e);s&&!r&&n<i?(t.focusNext(e),c(n+1)):s&&r&&n<i&&(t.focusNext(e),c(n-1))},Tab:(e,t,a)=>{a.preventDefault();const n=t.elements.indexOf(e);a.shiftKey?!s&&!r&&n>0?(t.focusPrevious(e),c(n-1)):!s&&r&&n<i&&(t.focusNext(e),c(n+1)):!s&&!r&&n<i?(t.focusNext(e),c(n+1)):!s&&r&&n>0&&(t.focusPrevious(e),c(n-1))},Home:(e,t,a)=>{a.preventDefault(),t.focusElement(t.first,e),c(0)},End:(e,t,a)=>{a.preventDefault(),t.focusElement(t.last,e),c(i)},Space:(e,t,a)=>{a.preventDefault(),e.children[0].click()},Enter:(e,t,a)=>{a.preventDefault(),e.children[0].click()}}}})},[N,b.length,s,c]);o.useEffect(()=>(E.initializeRovingTab(u),()=>E.removeFocusListener()),[]);const U=o.useCallback(E.triggerKeyboardEvent.bind(E),[]),J=o.useMemo(()=>d.classNames("k-stepper",{"k-stepper-linear":k},w),[k,w]),Q=o.useMemo(()=>({display:"grid",gridTemplateColumns:s?void 0:"repeat("+m*2+", 1fr)",gridTemplateRows:s?"repeat("+m+", 1fr)":void 0,...R}),[s,m,R]),W=o.useMemo(()=>d.classNames("k-step-list",{"k-step-list-horizontal":!s,"k-step-list-vertical":s}),[s]),X=o.useMemo(()=>({gridColumnStart:s?void 0:1,gridColumnEnd:s?void 0:-1,gridRowStart:s?1:void 0,gridRowEnd:s?-1:void 0}),[s]),Y=o.useMemo(()=>({gridColumnStart:s?void 0:2,gridColumnEnd:s?void 0:m*2,gridRowStart:s?1:void 0,gridRowEnd:s?m:void 0,top:s?17:void 0}),[s,m]),M=b&&b.map((r,i)=>{const e={index:i,disabled:g||r.disabled,focused:i===K,current:i===u,...r},t=P||ee.Step;return o.createElement(t,{key:i,...e})});return o.createElement($.StepperContext.Provider,{value:{animationDuration:f,isVertical:s,item:P,linear:k,mode:z,numOfSteps:m,value:u,successIcon:V,successSVGIcon:j,errorIcon:F,errorSVGIcon:L,onChange:B,onFocus:H}},o.createElement("nav",{className:J,style:Q,dir:N,role:"navigation",ref:v,onKeyDown:U},o.createElement("ol",{className:W,style:X},M||I),o.createElement(te.ProgressBar,{style:Y,labelPlacement:"start",animation:{duration:G},ariaLabel:_,"aria-hidden":!0,max:m-1,labelVisible:!1,orientation:S,reverse:S==="vertical",value:u,disabled:g,tabIndex:-1})))});O.propTypes={animationDuration:l.oneOfType([l.bool,l.number]),children:l.any,className:l.string,dir:l.string,disabled:l.bool,errorIcon:l.string,errorSVGIcon:d.svgIconPropType,item:l.any,items:l.any,linear:l.bool,mode:l.oneOf(["steps","labels"]),orientation:l.oneOf(["horizontal","vertical"]),style:l.object,successIcon:l.string,successSVGIcon:d.svgIconPropType,value:l.number.isRequired,onChange:l.func,onFocus:l.func};O.displayName="KendoStepper";exports.Stepper=O;