neba 1.10.0 → 1.11.0
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/README.md +35 -5
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar-group/AvatarGroup.js +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/blockquote/Blockquote.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/calendar/Calendar.d.ts +72 -0
- package/dist/components/calendar/Calendar.js +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/Card.js +1 -1
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +14 -2
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.d.ts +83 -0
- package/dist/components/confirm/Confirm.js +1 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +104 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +40 -8
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/footer/Footer.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.d.ts +1 -1
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.d.ts +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +1 -1
- package/dist/components/hover-card/HoverCard.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +70 -0
- package/dist/components/image/Image.js +1 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/list/List.js +1 -1
- package/dist/components/menubar/Menubar.js +1 -1
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +12 -2
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.d.ts +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popconfirm/Popconfirm.d.ts +71 -0
- package/dist/components/popconfirm/Popconfirm.js +1 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/portal/Portal.d.ts +48 -0
- package/dist/components/portal/Portal.js +1 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/provider/NebaProvider.d.ts +99 -0
- package/dist/components/provider/NebaProvider.js +1 -0
- package/dist/components/provider/index.d.ts +3 -0
- package/dist/components/provider/index.js +1 -0
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.d.ts +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.d.ts +2 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +1 -1
- package/dist/components/text-field/TextField.d.ts +12 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.d.ts +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.d.ts +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.js +1 -1
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.d.ts +88 -0
- package/dist/components/tree-select/TreeSelect.js +1 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +37 -0
- package/dist/components/visually-hidden/VisuallyHidden.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDisclosure.d.ts +21 -0
- package/dist/hooks/useDisclosure.js +1 -0
- package/dist/hooks/useElementSize.d.ts +23 -0
- package/dist/hooks/useElementSize.js +1 -0
- package/dist/hooks/useMediaQuery.d.ts +27 -0
- package/dist/hooks/useMediaQuery.js +1 -0
- package/dist/hooks/useOnScreen.d.ts +24 -0
- package/dist/hooks/useOnScreen.js +1 -0
- package/dist/hooks/useShortcut.d.ts +34 -0
- package/dist/hooks/useShortcut.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/internal/calendar.d.ts +31 -5
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/csv.d.ts +40 -0
- package/dist/internal/csv.js +1 -0
- package/dist/internal/date.d.ts +39 -1
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +46 -0
- package/dist/internal/defaults.js +1 -0
- package/dist/internal/i18n.d.ts +23 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/keys.d.ts +92 -0
- package/dist/internal/keys.js +1 -0
- package/dist/internal/media.d.ts +27 -0
- package/dist/internal/media.js +1 -1
- package/dist/internal/page-layout.d.ts +7 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +7 -1
- package/dist/internal/picker.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +34 -0
- package/package.json +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button.js";import{ChevronIcon as a}from"./icons.js";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles.js";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,daysInMonth as x,isDayOutside as w,isMonthBeforeYear as y,isSameDay as D,isSameMonth as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as Y,today as z,weekdayLabels as A,withTime as F,YEAR_PAGE_SIZE as j,yearPageStart as E}from"./date.js";import{dateFormatter as T}from"./format.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),Y=E(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${Y}–${Y+j-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,onPreviewChange:p,minDate:v,maxDate:x,shouldDisableDate:y,showOutsideDays:D=!0,autoFocus:P=!1,showPreviousButton:C=!0,showNextButton:A=!0,labels:F,className:E}){const[T,B]=o.useState("day"),H=o.useMemo(()=>d.filter(S),[d]),[L,K]=o.useState(()=>{const e=H.find(e=>N(e,s));return e?k(e):N(z(),s)?z():Y(s)}),O=o.useRef(P),_=o.useRef(null);o.useEffect(()=>{K(e=>N(e,s)?e:Y(s))},[s]),o.useLayoutEffect(()=>{O.current&&(O.current=!1,_.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>w(e,v,x)||(y?.(e)??!1),[v,x,y]),G=e=>{O.current=!0,B(e)},J=e=>{O.current=!0,u(e)};return t("div",{ref:_,className:i("flex flex-col",c[n],E),style:{"--n-cell":R[n]},onPointerLeave:()=>p?.(null),children:[e(U,{size:n,color:r,view:T,month:s,locale:a,labels:F,showPreviousButton:C,showNextButton:A,onStep:e=>{u("day"===T?f(s,e):b(s,"month"===T?e:e*j))},onViewChange:G}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===T?e(q,{size:n,locale:a,weekStartsOn:l,month:s,chosen:H,rangeStart:m,rangeEnd:h,focusedDate:L,showOutsideDays:D,isDisabled:V,onSelect:e=>{K(e),g(e)},onPreviewChange:p,onMoveFocus:e=>{O.current=!0,K(e),N(e,s)||u(Y(e))}}):"month"===T?e(I,{size:n,locale:a,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(s.getFullYear(),e,1)),G("day")}}):e($,{size:n,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(e,s.getMonth(),1)),G("month")}})})]})}function q({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,showOutsideDays:h,isDisabled:b,onSelect:x,onPreviewChange:w,onMoveFocus:y}){const M=p(a,r),P=A(o,r,"short"),C=A(o,r,"long"),k=T(o,{dateStyle:"full"}),Y=(j=d,S(F=c)&&S(j)?v(F,j)<=0?[F,j]:[j,F]:null);var F,j;const E=z();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:P.map((t,o)=>e("span",{role:"columnheader","aria-label":C[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),M.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const o=!N(t,a);if(o&&!h)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},t.getTime());const c=l.some(e=>D(e,t)),u=null!==Y&&v(t,Y[0])>=0&&v(t,Y[1])<=0,d=null!==Y&&u&&D(t,Y[0]),p=null!==Y&&u&&D(t,Y[1]);return e(O,{size:n,label:k.format(t),selected:c,inRange:u&&!c,rangeEdge:u?d&&p?"both":d?"start":p?"end":"middle":null,current:D(t,E)&&!c,muted:o,disabled:b(t),focused:D(t,m),className:i("size-(--n-cell)",s[n]),onClick:()=>x(t),onPointerEnter:()=>w?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),y(o()))})(e,t),children:t.getDate()},t.getTime())})},o))]})}function I({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,onMoveCursor:c,onPick:u}){const d=C(n,"short"),m=C(n,"long"),h=o.getFullYear(),g=new Date,b=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),c(f(Y(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(c=>{const f=3*n+c,p=M(h,f,1),w=M(h,f,x(h,f));return e(O,{size:t,label:`${m[f]} ${h}`,selected:r.some(e=>e.getFullYear()===h&&e.getMonth()===f),current:g.getFullYear()===h&&g.getMonth()===f,disabled:S(a)&&v(w,a)<0||S(l)&&v(p,l)>0,focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:b,children:d[f]},f)})},n))})}function $({size:t,month:n,chosen:o,minDate:r,maxDate:a,onMoveCursor:l,onPick:c}){const u=E(n.getFullYear()),d=(new Date).getFullYear(),m=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==t&&(e.preventDefault(),l(b(Y(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(h=>{const g=u+4*l+h;return e(O,{size:t,label:String(g),selected:o.some(e=>e.getFullYear()===g),current:g===d,disabled:S(r)&&g<r.getFullYear()||S(a)&&g>a.getFullYear(),focused:g===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>c(g),onKeyDown:m,children:g},g)})},l))})}function _(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:w,className:y}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(_),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),Y=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),z=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),j=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>F(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",y),style:{"--n-cell":R[n]},children:[j("hour",w.hour,C,e=>e===A,e=>h?String(e):z(e)),j("minute",w.minute,k,e=>e===D.getMinutes(),z),g?j("second",w.second,Y,e=>e===D.getSeconds(),z):null,h?j("meridiem",w.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":T(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button.js";import{ChevronIcon as a}from"./icons.js";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles.js";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,isDayOutside as x,isMonthBeforeYear as y,isSameDay as w,isSameMonth as D,isUnitOutside as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as z,today as Y,weekdayLabels as A,withTime as j,YEAR_PAGE_SIZE as E,yearPageStart as F}from"./date.js";import{dateFormatter as T}from"./format.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),z=F(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${z}–${z+E-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}const q={day:0,month:1,year:2};export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,granularity:p="day",renderDay:v,onPreviewChange:y,minDate:w,maxDate:N,shouldDisableDate:P,showOutsideDays:C=!0,autoFocus:A=!1,showPreviousButton:j=!0,showNextButton:F=!0,labels:T,className:B}){const[H,L]=o.useState(p),K=q[H]<q[p]?p:H,O=o.useMemo(()=>d.filter(S),[d]),[V,G]=o.useState(()=>{const e=O.find(e=>D(e,s));return e?k(e):D(Y(),s)?Y():z(s)}),J=o.useRef(A),Q=o.useRef(null);o.useEffect(()=>{G(e=>D(e,s)?e:z(s))},[s]),o.useLayoutEffect(()=>{J.current&&(J.current=!1,Q.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const W=o.useCallback(e=>x(e,w,N)||(P?.(e)??!1),[w,N,P]),X=e=>{J.current=!0,L(e)},Z=e=>{J.current=!0,u(e)};return t("div",{ref:Q,className:i("flex flex-col",c[n],B),style:{"--n-cell":R[n]},onPointerLeave:()=>y?.(null),children:[e(U,{size:n,color:r,view:K,month:s,locale:a,labels:T,showPreviousButton:j,showNextButton:F,onStep:e=>{u("day"===K?f(s,e):b(s,"month"===K?e:e*E))},onViewChange:X}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===K?e(I,{size:n,locale:a,weekStartsOn:l,month:s,chosen:O,rangeStart:m,rangeEnd:h,focusedDate:V,renderDay:v,showOutsideDays:C,isDisabled:W,onSelect:e=>{G(e),g(e)},onPreviewChange:y,onMoveFocus:e=>{J.current=!0,G(e),D(e,s)||u(z(e))}}):"month"===K?e($,{size:n,locale:a,month:s,chosen:O,minDate:w,maxDate:N,shouldDisable:"month"===p?P:void 0,onMoveCursor:Z,onPick:e=>{const t=M(s.getFullYear(),e,1);u(t),"month"===p?g(t):X("day")}}):e(_,{size:n,month:s,chosen:O,minDate:w,maxDate:N,shouldDisable:"year"===p?P:void 0,onMoveCursor:Z,onPick:e=>{if("year"===p){const t=M(e,0,1);return u(t),void g(t)}u(M(e,s.getMonth(),1)),X("month")}})})]})}function I({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,renderDay:h,showOutsideDays:b,isDisabled:x,onSelect:y,onPreviewChange:N,onMoveFocus:M}){const P=p(a,r),C=A(o,r,"short"),k=A(o,r,"long"),z=T(o,{dateStyle:"full"}),j=(F=d,S(E=c)&&S(F)?v(E,F)<=0?[E,F]:[F,E]:null);var E,F;const R=Y();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:C.map((t,o)=>e("span",{role:"columnheader","aria-label":k[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),P.map((o,c)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(o=>{const c=!D(o,a);if(c&&!b)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},o.getTime());const u=l.some(e=>w(e,o)),d=null!==j&&v(o,j[0])>=0&&v(o,j[1])<=0,p=null!==j&&d&&w(o,j[0]),S=null!==j&&d&&w(o,j[1]);return t(O,{size:n,label:z.format(o),selected:u,inRange:d&&!u,rangeEdge:d?p&&S?"both":p?"start":S?"end":"middle":null,current:w(o,R)&&!u,muted:c,disabled:x(o),focused:w(o,m),className:i("size-(--n-cell)",s[n]),onClick:()=>y(o),onPointerEnter:()=>N?.(o),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),M(o()))})(e,o),children:[o.getDate(),h?h(o):null]},o.getTime())})},c))]})}function $({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,shouldDisable:c,onMoveCursor:u,onPick:d}){const m=C(n,"short"),h=C(n,"long"),g=o.getFullYear(),b=new Date,p=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),u(f(z(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(u=>{const f=3*n+u,v=M(g,f,1);return e(O,{size:t,label:`${h[f]} ${g}`,selected:r.some(e=>e.getFullYear()===g&&e.getMonth()===f),current:b.getFullYear()===g&&b.getMonth()===f,disabled:N(v,"month",a,l)||(c?.(v)??!1),focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>d(f),onKeyDown:p,children:m[f]},f)})},n))})}function _({size:t,month:n,chosen:o,minDate:r,maxDate:a,shouldDisable:l,onMoveCursor:c,onPick:u}){const d=F(n.getFullYear()),m=(new Date).getFullYear(),h=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-E,PageDown:E}[e.key];void 0!==t&&(e.preventDefault(),c(b(z(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(c=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(g=>{const f=d+4*c+g,b=M(f,0,1);return e(O,{size:t,label:String(f),selected:o.some(e=>e.getFullYear()===f),current:f===m,disabled:N(b,"year",r,a)||(l?.(b)??!1),focused:f===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:h,children:f},f)})},c))})}function V(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:y,className:w}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(V),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),z=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),Y=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),E=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>j(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",w),style:{"--n-cell":R[n]},children:[E("hour",y.hour,C,e=>e===A,e=>h?String(e):Y(e)),E("minute",y.minute,k,e=>e===D.getMinutes(),Y),g?E("second",y.second,z,e=>e===D.getSeconds(),Y):null,h?E("meridiem",y.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":T(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A table as CSV.
|
|
3
|
+
*
|
|
4
|
+
* It is here rather than in DataTable because the escaping is the whole job and
|
|
5
|
+
* getting it wrong is silent: a comma inside a cell shifts every column after
|
|
6
|
+
* it by one, and nobody notices until a spreadsheet somewhere is off by a
|
|
7
|
+
* column. RFC 4180 is four rules, and all four are below.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One field, quoted only when it has to be.
|
|
11
|
+
*
|
|
12
|
+
* A field is quoted if it holds the separator, a quote, or a line break, and a
|
|
13
|
+
* quote inside a quoted field is written twice. `null` and `undefined` are
|
|
14
|
+
* empty rather than the words "null" and "undefined", which is what `String()`
|
|
15
|
+
* would put in a spreadsheet cell.
|
|
16
|
+
*/
|
|
17
|
+
export declare function csvField(value: unknown, separator?: string): string;
|
|
18
|
+
export interface CsvOptions {
|
|
19
|
+
/** What goes between fields. `;` for the locales whose spreadsheets expect it. */
|
|
20
|
+
separator?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Writes a byte-order mark in front.
|
|
23
|
+
*
|
|
24
|
+
* On by default, and not as a nicety: Excel reads a UTF-8 CSV without one as
|
|
25
|
+
* the local code page, so every non-ASCII name in the file arrives as
|
|
26
|
+
* mojibake. Every other reader ignores the mark.
|
|
27
|
+
*/
|
|
28
|
+
bom?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Rows of already-stringable values, as one CSV document. */
|
|
31
|
+
export declare function toCsv(rows: readonly (readonly unknown[])[], options?: CsvOptions): string;
|
|
32
|
+
/**
|
|
33
|
+
* Hands the file to the browser.
|
|
34
|
+
*
|
|
35
|
+
* A `blob:` URL and a synthesised click, which is the only way a page can
|
|
36
|
+
* produce a file the reader keeps. The URL is revoked on the next frame rather
|
|
37
|
+
* than immediately: some browsers have not finished reading it when the click
|
|
38
|
+
* returns, and revoking too early is a download that silently produces nothing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function downloadText(text: string, fileName: string, type: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function csvField(e,n=","){if(null==e)return"";const t=e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e);return/["\r\n]/.test(t)||t.includes(n)?`"${t.replaceAll('"','""')}"`:t}export function toCsv(e,n={}){const{separator:t=",",bom:o=!0}=n,r=e.map(e=>e.map(e=>csvField(e,t)).join(t)).join("\r\n");return o?`\ufeff${r}`:r}export function downloadText(e,n,t){const o=URL.createObjectURL(new Blob([e],{type:t})),r=document.createElement("a");r.href=o,r.download=n,r.rel="noopener",r.style.display="none",document.body.append(r),r.click(),r.remove(),requestAnimationFrame(()=>URL.revokeObjectURL(o))}
|
package/dist/internal/date.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* like a question is actually a command. Each function here copies first, so a
|
|
19
19
|
* `value` handed in by a caller is never the object that comes back out.
|
|
20
20
|
*/
|
|
21
|
-
import type { NebaWeekday } from '../types.js';
|
|
21
|
+
import type { NebaDateGranularity, NebaWeekday } from '../types.js';
|
|
22
22
|
/** Which unit the calendar is currently letting you pick. */
|
|
23
23
|
export type CalendarView = 'day' | 'month' | 'year';
|
|
24
24
|
/** How many years one page of the year grid holds. Four columns of three. */
|
|
@@ -39,6 +39,21 @@ export declare function isValidDate(value: unknown): value is Date;
|
|
|
39
39
|
export declare function startOfDay(date: Date): Date;
|
|
40
40
|
/** The first day of the month this date is in, at midnight. */
|
|
41
41
|
export declare function startOfMonth(date: Date): Date;
|
|
42
|
+
/** The first day of the year this date is in, at midnight. */
|
|
43
|
+
export declare function startOfYear(date: Date): Date;
|
|
44
|
+
/**
|
|
45
|
+
* The first instant of the unit this date falls in — the day, the month, the
|
|
46
|
+
* year — which is exactly what a picker of that granularity reports.
|
|
47
|
+
*
|
|
48
|
+
* One function rather than a branch at each call site because there are four:
|
|
49
|
+
* the cell that was clicked, the footer's shortcut, the bound checks below, and
|
|
50
|
+
* the caller's own `shouldDisableDate`. All four have to agree on what "the
|
|
51
|
+
* value stands for a whole month" means, or a month is blocked on the strength
|
|
52
|
+
* of a day the picker would never hand back.
|
|
53
|
+
*/
|
|
54
|
+
export declare function startOfUnit(date: Date, granularity: NebaDateGranularity): Date;
|
|
55
|
+
/** The last day of that same unit. */
|
|
56
|
+
export declare function endOfUnit(date: Date, granularity: NebaDateGranularity): Date;
|
|
42
57
|
/** How many days a month has, leap years included. */
|
|
43
58
|
export declare function daysInMonth(year: number, month: number): number;
|
|
44
59
|
/** Today, at midnight. The one place the pickers read the clock for a *date*. */
|
|
@@ -70,6 +85,19 @@ export declare function clampDate(date: Date, min?: Date | null, max?: Date | nu
|
|
|
70
85
|
* hour has been chosen.
|
|
71
86
|
*/
|
|
72
87
|
export declare function isDayOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Is the *whole unit* this date falls in outside the allowed span?
|
|
90
|
+
*
|
|
91
|
+
* The generalisation of `isDayOutside`, and the reason it is a separate
|
|
92
|
+
* function rather than a wider one: a bound has to be checked against the span
|
|
93
|
+
* a cell stands for, not against one instant inside it. The month grid has
|
|
94
|
+
* always said so — a `minDate` of 15 March leaves March pickable, it just
|
|
95
|
+
* starts late — and a picker whose granularity is `month` reports March for
|
|
96
|
+
* that cell, so the same comparison has to decide both.
|
|
97
|
+
*
|
|
98
|
+
* At `day` granularity this is `isDayOutside` exactly.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isUnitOutside(date: Date, granularity: NebaDateGranularity, min?: Date | null, max?: Date | null): boolean;
|
|
73
101
|
/** Minutes since local midnight — what `minTime`/`maxTime` are compared on. */
|
|
74
102
|
export declare function minutesOfDay(date: Date): number;
|
|
75
103
|
/** Seconds since local midnight, for the pickers that show a seconds column. */
|
|
@@ -137,6 +165,16 @@ export declare function withPlaceholder(samples: string[], placeholder: unknown)
|
|
|
137
165
|
* server that already parses those needs no new code.
|
|
138
166
|
*/
|
|
139
167
|
export declare function toISODate(date: Date): string;
|
|
168
|
+
/**
|
|
169
|
+
* The same date at a coarser granularity: `2026-03` and `2026`.
|
|
170
|
+
*
|
|
171
|
+
* `YYYY-MM` is what a native `<input type="month">` submits, which is the
|
|
172
|
+
* standard this file already follows. A picker asked for a month has to say
|
|
173
|
+
* `2026-03` rather than `2026-03-01`: the second invents a day, and a server
|
|
174
|
+
* parsing it as one would be parsing a day nobody chose.
|
|
175
|
+
*/
|
|
176
|
+
export declare function toISOMonth(date: Date): string;
|
|
177
|
+
export declare function toISOYear(date: Date): string;
|
|
140
178
|
export declare function toISOTime(date: Date, withSeconds?: boolean): string;
|
|
141
179
|
export declare function toISODateTime(date: Date, withSeconds?: boolean): string;
|
|
142
180
|
/**
|
package/dist/internal/date.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dateFormatter as t}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,
|
|
1
|
+
import{dateFormatter as t}from"./format.js";export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){const r=t.getFullYear();return"year"===e?makeDate(r,11,31):"month"===e?makeDate(r,t.getMonth(),daysInMonth(r,t.getMonth())):startOfDay(t)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=t.getFullYear(),n=t.getMonth()+e,o=new Date(t.getTime()),a=makeDate(r,n,1);return o.setFullYear(a.getFullYear(),a.getMonth(),Math.min(t.getDate(),daysInMonth(a.getFullYear(),a.getMonth()))),o}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayInRange(t,e,r){return!(!isValidDate(e)||!isValidDate(r))&&(compareDay(t,e)>0&&compareDay(t,r)<0)}export function clampDate(t,e,r){return isValidDate(e)&&t.getTime()<e.getTime()?new Date(e.getTime()):isValidDate(r)&&t.getTime()>r.getTime()?new Date(r.getTime()):t}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function minutesOfDay(t){return 60*t.getHours()+t.getMinutes()}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}export function formatDate(e,r,n){return isValidDate(e)?t(r,n).format(e):""}const e=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(r,n){const o=t(r,n);return[...new Set(e.map(t=>o.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISODate(t){const e=t=>String(t).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${e(t.getMonth()+1)}-${e(t.getDate())}`}export function toISOMonth(t){return`${String(t.getFullYear()).padStart(4,"0")}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const r=makeDate(2021,7,1);export function weekdayLabels(e,n,o="short"){const a=t(e,{weekday:o});return Array.from({length:7},(t,e)=>a.format(addDays(r,(n+e)%7)))}export function monthLabels(e,r="short"){const n=t(e,{month:r});return Array.from({length:12},(t,e)=>n.format(makeDate(2021,e,1)))}export function isMonthBeforeYear(e){const n=t(e,{year:"numeric",month:"long"}).formatToParts(r);return n.findIndex(t=>"month"===t.type)<n.findIndex(t=>"year"===t.type)}export function isHour12(e){const r=t(e,{hour:"numeric"}).resolvedOptions();return r.hourCycle?"h11"===r.hourCycle||"h12"===r.hourCycle:!0===r.hour12}export function meridiemLabels(e){const n=t(e,{hour:"numeric",hour12:!0}),o=t=>{const e=n.formatToParts(withTime(r,{hours:t})).find(t=>"dayPeriod"===t.type);return e?.value??(t<12?"AM":"PM")};return[o(9),o(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaDensity, NebaSize, NebaVariant } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The prop values an application can set once instead of at every call site.
|
|
5
|
+
*
|
|
6
|
+
* Four, and the list is closed on purpose. These are the axes whose right value
|
|
7
|
+
* is a property of the *product* rather than of the control — a dense
|
|
8
|
+
* application is dense everywhere, and a Korean one is Korean everywhere.
|
|
9
|
+
*
|
|
10
|
+
* `color` is deliberately not among them. A component's colour default is often
|
|
11
|
+
* semantic — an Alert is `info`, a Popconfirm is `danger`, severity carries
|
|
12
|
+
* meaning — and one global override would silently repaint those into
|
|
13
|
+
* something that means something else. `elevation` is out for the design
|
|
14
|
+
* language's reason: a shadow is opt-in, per surface, and an application-wide
|
|
15
|
+
* one is the moulded-plastic look the whole thing is against.
|
|
16
|
+
*/
|
|
17
|
+
export interface NebaDefaults {
|
|
18
|
+
size?: NebaSize;
|
|
19
|
+
density?: NebaDensity;
|
|
20
|
+
variant?: NebaVariant;
|
|
21
|
+
/** BCP 47 tag for every component that says a word on its own behalf. */
|
|
22
|
+
locale?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Which of the four a given component actually accepts. */
|
|
25
|
+
export type DefaultableKey = keyof NebaDefaults;
|
|
26
|
+
/**
|
|
27
|
+
* `null` when there is no provider, which is the common case and the one worth
|
|
28
|
+
* making free: `useStyleDefaults` hands the props straight back without
|
|
29
|
+
* allocating, so a page with no provider pays a `useContext` and nothing else.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DefaultsContext: React.Context<NebaDefaults | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Fills in the axes the caller left out, from the provider above.
|
|
34
|
+
*
|
|
35
|
+
* Called by every component that takes one of them, with the props it was
|
|
36
|
+
* given, *before* its own destructuring runs — so the order of precedence is
|
|
37
|
+
* the one a reader expects: the call site, then the provider, then the
|
|
38
|
+
* component's own literal default.
|
|
39
|
+
*
|
|
40
|
+
* The keys are passed in rather than worked out, and that is load-bearing. A
|
|
41
|
+
* key a component does not destructure stays in the props it spreads onto its
|
|
42
|
+
* root, so filling `density` into a component that has none would put
|
|
43
|
+
* `density="compact"` on a `<div>` — and `size` on an `<input>` is a real
|
|
44
|
+
* attribute that would quietly resize the field.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useStyleDefaults<P extends object>(props: P, keys: DefaultableKey[]): P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as t from"react";export const DefaultsContext=/*@__PURE__*/t.createContext(null);export function useStyleDefaults(e,o){const n=t.useContext(DefaultsContext);if(!n)return e;const s=e;let r=null;for(const t of o){const e=n[t];void 0!==e&&void 0===s[t]&&(r=r??{...s},r[t]=e)}return r??s}
|
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -78,6 +78,25 @@ export interface ActionMessages {
|
|
|
78
78
|
}
|
|
79
79
|
/** The `action` namespace, as Alert, Chip, Combobox, Dialog, Drawer, Popover and Toast read it. */
|
|
80
80
|
export declare const actionMessages: MessageTable<ActionMessages>;
|
|
81
|
+
/** ConfirmProvider. */
|
|
82
|
+
export interface ConfirmMessages {
|
|
83
|
+
/** The button that answers yes. */
|
|
84
|
+
confirm: string;
|
|
85
|
+
/**
|
|
86
|
+
* And the one that answers no — which is also what Escape and a click on the
|
|
87
|
+
* backdrop mean, so it is the label on the way out rather than a third option.
|
|
88
|
+
*/
|
|
89
|
+
cancel: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `confirm` namespace.
|
|
93
|
+
*
|
|
94
|
+
* Its own rather than two more keys on `action`, which holds the words on four
|
|
95
|
+
* different × buttons. A confirm's two buttons are a question being answered,
|
|
96
|
+
* not a thing being dismissed, and a namespace a Chip pulls in for the word
|
|
97
|
+
* "Remove" should not also carry them.
|
|
98
|
+
*/
|
|
99
|
+
export declare const confirmMessages: MessageTable<ConfirmMessages>;
|
|
81
100
|
/** TextLink. */
|
|
82
101
|
export interface LinkMessages {
|
|
83
102
|
/**
|
|
@@ -160,6 +179,8 @@ export interface TableMessages {
|
|
|
160
179
|
* same nothing to report and no chrome of its own to say it with.
|
|
161
180
|
*/
|
|
162
181
|
empty: string;
|
|
182
|
+
/** The button that writes what is on screen out as a file. */
|
|
183
|
+
exportCsv: string;
|
|
163
184
|
}
|
|
164
185
|
/** The `table` namespace, as Table and DataTable read it. */
|
|
165
186
|
export declare const tableMessages: MessageTable<TableMessages>;
|
|
@@ -546,6 +567,8 @@ export interface NebaLocale {
|
|
|
546
567
|
code?: Partial<CodeMessages>;
|
|
547
568
|
/** Steps. */
|
|
548
569
|
steps?: Partial<StepsMessages>;
|
|
570
|
+
/** Confirm. */
|
|
571
|
+
confirm?: Partial<ConfirmMessages>;
|
|
549
572
|
}
|
|
550
573
|
/**
|
|
551
574
|
* Teaches the library a language.
|
package/dist/internal/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";export function fill(e,s){return e.replace(/\{(\w+)\}/g,(e,
|
|
1
|
+
import*as e from"react";export function fill(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>s[o]??e)}export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove"}};export const confirmMessages={"":{confirm:"Confirm",cancel:"Cancel"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data",exportCsv:"Export CSV"}};export const colorMessages={"":{area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide"}};export const chartMessages={"":{label:"Chart"}};export const scrollMessages={"":{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const commandMessages={"":{label:"Command palette",search:"Type a command or search…",empty:"No commands found"}};export const transferMessages={"":{source:"Available",target:"Selected",toTarget:"Move to selected",toSource:"Move to available",search:"Search",selectAll:"Select all",empty:"Nothing here"}};export const anchorMessages={"":{label:"On this page"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}"}};export const overlayMessages={"":{label:"Overlay"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",skip:"Skip",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};const s={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const o=new WeakMap;export function resolveMessages(e,t){const a=e[""],r=t?.trim()??"";if(!r)return a;let n=o.get(e);n||(n=new Map,o.set(e,n));const c=n.get(r);if(c)return c;const l=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),o=s[0];if(!o)return[];const t=s.slice(1),a=t.find(e=>/^[a-z]{4}$/.test(e)),r=t.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${o}-${a}`:"",r?`${o}-${r}`:"",o].filter(Boolean)}(r).map(o=>{const t=s[o];return e[o]??(t?e[t]:void 0)}).find(Boolean),i=l?{...a,...l}:a;return n.set(r,i),i}export function useMessages(s,o){return e.useMemo(()=>resolveMessages(s,o),[s,o])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>s[o]??e)}const t={action:actionMessages,confirm:confirmMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,chart:chartMessages,scroll:scrollMessages,breadcrumb:breadcrumbMessages,anchor:anchorMessages,transfer:transferMessages,command:commandMessages,combobox:comboboxMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages};export function registerMessages(e,s){const a=e.trim().toLowerCase();for(const[e,r]of Object.entries(s)){const s=t[e];s&&r&&(s[a]=r,o.delete(s))}}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key combination, read rather than drawn.
|
|
3
|
+
*
|
|
4
|
+
* This is in `internal/` for `button-group.ts`'s reason with a sharper edge on
|
|
5
|
+
* it. `Shortcut` *draws* `Mod+K` and `CommandPalette` *binds* it, and the two
|
|
6
|
+
* were written separately — so the drawing side understood `Cmd`, `Command`,
|
|
7
|
+
* `Meta` and `Esc` and the binding side did not. `<Shortcut keys="Cmd+K" />`
|
|
8
|
+
* put a correct key cap on the screen over a shortcut that could never fire,
|
|
9
|
+
* which is the worst shape this bug can take: the label is the only evidence a
|
|
10
|
+
* reader has that the key exists at all.
|
|
11
|
+
*
|
|
12
|
+
* So the split is by job rather than by component. Everything that decides
|
|
13
|
+
* *which key a token means* is here and both sides read it. What a key *looks
|
|
14
|
+
* like* — `⌘`, `⇧`, the arrow glyphs — stays in `Shortcut`, because a TextField
|
|
15
|
+
* that binds `Mod+Enter` has no business carrying a table of Mac glyphs.
|
|
16
|
+
*
|
|
17
|
+
* Nothing here allocates at import time beyond two small object literals, and
|
|
18
|
+
* the platform is worked out once for the page.
|
|
19
|
+
*/
|
|
20
|
+
import type * as React from 'react';
|
|
21
|
+
import type { NebaShortcuts } from '../types.js';
|
|
22
|
+
/** The three platforms a combination can be named for, once `auto` is resolved. */
|
|
23
|
+
export type ResolvedOS = 'mac' | 'windows' | 'linux';
|
|
24
|
+
/**
|
|
25
|
+
* Splits the string form. Empty segments are what `'Ctrl++'` leaves behind, and
|
|
26
|
+
* dropping them is why the array form exists for that case.
|
|
27
|
+
*/
|
|
28
|
+
export declare function tokenize(keys: string | string[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* One token reduced to the name this file knows it by.
|
|
31
|
+
*
|
|
32
|
+
* It also folds a real `KeyboardEvent.key`, which is what lets the two sides of
|
|
33
|
+
* a comparison meet in the middle: a caller writes `Esc` and the browser
|
|
34
|
+
* reports `Escape`, and both arrive here as `escape`. The space bar is the one
|
|
35
|
+
* key whose `key` is punctuation, so it is named before the punctuation is
|
|
36
|
+
* stripped.
|
|
37
|
+
*/
|
|
38
|
+
export declare function canonicalKey(token: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* What the browser says it is running on.
|
|
41
|
+
*
|
|
42
|
+
* `userAgentData.platform` is the modern spelling and `navigator.platform` the
|
|
43
|
+
* deprecated one every browser still answers; the user agent string is the last
|
|
44
|
+
* resort, and *last resort* is the load-bearing word. The three are asked in
|
|
45
|
+
* order and the first that says anything at all is the answer — never all three
|
|
46
|
+
* matched at once, which is what this used to do.
|
|
47
|
+
*
|
|
48
|
+
* A union of the three can only ever be wrong in one direction: towards `mac`.
|
|
49
|
+
* A WebKit build on Linux or Windows reports its own platform and a *Safari on
|
|
50
|
+
* macOS* user agent string, so a haystack holding both reads as a Mac, and
|
|
51
|
+
* `Mod` then binds Command on a keyboard that has no Command key — with
|
|
52
|
+
* `Shortcut` drawing a ⌘ over it. That is this file's own opening paragraph
|
|
53
|
+
* happening again, one layer down.
|
|
54
|
+
*
|
|
55
|
+
* The rule is a pure function so it can be asserted on directly: the browser
|
|
56
|
+
* this suite runs in only ever reports one of these combinations, and the one
|
|
57
|
+
* that broke is not it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveOS(userAgentDataPlatform: string | undefined, platform: string | undefined, userAgent: string | undefined): ResolvedOS;
|
|
60
|
+
export declare function readOS(): ResolvedOS;
|
|
61
|
+
/**
|
|
62
|
+
* Enough of a keyboard event to decide a combination — so one function serves
|
|
63
|
+
* both a DOM `KeyboardEvent` and React's synthetic one.
|
|
64
|
+
*/
|
|
65
|
+
export interface KeyPress {
|
|
66
|
+
key: string;
|
|
67
|
+
code: string;
|
|
68
|
+
ctrlKey: boolean;
|
|
69
|
+
metaKey: boolean;
|
|
70
|
+
altKey: boolean;
|
|
71
|
+
shiftKey: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Does this keystroke satisfy `Mod+Shift+P`?
|
|
75
|
+
*
|
|
76
|
+
* The modifiers are matched **exactly**, not as a subset: a shortcut names the
|
|
77
|
+
* modifiers it wants, so `Enter` does not fire when `Mod+Enter` was pressed.
|
|
78
|
+
* That is what makes a `shortcuts` map unambiguous — at most one entry can
|
|
79
|
+
* match a keystroke, unless a caller spelled the same combination twice.
|
|
80
|
+
*/
|
|
81
|
+
export declare function matchesShortcut(event: KeyPress, shortcut: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The `shortcuts` map and the caller's own `onKeyDown`, as the one handler a
|
|
84
|
+
* control can carry.
|
|
85
|
+
*
|
|
86
|
+
* The map is checked first and every matching entry runs, so a caller who
|
|
87
|
+
* spelled one combination two ways gets both rather than an arbitrary one; then
|
|
88
|
+
* `onKeyDown` runs, and can read `event.defaultPrevented` to see what the map
|
|
89
|
+
* decided. `undefined` when there is nothing to bind, so a field with neither
|
|
90
|
+
* prop attaches no listener at all.
|
|
91
|
+
*/
|
|
92
|
+
export declare function keyHandler<E extends Element>(shortcuts: NebaShortcuts<E> | undefined, onKeyDown?: React.KeyboardEventHandler<E>): React.KeyboardEventHandler<E> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock",spacebar:"space",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright"};export function tokenize(t){return Array.isArray(t)?t.map(t=>t.trim()).filter(Boolean):t.split("+").map(t=>t.trim()).filter(Boolean)}export function canonicalKey(e){if(" "===e)return"space";const r=e.toLowerCase().replace(/[\s_-]/g,"");return t[r]??r}export function resolveOS(t,e,r){const n=t||e||r||"";return/mac|iphone|ipad|ipod/i.test(n)?"mac":/win/i.test(n)?"windows":"linux"}let e=null;export function readOS(){return e??=function(){if("undefined"==typeof navigator)return"windows";const t=navigator.userAgentData;return resolveOS(t?.platform,navigator.platform,navigator.userAgent)}(),e}export function matchesShortcut(t,e){const r=tokenize(e).map(canonicalKey);if(0===r.length)return!1;const n={ctrl:!1,meta:!1,alt:!1,shift:!1},o="mac"===readOS();for(const t of r.slice(0,-1))if("mod"===t)n[o?"meta":"ctrl"]=!0;else{if("meta"!==t&&"ctrl"!==t&&"alt"!==t&&"shift"!==t)return!1;n[t]=!0}return t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift&&function(t,e){if(canonicalKey(t.key)===e)return!0;if(1===e.length){if(e>="a"&&e<="z")return t.code===`Key${e.toUpperCase()}`;if(e>="0"&&e<="9")return t.code===`Digit${e}`}return!1}(t,r[r.length-1])}export function keyHandler(t,e){return t?r=>{for(const[e,n]of Object.entries(t))matchesShortcut(r,e)&&n(r);e?.(r)}:e}
|
package/dist/internal/media.d.ts
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
+
import type { NebaBreakpoint } from '../types.js';
|
|
1
2
|
/** Subscribes to one query. A no-op where there is no window to ask. */
|
|
2
3
|
export declare function subscribeToQuery(query: string, onChange: () => void): () => void;
|
|
3
4
|
/** The current answer. Reads a live object rather than building one. */
|
|
4
5
|
export declare function queryMatches(query: string): boolean;
|
|
5
6
|
/** A server has no window, so nothing matches. */
|
|
6
7
|
export declare function noMatchOnServer(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The five widths, written once and read in both directions.
|
|
10
|
+
*
|
|
11
|
+
* They are Tailwind's own defaults, which is what makes a Neba layout and a
|
|
12
|
+
* `md:` utility change at the same moment — and they are here rather than in
|
|
13
|
+
* `page-layout.ts`, where they used to be, because a layout asks "is the window
|
|
14
|
+
* *narrower* than this" and a caller asks "is it *at least* this". Two
|
|
15
|
+
* questions, one table: a second copy would be a second chance for the two to
|
|
16
|
+
* disagree about what `md` is.
|
|
17
|
+
*/
|
|
18
|
+
export declare const breakpointWidths: Record<NebaBreakpoint, string>;
|
|
19
|
+
/** Narrower than this breakpoint. `xs` has nothing below it, so it is `null`. */
|
|
20
|
+
export declare function widthBelow(breakpoint: NebaBreakpoint): string | null;
|
|
21
|
+
/** At this breakpoint or wider — the direction a Tailwind `md:` variant means. */
|
|
22
|
+
export declare function widthAtLeast(breakpoint: NebaBreakpoint): string;
|
|
23
|
+
/**
|
|
24
|
+
* One media query, as a boolean React can re-render on.
|
|
25
|
+
*
|
|
26
|
+
* `useSyncExternalStore` rather than state plus an effect, for the reason the
|
|
27
|
+
* whole module exists: a media query *is* an external store with a server
|
|
28
|
+
* answer, and reading it in an effect renders every subscriber once with the
|
|
29
|
+
* wrong answer and then again with the right one. `null` is a query that is
|
|
30
|
+
* always false and subscribes to nothing, which is what a breakpoint with
|
|
31
|
+
* nothing below it needs.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useMediaQuery(query: string | null): boolean;
|
|
7
34
|
/** The query behind every "the reader asked for less motion" decision. */
|
|
8
35
|
export declare const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
|
|
9
36
|
/**
|
package/dist/internal/media.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";const
|
|
1
|
+
"use client";import*as e from"react";const r=new Map;function t(e){if(r.has(e))return r.get(e)??null;const t="undefined"!=typeof window&&window.matchMedia?window.matchMedia(e):null;return r.set(e,t),t}export function subscribeToQuery(e,r){const n=t(e);return n?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):()=>{}}export function queryMatches(e){return t(e)?.matches??!1}export function noMatchOnServer(){return!1}export const breakpointWidths={xs:"0rem",sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};export function widthBelow(e){return"xs"===e?null:`(width < ${breakpointWidths[e]})`}export function widthAtLeast(e){return`(width >= ${breakpointWidths[e]})`}export function useMediaQuery(r){const t=e.useCallback(e=>r?subscribeToQuery(r,e):()=>{},[r]),n=e.useCallback(()=>!!r&&queryMatches(r),[r]);return e.useSyncExternalStore(t,n,noMatchOnServer)}export const reducedMotionQuery="(prefers-reduced-motion: reduce)";const n=e=>subscribeToQuery(reducedMotionQuery,e),o=()=>queryMatches(reducedMotionQuery);export function usePrefersReducedMotion(){return e.useSyncExternalStore(n,o,noMatchOnServer)}
|
|
@@ -96,6 +96,13 @@ export declare const PageLayoutContext: React.Context<PageLayoutContextValue>;
|
|
|
96
96
|
* "nobody said", which a standalone sidebar reads as `start`.
|
|
97
97
|
*/
|
|
98
98
|
export declare const SidebarSideContext: React.Context<SidebarSide | null>;
|
|
99
|
+
/**
|
|
100
|
+
* The media query each breakpoint's floor makes, written the way `styles.css`
|
|
101
|
+
* writes the grid's.
|
|
102
|
+
*
|
|
103
|
+
* `xs` has no query because its floor is zero: there is no width below it, so
|
|
104
|
+
* a sidebar that collapses there never collapses.
|
|
105
|
+
*/
|
|
99
106
|
/**
|
|
100
107
|
* The same five widths as Tailwind variants, for the parts of this that are
|
|
101
108
|
* decided in CSS rather than in JavaScript.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{
|
|
1
|
+
"use client";import*as e from"react";import{useMediaQuery as t,widthBelow as n}from"./media.js";export const PageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const SidebarSideContext=/*@__PURE__*/e.createContext(null);export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(e){return t("none"===e?null:n(e))}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?t?"right":"left":t?"left":"right"}
|
|
@@ -82,6 +82,12 @@ interface InternalShellProps extends PickerShellProps {
|
|
|
82
82
|
}>;
|
|
83
83
|
/** How far off the trigger the popup sits. */
|
|
84
84
|
sideOffset?: number;
|
|
85
|
+
/**
|
|
86
|
+
* A class name for the popup itself, which no `className` can reach: it is
|
|
87
|
+
* portalled to the end of `<body>`, outside the element the root class lands
|
|
88
|
+
* on. Only TreeSelect offers it to a caller so far.
|
|
89
|
+
*/
|
|
90
|
+
popupClassName?: string;
|
|
85
91
|
children: React.ReactNode;
|
|
86
92
|
triggerRef?: React.Ref<HTMLButtonElement>;
|
|
87
93
|
}
|
|
@@ -93,7 +99,7 @@ interface InternalShellProps extends PickerShellProps {
|
|
|
93
99
|
* and the way `invalid` re-points the whole colour family at `danger` so the
|
|
94
100
|
* edge, the ring and the message turn over together.
|
|
95
101
|
*/
|
|
96
|
-
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, sideOffset, children, triggerRef, ...props }: InternalShellProps): React.JSX.Element;
|
|
102
|
+
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, sideOffset, popupClassName, children, triggerRef, ...props }: InternalShellProps): React.JSX.Element;
|
|
97
103
|
/**
|
|
98
104
|
* The row of shortcuts under a picker's panel.
|
|
99
105
|
*
|
package/dist/internal/picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Field as i}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{CloseIcon as l}from"./icons.js";import{WidthSizer as r}from"./sizer.js";import{chipRemoveClasses as s,controlHeightClasses as o,controlTextLeadingClasses as d,cx as c,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as m,focusWithinRingClasses as f,gapClasses as b,iconClasses as h,metaTextClasses as x,paddingXClasses as g,radiusClasses as v,stackGapClasses as y,surfaceClasses as N,surfaceSlots as w,transitionClasses as P}from"./styles.js";export function popupSlots(e,a){return{...w(e,a),"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`}}const j=["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",P,"focus-within:[transition-duration:0ms]",f,h].join(" ");export const pickerPopupClasses=[N,"border bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function PickerShell({variant:f="outline",size:h="md",color:N="primary",density:P="default",elevation:C=0,label:k,description:$,error:O,invalid:z,startIcon:F,fullWidth:R=!1,disabled:S=!1,readOnly:q=!1,required:D=!1,id:I,className:_,style:E,display:L,samples:T,empty:V,clearable:W=!1,onClear:A,open:B,onOpenChange:G,labels:H,hiddenValues:J,sideOffset:K=6,popupClassName:M,children:Q,triggerRef:U,...X}){const Y=n.useId(),Z=I??`${Y}-trigger`,ee=`${Y}-label`,ae=`${Y}-description`,ne=`${Y}-error`,ie=null!=O&&!1!==O&&""!==O,te=z??ie,le=te?"danger":N,re=S||q,se=c($?ae:null,ie?ne:null)||void 0;return a(i.Root,{disabled:S,invalid:te,className:c("flex-col align-top",y[h],R?"flex w-full":"inline-flex",_),style:{...w(le,C),...E},...X,children:[k?e(i.Label,{id:ee,htmlFor:Z,className:c(x[h],"font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:k}):null,a(t.Root,{open:B,onOpenChange:e=>G(e),children:[a("span",{className:c(j,o[h],d[h],v[h],b[h],g[P][h],S?p[f]:q?u[f]:m[f]),children:[a(t.Trigger,{id:Z,ref:U,disabled:S,"aria-labelledby":k?ee:void 0,"aria-describedby":se,"aria-required":D||void 0,"aria-invalid":te||void 0,className:c("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",b[h],"[outline:none]",re?"cursor-default":"cursor-pointer"),children:[F?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)",children:F}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:c("w-full truncate",V?"text-(--neba-muted-fg)":"text-(--neba-fg)"),children:L}),e(r,{samples:T??[]})]})]}),!W||V||re?null:e("button",{type:"button","aria-label":H.clear,className:c(s,"text-(--neba-muted-fg)"),onClick:e=>{e.stopPropagation(),A()},children:e(l,{})})]}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:K,align:"start",children:e(t.Popup,{initialFocus:!1,className:c(pickerPopupClasses,v[h],popupPaddingClasses[h],d[h],M),style:popupSlots(le,3),children:Q})})})]}),$?e(i.Description,{id:ae,className:c(x[h],"text-(--neba-muted-fg)"),children:$}):null,ie?e(i.Error,{id:ne,match:!0,className:c(x[h],"text-(--n-accent)"),children:O}):null,J?.map((a,n)=>e("input",{type:"hidden",name:a.name,value:a.value},n))]})}export function PickerFooter({size:a,children:n}){return e("div",{className:c("flex items-center justify-end border-t pt-1.5","[border-color:var(--n-line)]",b[a]),children:n})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--n-line)"})}
|
package/dist/locales/ar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ar={action:{close:"إغلاق",dismiss:"تجاهل",clear:"مسح",remove:"إزالة"},link:{newTab:"(يفتح في علامة تبويب جديدة)"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"قد يحتوي على حرق للأحداث"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن…"},empty:{title:"لا يوجد شيء هنا"},table:{search:"بحث",selectAll:"تحديد كل الصفوف",selectRow:"تحديد الصف",rowsPerPage:"صفوف لكل صفحة",range:"{start}–{end} من {total}",selected:"تم تحديد {count}",empty:"لا توجد بيانات"},color:{area:"التشبع والسطوع",hue:"درجة اللون",alpha:"العتامة",value:"قيمة اللون",swatches:"ألوان جاهزة",clear:"مسح",empty:"اختر لونًا"},rating:{label:"التقييم",value:"{value} من {max}",empty:"بدون تقييم"},number:{increase:"زيادة",decrease:"إنقاص"},pagination:{label:"ترقيم الصفحات",page:"الصفحة {page}",status:"الصفحة {page} من {total}",previous:"الصفحة السابقة",next:"الصفحة التالية",first:"الصفحة الأولى",last:"الصفحة الأخيرة"},carousel:{label:"شريط عرض",slide:"الشريحة {index} من {total}",previous:"الشريحة السابقة",next:"الشريحة التالية"},chart:{label:"رسم بياني"},scroll:{label:"محتوى قابل للتمرير",previous:"التمرير للخلف",next:"التمرير للأمام"},breadcrumb:{label:"مسار التنقل",expand:"إظهار الخطوات المخفية"},anchor:{label:"في هذه الصفحة"},transfer:{source:"المتاح",target:"المحدد",toTarget:"النقل إلى المحدد",toSource:"الإرجاع إلى المتاح",search:"بحث",selectAll:"تحديد الكل",empty:"لا شيء هنا"},command:{label:"لوحة الأوامر",search:"اكتب أمراً أو ابحث…",empty:"لا توجد أوامر مطابقة"},combobox:{empty:"لا توجد نتائج مطابقة",remove:"إزالة {label}"},overlay:{label:"تراكب"},window:{minimize:"تصغير",maximize:"تكبير",restore:"استعادة",resize:"تغيير حجم النافذة"},layout:{skipToContent:"تخطي إلى المحتوى",sidebar:"الشريط الجانبي",openSidebar:"فتح الشريط الجانبي",closeSidebar:"إغلاق الشريط الجانبي",resizeSidebar:"تغيير حجم الشريط الجانبي"},code:{code:"شفرة",copy:"نسخ",copied:"تم النسخ",copyFailed:"تعذّر النسخ",raw:"خام",prompt:"موجّه الأوامر"},steps:{previous:"السابق",next:"التالي",done:"تم",skip:"تخطي",restart:"البدء من جديد",completed:"اكتملت جميع الخطوات",steps:"الخطوات",position:"{index} من {total}",step:"الخطوة {index}: {title}"}};
|
|
1
|
+
export const ar={action:{close:"إغلاق",dismiss:"تجاهل",clear:"مسح",remove:"إزالة"},confirm:{confirm:"تأكيد",cancel:"إلغاء"},link:{newTab:"(يفتح في علامة تبويب جديدة)"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"قد يحتوي على حرق للأحداث"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن…"},empty:{title:"لا يوجد شيء هنا"},table:{search:"بحث",selectAll:"تحديد كل الصفوف",selectRow:"تحديد الصف",rowsPerPage:"صفوف لكل صفحة",range:"{start}–{end} من {total}",selected:"تم تحديد {count}",empty:"لا توجد بيانات",exportCsv:"تصدير CSV"},color:{area:"التشبع والسطوع",hue:"درجة اللون",alpha:"العتامة",value:"قيمة اللون",swatches:"ألوان جاهزة",clear:"مسح",empty:"اختر لونًا"},rating:{label:"التقييم",value:"{value} من {max}",empty:"بدون تقييم"},number:{increase:"زيادة",decrease:"إنقاص"},pagination:{label:"ترقيم الصفحات",page:"الصفحة {page}",status:"الصفحة {page} من {total}",previous:"الصفحة السابقة",next:"الصفحة التالية",first:"الصفحة الأولى",last:"الصفحة الأخيرة"},carousel:{label:"شريط عرض",slide:"الشريحة {index} من {total}",previous:"الشريحة السابقة",next:"الشريحة التالية"},chart:{label:"رسم بياني"},scroll:{label:"محتوى قابل للتمرير",previous:"التمرير للخلف",next:"التمرير للأمام"},breadcrumb:{label:"مسار التنقل",expand:"إظهار الخطوات المخفية"},anchor:{label:"في هذه الصفحة"},transfer:{source:"المتاح",target:"المحدد",toTarget:"النقل إلى المحدد",toSource:"الإرجاع إلى المتاح",search:"بحث",selectAll:"تحديد الكل",empty:"لا شيء هنا"},command:{label:"لوحة الأوامر",search:"اكتب أمراً أو ابحث…",empty:"لا توجد أوامر مطابقة"},combobox:{empty:"لا توجد نتائج مطابقة",remove:"إزالة {label}"},overlay:{label:"تراكب"},window:{minimize:"تصغير",maximize:"تكبير",restore:"استعادة",resize:"تغيير حجم النافذة"},layout:{skipToContent:"تخطي إلى المحتوى",sidebar:"الشريط الجانبي",openSidebar:"فتح الشريط الجانبي",closeSidebar:"إغلاق الشريط الجانبي",resizeSidebar:"تغيير حجم الشريط الجانبي"},code:{code:"شفرة",copy:"نسخ",copied:"تم النسخ",copyFailed:"تعذّر النسخ",raw:"خام",prompt:"موجّه الأوامر"},steps:{previous:"السابق",next:"التالي",done:"تم",skip:"تخطي",restart:"البدء من جديد",completed:"اكتملت جميع الخطوات",steps:"الخطوات",position:"{index} من {total}",step:"الخطوة {index}: {title}"}};
|
package/dist/locales/de.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const de={action:{close:"Schließen",dismiss:"Ausblenden",clear:"Löschen",remove:"Entfernen"},link:{newTab:"(wird in einem neuen Tab geöffnet)"},spoiler:{reveal:"Anzeigen",hide:"Ausblenden",notice:"Kann Spoiler enthalten"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt…"},empty:{title:"Nichts vorhanden"},table:{search:"Suchen",selectAll:"Alle Zeilen auswählen",selectRow:"Zeile auswählen",rowsPerPage:"Zeilen pro Seite",range:"{start}–{end} von {total}",selected:"{count} ausgewählt",empty:"Keine Daten"},color:{area:"Sättigung und Helligkeit",hue:"Farbton",alpha:"Deckkraft",value:"Farbwert",swatches:"Vorgegebene Farben",clear:"Löschen",empty:"Farbe auswählen"},rating:{label:"Bewertung",value:"{value} von {max}",empty:"Keine Bewertung"},number:{increase:"Erhöhen",decrease:"Verringern"},pagination:{label:"Seitennavigation",page:"Seite {page}",status:"Seite {page} von {total}",previous:"Vorherige Seite",next:"Nächste Seite",first:"Erste Seite",last:"Letzte Seite"},carousel:{label:"Karussell",slide:"Folie {index} von {total}",previous:"Vorherige Folie",next:"Nächste Folie"},chart:{label:"Diagramm"},scroll:{label:"Scrollbarer Inhalt",previous:"Zurückscrollen",next:"Weiterscrollen"},breadcrumb:{label:"Breadcrumb-Navigation",expand:"Ausgeblendete Schritte anzeigen"},anchor:{label:"Auf dieser Seite"},transfer:{source:"Verfügbar",target:"Ausgewählt",toTarget:"Zu Ausgewählt verschieben",toSource:"Zurück zu Verfügbar",search:"Suchen",selectAll:"Alle auswählen",empty:"Nichts vorhanden"},command:{label:"Befehlspalette",search:"Befehl eingeben oder suchen…",empty:"Keine Befehle gefunden"},combobox:{empty:"Keine Treffer",remove:"{label} entfernen"},overlay:{label:"Overlay"},window:{minimize:"Minimieren",maximize:"Maximieren",restore:"Wiederherstellen",resize:"Fenstergröße ändern"},layout:{skipToContent:"Zum Inhalt springen",sidebar:"Seitenleiste",openSidebar:"Seitenleiste öffnen",closeSidebar:"Seitenleiste schließen",resizeSidebar:"Seitenleiste anpassen"},code:{code:"Code",copy:"Kopieren",copied:"Kopiert",copyFailed:"Kopieren nicht möglich",raw:"Unformatiert",prompt:"Eingabeaufforderung"},steps:{previous:"Zurück",next:"Weiter",done:"Fertig",skip:"Überspringen",restart:"Von vorn beginnen",completed:"Alle Schritte abgeschlossen",steps:"Schritte",position:"{index} von {total}",step:"Schritt {index}: {title}"}};
|
|
1
|
+
export const de={action:{close:"Schließen",dismiss:"Ausblenden",clear:"Löschen",remove:"Entfernen"},confirm:{confirm:"Bestätigen",cancel:"Abbrechen"},link:{newTab:"(wird in einem neuen Tab geöffnet)"},spoiler:{reveal:"Anzeigen",hide:"Ausblenden",notice:"Kann Spoiler enthalten"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt…"},empty:{title:"Nichts vorhanden"},table:{search:"Suchen",selectAll:"Alle Zeilen auswählen",selectRow:"Zeile auswählen",rowsPerPage:"Zeilen pro Seite",range:"{start}–{end} von {total}",selected:"{count} ausgewählt",empty:"Keine Daten",exportCsv:"CSV exportieren"},color:{area:"Sättigung und Helligkeit",hue:"Farbton",alpha:"Deckkraft",value:"Farbwert",swatches:"Vorgegebene Farben",clear:"Löschen",empty:"Farbe auswählen"},rating:{label:"Bewertung",value:"{value} von {max}",empty:"Keine Bewertung"},number:{increase:"Erhöhen",decrease:"Verringern"},pagination:{label:"Seitennavigation",page:"Seite {page}",status:"Seite {page} von {total}",previous:"Vorherige Seite",next:"Nächste Seite",first:"Erste Seite",last:"Letzte Seite"},carousel:{label:"Karussell",slide:"Folie {index} von {total}",previous:"Vorherige Folie",next:"Nächste Folie"},chart:{label:"Diagramm"},scroll:{label:"Scrollbarer Inhalt",previous:"Zurückscrollen",next:"Weiterscrollen"},breadcrumb:{label:"Breadcrumb-Navigation",expand:"Ausgeblendete Schritte anzeigen"},anchor:{label:"Auf dieser Seite"},transfer:{source:"Verfügbar",target:"Ausgewählt",toTarget:"Zu Ausgewählt verschieben",toSource:"Zurück zu Verfügbar",search:"Suchen",selectAll:"Alle auswählen",empty:"Nichts vorhanden"},command:{label:"Befehlspalette",search:"Befehl eingeben oder suchen…",empty:"Keine Befehle gefunden"},combobox:{empty:"Keine Treffer",remove:"{label} entfernen"},overlay:{label:"Overlay"},window:{minimize:"Minimieren",maximize:"Maximieren",restore:"Wiederherstellen",resize:"Fenstergröße ändern"},layout:{skipToContent:"Zum Inhalt springen",sidebar:"Seitenleiste",openSidebar:"Seitenleiste öffnen",closeSidebar:"Seitenleiste schließen",resizeSidebar:"Seitenleiste anpassen"},code:{code:"Code",copy:"Kopieren",copied:"Kopiert",copyFailed:"Kopieren nicht möglich",raw:"Unformatiert",prompt:"Eingabeaufforderung"},steps:{previous:"Zurück",next:"Weiter",done:"Fertig",skip:"Überspringen",restart:"Von vorn beginnen",completed:"Alle Schritte abgeschlossen",steps:"Schritte",position:"{index} von {total}",step:"Schritt {index}: {title}"}};
|
package/dist/locales/es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const es={action:{close:"Cerrar",dismiss:"Descartar",clear:"Borrar",remove:"Quitar"},link:{newTab:"(se abre en una pestaña nueva)"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Puede contener spoilers"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo…"},empty:{title:"No hay nada aquí"},table:{search:"Buscar",selectAll:"Seleccionar todas las filas",selectRow:"Seleccionar fila",rowsPerPage:"Filas por página",range:"{start}–{end} de {total}",selected:"{count} seleccionadas",empty:"Sin datos"},color:{area:"Saturación y brillo",hue:"Tono",alpha:"Opacidad",value:"Valor del color",swatches:"Colores predefinidos",clear:"Borrar",empty:"Elegir un color"},rating:{label:"Valoración",value:"{value} de {max}",empty:"Sin valoración"},number:{increase:"Aumentar",decrease:"Disminuir"},pagination:{label:"Paginación",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Página siguiente",first:"Primera página",last:"Última página"},carousel:{label:"Carrusel",slide:"Diapositiva {index} de {total}",previous:"Diapositiva anterior",next:"Diapositiva siguiente"},chart:{label:"Gráfico"},scroll:{label:"Contenido desplazable",previous:"Desplazar hacia atrás",next:"Desplazar hacia adelante"},breadcrumb:{label:"Ruta de navegación",expand:"Mostrar los pasos ocultos"},anchor:{label:"En esta página"},transfer:{source:"Disponibles",target:"Seleccionados",toTarget:"Mover a seleccionados",toSource:"Devolver a disponibles",search:"Buscar",selectAll:"Seleccionar todo",empty:"No hay nada"},command:{label:"Paleta de comandos",search:"Escribe un comando o busca…",empty:"No se encontraron comandos"},combobox:{empty:"Sin coincidencias",remove:"Quitar {label}"},overlay:{label:"Superposición"},window:{minimize:"Minimizar",maximize:"Maximizar",restore:"Restaurar",resize:"Cambiar el tamaño de la ventana"},layout:{skipToContent:"Saltar al contenido",sidebar:"Barra lateral",openSidebar:"Abrir barra lateral",closeSidebar:"Cerrar barra lateral",resizeSidebar:"Redimensionar barra lateral"},code:{code:"Código",copy:"Copiar",copied:"Copiado",copyFailed:"No se pudo copiar",raw:"Sin formato",prompt:"Símbolo del sistema"},steps:{previous:"Anterior",next:"Siguiente",done:"Hecho",skip:"Omitir",restart:"Empezar de nuevo",completed:"Todos los pasos completados",steps:"Pasos",position:"{index} de {total}",step:"Paso {index}: {title}"}};
|
|
1
|
+
export const es={action:{close:"Cerrar",dismiss:"Descartar",clear:"Borrar",remove:"Quitar"},confirm:{confirm:"Confirmar",cancel:"Cancelar"},link:{newTab:"(se abre en una pestaña nueva)"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Puede contener spoilers"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo…"},empty:{title:"No hay nada aquí"},table:{search:"Buscar",selectAll:"Seleccionar todas las filas",selectRow:"Seleccionar fila",rowsPerPage:"Filas por página",range:"{start}–{end} de {total}",selected:"{count} seleccionadas",empty:"Sin datos",exportCsv:"Exportar CSV"},color:{area:"Saturación y brillo",hue:"Tono",alpha:"Opacidad",value:"Valor del color",swatches:"Colores predefinidos",clear:"Borrar",empty:"Elegir un color"},rating:{label:"Valoración",value:"{value} de {max}",empty:"Sin valoración"},number:{increase:"Aumentar",decrease:"Disminuir"},pagination:{label:"Paginación",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Página siguiente",first:"Primera página",last:"Última página"},carousel:{label:"Carrusel",slide:"Diapositiva {index} de {total}",previous:"Diapositiva anterior",next:"Diapositiva siguiente"},chart:{label:"Gráfico"},scroll:{label:"Contenido desplazable",previous:"Desplazar hacia atrás",next:"Desplazar hacia adelante"},breadcrumb:{label:"Ruta de navegación",expand:"Mostrar los pasos ocultos"},anchor:{label:"En esta página"},transfer:{source:"Disponibles",target:"Seleccionados",toTarget:"Mover a seleccionados",toSource:"Devolver a disponibles",search:"Buscar",selectAll:"Seleccionar todo",empty:"No hay nada"},command:{label:"Paleta de comandos",search:"Escribe un comando o busca…",empty:"No se encontraron comandos"},combobox:{empty:"Sin coincidencias",remove:"Quitar {label}"},overlay:{label:"Superposición"},window:{minimize:"Minimizar",maximize:"Maximizar",restore:"Restaurar",resize:"Cambiar el tamaño de la ventana"},layout:{skipToContent:"Saltar al contenido",sidebar:"Barra lateral",openSidebar:"Abrir barra lateral",closeSidebar:"Cerrar barra lateral",resizeSidebar:"Redimensionar barra lateral"},code:{code:"Código",copy:"Copiar",copied:"Copiado",copyFailed:"No se pudo copiar",raw:"Sin formato",prompt:"Símbolo del sistema"},steps:{previous:"Anterior",next:"Siguiente",done:"Hecho",skip:"Omitir",restart:"Empezar de nuevo",completed:"Todos los pasos completados",steps:"Pasos",position:"{index} de {total}",step:"Paso {index}: {title}"}};
|