@agentero/design-system 0.35.0 → 0.36.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/mcp/manifests/components.html +621 -106
- package/mcp/manifests/components.json +447 -1
- package/package.json +8 -2
- package/src/input/context.d.ts +11 -2
- package/src/input/index.d.ts +1 -0
- package/src/input-number/index.d.ts +2 -0
- package/src/input-number/index.js +2 -0
- package/src/input-number/input-number.d.ts +82 -0
- package/src/input-number/input-number.js +33 -0
- package/src/input-search/constants.d.ts +7 -0
- package/src/input-search/constants.js +4 -0
- package/src/input-search/debounced-input-search.d.ts +56 -0
- package/src/input-search/debounced-input-search.js +27 -0
- package/src/input-search/index.d.ts +3 -0
- package/src/input-search/index.js +4 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { InputContext as e, useInputContext as t } from "../input/context.js";
|
|
3
|
+
import { Input as n } from "../input/input.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { NumericFormat as i } from "react-number-format";
|
|
6
|
+
//#region src/input-number/input-number.tsx
|
|
7
|
+
var a = (t) => /* @__PURE__ */ r(e, {
|
|
8
|
+
value: null,
|
|
9
|
+
children: /* @__PURE__ */ r(n, {
|
|
10
|
+
"data-slot": "input-number",
|
|
11
|
+
...t
|
|
12
|
+
})
|
|
13
|
+
}), o = (e) => {
|
|
14
|
+
let { ref: n, maxNumber: o, thousandSeparator: s = !1, allowLeadingZeros: c = !0, onChange: l, ...u } = t(e);
|
|
15
|
+
return /* @__PURE__ */ r(i, {
|
|
16
|
+
...u,
|
|
17
|
+
customInput: a,
|
|
18
|
+
getInputRef: n,
|
|
19
|
+
thousandSeparator: s,
|
|
20
|
+
allowLeadingZeros: c,
|
|
21
|
+
allowNegative: !1,
|
|
22
|
+
onChange: l,
|
|
23
|
+
onValueChange: ({ formattedValue: e }, { event: t, source: n }) => {
|
|
24
|
+
if (n !== "event" || t?.type !== "blur") return;
|
|
25
|
+
let r = t.target;
|
|
26
|
+
r.value = e, l?.(Object.assign(Object.create(t), t, { type: "change" }));
|
|
27
|
+
},
|
|
28
|
+
isAllowed: ({ floatValue: e }) => o === void 0 || e === void 0 || e <= o
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
o.displayName = "InputNumber";
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as InputNumber };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { InputSearchProps } from './input-search';
|
|
3
|
+
export type DebouncedInputSearchProps = Omit<InputSearchProps, 'value' | 'defaultValue' | 'onChange'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The query the page is filtering by. The field shows it, and follows it
|
|
6
|
+
* when it changes from outside (a reset button, a saved filter, navigation),
|
|
7
|
+
* unless the user is in the middle of typing: then what they typed stays,
|
|
8
|
+
* and `onChange` reports it once they pause.
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* Fires once the user has stopped typing for `DEBOUNCE_TIME` milliseconds,
|
|
13
|
+
* with the change event of the last keystroke; clearing the field goes
|
|
14
|
+
* through the same delay. A pending call fires at once when the user
|
|
15
|
+
* presses Enter, and is dropped when the field unmounts, so a page that is
|
|
16
|
+
* navigating away is not sent back. Read the text from `event.target.value`, which is
|
|
17
|
+
* what the field shows at that moment. `event.currentTarget` is no longer
|
|
18
|
+
* set by then, since the event is delivered after the browser's dispatch.
|
|
19
|
+
*/
|
|
20
|
+
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* DebouncedInputSearch is an [InputSearch](?path=/docs/components-inputsearch--docs)
|
|
24
|
+
* for filters that are expensive to run: a table query, a request to the
|
|
25
|
+
* server. Keystrokes show up in the field at once, but `onChange` fires only
|
|
26
|
+
* once the user pauses for `DEBOUNCE_TIME` (300ms), with the last change
|
|
27
|
+
* event, so the page runs one search per pause instead of one per key. It is
|
|
28
|
+
* always controlled: `value` and `onChange` are required, the page owns the
|
|
29
|
+
* query, and the field follows a `value` changed from outside while the user
|
|
30
|
+
* is not typing.
|
|
31
|
+
*
|
|
32
|
+
* Every other prop goes to the InputSearch and from there to the `<input>`:
|
|
33
|
+
* the `ref`, `size`, `isLoading`, `placeholder`, `aria-*` and every other
|
|
34
|
+
* standard attribute. Only `type` is not accepted. `className` styles the
|
|
35
|
+
* frame.
|
|
36
|
+
*
|
|
37
|
+
* Do not use it where every keystroke matters, such as filtering a short list
|
|
38
|
+
* already in memory; that is a plain
|
|
39
|
+
* [InputSearch](?path=/docs/components-inputsearch--docs). To pick a value from
|
|
40
|
+
* the results, use [Combobox](?path=/docs/components-combobox--docs).
|
|
41
|
+
*
|
|
42
|
+
* @summary Search input that reports the query once the user pauses typing
|
|
43
|
+
* @dataAttribute {string} data-slot - Always set to "input-search" on the frame
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <DebouncedInputSearch
|
|
47
|
+
* aria-label="Search agencies"
|
|
48
|
+
* value={filters.query}
|
|
49
|
+
* onChange={event => setFilters({ ...filters, query: event.target.value })}
|
|
50
|
+
* isLoading={isFetching}
|
|
51
|
+
* />
|
|
52
|
+
*/
|
|
53
|
+
export declare const DebouncedInputSearch: {
|
|
54
|
+
({ value, onChange, onKeyDown, ...props }: DebouncedInputSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { chain as e } from "../../lib/merge-props.js";
|
|
3
|
+
import "./constants.js";
|
|
4
|
+
import { InputSearch as t } from "./input-search.js";
|
|
5
|
+
import { useState as n } from "react";
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
import { useDebouncedCallback as i } from "use-debounce";
|
|
8
|
+
//#region src/input-search/debounced-input-search.tsx
|
|
9
|
+
var a = ({ value: a, onChange: o, onKeyDown: s, ...c }) => {
|
|
10
|
+
let [l, u] = n(a), [d, f] = n(a), p = i(o, 300);
|
|
11
|
+
a !== d && (f(a), p.isPending() || u(a));
|
|
12
|
+
let m = (e) => {
|
|
13
|
+
u(e.target.value), p(e);
|
|
14
|
+
}, h = (e) => {
|
|
15
|
+
let t = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
16
|
+
e.key === "Enter" && !t && p.flush();
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ r(t, {
|
|
19
|
+
...c,
|
|
20
|
+
value: l,
|
|
21
|
+
onChange: m,
|
|
22
|
+
onKeyDown: e(h, s)
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
a.displayName = "DebouncedInputSearch";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { a as DebouncedInputSearch };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export { DEBOUNCE_TIME } from './constants';
|
|
2
|
+
export { DebouncedInputSearch } from './debounced-input-search';
|
|
3
|
+
export type { DebouncedInputSearchProps } from './debounced-input-search';
|
|
1
4
|
export { InputSearch, inputSearchRecipe } from './input-search';
|
|
2
5
|
export type { InputSearchProps } from './input-search';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DEBOUNCE_TIME as e } from "./constants.js";
|
|
2
|
+
import { InputSearch as t, inputSearchRecipe as n } from "./input-search.js";
|
|
3
|
+
import { DebouncedInputSearch as r } from "./debounced-input-search.js";
|
|
4
|
+
export { e as DEBOUNCE_TIME, r as DebouncedInputSearch, t as InputSearch, n as inputSearchRecipe };
|