@plexui/ui 0.35.0 → 0.37.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.
@@ -30,6 +30,19 @@ export type SidebarProviderProps = {
30
30
  * Callback when open state changes
31
31
  */
32
32
  onOpenChange?: (open: boolean) => void;
33
+ /**
34
+ * Controlled open state of the phone drawer (`SidebarMobile`)
35
+ */
36
+ openMobile?: boolean;
37
+ /**
38
+ * Initial open state of the phone drawer (uncontrolled)
39
+ * @default false
40
+ */
41
+ defaultOpenMobile?: boolean;
42
+ /**
43
+ * Called when the phone drawer opens or closes: its menu button, its backdrop, Escape or a swipe
44
+ */
45
+ onOpenMobileChange?: (open: boolean) => void;
33
46
  /**
34
47
  * Collapsible mode
35
48
  * @default "offcanvas"
@@ -49,7 +62,7 @@ export type SidebarProviderProps = {
49
62
  */
50
63
  className?: string;
51
64
  };
52
- export declare const SidebarProvider: ({ children, defaultOpen, open: openProp, onOpenChange: setOpenProp, collapsible, variant, style, className, }: SidebarProviderProps) => import("react/jsx-runtime").JSX.Element;
65
+ export declare const SidebarProvider: ({ children, defaultOpen, open: openProp, onOpenChange: setOpenProp, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, collapsible, variant, style, className, }: SidebarProviderProps) => import("react/jsx-runtime").JSX.Element;
53
66
  export declare const SIDEBAR_CONSTANTS: {
54
67
  readonly WIDTH: "240px";
55
68
  readonly WIDTH_APP: "260px";
@@ -0,0 +1,54 @@
1
+ import type { MaskitoOptions } from "@maskito/core";
2
+ import { type MaskitoDateMode, type MaskitoTimeMode } from "@maskito/kit";
3
+ import { DateTime, type Zone } from "luxon";
4
+ export type DateInputFormat = {
5
+ mode: MaskitoDateMode;
6
+ separator: string;
7
+ /** Set for a date and time */
8
+ timeMode?: MaskitoTimeMode;
9
+ dateTimeSeparator: string;
10
+ /** Earliest allowed instant, in milliseconds */
11
+ min?: number;
12
+ /** Latest allowed instant, in milliseconds */
13
+ max?: number;
14
+ /** Zone of the value (dateInputZone): typed dates are made in it. Luxon's default zone when not set */
15
+ zone?: Zone | string;
16
+ };
17
+ /**
18
+ * The zone typed dates are made in: the value's own zone object (Luxon's default zone without a value). A zone rebuilt
19
+ * from its name can be another one: Luxon's system zone becomes the zone of its name, the zone named UTC becomes the
20
+ * fixed UTC offset, and a name like UTC+5:5 (a 5:05 offset) does not parse back. The same object for the same zone,
21
+ * so it keys a memo.
22
+ */
23
+ export declare const dateInputZone: (value: DateTime | null | undefined) => Zone | undefined;
24
+ /** The key a DateInput re-shows its value on: the instant and the zone. */
25
+ export declare const dateInputValueKey: (value: DateTime | null | undefined) => string;
26
+ /** The text a DateInput shows for a value: its wall clock in its own zone, kept within min and max. */
27
+ export declare const formatDateInput: (value: DateTime | null, format: DateInputFormat) => string;
28
+ /**
29
+ * The value for a complete text, or `null` while it is not one. A typed
30
+ * date is made in the format's zone from the typed fields, so the time is
31
+ * the one typed on a daylight saving day too. A date that does not exist is
32
+ * `null`; a time skipped by a clock change moves forward, as Luxon does, and
33
+ * a time the clocks show twice is its first pass, as the browser's Date reads
34
+ * it, unless only the second is within min and max or the text is a bound's
35
+ * own. Kept within min and max when the mode has a year, as Maskito's reading is.
36
+ */
37
+ export declare const parseDateInput: (text: string, format: DateInputFormat) => DateTime<boolean> | null;
38
+ /**
39
+ * min or max for Maskito's mask, which builds the typed dates with the
40
+ * browser's Date from their fields: the same fields, read in the value's
41
+ * zone, so the mask compares wall clocks. Only its steps for a date not yet
42
+ * complete read them, as keepTypedValue takes over the rest.
43
+ */
44
+ export declare const maskDate: (millis: number, zone: Zone | string | undefined) => Date;
45
+ /**
46
+ * Maskito's date and date-and-time masks end with a step that rebuilds a complete date with the browser's Date to keep
47
+ * it within min and max: in a zone whose clocks skipped a whole day the date moved a day, in the hour the browser's
48
+ * clocks skip a time typed for a value in another zone moved an hour, and min and max held on the browser's clock.
49
+ * This step reads a complete text in the value's zone, as the value is read (a time the clocks skip moves forward, an
50
+ * hour they repeat is its first pass or the one within min and max), and shows it kept within min and max as instants,
51
+ * so the text is the value's. A date and time without its time yet keeps its date within the dates of min and max. A
52
+ * date that does not exist, or one not yet complete, stays with Maskito's step.
53
+ */
54
+ export declare const keepTypedValue: (options: MaskitoOptions, format: DateInputFormat) => MaskitoOptions;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).
3
+ *
4
+ * - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes
5
+ * it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in
6
+ * `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`
7
+ * and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.
8
+ * - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other
9
+ * listener has had the key, so a menu or dialog over the drawer takes its own Escape first.
10
+ */
11
+ /** How far in from its edge a swipe that opens the drawer may start */
12
+ export declare const DRAWER_EDGE_ZONE = 24;
13
+ /** How far a finger moves before the swipe is taken as horizontal or left to the page */
14
+ export declare const DRAWER_SWIPE_SLOP = 10;
15
+ /** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */
16
+ export declare const DRAWER_SWIPE_VELOCITY = 0.3;
17
+ /** A finger held still this long, in ms, before it lifts lets go by distance alone */
18
+ export declare const DRAWER_SWIPE_HOLD = 100;
19
+ export type DrawerSwipeOptions = {
20
+ /** The element that holds the drawer and the page, where the drag state is written */
21
+ root: HTMLElement;
22
+ /** The drawer itself */
23
+ drawer: HTMLElement;
24
+ isOpen: () => boolean;
25
+ setOpen: (open: boolean) => void;
26
+ /** False turns the gesture off (a wide layout) */
27
+ enabled?: () => boolean;
28
+ };
29
+ /** Starts the gesture on `root`; returns the cleanup */
30
+ export declare function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled }: DrawerSwipeOptions): () => void;
31
+ /** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */
32
+ export declare const drawerTabbables: (drawer: HTMLElement) => HTMLElement[];
33
+ /** The first control of the open drawer, or the drawer itself */
34
+ export declare const drawerInitialFocus: (drawer: HTMLElement) => HTMLElement;
35
+ /**
36
+ * Focuses where focus goes when the drawer closes: the control that opened it, or, when that cannot take focus (it
37
+ * sat in another drawer that has closed since, it is gone, or it was the page itself), the menu button of this
38
+ * drawer's provider, then any menu button on the page. The first that takes focus; `null` when none does. A drawer
39
+ * that has already left the page has no provider around it, so `root` is the provider taken while it was open.
40
+ */
41
+ export declare const returnDrawerFocus: (opener: Element | null, drawer: HTMLElement, root?: Element | null) => HTMLElement | null;
42
+ /**
43
+ * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
44
+ * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
45
+ */
46
+ export declare function loopDrawerFocus(event: KeyboardEvent, drawer: HTMLElement): void;
47
+ /**
48
+ * Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog
49
+ * over the drawer has its listener on the way there and takes the key first, however it listens.
50
+ */
51
+ export declare function closeOnUnhandledEscape(event: KeyboardEvent, drawer: HTMLElement, close: () => void): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/ui",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "Modern design system for building high-quality applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -99,7 +99,7 @@
99
99
  "@maskito/core": "^5.2.2",
100
100
  "@maskito/kit": "^5.2.2",
101
101
  "@maskito/react": "^5.2.2",
102
- "@plexui/styles": "^0.1.40",
102
+ "@plexui/styles": "^0.1.42",
103
103
  "@radix-ui/react-dismissable-layer": "1.2.1",
104
104
  "@radix-ui/react-focus-guards": "1.2.0",
105
105
  "@radix-ui/react-focus-scope": "1.3.1",