@tedi-design-system/react 17.1.0-rc.6 → 17.1.0-rc.8
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/_virtual/index.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/text-group/index.d.ts +2 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +82 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +30 -0
- package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.d.ts +9 -1
- package/src/tedi/components/content/text-group/text-group.es.js +20 -15
- package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.module.scss.es.js +3 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +70 -70
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +110 -110
- package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field-helpers.d.ts +51 -0
- package/src/tedi/components/form/time-field/time-field-helpers.es.js +65 -0
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.d.ts +87 -0
- package/src/tedi/components/form/time-field/time-field.es.js +149 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.es.js +10 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +38 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +101 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.d.ts +40 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +184 -0
- package/src/tedi/components/form/time-picker/time-picker.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.d.ts +60 -0
- package/src/tedi/components/form/time-picker/time-picker.es.js +45 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +14 -0
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +9 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +98 -88
- package/src/tedi/index.d.ts +3 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +9 -2
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +214 -208
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"tedi-time-field__textfield": "tedi-time-field__textfield-73806efe",
|
|
3
|
+
"tedi-time-field__textfield--disabled": "tedi-time-field__textfield--disabled-86b8b11c",
|
|
4
|
+
"tedi-time-field__container": "tedi-time-field__container-45902dd9",
|
|
5
|
+
"tedi-time-field__icon--disabled": "tedi-time-field__icon--disabled-1c2b77ca",
|
|
6
|
+
"tedi-time-field__picker-wrapper": "tedi-time-field__picker-wrapper-6dd90739"
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
e as default
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),d=require("react"),h=require("../../../../../../../external/classnames/index.cjs.js"),R=require("../../../../buttons/button/button.cjs.js"),A=require("../../../choice-group/choice-group.cjs.js"),u=require("../../time-picker.module.scss.cjs.js"),C=require("../../../../../providers/label-provider/use-labels.cjs.js"),G=require("../../../../layout/grid/row.cjs.js"),I=require("../../../../layout/grid/col.cjs.js"),k=({times:m,value:o,onSelect:f,className:w,colWidth:a={xs:6,md:4},variant:p="button",bordered:x=!0})=>{const l=d.useId(),{getLabel:q}=C.useLabels(),s=d.useRef(null);d.useEffect(()=>{if(!o)return;const e=s.current;if(!e)return;const r=e.querySelector(`input[type="radio"][value="${o}"], button[data-time="${o}"]`);r==null||r.focus({preventScroll:!0})},[]);const _=e=>{var g;if(p!=="radio")return;const r=s.current;if(!r)return;const t=Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));if(t.length===0)return;const i=t.findIndex(j=>j===document.activeElement);let n;switch(e.key){case"ArrowDown":case"ArrowRight":n=i<0||i===t.length-1?0:i+1;break;case"ArrowUp":case"ArrowLeft":n=i<=0?t.length-1:i-1;break;case"Home":n=0;break;case"End":n=t.length-1;break;default:return}e.preventDefault(),(g=t[n])==null||g.focus()},b=h.default(u.default["tedi-time-picker__grid"],{[u.default["tedi-time-picker__grid--borderless"]]:!x},w),y=typeof a=="object"?a:{width:a};return p==="radio"?c.jsx("div",{ref:s,className:b,onKeyDown:_,children:c.jsx(A.ChoiceGroup,{id:`time-picker-group-${l}`,label:q("timePicker.pickTime"),inputType:"radio",name:`time-grid-${l}`,value:o,onChange:e=>f(e),items:m.map(e=>({id:`time-${l}-${e}`,label:e,value:e,colProps:y})),direction:"row",variant:"card",showIndicator:!0,color:"secondary",hideLabel:!0})}):c.jsx("div",{ref:s,className:b,children:c.jsx(G.Row,{gutter:2,children:m.map(e=>d.createElement(I.Col,{...y,key:e},c.jsx(R.Button,{noStyle:!0,"data-time":e,className:h.default(u.default["tedi-time-picker__grid-item"],{[u.default["tedi-time-picker__grid-item--selected"]]:e===o}),onClick:()=>f(e),children:e})))})})};k.displayName="TimeGrid";exports.TimeGrid=k;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ColProps, ColSize } from '../../../../layout/grid';
|
|
2
|
+
export interface TimeGridProps {
|
|
3
|
+
/**
|
|
4
|
+
* Times in HH:mm format
|
|
5
|
+
*/
|
|
6
|
+
times: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Selected value
|
|
9
|
+
*/
|
|
10
|
+
value?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Selection handler
|
|
13
|
+
*/
|
|
14
|
+
onSelect: (time: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Grid column width per time slot. Accepts either:
|
|
17
|
+
*
|
|
18
|
+
* - a single `ColSize` (1–12 or `'auto'`) applied at every breakpoint, or
|
|
19
|
+
* - a breakpoint object (`{ xs?, sm?, md?, lg?, xl?, xxl? }`) for responsive
|
|
20
|
+
* layouts.
|
|
21
|
+
*
|
|
22
|
+
* Default is `{ xs: 6, md: 4 }` — 2 slots per row on phones (where 33%
|
|
23
|
+
* is too narrow for the radio card's intrinsic content width and would
|
|
24
|
+
* otherwise wrap one-per-row), 3 slots per row from `md` up.
|
|
25
|
+
*/
|
|
26
|
+
colWidth?: ColSize | Pick<ColProps, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'>;
|
|
27
|
+
/**
|
|
28
|
+
* Display mode
|
|
29
|
+
*/
|
|
30
|
+
variant?: 'button' | 'radio';
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to render the surrounding card chrome (border, background, radius).
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
bordered?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const TimeGrid: React.FC<TimeGridProps>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useId as A, useRef as C, useEffect as I, createElement as N } from "react";
|
|
3
|
+
import h from "../../../../../../../external/classnames/index.es.js";
|
|
4
|
+
import { Button as $ } from "../../../../buttons/button/button.es.js";
|
|
5
|
+
import { ChoiceGroup as R } from "../../../choice-group/choice-group.es.js";
|
|
6
|
+
import d from "../../time-picker.module.scss.es.js";
|
|
7
|
+
import { useLabels as D } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
8
|
+
import { Row as E } from "../../../../layout/grid/row.es.js";
|
|
9
|
+
import { Col as G } from "../../../../layout/grid/col.es.js";
|
|
10
|
+
const L = ({
|
|
11
|
+
times: l,
|
|
12
|
+
value: o,
|
|
13
|
+
onSelect: u,
|
|
14
|
+
className: k,
|
|
15
|
+
colWidth: a = { xs: 6, md: 4 },
|
|
16
|
+
variant: p = "button",
|
|
17
|
+
bordered: g = !0
|
|
18
|
+
}) => {
|
|
19
|
+
const m = A(), { getLabel: w } = D(), s = C(null);
|
|
20
|
+
I(() => {
|
|
21
|
+
if (!o) return;
|
|
22
|
+
const e = s.current;
|
|
23
|
+
if (!e) return;
|
|
24
|
+
const r = e.querySelector(
|
|
25
|
+
`input[type="radio"][value="${o}"], button[data-time="${o}"]`
|
|
26
|
+
);
|
|
27
|
+
r == null || r.focus({ preventScroll: !0 });
|
|
28
|
+
}, []);
|
|
29
|
+
const _ = (e) => {
|
|
30
|
+
var b;
|
|
31
|
+
if (p !== "radio") return;
|
|
32
|
+
const r = s.current;
|
|
33
|
+
if (!r) return;
|
|
34
|
+
const t = Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));
|
|
35
|
+
if (t.length === 0) return;
|
|
36
|
+
const i = t.findIndex((x) => x === document.activeElement);
|
|
37
|
+
let n;
|
|
38
|
+
switch (e.key) {
|
|
39
|
+
case "ArrowDown":
|
|
40
|
+
case "ArrowRight":
|
|
41
|
+
n = i < 0 || i === t.length - 1 ? 0 : i + 1;
|
|
42
|
+
break;
|
|
43
|
+
case "ArrowUp":
|
|
44
|
+
case "ArrowLeft":
|
|
45
|
+
n = i <= 0 ? t.length - 1 : i - 1;
|
|
46
|
+
break;
|
|
47
|
+
case "Home":
|
|
48
|
+
n = 0;
|
|
49
|
+
break;
|
|
50
|
+
case "End":
|
|
51
|
+
n = t.length - 1;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e.preventDefault(), (b = t[n]) == null || b.focus();
|
|
57
|
+
}, f = h(
|
|
58
|
+
d["tedi-time-picker__grid"],
|
|
59
|
+
{
|
|
60
|
+
[d["tedi-time-picker__grid--borderless"]]: !g
|
|
61
|
+
},
|
|
62
|
+
k
|
|
63
|
+
), y = typeof a == "object" ? a : { width: a };
|
|
64
|
+
return p === "radio" ? /* @__PURE__ */ c("div", { ref: s, className: f, onKeyDown: _, children: /* @__PURE__ */ c(
|
|
65
|
+
R,
|
|
66
|
+
{
|
|
67
|
+
id: `time-picker-group-${m}`,
|
|
68
|
+
label: w("timePicker.pickTime"),
|
|
69
|
+
inputType: "radio",
|
|
70
|
+
name: `time-grid-${m}`,
|
|
71
|
+
value: o,
|
|
72
|
+
onChange: (e) => u(e),
|
|
73
|
+
items: l.map((e) => ({
|
|
74
|
+
id: `time-${m}-${e}`,
|
|
75
|
+
label: e,
|
|
76
|
+
value: e,
|
|
77
|
+
colProps: y
|
|
78
|
+
})),
|
|
79
|
+
direction: "row",
|
|
80
|
+
variant: "card",
|
|
81
|
+
showIndicator: !0,
|
|
82
|
+
color: "secondary",
|
|
83
|
+
hideLabel: !0
|
|
84
|
+
}
|
|
85
|
+
) }) : /* @__PURE__ */ c("div", { ref: s, className: f, children: /* @__PURE__ */ c(E, { gutter: 2, children: l.map((e) => /* @__PURE__ */ N(G, { ...y, key: e }, /* @__PURE__ */ c(
|
|
86
|
+
$,
|
|
87
|
+
{
|
|
88
|
+
noStyle: !0,
|
|
89
|
+
"data-time": e,
|
|
90
|
+
className: h(d["tedi-time-picker__grid-item"], {
|
|
91
|
+
[d["tedi-time-picker__grid-item--selected"]]: e === o
|
|
92
|
+
}),
|
|
93
|
+
onClick: () => u(e),
|
|
94
|
+
children: e
|
|
95
|
+
}
|
|
96
|
+
))) }) });
|
|
97
|
+
};
|
|
98
|
+
L.displayName = "TimeGrid";
|
|
99
|
+
export {
|
|
100
|
+
L as TimeGrid
|
|
101
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),t=require("../../../time-field/time-field-helpers.cjs.js"),p=require("../../time-picker.module.scss.cjs.js"),F=({hours:c,minutes:l,selectedHour:a,selectedMinute:s,onChange:x,className:P,bordered:L=!0})=>{const I=n.useId(),i=n.useRef(null),d=n.useRef(null),f=n.useRef(!1),m=n.useRef(!1),g=n.useRef(),k=n.useRef(),v=n.useRef(-1),b=n.useRef(-1),[M,R]=n.useState(null),[C,$]=n.useState(null),N=(r,e)=>Math.max(0,Math.min(e-1,r)),A=(r,e,o)=>{const T=r.current;if(!T||e<0)return;const w=t.getScrollTopForIndex(e);o?f.current=!0:m.current=!0,T.scrollTo({top:w,behavior:"instant"}),requestAnimationFrame(()=>{o?f.current=!1:m.current=!1})};n.useLayoutEffect(()=>{const r=c.indexOf(a),e=l.indexOf(s);r!==v.current&&(v.current=r,A(i,r,!0)),e!==b.current&&(b.current=e,A(d,e,!1)),R(r),$(e)},[c,l,a,s]);const q=n.useRef(()=>{});q.current=()=>{const r=i.current;if(!r||f.current)return;t.clearScrollTimeout(g.current);const e=N(t.snapToNearestItem(r.scrollTop,c.length),c.length);R(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(f.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{f.current=!1})),e!==v.current&&(v.current=e,x(c[e],s))};const y=n.useRef(()=>{});y.current=()=>{const r=d.current;if(!r||m.current)return;t.clearScrollTimeout(k.current);const e=N(t.snapToNearestItem(r.scrollTop,l.length),l.length);$(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(m.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{m.current=!1})),e!==b.current&&(b.current=e,x(a,l[e]))},n.useEffect(()=>{const r=i.current,e=d.current;if(!r||!e)return;const o=()=>q.current(),T=()=>y.current();return r.addEventListener("scrollend",o),e.addEventListener("scrollend",T),()=>{r.removeEventListener("scrollend",o),e.removeEventListener("scrollend",T)}},[]);const H=()=>{if(!i.current||f.current)return;const r=N(t.snapToNearestItem(i.current.scrollTop,c.length),c.length);R(r),t.clearScrollTimeout(g.current),g.current=setTimeout(()=>q.current(),150)},K=()=>{if(!d.current||m.current)return;const r=N(t.snapToNearestItem(d.current.scrollTop,l.length),l.length);$(r),t.clearScrollTimeout(k.current),k.current=setTimeout(()=>y.current(),150)},W=r=>{const e=c[r];!e||!i.current||(t.clearScrollTimeout(g.current),v.current=r,R(r),x(e,s),f.current=!0,t.scrollToIndex(i.current,r,"smooth"),setTimeout(()=>{f.current=!1},300))},U=r=>{const e=l[r];!e||!d.current||(t.clearScrollTimeout(k.current),b.current=r,$(r),x(a,e),m.current=!0,t.scrollToIndex(d.current,r,"smooth"),setTimeout(()=>{m.current=!1},300))},D=(r,e,o,T)=>w=>{const u=e.indexOf(o);if(u===-1)return;let h=-1,_=!1;switch(w.key){case"ArrowDown":h=(u+1)%e.length,_=u===e.length-1;break;case"ArrowUp":h=(u-1+e.length)%e.length,_=u===0;break;case"Home":h=0;break;case"End":h=e.length-1;break;case"PageDown":h=(u+5)%e.length,_=u+5>=e.length;break;case"PageUp":h=(u-5+e.length)%e.length,_=u-5<0;break;case"Enter":case" ":w.preventDefault(),T(e[u]);return;default:return}w.preventDefault();const O=r==="hour"?i.current:d.current,S=O==null?void 0:O.querySelector(`#${CSS.escape(`${I}-${r}-${h}`)}`);S==null||S.focus(),S==null||S.scrollIntoView({block:"center",behavior:_?"auto":"smooth"})};return n.useEffect(()=>()=>{t.clearScrollTimeout(g.current),t.clearScrollTimeout(k.current)},[]),E.jsxs("div",{className:j.default(p.default["tedi-time-picker__wheel"],{[p.default["tedi-time-picker__wheel--borderless"]]:!L},P),children:[E.jsx("div",{ref:i,role:"listbox","aria-label":"Hours",tabIndex:0,"aria-activedescendant":`${I}-hour-${c.indexOf(a)}`,className:p.default["tedi-time-picker__wheel-column"],onScroll:H,onKeyDown:D("hour",c,a,r=>x(r,s)),children:c.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(M??c.indexOf(a))}),onClick:()=>W(e),id:`${I}-hour-${e}`,role:"option","aria-selected":r===a,children:r},r))}),E.jsx("div",{ref:d,role:"listbox",className:p.default["tedi-time-picker__wheel-column"],onScroll:K,"aria-label":"Minutes",tabIndex:0,"aria-activedescendant":`${I}-minute-${l.indexOf(s)}`,onKeyDown:D("minute",l,s,r=>x(a,r)),children:l.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(C??l.indexOf(s))}),onClick:()=>U(e),id:`${I}-minute-${e}`,role:"option","aria-selected":r===s,children:r},r))})]})};F.displayName="TimeWheel";exports.TimeWheel=F;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TimeWheelProps {
|
|
3
|
+
/**
|
|
4
|
+
* Array of all available hours (normally ["00", "01", ..., "23"]).
|
|
5
|
+
*/
|
|
6
|
+
hours: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Array of available minutes based on the `stepMinutes` value
|
|
9
|
+
* (e.g. ["00", "05", "10", ..., "55"] when step is 5).
|
|
10
|
+
*/
|
|
11
|
+
minutes: string[];
|
|
12
|
+
/**
|
|
13
|
+
* The currently selected hour ("00" to "23").
|
|
14
|
+
* Used to control the scroll position of the hour wheel.
|
|
15
|
+
*/
|
|
16
|
+
selectedHour: string;
|
|
17
|
+
/**
|
|
18
|
+
* The currently selected minute.
|
|
19
|
+
* Must exist in the `minutes` array.
|
|
20
|
+
* Used to control the scroll position of the minute wheel.
|
|
21
|
+
*/
|
|
22
|
+
selectedMinute: string;
|
|
23
|
+
/**
|
|
24
|
+
* Callback fired when the user changes either the hour or minute via scrolling or clicking.
|
|
25
|
+
*
|
|
26
|
+
* @param hour - Selected hour in "HH" format
|
|
27
|
+
* @param minute - Selected minute in "mm" format
|
|
28
|
+
*/
|
|
29
|
+
onChange: (hour: string, minute: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Additional CSS class name to apply to the root wheel container.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to render the surrounding card chrome (border, background, radius).
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
bordered?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const TimeWheel: React.FC<TimeWheelProps>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { jsxs as Q, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import F from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import M, { useRef as l, useLayoutEffect as X, useEffect as j } from "react";
|
|
4
|
+
import { clearScrollTimeout as d, snapToNearestItem as A, needsScrollCorrection as C, scrollToIndex as D, getScrollTopForIndex as P } from "../../../time-field/time-field-helpers.es.js";
|
|
5
|
+
import p from "../../time-picker.module.scss.es.js";
|
|
6
|
+
const Y = ({
|
|
7
|
+
hours: t,
|
|
8
|
+
minutes: n,
|
|
9
|
+
selectedHour: u,
|
|
10
|
+
selectedMinute: i,
|
|
11
|
+
onChange: k,
|
|
12
|
+
className: H,
|
|
13
|
+
bordered: U = !0
|
|
14
|
+
}) => {
|
|
15
|
+
const g = M.useId(), a = l(null), s = l(null), m = l(!1), f = l(!1), v = l(), S = l(), w = l(-1), _ = l(-1), [W, E] = M.useState(null), [V, $] = M.useState(null), N = (r, e) => Math.max(0, Math.min(e - 1, r)), R = (r, e, c) => {
|
|
16
|
+
const h = r.current;
|
|
17
|
+
if (!h || e < 0) return;
|
|
18
|
+
const I = P(e);
|
|
19
|
+
c ? m.current = !0 : f.current = !0, h.scrollTo({ top: I, behavior: "instant" }), requestAnimationFrame(() => {
|
|
20
|
+
c ? m.current = !1 : f.current = !1;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
X(() => {
|
|
24
|
+
const r = t.indexOf(u), e = n.indexOf(i);
|
|
25
|
+
r !== w.current && (w.current = r, R(a, r, !0)), e !== _.current && (_.current = e, R(s, e, !1)), E(r), $(e);
|
|
26
|
+
}, [t, n, u, i]);
|
|
27
|
+
const O = l(() => {
|
|
28
|
+
});
|
|
29
|
+
O.current = () => {
|
|
30
|
+
const r = a.current;
|
|
31
|
+
if (!r || m.current) return;
|
|
32
|
+
d(v.current);
|
|
33
|
+
const e = N(A(r.scrollTop, t.length), t.length);
|
|
34
|
+
E(e);
|
|
35
|
+
const c = P(e);
|
|
36
|
+
C(r.scrollTop, c, 8) && (m.current = !0, D(r, e, "instant"), requestAnimationFrame(() => {
|
|
37
|
+
m.current = !1;
|
|
38
|
+
})), e !== w.current && (w.current = e, k(t[e], i));
|
|
39
|
+
};
|
|
40
|
+
const L = l(() => {
|
|
41
|
+
});
|
|
42
|
+
L.current = () => {
|
|
43
|
+
const r = s.current;
|
|
44
|
+
if (!r || f.current) return;
|
|
45
|
+
d(S.current);
|
|
46
|
+
const e = N(A(r.scrollTop, n.length), n.length);
|
|
47
|
+
$(e);
|
|
48
|
+
const c = P(e);
|
|
49
|
+
C(r.scrollTop, c, 8) && (f.current = !0, D(r, e, "instant"), requestAnimationFrame(() => {
|
|
50
|
+
f.current = !1;
|
|
51
|
+
})), e !== _.current && (_.current = e, k(u, n[e]));
|
|
52
|
+
}, j(() => {
|
|
53
|
+
const r = a.current, e = s.current;
|
|
54
|
+
if (!r || !e) return;
|
|
55
|
+
const c = () => O.current(), h = () => L.current();
|
|
56
|
+
return r.addEventListener("scrollend", c), e.addEventListener("scrollend", h), () => {
|
|
57
|
+
r.removeEventListener("scrollend", c), e.removeEventListener("scrollend", h);
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
const z = () => {
|
|
61
|
+
if (!a.current || m.current) return;
|
|
62
|
+
const r = N(A(a.current.scrollTop, t.length), t.length);
|
|
63
|
+
E(r), d(v.current), v.current = setTimeout(() => O.current(), 150);
|
|
64
|
+
}, B = () => {
|
|
65
|
+
if (!s.current || f.current) return;
|
|
66
|
+
const r = N(A(s.current.scrollTop, n.length), n.length);
|
|
67
|
+
$(r), d(S.current), S.current = setTimeout(() => L.current(), 150);
|
|
68
|
+
}, G = (r) => {
|
|
69
|
+
const e = t[r];
|
|
70
|
+
!e || !a.current || (d(v.current), w.current = r, E(r), k(e, i), m.current = !0, D(a.current, r, "smooth"), setTimeout(() => {
|
|
71
|
+
m.current = !1;
|
|
72
|
+
}, 300));
|
|
73
|
+
}, J = (r) => {
|
|
74
|
+
const e = n[r];
|
|
75
|
+
!e || !s.current || (d(S.current), _.current = r, $(r), k(u, e), f.current = !0, D(s.current, r, "smooth"), setTimeout(() => {
|
|
76
|
+
f.current = !1;
|
|
77
|
+
}, 300));
|
|
78
|
+
}, K = (r, e, c, h) => (I) => {
|
|
79
|
+
const o = e.indexOf(c);
|
|
80
|
+
if (o === -1) return;
|
|
81
|
+
let x = -1, b = !1;
|
|
82
|
+
switch (I.key) {
|
|
83
|
+
case "ArrowDown":
|
|
84
|
+
x = (o + 1) % e.length, b = o === e.length - 1;
|
|
85
|
+
break;
|
|
86
|
+
case "ArrowUp":
|
|
87
|
+
x = (o - 1 + e.length) % e.length, b = o === 0;
|
|
88
|
+
break;
|
|
89
|
+
case "Home":
|
|
90
|
+
x = 0;
|
|
91
|
+
break;
|
|
92
|
+
case "End":
|
|
93
|
+
x = e.length - 1;
|
|
94
|
+
break;
|
|
95
|
+
case "PageDown":
|
|
96
|
+
x = (o + 5) % e.length, b = o + 5 >= e.length;
|
|
97
|
+
break;
|
|
98
|
+
case "PageUp":
|
|
99
|
+
x = (o - 5 + e.length) % e.length, b = o - 5 < 0;
|
|
100
|
+
break;
|
|
101
|
+
case "Enter":
|
|
102
|
+
case " ":
|
|
103
|
+
I.preventDefault(), h(e[o]);
|
|
104
|
+
return;
|
|
105
|
+
default:
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
I.preventDefault();
|
|
109
|
+
const q = r === "hour" ? a.current : s.current, T = q == null ? void 0 : q.querySelector(`#${CSS.escape(`${g}-${r}-${x}`)}`);
|
|
110
|
+
T == null || T.focus(), T == null || T.scrollIntoView({ block: "center", behavior: b ? "auto" : "smooth" });
|
|
111
|
+
};
|
|
112
|
+
return j(() => () => {
|
|
113
|
+
d(v.current), d(S.current);
|
|
114
|
+
}, []), /* @__PURE__ */ Q(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: F(
|
|
118
|
+
p["tedi-time-picker__wheel"],
|
|
119
|
+
{ [p["tedi-time-picker__wheel--borderless"]]: !U },
|
|
120
|
+
H
|
|
121
|
+
),
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ y(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
ref: a,
|
|
127
|
+
role: "listbox",
|
|
128
|
+
"aria-label": "Hours",
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
"aria-activedescendant": `${g}-hour-${t.indexOf(u)}`,
|
|
131
|
+
className: p["tedi-time-picker__wheel-column"],
|
|
132
|
+
onScroll: z,
|
|
133
|
+
onKeyDown: K("hour", t, u, (r) => k(r, i)),
|
|
134
|
+
children: t.map((r, e) => /* @__PURE__ */ y(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
className: F(p["tedi-time-picker__wheel-item"], {
|
|
138
|
+
[p["tedi-time-picker__wheel-item--selected"]]: e === (W ?? t.indexOf(u))
|
|
139
|
+
}),
|
|
140
|
+
onClick: () => G(e),
|
|
141
|
+
id: `${g}-hour-${e}`,
|
|
142
|
+
role: "option",
|
|
143
|
+
"aria-selected": r === u,
|
|
144
|
+
children: r
|
|
145
|
+
},
|
|
146
|
+
r
|
|
147
|
+
))
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ y(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
ref: s,
|
|
154
|
+
role: "listbox",
|
|
155
|
+
className: p["tedi-time-picker__wheel-column"],
|
|
156
|
+
onScroll: B,
|
|
157
|
+
"aria-label": "Minutes",
|
|
158
|
+
tabIndex: 0,
|
|
159
|
+
"aria-activedescendant": `${g}-minute-${n.indexOf(i)}`,
|
|
160
|
+
onKeyDown: K("minute", n, i, (r) => k(u, r)),
|
|
161
|
+
children: n.map((r, e) => /* @__PURE__ */ y(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
className: F(p["tedi-time-picker__wheel-item"], {
|
|
165
|
+
[p["tedi-time-picker__wheel-item--selected"]]: e === (V ?? n.indexOf(i))
|
|
166
|
+
}),
|
|
167
|
+
onClick: () => J(e),
|
|
168
|
+
id: `${g}-minute-${e}`,
|
|
169
|
+
role: "option",
|
|
170
|
+
"aria-selected": r === i,
|
|
171
|
+
children: r
|
|
172
|
+
},
|
|
173
|
+
r
|
|
174
|
+
))
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
Y.displayName = "TimeWheel";
|
|
182
|
+
export {
|
|
183
|
+
Y as TimeWheel
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),n=require("react"),t=require("../time-field/time-field-helpers.cjs.js"),H=require("./components/time-grid/time-grid.cjs.js"),x=require("./components/time-wheel/time-wheel.cjs.js"),T=({value:s,defaultValue:f="",onChange:r,stepMinutes:o=1,availableTimes:i,gridVariant:h="button",className:u,bordered:c=!0})=>{const[j,P]=n.useState(f),l=s!==void 0,m=l?s:j,d=e=>{l||P(e),r==null||r(e)},a=n.useMemo(t.generateHours,[]),q=n.useMemo(()=>t.generateMinutes(o),[o]),{hour:y,minute:S}=t.parseTime(m||"12:00"),g=a.includes(y)?y:"12",k=t.findClosestMinute(S,q);return Array.isArray(i)&&i.length>0?M.jsx(H.TimeGrid,{times:i,value:m,variant:h,onSelect:d,className:u,bordered:c}):M.jsx(x.TimeWheel,{hours:a,minutes:q,selectedHour:g,selectedMinute:k,onChange:(e,p)=>d(`${e}:${p}`),className:u,bordered:c})};T.displayName="TimePicker";exports.TimePicker=T;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TimePickerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Currently selected time in "HH:mm" format (24-hour).
|
|
5
|
+
*
|
|
6
|
+
* @example "14:30"
|
|
7
|
+
* @default ""
|
|
8
|
+
*/
|
|
9
|
+
value?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Initial time value for uncontrolled mode. Should be in "HH:mm" format.
|
|
12
|
+
* @example "09:00"
|
|
13
|
+
* @default ""
|
|
14
|
+
*/
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Callback fired when the user selects a new time.
|
|
18
|
+
* Returns the selected time in "HH:mm" format.
|
|
19
|
+
*
|
|
20
|
+
* @param time - Selected time as "HH:mm" string
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (time: string) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Minute step interval for the minute wheel.
|
|
25
|
+
* Determines which minute values are shown (e.g. 00, 05, 10, ..., 55).
|
|
26
|
+
*
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
stepMinutes?: number;
|
|
30
|
+
/**
|
|
31
|
+
* When provided, the component switches from wheel mode to grid mode.
|
|
32
|
+
* Displays a list/grid of predefined time slots instead of scrollable wheels.
|
|
33
|
+
*
|
|
34
|
+
* Each string must be in "HH:mm" format.
|
|
35
|
+
*
|
|
36
|
+
* @example ["09:00", "09:30", "10:00", "14:00", "15:30"]
|
|
37
|
+
*/
|
|
38
|
+
availableTimes?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Variant of the grid rendered when `availableTimes` is provided:
|
|
41
|
+
* - 'buttons' – buttons grid
|
|
42
|
+
* - 'radio' – radio buttons grid
|
|
43
|
+
* @default button
|
|
44
|
+
*/
|
|
45
|
+
gridVariant?: 'button' | 'radio';
|
|
46
|
+
/**
|
|
47
|
+
* Additional CSS class name to apply to the root element.
|
|
48
|
+
* Useful for custom styling and layout overrides.
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to render the surrounding card (border, background, radius).
|
|
53
|
+
* Set to `false` when embedding inside a parent that already provides
|
|
54
|
+
* its own surface — e.g. alongside a calendar inside `DateTimeField`.
|
|
55
|
+
* The inner gradient masks and column separators are preserved either way.
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
bordered?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare const TimePicker: React.FC<TimePickerProps>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import S, { useMemo as a } from "react";
|
|
3
|
+
import { generateHours as _, generateMinutes as $, parseTime as g, findClosestMinute as j } from "../time-field/time-field-helpers.es.js";
|
|
4
|
+
import { TimeGrid as x } from "./components/time-grid/time-grid.es.js";
|
|
5
|
+
import { TimeWheel as G } from "./components/time-wheel/time-wheel.es.js";
|
|
6
|
+
const I = ({
|
|
7
|
+
value: o,
|
|
8
|
+
defaultValue: h = "",
|
|
9
|
+
onChange: e,
|
|
10
|
+
stepMinutes: n = 1,
|
|
11
|
+
availableTimes: r,
|
|
12
|
+
gridVariant: y = "button",
|
|
13
|
+
className: i,
|
|
14
|
+
bordered: s = !0
|
|
15
|
+
}) => {
|
|
16
|
+
const [M, T] = S.useState(h), c = o !== void 0, m = c ? o : M, u = (t) => {
|
|
17
|
+
c || T(t), e == null || e(t);
|
|
18
|
+
}, f = a(_, []), l = a(() => $(n), [n]), { hour: d, minute: k } = g(m || "12:00"), A = f.includes(d) ? d : "12", H = j(k, l);
|
|
19
|
+
return Array.isArray(r) && r.length > 0 ? /* @__PURE__ */ p(
|
|
20
|
+
x,
|
|
21
|
+
{
|
|
22
|
+
times: r,
|
|
23
|
+
value: m,
|
|
24
|
+
variant: y,
|
|
25
|
+
onSelect: u,
|
|
26
|
+
className: i,
|
|
27
|
+
bordered: s
|
|
28
|
+
}
|
|
29
|
+
) : /* @__PURE__ */ p(
|
|
30
|
+
G,
|
|
31
|
+
{
|
|
32
|
+
hours: f,
|
|
33
|
+
minutes: l,
|
|
34
|
+
selectedHour: A,
|
|
35
|
+
selectedMinute: H,
|
|
36
|
+
onChange: (t, P) => u(`${t}:${P}`),
|
|
37
|
+
className: i,
|
|
38
|
+
bordered: s
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
I.displayName = "TimePicker";
|
|
43
|
+
export {
|
|
44
|
+
I as TimePicker
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker__wheel":"tedi-time-picker__wheel-3c73e157","tedi-time-picker__wheel--borderless":"tedi-time-picker__wheel--borderless-42e8669c","tedi-time-picker__wheel-column":"tedi-time-picker__wheel-column-02048315","tedi-time-picker__wheel-item":"tedi-time-picker__wheel-item-78600fe1","tedi-time-picker__wheel-item--selected":"tedi-time-picker__wheel-item--selected-cc3c7194","tedi-time-picker__grid":"tedi-time-picker__grid-5cf42402","tedi-time-picker__grid--borderless":"tedi-time-picker__grid--borderless-805d6413","tedi-time-picker__grid-item":"tedi-time-picker__grid-item-53c9d41d","tedi-time-picker__grid-item--selected":"tedi-time-picker__grid-item--selected-32fb5e5d"};exports.default=e;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"tedi-time-picker__wheel": "tedi-time-picker__wheel-3c73e157",
|
|
3
|
+
"tedi-time-picker__wheel--borderless": "tedi-time-picker__wheel--borderless-42e8669c",
|
|
4
|
+
"tedi-time-picker__wheel-column": "tedi-time-picker__wheel-column-02048315",
|
|
5
|
+
"tedi-time-picker__wheel-item": "tedi-time-picker__wheel-item-78600fe1",
|
|
6
|
+
"tedi-time-picker__wheel-item--selected": "tedi-time-picker__wheel-item--selected-cc3c7194",
|
|
7
|
+
"tedi-time-picker__grid": "tedi-time-picker__grid-5cf42402",
|
|
8
|
+
"tedi-time-picker__grid--borderless": "tedi-time-picker__grid--borderless-805d6413",
|
|
9
|
+
"tedi-time-picker__grid-item": "tedi-time-picker__grid-item-53c9d41d",
|
|
10
|
+
"tedi-time-picker__grid-item--selected": "tedi-time-picker__grid-item--selected-32fb5e5d"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
e as default
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),H=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),H=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),O=require("./dropdown.module.scss.cjs.js"),$=require("./dropdown-content/dropdown-content.cjs.js"),z=require("./dropdown-context.cjs.js"),G=require("./dropdown-helpers.cjs.js"),J=require("./dropdown-item/dropdown-item.cjs.js"),K=require("./dropdown-separator/dropdown-separator.cjs.js"),Q=require("./dropdown-trigger/dropdown-trigger.cjs.js"),V=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),m=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),X=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Y=require("../../../providers/label-provider/use-labels.cjs.js"),Z=4,d=w=>{var I;const{getCurrentBreakpointProps:S}=X.useBreakpointProps(w.defaultServerBreakpoint),{children:F,modal:v=!1,divided:P=!1,width:R="auto",variant:u="default",open:p,defaultOpen:b=!1,onOpenChange:a,defaultActiveIndex:o,placement:f="bottom-start",className:j}=S(w),{getLabel:k}=Y.useLabels(),y=e.useFloatingNodeId(),q=t.useRef([]),[l,g]=t.useState(o??null),[h,B]=t.useState(null),[N,T]=t.useState(b),n=p??N;t.useEffect(()=>{n||g(o??null)},[n,o]);const x=t.useCallback(i=>{p===void 0&&T(i),a==null||a(i)},[p,a]),U=e.useFloating({nodeId:y,open:n,placement:f,onOpenChange:x,middleware:[m.offset(Z),m.flip(),m.shift()],whileElementsMounted:V.autoUpdate}),{context:r,refs:s,x:_,y:L,strategy:M}=U,D=e.useInteractions([e.useClick(r),e.useRole(r,{role:"menu"}),e.useDismiss(r),e.useListNavigation(r,{listRef:q,activeIndex:l,onNavigate:g,loop:!0,selectedIndex:o??null,focusItemOnOpen:o!==null?!0:"auto"})]),W={open:n,setOpen:x,refs:s,listItemsRef:q,activeIndex:l,setActiveIndex:g,placement:f,content:h,setContent:B,divided:P,variant:u,...D},E=(I=s.reference.current)==null?void 0:I.getBoundingClientRect().width,A=t.useMemo(()=>{const i=s.reference.current;if(!i)return;const C=i.offsetParent;if(C)return C.getBoundingClientRect().width},[s.reference.current]);return c.jsxs(z.DropdownContext.Provider,{value:W,children:[F,c.jsx(e.FloatingPortal,{children:n&&c.jsx(e.FloatingFocusManager,{context:r,modal:v,visuallyHiddenDismiss:v?k("close"):!1,children:c.jsx("div",{...D.getFloatingProps({ref:s.setFloating,className:H.default(O.default["tedi-dropdown"],{[O.default[`tedi-dropdown--${u}`]]:u==="tree"},j),style:{position:M,left:_??0,top:L??0,width:G.resolveDropdownWidth(R,E,A)},role:"menu","aria-orientation":"vertical","aria-activedescendant":l!==null?`dropdown-item-${l}`:void 0}),"data-placement":f,"data-state":n?"open":"closed",children:h})})})]})};d.Trigger=Q.DropdownTrigger;d.Content=$.DropdownContent;d.Item=J.DropdownItem;d.Separator=K.DropdownSeparator;exports.Dropdown=d;
|
|
@@ -61,6 +61,15 @@ export interface DropdownProps extends BreakpointSupport<DropdownBreakpointProps
|
|
|
61
61
|
* Change handler (fires for both modes)
|
|
62
62
|
*/
|
|
63
63
|
onOpenChange?: (open: boolean) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Index of the item that should be focused when the dropdown opens.
|
|
66
|
+
*
|
|
67
|
+
* Pass the index of the "current selection" so the user can arrow-key or
|
|
68
|
+
* Enter/Space to reconfirm without first pressing an arrow. Omit (or pass
|
|
69
|
+
* `undefined`) to keep the default behaviour — no item is pre-focused and
|
|
70
|
+
* the user has to press an arrow key to start navigating.
|
|
71
|
+
*/
|
|
72
|
+
defaultActiveIndex?: number;
|
|
64
73
|
className?: string;
|
|
65
74
|
}
|
|
66
75
|
export declare const Dropdown: {
|