@charcuterie/ui 3.29.0 → 3.29.1
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/SearchInput/SearchInput.d.ts +3 -1
- package/dist/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/SearchInput/SearchInput.js +0 -1
- package/dist/SearchInput/SearchInput.js.map +1 -1
- package/package.json +1 -1
- package/src/SearchInput/SearchInput.mdx +3 -0
- package/src/SearchInput/SearchInput.stories.tsx +2 -2
- package/src/SearchInput/SearchInput.tsx +5 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ControlSize } from "@charcuterie/tokens";
|
|
2
2
|
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
3
|
+
export type SearchInputSize = Exclude<ControlSize, "sm">;
|
|
3
4
|
export type SearchInputProps = Omit<ComponentPropsWithRef<"input">, "size" | "type"> & {
|
|
4
5
|
/** The app-owned glyph inside the clear button. */
|
|
5
6
|
clearIcon: ReactNode;
|
|
@@ -7,7 +8,8 @@ export type SearchInputProps = Omit<ComponentPropsWithRef<"input">, "size" | "ty
|
|
|
7
8
|
/** Override value-derived visibility for an uncontrolled input. */
|
|
8
9
|
isClearVisible?: boolean;
|
|
9
10
|
onClear: () => void;
|
|
10
|
-
size
|
|
11
|
+
/** Search and clear targets are never smaller than the medium control size. */
|
|
12
|
+
size?: SearchInputSize;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* A search field whose clear affordance is a real, labelled icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;AASd,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;AAOxD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,qBAAqB,CAAC,OAAO,CAAC,EAC9B,MAAM,GAAG,MAAM,CAChB,GAAG;IACF,mDAAmD;IACnD,SAAS,EAAE,SAAS,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mEAAmE;IACnE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,eAAe,CAAA;CACvB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,8GAWzB,gBAAgB,KAAG,SAmDrB,CAAA"}
|
|
@@ -4,7 +4,6 @@ import { IconButton } from "../IconButton/IconButton.js";
|
|
|
4
4
|
import { DISABLED_CLASS, FOCUS_RING_CLASS, } from "../intentStyles.js";
|
|
5
5
|
import { toClassName } from "../toClassName.js";
|
|
6
6
|
const INPUT_SIZE_CLASS = {
|
|
7
|
-
sm: "h-(--control-height-sm) ps-(--control-padding-inline-sm) pe-(--control-height-sm) text-sm",
|
|
8
7
|
md: "h-(--control-height-md) ps-(--control-padding-inline-md) pe-(--control-height-md) text-md",
|
|
9
8
|
lg: "h-(--control-height-lg) ps-(--control-padding-inline-lg) pe-(--control-height-lg) text-lg",
|
|
10
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":";AACA,OAAO,EAGL,MAAM,GACP,MAAM,OAAO,CA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EAAE,WAAW,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAEnD,mBACM,UAAU,EACd,SAAS,EAAE,WAAW,CACpB,+TAA+T,EAC/T,gBAAgB,CAAC,IAAI,CAAC,EACtB,gBAAgB,EAChB,cAAc,CACf,EACD,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,KAAK,GACZ,EAED,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAClC,eAAM,SAAS,EAAC,4CAA4C,YAC1D,KAAC,UAAU,IACT,UAAU,EAAC,OAAO,EAClB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,EAAE,CAAA;wBACT,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAA;oBAC3B,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CACvB,KAAK,CAAC,cAAc,EAAE,EAExB,IAAI,EAAE,IAAI,YAET,SAAS,GACC,GACR,CACR,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -9,6 +9,9 @@ The search field with a labelled icon button for clearing its value. The app sup
|
|
|
9
9
|
glyph and owns the query. The component owns the field skin, the full control-sized target,
|
|
10
10
|
the native cancel-widget suppression, and focus return after a clear.
|
|
11
11
|
|
|
12
|
+
Search fields accept medium and large sizes. They do not offer the small control variant,
|
|
13
|
+
because the clear button is a primary pointer target rather than a compact toolbar action.
|
|
14
|
+
|
|
12
15
|
Use `Field` for a visible label, or pass `aria-label` when the surrounding layout already
|
|
13
16
|
names the search.
|
|
14
17
|
|
|
@@ -25,7 +25,7 @@ const ClearIcon = () => (
|
|
|
25
25
|
const ControlledSearch = ({
|
|
26
26
|
size = "md",
|
|
27
27
|
}: {
|
|
28
|
-
size?: "
|
|
28
|
+
size?: "md" | "lg"
|
|
29
29
|
}) => {
|
|
30
30
|
const [value, setValue] = useState("filter paper")
|
|
31
31
|
|
|
@@ -69,7 +69,7 @@ export const AllVariants: Story = {
|
|
|
69
69
|
render: () => (
|
|
70
70
|
<StorySection title="The field and its clear button share one density-aware control size.">
|
|
71
71
|
<StoryGrid columns={3}>
|
|
72
|
-
{(["
|
|
72
|
+
{(["md", "lg"] as const).map((size) => (
|
|
73
73
|
<StoryCell key={size} label={size}>
|
|
74
74
|
<ControlledSearch size={size} />
|
|
75
75
|
</StoryCell>
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
} from "../intentStyles.ts"
|
|
13
13
|
import { toClassName } from "../toClassName.ts"
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export type SearchInputSize = Exclude<ControlSize, "sm">
|
|
16
|
+
|
|
17
|
+
const INPUT_SIZE_CLASS: Record<SearchInputSize, string> = {
|
|
17
18
|
md: "h-(--control-height-md) ps-(--control-padding-inline-md) pe-(--control-height-md) text-md",
|
|
18
19
|
lg: "h-(--control-height-lg) ps-(--control-padding-inline-lg) pe-(--control-height-lg) text-lg",
|
|
19
20
|
}
|
|
@@ -28,7 +29,8 @@ export type SearchInputProps = Omit<
|
|
|
28
29
|
/** Override value-derived visibility for an uncontrolled input. */
|
|
29
30
|
isClearVisible?: boolean
|
|
30
31
|
onClear: () => void
|
|
31
|
-
size
|
|
32
|
+
/** Search and clear targets are never smaller than the medium control size. */
|
|
33
|
+
size?: SearchInputSize
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/**
|