@design-edito/tools 0.5.2 → 0.5.3
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/agnostic/html/deep-select/index.js +5 -3
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +8 -8
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +8 -8
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +2 -2
- package/agnostic/html/index.d.ts +1 -1
- package/agnostic/html/index.js +1 -1
- package/agnostic/misc/index.d.ts +3 -3
- package/agnostic/misc/index.js +3 -3
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/optim/index.d.ts +1 -1
- package/agnostic/optim/index.js +1 -1
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/time/dates/format-date/index.d.ts +4 -2
- package/agnostic/time/dates/format-date/index.js +43 -94
- package/agnostic/time/dates/format-date/index.test.js +154 -0
- package/agnostic/time/dates/format-date/parts.d.ts +28 -0
- package/agnostic/time/dates/format-date/parts.js +136 -0
- package/agnostic/time/dates/format-date/types.d.ts +84 -0
- package/agnostic/time/dates/format-date/types.js +1 -0
- package/agnostic/time/duration/format-duration/index.d.ts +42 -0
- package/agnostic/time/duration/format-duration/index.js +94 -0
- package/agnostic/time/duration/format-duration/index.test.d.ts +1 -0
- package/agnostic/time/duration/format-duration/index.test.js +148 -0
- package/agnostic/time/duration/format-duration/parts.d.ts +32 -0
- package/agnostic/time/duration/format-duration/parts.js +107 -0
- package/agnostic/time/duration/format-duration/types.d.ts +93 -0
- package/agnostic/time/duration/format-duration/types.js +1 -0
- package/agnostic/time/duration/index.d.ts +6 -1
- package/agnostic/time/duration/index.js +2 -2
- package/agnostic/time/duration/index.test.d.ts +1 -0
- package/agnostic/time/duration/index.test.js +168 -0
- package/agnostic/time/index.d.ts +1 -1
- package/agnostic/time/index.js +1 -1
- package/components/BeforeAfter/index.controlled.d.ts +25 -25
- package/components/BeforeAfter/index.controlled.js +47 -53
- package/components/BeforeAfter/index.d.ts +20 -23
- package/components/BeforeAfter/index.js +48 -40
- package/components/Button/index.js +1 -1
- package/components/Clippable/index.d.ts +17 -26
- package/components/Clippable/index.js +21 -23
- package/components/Disclaimer/index.d.ts +29 -22
- package/components/Disclaimer/index.js +29 -24
- package/components/Drawer/index.d.ts +45 -25
- package/components/Drawer/index.js +61 -52
- package/components/EventListener/index.d.ts +4 -5
- package/components/Gallery/index.d.ts +14 -16
- package/components/Gallery/index.js +25 -30
- package/components/Iframe/index.js +2 -2
- package/components/Image/index.d.ts +5 -12
- package/components/Image/index.js +11 -32
- package/components/Input/index.d.ts +23 -19
- package/components/Input/index.js +30 -20
- package/components/JsonEditor/index.d.ts +177 -9
- package/components/JsonEditor/index.js +133 -77
- package/components/JsonEditor/types.d.ts +11 -0
- package/components/JsonEditor/types.js +1 -0
- package/components/JsonEditor/utils.d.ts +8 -0
- package/components/JsonEditor/utils.js +23 -0
- package/components/ListLoader/index.controlled.d.ts +5 -5
- package/components/ListLoader/index.controlled.js +4 -4
- package/components/ListLoader/index.d.ts +11 -11
- package/components/ListLoader/index.js +12 -12
- package/components/Overlayer/index.js +4 -4
- package/components/Paginator/index.d.ts +7 -12
- package/components/Paginator/index.js +7 -11
- package/components/ResizeObserver/index.d.ts +14 -3
- package/components/ResizeObserver/index.js +49 -24
- package/components/Scrllgngn/index.d.ts +17 -13
- package/components/Scrllgngn/index.js +25 -84
- package/components/Scrllgngn/utils.d.ts +52 -0
- package/components/Scrllgngn/utils.js +102 -0
- package/components/ScrollListener/index.d.ts +43 -28
- package/components/ScrollListener/index.js +59 -79
- package/components/ScrollListener/utils.d.ts +37 -16
- package/components/ScrollListener/utils.js +141 -28
- package/components/Select/index.d.ts +24 -20
- package/components/Select/index.js +30 -20
- package/components/Sequencer/index.controlled.d.ts +16 -26
- package/components/Sequencer/index.controlled.js +15 -12
- package/components/Sequencer/index.d.ts +25 -30
- package/components/Sequencer/index.js +20 -34
- package/components/Subtitles/index.d.ts +29 -5
- package/components/Subtitles/index.js +90 -12
- package/components/Textarea/index.d.ts +26 -20
- package/components/Textarea/index.js +40 -21
- package/components/Theatre/index.d.ts +35 -39
- package/components/Theatre/index.js +46 -58
- package/components/UIModule/index.d.ts +25 -29
- package/components/UIModule/index.js +81 -110
- package/components/Video/index.controlled.d.ts +51 -51
- package/components/Video/index.controlled.js +75 -72
- package/components/Video/index.d.ts +12 -14
- package/components/Video/index.js +41 -86
- package/components/Video/utils.d.ts +35 -3
- package/components/Video/utils.js +37 -14
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/utils/index.d.ts +22 -0
- package/components/utils/index.js +31 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/node/@aws-s3/storage/file/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/index.js +1 -1
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/images/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +1 -1
- package/node/images/transform/operations/index.js +1 -1
- package/node/index.d.ts +1 -1
- package/node/index.js +1 -1
- package/package.json +20 -5
- package/TODO.md +0 -269
- package/components/BeforeAfter/utils.d.ts +0 -4
- package/components/BeforeAfter/utils.js +0 -9
- package/components/Input/index.controlled.d.ts +0 -42
- package/components/Input/index.controlled.js +0 -54
- package/components/Select/index.controlled.d.ts +0 -43
- package/components/Select/index.controlled.js +0 -54
- package/components/Subtitles/types.d.ts +0 -24
- package/components/Subtitles/utils.d.ts +0 -32
- package/components/Subtitles/utils.js +0 -107
- package/components/Textarea/index.controlled.d.ts +0 -50
- package/components/Textarea/index.controlled.js +0 -75
- /package/{components/Subtitles/types.js → agnostic/time/dates/format-date/index.test.d.ts} +0 -0
- /package/components/ResizeObserver/{style.module.css → styles.module.css} +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { type FunctionComponent, type TextareaHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import type { WithClassName } from '../utils/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the {@link ControlledTextarea} component.
|
|
5
|
-
*
|
|
6
|
-
* Extends all native {@link TextareaHTMLAttributes} and {@link WithClassName}
|
|
7
|
-
* with optional label, error content, and automatic height adjustment.
|
|
8
|
-
*
|
|
9
|
-
* @property label - Content rendered as an associated `<label>`. When omitted, no label is rendered.
|
|
10
|
-
* @property error - Content rendered as an error message below the textarea. When omitted, no error is rendered.
|
|
11
|
-
* @property autoHeight - When `true`, automatically adjusts the textarea height
|
|
12
|
-
* to fit its content. Defaults to `false`.
|
|
13
|
-
* @property className - Additional class name(s) applied to the textarea element.
|
|
14
|
-
*/
|
|
15
|
-
export type Props = TextareaHTMLAttributes<HTMLTextAreaElement> & WithClassName<{
|
|
16
|
-
label?: ReactNode;
|
|
17
|
-
error?: ReactNode;
|
|
18
|
-
autoHeight?: boolean;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Controlled textarea field component.
|
|
22
|
-
*
|
|
23
|
-
* Renders a native `<textarea>` element with optional label and error feedback.
|
|
24
|
-
* The textarea value is entirely driven by the provided `value` prop and all
|
|
25
|
-
* native textarea attributes are forwarded to the underlying element.
|
|
26
|
-
*
|
|
27
|
-
* A stable auto-generated `id` is created on mount and used to associate the
|
|
28
|
-
* rendered label through the `htmlFor` attribute.
|
|
29
|
-
*
|
|
30
|
-
* When `autoHeight` is enabled, the textarea height automatically expands or
|
|
31
|
-
* shrinks to match its content.
|
|
32
|
-
*
|
|
33
|
-
* ### CSS elements
|
|
34
|
-
* - `label`
|
|
35
|
-
* - `error`
|
|
36
|
-
*
|
|
37
|
-
* @param props - Component properties.
|
|
38
|
-
* @see {@link Props}
|
|
39
|
-
*
|
|
40
|
-
* @returns A labelled controlled textarea with optional error feedback.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* - The component does not manage its own value state.
|
|
44
|
-
* - Consumers are responsible for updating `value` in response to `onChange`.
|
|
45
|
-
* - Additional `className` values are merged with the component public class name
|
|
46
|
-
* and applied to the underlying `<textarea>` element.
|
|
47
|
-
* - When `autoHeight` is enabled, height recalculation occurs whenever the
|
|
48
|
-
* textarea value changes and every 500ms thereafter.
|
|
49
|
-
*/
|
|
50
|
-
export declare const ControlledTextarea: FunctionComponent<Props>;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useLayoutEffect, useRef } from 'react';
|
|
3
|
-
import { clss } from '../../agnostic/css/clss/index.js';
|
|
4
|
-
import { isNotFalsy } from '../../agnostic/booleans/is-falsy/index.js';
|
|
5
|
-
import { randomHash } from '../../agnostic/random/uuid/index.js';
|
|
6
|
-
import { textarea as publicClassName } from '../public-classnames.js';
|
|
7
|
-
import { mergeClassNames } from '../utils/index.js';
|
|
8
|
-
import cssModule from './styles.module.css';
|
|
9
|
-
/**
|
|
10
|
-
* Controlled textarea field component.
|
|
11
|
-
*
|
|
12
|
-
* Renders a native `<textarea>` element with optional label and error feedback.
|
|
13
|
-
* The textarea value is entirely driven by the provided `value` prop and all
|
|
14
|
-
* native textarea attributes are forwarded to the underlying element.
|
|
15
|
-
*
|
|
16
|
-
* A stable auto-generated `id` is created on mount and used to associate the
|
|
17
|
-
* rendered label through the `htmlFor` attribute.
|
|
18
|
-
*
|
|
19
|
-
* When `autoHeight` is enabled, the textarea height automatically expands or
|
|
20
|
-
* shrinks to match its content.
|
|
21
|
-
*
|
|
22
|
-
* ### CSS elements
|
|
23
|
-
* - `label`
|
|
24
|
-
* - `error`
|
|
25
|
-
*
|
|
26
|
-
* @param props - Component properties.
|
|
27
|
-
* @see {@link Props}
|
|
28
|
-
*
|
|
29
|
-
* @returns A labelled controlled textarea with optional error feedback.
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* - The component does not manage its own value state.
|
|
33
|
-
* - Consumers are responsible for updating `value` in response to `onChange`.
|
|
34
|
-
* - Additional `className` values are merged with the component public class name
|
|
35
|
-
* and applied to the underlying `<textarea>` element.
|
|
36
|
-
* - When `autoHeight` is enabled, height recalculation occurs whenever the
|
|
37
|
-
* textarea value changes and every 500ms thereafter.
|
|
38
|
-
*/
|
|
39
|
-
export const ControlledTextarea = ({ label, error, autoHeight = false, value, className, ...rest }) => {
|
|
40
|
-
const [id] = useState(`_${randomHash(12)}`);
|
|
41
|
-
const textareaRef = useRef(null);
|
|
42
|
-
// Handlers
|
|
43
|
-
const adjustHeight = () => {
|
|
44
|
-
const textarea = textareaRef.current;
|
|
45
|
-
if (textarea === null)
|
|
46
|
-
return;
|
|
47
|
-
textarea.style.height = 'auto';
|
|
48
|
-
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
49
|
-
};
|
|
50
|
-
// Fx. dep `authHeight`, `value` - Compute content height
|
|
51
|
-
useLayoutEffect(() => {
|
|
52
|
-
if (!autoHeight)
|
|
53
|
-
return;
|
|
54
|
-
adjustHeight();
|
|
55
|
-
}, [autoHeight, value]);
|
|
56
|
-
// Rendering
|
|
57
|
-
const c = clss(publicClassName, { cssModule });
|
|
58
|
-
const rootClss = mergeClassNames(c(null), className);
|
|
59
|
-
return _jsxs(_Fragment, { children: [isNotFalsy(label) && _jsx("label", { className: c('label'), htmlFor: id, children: label }), _jsx("textarea", { ...rest, ref: textareaRef, className: rootClss, id: id, value: value, onChange: e => {
|
|
60
|
-
const { target } = e;
|
|
61
|
-
rest.onChange?.(e);
|
|
62
|
-
if (value === undefined)
|
|
63
|
-
return;
|
|
64
|
-
if (typeof value === 'number') {
|
|
65
|
-
target.value = `${value}`;
|
|
66
|
-
}
|
|
67
|
-
else if (typeof value === 'string') {
|
|
68
|
-
target.value = value;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// value is readonly string[]
|
|
72
|
-
// not supported for <select>; ignore or normalize if needed
|
|
73
|
-
}
|
|
74
|
-
} }), isNotFalsy(error) && _jsx("span", { className: c('error'), children: error })] });
|
|
75
|
-
};
|
|
File without changes
|
|
File without changes
|