@opencxh/ui-kit 3.141.0 → 3.145.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.
@@ -2,6 +2,11 @@ import { default as React } from 'react';
2
2
  export interface SegmentedOption<T extends string> {
3
3
  value: T;
4
4
  label: React.ReactNode;
5
+ /**
6
+ * Accessible name and tooltip, for a segment whose label is an icon. Without
7
+ * it an icon-only segment announces as an empty tab.
8
+ */
9
+ title?: string;
5
10
  }
6
11
  export interface SegmentedToggleProps<T extends string> {
7
12
  options: SegmentedOption<T>[];
@@ -13,6 +13,7 @@ export { Link, type LinkProps } from './action/Link';
13
13
  export { SegmentedToggle, type SegmentedOption, type SegmentedToggleProps } from './action/SegmentedToggle';
14
14
  export { SplitButton, type SplitButtonOption, type SplitButtonProps } from './action/SplitButton';
15
15
  export { Checkbox, type CheckboxProps } from './input/Checkbox';
16
+ export { ImageField, type ImageFieldProps } from './input/ImageField';
16
17
  export { DatePicker, type DatePickerProps } from './input/DatePicker';
17
18
  export { FolderSelect, type FolderDestination, type FolderSelectProps } from './input/FolderSelect';
18
19
  export { SearchableTextField, type SearchableTextFieldProps } from './input/SearchableTextField';
@@ -0,0 +1,37 @@
1
+ import { default as React } from 'react';
2
+ export interface ImageFieldProps {
3
+ label?: string;
4
+ /** Current value as a base64 data URI, or undefined when empty. */
5
+ value?: string;
6
+ onChange: (value: string | undefined) => void;
7
+ /** Longest side after downscaling. */
8
+ maxDimension?: number;
9
+ /**
10
+ * Ceiling for the encoded result. The server checks this too — this one is
11
+ * here so the user finds out before saving, not so the rule is enforced.
12
+ */
13
+ maxBytes?: number;
14
+ /** Preview box shape. */
15
+ aspect?: "square" | "wide";
16
+ helperText?: React.ReactNode;
17
+ disabled?: boolean;
18
+ className?: string;
19
+ chooseLabel?: string;
20
+ removeLabel?: string;
21
+ /** Shown when the picked file is still too large after downscaling. */
22
+ tooLargeLabel?: string;
23
+ }
24
+ /**
25
+ * Pick an image and keep it inline as a base64 data URI.
26
+ *
27
+ * For the small brand assets that live on a row rather than in the storage app
28
+ * — an organisation logo, a help centre favicon. Not for content: an article
29
+ * image belongs in storage, once storage can serve a public URL.
30
+ *
31
+ * The canvas downscale is a courtesy, not a limit. The same ceiling is enforced
32
+ * server-side by `assertInlineImage`, because anyone can call the API without
33
+ * going through this field.
34
+ */
35
+ export declare function ImageField({ label, value, onChange, maxDimension, maxBytes, aspect, helperText, disabled, className, chooseLabel, removeLabel, tooLargeLabel, }: ImageFieldProps): React.JSX.Element;
36
+ /** Roughly how many bytes a data URI's payload decodes to. */
37
+ export declare function approximateBytes(dataUri: string): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/ui-kit",
3
- "version": "3.141.0",
3
+ "version": "3.145.0",
4
4
  "description": "Theme-aware UI component library for OpenCXH platform",
5
5
  "type": "module",
6
6
  "exports": {