@ksojecki/purpose-ui 0.3.2 → 0.4.0-next.20261201202812
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/README.md +4 -0
- package/dist/actions/index.js +3 -40
- package/dist/actions-muI1GKgz.js +40 -0
- package/dist/css-C1oojmN3.js +602 -0
- package/dist/feedback/index.js +1 -1
- package/dist/forms/ColorInput.d.ts +33 -0
- package/dist/forms/FileInput.d.ts +25 -5
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +464 -146
- package/dist/hex-BZsMkL37.js +10 -0
- package/dist/internal/FileDropContent.d.ts +15 -0
- package/dist/internal/fileAccept.d.ts +5 -0
- package/dist/internal/fileSize.d.ts +2 -0
- package/dist/internal/hex.d.ts +4 -0
- package/dist/internal/theme-generator/cli.d.ts +16 -0
- package/dist/internal/theme-generator/color.d.ts +13 -0
- package/dist/internal/theme-generator/config.d.ts +51 -0
- package/dist/internal/theme-generator/contrast.d.ts +18 -0
- package/dist/internal/theme-generator/css.d.ts +7 -0
- package/dist/internal/theme-generator/derive.d.ts +20 -0
- package/dist/internal/theme-generator/roles.d.ts +10 -0
- package/dist/internal/theme-generator/tokens.d.ts +7 -0
- package/dist/internal/useFileDrop.d.ts +23 -0
- package/dist/internal/useFileSelection.d.ts +10 -0
- package/dist/internal/useHexDraft.d.ts +12 -0
- package/dist/internal/useInputNode.d.ts +3 -0
- package/dist/theme-generator/cli.d.ts +2 -0
- package/dist/theme-generator/cli.js +128 -0
- package/dist/theme-generator/index.d.ts +9 -0
- package/dist/theme-generator/index.js +3 -0
- package/package.json +15 -4
- package/theme-config.schema.json +124 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ControlSize } from './Field';
|
|
2
|
+
export interface ColorInputProps {
|
|
3
|
+
/** Visible label. Omit it and pass `aria-label` for a bare control. */
|
|
4
|
+
label?: string;
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
/** Current colour as hex (`#rrggbb`). */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Called with a lowercase `#rrggbb` whenever either control holds a valid colour. */
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
/** @default 'md' */
|
|
13
|
+
controlSize?: ControlSize;
|
|
14
|
+
/**
|
|
15
|
+
* Stretches to the container width.
|
|
16
|
+
*
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
id?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A colour swatch that opens the platform picker, paired with a hex text field. Accepts `#rgb` and `#rrggbb`
|
|
26
|
+
* with or without `#`; while the text is not a colour the field is marked invalid and `onChange` is not called.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <ColorInput label="Primary" onChange={setPrimary} value={primary} />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function ColorInput({ label, 'aria-label': ariaLabel, hint, error, value, onChange, controlSize, fullWidth, disabled, id, className, }: ColorInputProps): import("react").JSX.Element;
|
|
@@ -4,7 +4,11 @@ export interface FileInputProps extends Omit<ComponentPropsWithRef<'input'>, 'si
|
|
|
4
4
|
label?: string;
|
|
5
5
|
hint?: string;
|
|
6
6
|
error?: string;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* `xs` and `sm` draw a compact one-row zone; `md` and `lg` a taller zone with the content stacked.
|
|
9
|
+
*
|
|
10
|
+
* @default 'md'
|
|
11
|
+
*/
|
|
8
12
|
controlSize?: ControlSize;
|
|
9
13
|
/**
|
|
10
14
|
* Stretches to the container width.
|
|
@@ -12,14 +16,30 @@ export interface FileInputProps extends Omit<ComponentPropsWithRef<'input'>, 'si
|
|
|
12
16
|
* @default true
|
|
13
17
|
*/
|
|
14
18
|
fullWidth?: boolean;
|
|
19
|
+
/** Prompt in the drop zone. Defaults to "Drag and drop a file here" ("…files here" with `multiple`). */
|
|
20
|
+
dropText?: string;
|
|
21
|
+
/** Text of the picker action. Defaults to "Choose file" ("Choose files" with `multiple`). */
|
|
22
|
+
browseText?: string;
|
|
23
|
+
/** Accessible name of the remove button. Defaults to "Remove file" ("Remove files" with `multiple`). */
|
|
24
|
+
removeLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Error shown after a drop of a file that doesn't match `accept`, unless `error` is set.
|
|
27
|
+
*
|
|
28
|
+
* @default "This file type isn't accepted."
|
|
29
|
+
*/
|
|
30
|
+
rejectText?: string;
|
|
31
|
+
/** Called with the dropped files that don't match `accept`; nothing is selected then. */
|
|
32
|
+
onReject?: (files: File[]) => void;
|
|
15
33
|
}
|
|
16
34
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
35
|
+
* Drop zone with a file picker. Clicking it, or Enter and Space on it, opens the picker; dropped files are
|
|
36
|
+
* selected too, after a check against `accept`. The selected files are listed with a remove button.
|
|
37
|
+
* It stays a native file input: `onChange` gets the native event and `event.currentTarget.files`.
|
|
38
|
+
* Pass `label` to get a labelled Field; omit it for the bare control.
|
|
19
39
|
*
|
|
20
40
|
* @example
|
|
21
41
|
* ```tsx
|
|
22
|
-
* <FileInput accept="
|
|
42
|
+
* <FileInput accept=".csv,text/csv" hint="CSV up to 5 MB." label="Statement" onChange={pick} />
|
|
23
43
|
* ```
|
|
24
44
|
*/
|
|
25
|
-
export declare function FileInput({ label, hint, error, controlSize, fullWidth,
|
|
45
|
+
export declare function FileInput({ label, hint, error, controlSize, fullWidth, rejectText, id, 'aria-describedby': callerDescribedBy, ...props }: FileInputProps): import("react").JSX.Element;
|
package/dist/forms/index.d.ts
CHANGED