@enigmax/primitives 0.17.0 → 0.18.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/button-CaXaqG_K.d.ts +63 -0
- package/dist/chunk-2QFTRNAZ.js +88 -0
- package/dist/chunk-6BGBYUSZ.js +114 -0
- package/dist/chunk-AU3H5WIY.js +107 -0
- package/dist/chunk-F25CGNQC.js +19 -0
- package/dist/chunk-HC2ME5PU.js +168 -0
- package/dist/chunk-HS3X3XCW.js +43 -0
- package/dist/chunk-IIT6U7LM.js +249 -0
- package/dist/chunk-IXVMRVD4.js +96 -0
- package/dist/chunk-KJINGUQN.js +188 -0
- package/dist/chunk-LKA2UG4P.js +542 -0
- package/dist/chunk-MMQPZGSU.js +161 -0
- package/dist/chunk-OCMI7R6H.js +79 -0
- package/dist/chunk-QYMUIW5I.js +28 -0
- package/dist/chunk-S653GLSF.js +17 -0
- package/dist/chunk-SNYUBXWQ.js +149 -0
- package/dist/chunk-U3V4EHOB.js +41 -0
- package/dist/chunk-UOSSNUSC.js +309 -0
- package/dist/chunk-WSB655JB.js +47 -0
- package/dist/chunk-XNNQRA35.js +31 -0
- package/dist/chunk-XQHCZAPJ.js +102 -0
- package/dist/chunk-ZCUFYBPB.js +154 -0
- package/dist/chunk-ZWR2EXHQ.js +55 -0
- package/dist/flags-BBJc9unY.d.ts +133 -0
- package/dist/index-D-ARvWpQ.d.ts +306 -0
- package/dist/index-DNXPtY9X.d.ts +144 -0
- package/dist/index.d.ts +16 -602
- package/dist/index.js +9 -1
- package/dist/input-BwXjFenq.d.ts +77 -0
- package/dist/marquee-CJ3Uwy3E.d.ts +81 -0
- package/dist/network-D2LsBG_k.d.ts +39 -0
- package/dist/next/index.d.ts +20 -3
- package/dist/next/index.js +23 -3
- package/dist/notifications-BpVV6sel.d.ts +70 -0
- package/dist/password-3DRQYAYQ.js +2 -0
- package/dist/password-C8lG4Zm9.d.ts +71 -0
- package/dist/password-FB2CUEKJ.js +1 -0
- package/dist/react/button.d.ts +75 -0
- package/dist/react/button.js +4 -0
- package/dist/react/flag.d.ts +37 -0
- package/dist/react/flag.js +3 -0
- package/dist/react/index.d.ts +28 -312
- package/dist/react/index.js +22 -2
- package/dist/react/input.d.ts +4 -0
- package/dist/react/input.js +3 -0
- package/dist/react/marquee.d.ts +44 -0
- package/dist/react/marquee.js +3 -0
- package/dist/react/network.d.ts +20 -0
- package/dist/react/network.js +3 -0
- package/dist/react/notifications.d.ts +17 -0
- package/dist/react/notifications.js +3 -0
- package/dist/react/palette.d.ts +3 -0
- package/dist/react/palette.js +4 -0
- package/dist/react/relative-time.d.ts +21 -0
- package/dist/react/relative-time.js +3 -0
- package/dist/react/search.d.ts +30 -0
- package/dist/react/search.js +3 -0
- package/dist/react/slot.d.ts +47 -0
- package/dist/react/slot.js +2 -0
- package/dist/react/toast.d.ts +40 -0
- package/dist/react/toast.js +4 -0
- package/dist/react-router/index.d.ts +20 -3
- package/dist/react-router/index.js +23 -3
- package/dist/relative-time-YpRTG7YH.d.ts +106 -0
- package/dist/search-P4OHCRXD.js +50 -0
- package/package.json +52 -2
- package/registry.json +175 -18
- package/src/core/flags.ts +88 -42
- package/src/core/input-icons.ts +34 -0
- package/src/core/input.ts +5 -21
- package/src/core/palette.ts +0 -0
- package/src/index.ts +2 -2
- package/src/react/button.tsx +70 -4
- package/src/react/flag.tsx +18 -6
- package/src/react/index.ts +40 -5
- package/src/react/input/icon.tsx +17 -0
- package/src/react/input/index.tsx +307 -0
- package/src/react/input/password.tsx +174 -0
- package/src/react/input/search.tsx +82 -0
- package/src/react/input/types.ts +146 -0
- package/src/react/input/write-value.ts +18 -0
- package/src/react/palette/context.ts +60 -0
- package/src/react/palette/index.tsx +66 -0
- package/src/react/palette/root.tsx +621 -0
- package/src/react/slot.tsx +91 -0
- package/src/react/use-button.ts +3 -1
- package/dist/chunk-4GLYRF4B.js +0 -1259
- package/dist/chunk-JFNND6P4.js +0 -749
- package/src/react/input.tsx +0 -429
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { d as Notifications, N as Notification } from '../notifications-BpVV6sel.js';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `<Toaster />` - the stack, the movement and the gestures. No colours.
|
|
6
|
+
*
|
|
7
|
+
* The queue underneath already owns ordering, dedupe by key, sticky errors and timers that
|
|
8
|
+
* HOLD while the tab is hidden. What this adds is everything you cannot express in a queue:
|
|
9
|
+
* a toast that is on its way out is still on screen, a pointer resting on the stack must
|
|
10
|
+
* stop the clock, and a swipe has to follow the finger before it decides anything.
|
|
11
|
+
*
|
|
12
|
+
* Every part carries a data attribute, so the theme is a stylesheet you own. `enigma add
|
|
13
|
+
* toast --copy` writes one.
|
|
14
|
+
*/
|
|
15
|
+
type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
16
|
+
interface ToasterProps {
|
|
17
|
+
/** Which queue to render. The shared one by default. */
|
|
18
|
+
queue?: Notifications;
|
|
19
|
+
position?: ToastPosition;
|
|
20
|
+
/**
|
|
21
|
+
* How long the exit animation lasts, in ms. The node stays mounted for exactly this
|
|
22
|
+
* long after it leaves the queue - a toast that vanishes the instant it is dismissed
|
|
23
|
+
* cannot animate out, and that is the only reason this component keeps its own list.
|
|
24
|
+
*/
|
|
25
|
+
exitDuration?: number;
|
|
26
|
+
/** Px a toast must travel before the release dismisses it. */
|
|
27
|
+
swipeThreshold?: number;
|
|
28
|
+
/** Render a toast yourself. The default renders title, body and the action. */
|
|
29
|
+
children?: (notification: Notification, controls: ToastControls) => ReactNode;
|
|
30
|
+
/** Accessible name for the region. */
|
|
31
|
+
label?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
}
|
|
35
|
+
interface ToastControls {
|
|
36
|
+
dismiss: () => void;
|
|
37
|
+
}
|
|
38
|
+
declare function Toaster({ queue, position, exitDuration, swipeThreshold, children, label, className, style }: ToasterProps): ReactNode;
|
|
39
|
+
|
|
40
|
+
export { type ToastControls, type ToastPosition, Toaster, type ToasterProps };
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonProps } from '../react/
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
2
|
+
import { ButtonProps } from '../react/button.js';
|
|
3
|
+
export { UseMarqueeResult, useMarquee } from '../react/marquee.js';
|
|
4
|
+
export { M as MarqueeHover, a as MarqueeInstance, b as MarqueeOptions } from '../marquee-CJ3Uwy3E.js';
|
|
5
|
+
export { PasswordStrength, PasswordStrengthProps, UseButtonResult, UseInputResult, getLinkComponent, setLinkComponent, useButton, useInput } from '../react/index.js';
|
|
6
|
+
export { UseSearchResult, useSearch } from '../react/search.js';
|
|
7
|
+
export { I as InputAction, b as InputIcon, d as InputOptions } from '../input-BwXjFenq.js';
|
|
5
8
|
export { F as FuseConstructor, b as SearchMatch, c as SearchOptions } from '../search-CsO3L1Lw.js';
|
|
9
|
+
export { c as ButtonOptions, d as ButtonState } from '../button-CaXaqG_K.js';
|
|
10
|
+
export { B as BreachChecker, a as BreachState, b as BreachStatus, F as FieldAction, I as Input, c as InputBaseProps, d as InputProps, e as InputType, P as PasswordOnlyProps, g as PlainOnlyProps, S as SearchOnlyProps } from '../index-DNXPtY9X.js';
|
|
11
|
+
export { Slot, SlotProps, mergeSlotProps } from '../react/slot.js';
|
|
12
|
+
export { E as EstimateOptions, G as GeneratePasswordOptions, a as PasswordScore, b as PasswordStrengthReport, e as estimatePasswordStrength, g as generatePassword } from '../password-C8lG4Zm9.js';
|
|
13
|
+
export { UseNotificationsResult, createNotificationQueue, defaultQueue, useNotifications } from '../react/notifications.js';
|
|
14
|
+
export { ToastControls, ToastPosition, Toaster, ToasterProps } from '../react/toast.js';
|
|
15
|
+
export { useNetworkState } from '../react/network.js';
|
|
16
|
+
export { a as NetworkState } from '../network-D2LsBG_k.js';
|
|
17
|
+
export { RelativeTime, RelativeTimeProps } from '../react/relative-time.js';
|
|
18
|
+
export { Flag, FlagProps } from '../react/flag.js';
|
|
19
|
+
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-BBJc9unY.js';
|
|
20
|
+
export { P as PaletteContent, a as PaletteContextValue, b as PaletteField, c as PaletteFooter, d as PaletteItem, e as PaletteList, f as PaletteListProps, g as PaletteRoot, h as PaletteRootProps, i as PaletteRow, j as PaletteSection, k as PaletteTrigger, R as RecentEntry, l as RecentStore, S as SearchPalette, m as SearchPaletteProps, n as createRecentStore, o as groupRows, p as isPaletteShortcut, q as moveActive, r as recentKey, s as shortcutLabel, u as usePaletteContext } from '../index-D-ARvWpQ.js';
|
|
21
|
+
import '../notifications-BpVV6sel.js';
|
|
22
|
+
import '../relative-time-YpRTG7YH.js';
|
|
6
23
|
|
|
7
24
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLElement>>;
|
|
8
25
|
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
2
|
+
export { useInput } from '../chunk-U3V4EHOB.js';
|
|
3
|
+
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
4
|
+
export { Flag } from '../chunk-XNNQRA35.js';
|
|
5
|
+
export { Toaster } from '../chunk-ZCUFYBPB.js';
|
|
6
|
+
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
7
|
+
export { useSearch } from '../chunk-WSB655JB.js';
|
|
8
|
+
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
9
|
+
export { createNotificationQueue, defaultQueue, useNotifications } from '../chunk-QYMUIW5I.js';
|
|
10
|
+
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
11
|
+
import '../chunk-KJINGUQN.js';
|
|
12
|
+
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
13
|
+
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-AU3H5WIY.js';
|
|
14
|
+
import '../chunk-UOSSNUSC.js';
|
|
15
|
+
import '../chunk-2QFTRNAZ.js';
|
|
16
|
+
import '../chunk-SNYUBXWQ.js';
|
|
17
|
+
import '../chunk-IXVMRVD4.js';
|
|
18
|
+
export { Input } from '../chunk-IIT6U7LM.js';
|
|
19
|
+
import '../chunk-F25CGNQC.js';
|
|
20
|
+
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, createRecentStore, groupRows, isPaletteShortcut, moveActive, recentKey, shortcutLabel, usePaletteContext } from '../chunk-LKA2UG4P.js';
|
|
5
21
|
import '../chunk-UZFEEFMF.js';
|
|
22
|
+
import { Button } from '../chunk-6BGBYUSZ.js';
|
|
23
|
+
export { getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
24
|
+
import '../chunk-MMQPZGSU.js';
|
|
25
|
+
export { Slot, mergeSlotProps } from '../chunk-HS3X3XCW.js';
|
|
6
26
|
import { Link } from 'react-router';
|
|
7
27
|
import { forwardRef, createElement } from 'react';
|
|
8
28
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relative time: "3 hours ago", and everything that has to be right around it.
|
|
3
|
+
*
|
|
4
|
+
* The rendering itself is `<relative-time>` (@github/relative-time-element), which already
|
|
5
|
+
* owns the hard parts - Intl.RelativeTimeFormat per locale, and re-rendering on a schedule
|
|
6
|
+
* that gets slower as the date gets older. What is here is the part every wrapper
|
|
7
|
+
* re-implements and usually gets wrong: parsing a timestamp that does not declare its zone,
|
|
8
|
+
* knowing when the date has aged past the relative threshold, and producing an absolute
|
|
9
|
+
* label to show while the element is still loading, or forever if scripting is off.
|
|
10
|
+
*
|
|
11
|
+
* Nothing in this file touches the DOM, so it renders on a server.
|
|
12
|
+
*/
|
|
13
|
+
/** How the element should phrase it. `auto` is relative until the threshold, then a date. */
|
|
14
|
+
type RelativeTimeFormat = "auto" | "relative" | "duration" | "datetime" | "micro" | "elapsed";
|
|
15
|
+
type RelativeTimeTense = "auto" | "past" | "future";
|
|
16
|
+
type RelativeTimePrecision = "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
17
|
+
type RelativeTimeStyle = "long" | "short" | "narrow";
|
|
18
|
+
type NumericStyle = "numeric" | "2-digit";
|
|
19
|
+
interface RelativeTimeOptions {
|
|
20
|
+
format?: RelativeTimeFormat;
|
|
21
|
+
tense?: RelativeTimeTense;
|
|
22
|
+
precision?: RelativeTimePrecision;
|
|
23
|
+
/** ISO 8601 duration. Past this age `auto` stops being relative. Default `P30D`. */
|
|
24
|
+
threshold?: string;
|
|
25
|
+
/** Word before an absolute date, e.g. "on 5 May". Empty string removes it. */
|
|
26
|
+
prefix?: string;
|
|
27
|
+
formatStyle?: RelativeTimeStyle;
|
|
28
|
+
/**
|
|
29
|
+
* BCP 47 tag. Left undefined the element reads the closest `lang` in the document,
|
|
30
|
+
* which is what a translated page wants - hardcoding one is how a Spanish page ends
|
|
31
|
+
* up saying "3 hours ago".
|
|
32
|
+
*/
|
|
33
|
+
locale?: string;
|
|
34
|
+
/** IANA zone for the absolute rendering. Undefined means the reader's own. */
|
|
35
|
+
timeZone?: string;
|
|
36
|
+
second?: NumericStyle;
|
|
37
|
+
minute?: NumericStyle;
|
|
38
|
+
hour?: NumericStyle;
|
|
39
|
+
weekday?: RelativeTimeStyle;
|
|
40
|
+
day?: NumericStyle;
|
|
41
|
+
month?: NumericStyle | "short" | "long" | "narrow";
|
|
42
|
+
year?: NumericStyle;
|
|
43
|
+
timeZoneName?: "long" | "short" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric";
|
|
44
|
+
/** Drop the exact timestamp the element otherwise puts in `title`. */
|
|
45
|
+
noTitle?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Once the date is older than `threshold`, render it as digits (05/05/2026) instead of
|
|
48
|
+
* a prefixed month name. The cutoff is the threshold itself, not a guess at it.
|
|
49
|
+
*/
|
|
50
|
+
numericBeyondThreshold?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** Everything derived from a date, in one pass, for whichever adapter is rendering it. */
|
|
53
|
+
interface RelativeTimeView {
|
|
54
|
+
/** Null when the input could not be parsed - nothing else here is meaningful then. */
|
|
55
|
+
date: Date | null;
|
|
56
|
+
/** `datetime` attribute value: always UTC, always ISO. */
|
|
57
|
+
iso: string;
|
|
58
|
+
/** Absolute text. Shown until the element upgrades, and forever without scripting. */
|
|
59
|
+
label: string;
|
|
60
|
+
/** Full timestamp for `title` / `aria-label`. */
|
|
61
|
+
exact: string;
|
|
62
|
+
/** The date is older (or further ahead) than `threshold`. */
|
|
63
|
+
beyondThreshold: boolean;
|
|
64
|
+
/** Render `label` in a plain `<time>` and skip the element entirely. */
|
|
65
|
+
absoluteOnly: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A timestamp with no zone is UTC.
|
|
69
|
+
*
|
|
70
|
+
* This is the single most common defect in a date column: `2026-08-13 22:41:00` comes back
|
|
71
|
+
* from the database with no offset, `new Date()` reads it as LOCAL time, and every reader
|
|
72
|
+
* east or west of the server sees a time that is hours out - silently, because the wrong
|
|
73
|
+
* time is still a valid one.
|
|
74
|
+
*
|
|
75
|
+
* A date with no clock is left exactly as it is. The spec already reads a bare `YYYY-MM-DD`
|
|
76
|
+
* as UTC, so there is nothing to add - and `YYYY-MM-DDZ` is not in the spec's grammar at
|
|
77
|
+
* all, which drops it into each engine's own legacy parser. That is a portability coin
|
|
78
|
+
* flip on a value that was already correct.
|
|
79
|
+
*/
|
|
80
|
+
declare function ensureZone(text: string): string;
|
|
81
|
+
/** Parse anything a date column or an API hands over. Null rather than an Invalid Date. */
|
|
82
|
+
declare function normalizeDate(value: string | number | Date | null | undefined): Date | null;
|
|
83
|
+
/**
|
|
84
|
+
* ISO 8601 duration to milliseconds, for comparing an age against `threshold`.
|
|
85
|
+
*
|
|
86
|
+
* Years and months are approximated the way the element approximates them, because the
|
|
87
|
+
* threshold is a rough "old enough to stop counting", not an anniversary.
|
|
88
|
+
*/
|
|
89
|
+
declare function parseDuration(value: string): number;
|
|
90
|
+
/**
|
|
91
|
+
* Everything an adapter needs to render one date.
|
|
92
|
+
*
|
|
93
|
+
* `now` is a parameter so a test can pin it, and so a server render can pass the same
|
|
94
|
+
* instant it used elsewhere on the page.
|
|
95
|
+
*/
|
|
96
|
+
declare function relativeTimeView(value: string | number | Date | null | undefined, options?: RelativeTimeOptions, now?: Date): RelativeTimeView;
|
|
97
|
+
/**
|
|
98
|
+
* The element's attributes, kebab-cased, with anything undefined left out.
|
|
99
|
+
*
|
|
100
|
+
* Written as attributes rather than properties because that is the half of a custom
|
|
101
|
+
* element's API that works before it is defined - the markup is already correct when the
|
|
102
|
+
* definition arrives late, or never.
|
|
103
|
+
*/
|
|
104
|
+
declare function relativeTimeAttributes(view: RelativeTimeView, options?: RelativeTimeOptions): Record<string, string>;
|
|
105
|
+
|
|
106
|
+
export { type RelativeTimeFormat as R, type RelativeTimeOptions as a, type RelativeTimePrecision as b, type RelativeTimeStyle as c, type RelativeTimeTense as d, type RelativeTimeView as e, ensureZone as f, relativeTimeView as g, normalizeDate as n, parseDuration as p, relativeTimeAttributes as r };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createSearch } from './chunk-UZFEEFMF.js';
|
|
2
|
+
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
3
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function SearchExtras({
|
|
6
|
+
input,
|
|
7
|
+
items,
|
|
8
|
+
keys,
|
|
9
|
+
delay = 150,
|
|
10
|
+
limit,
|
|
11
|
+
fuse,
|
|
12
|
+
fuseOptions,
|
|
13
|
+
matcher,
|
|
14
|
+
onResults,
|
|
15
|
+
renderResults
|
|
16
|
+
}) {
|
|
17
|
+
const [results, setResults] = useState([]);
|
|
18
|
+
const [query, setQuery] = useState("");
|
|
19
|
+
const listener = useRef(onResults);
|
|
20
|
+
listener.current = onResults;
|
|
21
|
+
const instance = useMemo(() => createSearch({
|
|
22
|
+
items,
|
|
23
|
+
keys,
|
|
24
|
+
fuse,
|
|
25
|
+
fuseOptions,
|
|
26
|
+
matcher,
|
|
27
|
+
debounce: delay,
|
|
28
|
+
limit,
|
|
29
|
+
onResults: (next, nextQuery) => {
|
|
30
|
+
setResults(next);
|
|
31
|
+
setQuery(nextQuery);
|
|
32
|
+
listener.current?.(next, nextQuery);
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}), []);
|
|
36
|
+
useEffect(() => () => instance.destroy(), [instance]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
instance.setItems(items ?? []);
|
|
39
|
+
}, [instance, items]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
instance.update({ keys, fuse, fuseOptions, matcher, debounce: delay, limit });
|
|
42
|
+
}, [instance, keys, fuse, fuseOptions, matcher, delay, limit]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!input) return;
|
|
45
|
+
return instance.attach(input);
|
|
46
|
+
}, [instance, input]);
|
|
47
|
+
return renderResults ? /* @__PURE__ */ jsx(Fragment, { children: renderResults(results, query) }) : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { SearchExtras };
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Headless components: the behaviour, the timing and the accessibility, with no styles of their own. Framework-agnostic core plus thin adapters.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"*.css"
|
|
8
|
+
],
|
|
6
9
|
"main": "./dist/index.js",
|
|
7
10
|
"types": "./dist/index.d.ts",
|
|
8
11
|
"exports": {
|
|
@@ -14,6 +17,50 @@
|
|
|
14
17
|
"types": "./dist/react/index.d.ts",
|
|
15
18
|
"import": "./dist/react/index.js"
|
|
16
19
|
},
|
|
20
|
+
"./react/input": {
|
|
21
|
+
"types": "./dist/react/input.d.ts",
|
|
22
|
+
"import": "./dist/react/input.js"
|
|
23
|
+
},
|
|
24
|
+
"./react/palette": {
|
|
25
|
+
"types": "./dist/react/palette.d.ts",
|
|
26
|
+
"import": "./dist/react/palette.js"
|
|
27
|
+
},
|
|
28
|
+
"./react/button": {
|
|
29
|
+
"types": "./dist/react/button.d.ts",
|
|
30
|
+
"import": "./dist/react/button.js"
|
|
31
|
+
},
|
|
32
|
+
"./react/flag": {
|
|
33
|
+
"types": "./dist/react/flag.d.ts",
|
|
34
|
+
"import": "./dist/react/flag.js"
|
|
35
|
+
},
|
|
36
|
+
"./react/toast": {
|
|
37
|
+
"types": "./dist/react/toast.d.ts",
|
|
38
|
+
"import": "./dist/react/toast.js"
|
|
39
|
+
},
|
|
40
|
+
"./react/marquee": {
|
|
41
|
+
"types": "./dist/react/marquee.d.ts",
|
|
42
|
+
"import": "./dist/react/marquee.js"
|
|
43
|
+
},
|
|
44
|
+
"./react/search": {
|
|
45
|
+
"types": "./dist/react/search.d.ts",
|
|
46
|
+
"import": "./dist/react/search.js"
|
|
47
|
+
},
|
|
48
|
+
"./react/network": {
|
|
49
|
+
"types": "./dist/react/network.d.ts",
|
|
50
|
+
"import": "./dist/react/network.js"
|
|
51
|
+
},
|
|
52
|
+
"./react/notifications": {
|
|
53
|
+
"types": "./dist/react/notifications.d.ts",
|
|
54
|
+
"import": "./dist/react/notifications.js"
|
|
55
|
+
},
|
|
56
|
+
"./react/relative-time": {
|
|
57
|
+
"types": "./dist/react/relative-time.d.ts",
|
|
58
|
+
"import": "./dist/react/relative-time.js"
|
|
59
|
+
},
|
|
60
|
+
"./react/slot": {
|
|
61
|
+
"types": "./dist/react/slot.d.ts",
|
|
62
|
+
"import": "./dist/react/slot.js"
|
|
63
|
+
},
|
|
17
64
|
"./registry.json": "./registry.json",
|
|
18
65
|
"./search": {
|
|
19
66
|
"types": "./dist/search/index.d.ts",
|
|
@@ -51,6 +98,7 @@
|
|
|
51
98
|
],
|
|
52
99
|
"peerDependencies": {
|
|
53
100
|
"@github/relative-time-element": ">=4",
|
|
101
|
+
"react-dom": ">=18",
|
|
54
102
|
"fuse.js": ">=6",
|
|
55
103
|
"next": ">=13",
|
|
56
104
|
"react": ">=18",
|
|
@@ -60,6 +108,9 @@
|
|
|
60
108
|
"react": {
|
|
61
109
|
"optional": true
|
|
62
110
|
},
|
|
111
|
+
"react-dom": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
63
114
|
"fuse.js": {
|
|
64
115
|
"optional": true
|
|
65
116
|
},
|
|
@@ -92,7 +143,6 @@
|
|
|
92
143
|
"keywords": [
|
|
93
144
|
"carousel",
|
|
94
145
|
"enigma",
|
|
95
|
-
"flag-icons",
|
|
96
146
|
"flags",
|
|
97
147
|
"fuse",
|
|
98
148
|
"headless",
|
package/registry.json
CHANGED
|
@@ -155,8 +155,8 @@
|
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"name": "input",
|
|
158
|
-
"title": "Input,
|
|
159
|
-
"description": "A field you pass props to,
|
|
158
|
+
"title": "Input, one field for every type",
|
|
159
|
+
"description": "A field you pass props to, typed by its `type`: password gets the reveal toggle, a generator, a strength meter and a breach check; search gets debouncing, ranking and a clear button; everything else is a plain field with native props. What each type needs is loaded when that type is used, so a form of text fields ships none of it.",
|
|
160
160
|
"targets": [
|
|
161
161
|
"vanilla",
|
|
162
162
|
"astro",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"entry": {
|
|
166
166
|
"vanilla": "@enigmax/primitives",
|
|
167
167
|
"astro": "@enigmax/primitives",
|
|
168
|
-
"react": "@enigmax/primitives/react"
|
|
168
|
+
"react": "@enigmax/primitives/react/input"
|
|
169
169
|
},
|
|
170
170
|
"exports": {
|
|
171
171
|
"vanilla": [
|
|
@@ -181,17 +181,28 @@
|
|
|
181
181
|
},
|
|
182
182
|
"files": [
|
|
183
183
|
{
|
|
184
|
-
"path": "src/core/input.ts",
|
|
185
|
-
"dest": "input/input.ts",
|
|
184
|
+
"path": "src/core/input-icons.ts",
|
|
185
|
+
"dest": "input/input-icons.ts",
|
|
186
186
|
"targets": [
|
|
187
187
|
"vanilla",
|
|
188
188
|
"astro",
|
|
189
189
|
"react"
|
|
190
190
|
]
|
|
191
191
|
},
|
|
192
|
+
{
|
|
193
|
+
"path": "src/core/input.ts",
|
|
194
|
+
"dest": "input/input.ts",
|
|
195
|
+
"targets": [
|
|
196
|
+
"vanilla",
|
|
197
|
+
"astro"
|
|
198
|
+
],
|
|
199
|
+
"rewrite": {
|
|
200
|
+
"@/core/input-icons": "./input-icons"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
192
203
|
{
|
|
193
204
|
"path": "src/core/password.ts",
|
|
194
|
-
"dest": "input/password.ts",
|
|
205
|
+
"dest": "input/password-core.ts",
|
|
195
206
|
"targets": [
|
|
196
207
|
"vanilla",
|
|
197
208
|
"astro",
|
|
@@ -199,13 +210,56 @@
|
|
|
199
210
|
]
|
|
200
211
|
},
|
|
201
212
|
{
|
|
202
|
-
"path": "src/
|
|
203
|
-
"dest": "input/
|
|
213
|
+
"path": "src/core/search.ts",
|
|
214
|
+
"dest": "input/search-core.ts",
|
|
215
|
+
"targets": [
|
|
216
|
+
"react"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"path": "src/react/input/types.ts",
|
|
221
|
+
"dest": "input/types.ts",
|
|
222
|
+
"targets": [
|
|
223
|
+
"react"
|
|
224
|
+
],
|
|
225
|
+
"rewrite": {
|
|
226
|
+
"@/core/search": "./search-core",
|
|
227
|
+
"@/core/password": "./password-core"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"path": "src/react/input/icon.tsx",
|
|
232
|
+
"dest": "input/icon.tsx",
|
|
233
|
+
"targets": [
|
|
234
|
+
"react"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"path": "src/react/input/write-value.ts",
|
|
239
|
+
"dest": "input/write-value.ts",
|
|
240
|
+
"targets": [
|
|
241
|
+
"react"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"path": "src/react/input/password.tsx",
|
|
246
|
+
"dest": "input/password.tsx",
|
|
204
247
|
"targets": [
|
|
205
248
|
"react"
|
|
206
249
|
],
|
|
207
250
|
"rewrite": {
|
|
208
|
-
"@/core/
|
|
251
|
+
"@/core/password": "./password-core",
|
|
252
|
+
"@/react/input/types": "./types"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"path": "src/react/input/search.tsx",
|
|
257
|
+
"dest": "input/search.tsx",
|
|
258
|
+
"targets": [
|
|
259
|
+
"react"
|
|
260
|
+
],
|
|
261
|
+
"rewrite": {
|
|
262
|
+
"@/core/search": "./search-core"
|
|
209
263
|
}
|
|
210
264
|
},
|
|
211
265
|
{
|
|
@@ -219,15 +273,20 @@
|
|
|
219
273
|
"style": "css"
|
|
220
274
|
},
|
|
221
275
|
{
|
|
222
|
-
"path": "src/react/input.tsx",
|
|
276
|
+
"path": "src/react/input/index.tsx",
|
|
223
277
|
"dest": "input/index.tsx",
|
|
224
278
|
"main": true,
|
|
225
279
|
"targets": [
|
|
226
280
|
"react"
|
|
227
281
|
],
|
|
228
282
|
"rewrite": {
|
|
229
|
-
"@/
|
|
230
|
-
"@/
|
|
283
|
+
"@/react/input/icon": "./icon",
|
|
284
|
+
"@/react/input/write-value": "./write-value",
|
|
285
|
+
"@/core/input-icons": "./input-icons",
|
|
286
|
+
"@/react/input/types": "./types",
|
|
287
|
+
"@/react/input/password": "./password",
|
|
288
|
+
"@/react/input/search": "./search",
|
|
289
|
+
"@/core/password": "./password-core"
|
|
231
290
|
}
|
|
232
291
|
},
|
|
233
292
|
{
|
|
@@ -262,7 +321,8 @@
|
|
|
262
321
|
"[data-enigma-password-strength-segment]",
|
|
263
322
|
"[data-enigma-password-strength-segment][data-filled]",
|
|
264
323
|
"[data-enigma-password-strength-label]",
|
|
265
|
-
"[data-enigma-password-strength-warning]"
|
|
324
|
+
"[data-enigma-password-strength-warning]",
|
|
325
|
+
"[data-enigma-input-action=clear]"
|
|
266
326
|
],
|
|
267
327
|
"docs": "docs/notes/primitives.md#input",
|
|
268
328
|
"recipes": [
|
|
@@ -273,7 +333,7 @@
|
|
|
273
333
|
{
|
|
274
334
|
"name": "search",
|
|
275
335
|
"title": "Search as you type",
|
|
276
|
-
"description": "
|
|
336
|
+
"description": "The engine behind `<Input type=\"search\">` and the palette: debouncing, ranking and cancellation, fuzzy with Fuse.js or a built-in accent-insensitive substring matcher with no dependency at all.",
|
|
277
337
|
"targets": [
|
|
278
338
|
"vanilla",
|
|
279
339
|
"astro",
|
|
@@ -282,7 +342,7 @@
|
|
|
282
342
|
"entry": {
|
|
283
343
|
"vanilla": "@enigmax/primitives/search",
|
|
284
344
|
"astro": "@enigmax/primitives/search",
|
|
285
|
-
"react": "@enigmax/primitives/react"
|
|
345
|
+
"react": "@enigmax/primitives/react/search"
|
|
286
346
|
},
|
|
287
347
|
"exports": {
|
|
288
348
|
"vanilla": [
|
|
@@ -413,14 +473,111 @@
|
|
|
413
473
|
"[data-loading]",
|
|
414
474
|
"[data-cooldown]",
|
|
415
475
|
"[aria-disabled=true]",
|
|
416
|
-
"[aria-busy=true]"
|
|
476
|
+
"[aria-busy=true]",
|
|
477
|
+
"[data-enigma-button-key]"
|
|
417
478
|
],
|
|
418
479
|
"docs": "docs/notes/primitives.md#button"
|
|
419
480
|
},
|
|
481
|
+
{
|
|
482
|
+
"name": "palette",
|
|
483
|
+
"title": "Command palette",
|
|
484
|
+
"description": "Ctrl/Cmd+K, search as you type, what was searched before, groups, and every key a palette is expected to answer to. A dialog made of parts you can compose or take whole, with the focus trap, the scroll lock and the listbox wiring already right.",
|
|
485
|
+
"targets": [
|
|
486
|
+
"react"
|
|
487
|
+
],
|
|
488
|
+
"entry": {
|
|
489
|
+
"react": "@enigmax/primitives/react/palette"
|
|
490
|
+
},
|
|
491
|
+
"exports": {
|
|
492
|
+
"react": [
|
|
493
|
+
"SearchPalette"
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
"files": [
|
|
497
|
+
{
|
|
498
|
+
"path": "src/core/palette.ts",
|
|
499
|
+
"dest": "palette/palette.ts",
|
|
500
|
+
"targets": [
|
|
501
|
+
"react"
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"path": "src/core/search.ts",
|
|
506
|
+
"dest": "palette/search-core.ts",
|
|
507
|
+
"targets": [
|
|
508
|
+
"react"
|
|
509
|
+
]
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"path": "src/react/slot.tsx",
|
|
513
|
+
"dest": "palette/slot.tsx",
|
|
514
|
+
"targets": [
|
|
515
|
+
"react"
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"path": "src/react/palette/context.ts",
|
|
520
|
+
"dest": "palette/context.ts",
|
|
521
|
+
"targets": [
|
|
522
|
+
"react"
|
|
523
|
+
],
|
|
524
|
+
"rewrite": {
|
|
525
|
+
"@/core/palette": "./palette",
|
|
526
|
+
"@/core/search": "./search-core"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"path": "src/react/palette/root.tsx",
|
|
531
|
+
"dest": "palette/root.tsx",
|
|
532
|
+
"targets": [
|
|
533
|
+
"react"
|
|
534
|
+
],
|
|
535
|
+
"rewrite": {
|
|
536
|
+
"@/core/palette": "./palette",
|
|
537
|
+
"@/core/search": "./search-core",
|
|
538
|
+
"@/react/slot": "./slot",
|
|
539
|
+
"@/react/palette/context": "./context"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"path": "src/react/palette/index.tsx",
|
|
544
|
+
"dest": "palette/index.tsx",
|
|
545
|
+
"main": true,
|
|
546
|
+
"targets": [
|
|
547
|
+
"react"
|
|
548
|
+
],
|
|
549
|
+
"rewrite": {
|
|
550
|
+
"@/react/palette/root": "./root",
|
|
551
|
+
"@/react/palette/context": "./context"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
],
|
|
555
|
+
"styles": false,
|
|
556
|
+
"themeHooks": [
|
|
557
|
+
"[data-enigma-palette-trigger]",
|
|
558
|
+
"[data-enigma-palette-trigger-key]",
|
|
559
|
+
"[data-enigma-palette-overlay]",
|
|
560
|
+
"[data-enigma-palette-content]",
|
|
561
|
+
"[data-enigma-palette-title]",
|
|
562
|
+
"[data-enigma-palette-field]",
|
|
563
|
+
"[data-enigma-palette-list]",
|
|
564
|
+
"[data-enigma-palette-group]",
|
|
565
|
+
"[data-enigma-palette-group-label]",
|
|
566
|
+
"[data-enigma-palette-item]",
|
|
567
|
+
"[data-enigma-palette-item][data-active=true]",
|
|
568
|
+
"[data-enigma-palette-item][data-kind=recent]",
|
|
569
|
+
"[data-enigma-palette-item-label]",
|
|
570
|
+
"[data-enigma-palette-item-description]",
|
|
571
|
+
"[data-enigma-palette-empty]",
|
|
572
|
+
"[data-enigma-palette-footer]",
|
|
573
|
+
"[data-enigma-palette-hint]"
|
|
574
|
+
],
|
|
575
|
+
"docs": "docs/notes/primitives.md#palette"
|
|
576
|
+
},
|
|
420
577
|
{
|
|
421
578
|
"name": "flags",
|
|
422
579
|
"title": "Country flags",
|
|
423
|
-
"description": "A flag as an image,
|
|
580
|
+
"description": "A flag as an image, served by enigma or from files in your project, rectangular, square or round. It names itself in the reader's language, and accepts the emoji flag it replaces as its code - Windows ships no glyph for those, so a picker built out of emoji renders as bare letters for most desktop readers.",
|
|
424
581
|
"targets": [
|
|
425
582
|
"vanilla",
|
|
426
583
|
"astro",
|
|
@@ -429,7 +586,7 @@
|
|
|
429
586
|
"entry": {
|
|
430
587
|
"vanilla": "@enigmax/primitives",
|
|
431
588
|
"astro": "@enigmax/primitives",
|
|
432
|
-
"react": "@enigmax/primitives/react"
|
|
589
|
+
"react": "@enigmax/primitives/react/flag"
|
|
433
590
|
},
|
|
434
591
|
"exports": {
|
|
435
592
|
"vanilla": [
|