@plexui/ui 0.36.0 → 0.38.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/dist/es/components/DateInput/DateInput.js +29 -30
- package/dist/es/components/DateInput/DateInput.js.map +1 -1
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js +25 -171
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/es/components/MarkdownEditor/index.js.map +1 -1
- package/dist/es/components/Sidebar/Sidebar.js +14 -8
- package/dist/es/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/es/lib/dateInputText.js +201 -0
- package/dist/es/lib/dateInputText.js.map +1 -0
- package/dist/es/lib/markdownEditorSchema.js +318 -0
- package/dist/es/lib/markdownEditorSchema.js.map +1 -0
- package/dist/es/lib/phoneDrawer.js +27 -0
- package/dist/es/lib/phoneDrawer.js.map +1 -1
- package/dist/types/components/DateInput/DateInput.d.ts +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +15 -1
- package/dist/types/components/MarkdownEditor/index.d.ts +1 -1
- package/dist/types/lib/dateInputText.d.ts +54 -0
- package/dist/types/lib/markdownEditorSchema.d.ts +47 -0
- package/dist/types/lib/phoneDrawer.d.ts +7 -0
- package/package.json +2 -2
|
@@ -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,47 @@
|
|
|
1
|
+
import type { AnyExtension } from "@tiptap/core";
|
|
2
|
+
export type MarkdownEditorFormat = "bold" | "italic" | "orderedList" | "bulletList" | "link";
|
|
3
|
+
export declare const MARKDOWN_EDITOR_FORMATS: readonly MarkdownEditorFormat[];
|
|
4
|
+
export type MarkdownEditorSchema = {
|
|
5
|
+
/** The formats the editor offers: a toolbar button, its shortcut and input rule, and a mark or node in the schema */
|
|
6
|
+
formats: ReadonlySet<MarkdownEditorFormat>;
|
|
7
|
+
/** A single newline is a line break, read and written as one "\n" */
|
|
8
|
+
breaks: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const markdownEditorSchema: (formats?: readonly MarkdownEditorFormat[], breaks?: boolean) => MarkdownEditorSchema;
|
|
11
|
+
/**
|
|
12
|
+
* The editor's extensions. A format left out has no mark or node: its shortcut and input rule are gone, and pasted or
|
|
13
|
+
* incoming content keeps its text without it, so the markdown going out does not write it either.
|
|
14
|
+
*/
|
|
15
|
+
export declare const markdownEditorExtensions: ({ formats, breaks }: MarkdownEditorSchema, placeholder?: string) => AnyExtension[];
|
|
16
|
+
type MarkdownNode = {
|
|
17
|
+
type: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
position?: {
|
|
20
|
+
start: {
|
|
21
|
+
offset?: number;
|
|
22
|
+
};
|
|
23
|
+
end: {
|
|
24
|
+
offset?: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
children?: MarkdownNode[];
|
|
28
|
+
};
|
|
29
|
+
type HtmlNode = {
|
|
30
|
+
type: string;
|
|
31
|
+
tagName?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
properties?: Record<string, unknown>;
|
|
34
|
+
children?: HtmlNode[];
|
|
35
|
+
};
|
|
36
|
+
export declare function remarkWithoutHtml(this: {
|
|
37
|
+
data(): object;
|
|
38
|
+
}): void;
|
|
39
|
+
export declare function remarkLineBreaks(): (tree: MarkdownNode, file: {
|
|
40
|
+
value?: unknown;
|
|
41
|
+
}) => void;
|
|
42
|
+
/**
|
|
43
|
+
* The first frame's HTML in the editor's schema. A document left with no block is the empty paragraph ProseMirror
|
|
44
|
+
* gives it, with the placeholder the editor would show (`placeholder` only while it can be edited).
|
|
45
|
+
*/
|
|
46
|
+
export declare const rehypeEditorSchema: ({ formats }: MarkdownEditorSchema, placeholder?: string) => () => (tree: HtmlNode) => void;
|
|
47
|
+
export {};
|
|
@@ -32,6 +32,13 @@ export declare function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabl
|
|
|
32
32
|
export declare const drawerTabbables: (drawer: HTMLElement) => HTMLElement[];
|
|
33
33
|
/** The first control of the open drawer, or the drawer itself */
|
|
34
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;
|
|
35
42
|
/**
|
|
36
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
|
|
37
44
|
* drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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.
|
|
102
|
+
"@plexui/styles": "^0.1.43",
|
|
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",
|