@a-type/ui 4.1.0-beta.4 → 4.1.0-beta.6
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/cjs/components/input/Input.d.ts +3 -1
- package/dist/cjs/components/input/Input.js +6 -2
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/input/Input.stories.d.ts +3 -1
- package/dist/cjs/components/note/Note.d.ts +6 -1
- package/dist/cjs/components/note/Note.js +9 -3
- package/dist/cjs/components/note/Note.js.map +1 -1
- package/dist/cjs/components/note/Note.stories.d.ts +4 -1
- package/dist/cjs/components/note/Note.stories.js +7 -1
- package/dist/cjs/components/note/Note.stories.js.map +1 -1
- package/dist/cjs/components/textArea/TextArea.d.ts +9 -2
- package/dist/cjs/components/textArea/TextArea.js +50 -9
- package/dist/cjs/components/textArea/TextArea.js.map +1 -1
- package/dist/cjs/components/textArea/TextArea.stories.d.ts +7 -2
- package/dist/css/main.css +4 -4
- package/dist/esm/components/input/Input.d.ts +3 -1
- package/dist/esm/components/input/Input.js +6 -2
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.stories.d.ts +3 -1
- package/dist/esm/components/note/Note.d.ts +6 -1
- package/dist/esm/components/note/Note.js +8 -2
- package/dist/esm/components/note/Note.js.map +1 -1
- package/dist/esm/components/note/Note.stories.d.ts +4 -1
- package/dist/esm/components/note/Note.stories.js +6 -0
- package/dist/esm/components/note/Note.stories.js.map +1 -1
- package/dist/esm/components/textArea/TextArea.d.ts +9 -2
- package/dist/esm/components/textArea/TextArea.js +17 -8
- package/dist/esm/components/textArea/TextArea.js.map +1 -1
- package/dist/esm/components/textArea/TextArea.stories.d.ts +7 -2
- package/package.json +1 -1
- package/src/components/input/Input.tsx +17 -5
- package/src/components/note/Note.stories.tsx +10 -0
- package/src/components/note/Note.tsx +19 -3
- package/src/components/textArea/TextArea.tsx +45 -27
|
@@ -13,6 +13,8 @@ export interface InputProps extends Omit<BaseInputProps, 'className'> {
|
|
|
13
13
|
ref?: Ref<HTMLInputElement>;
|
|
14
14
|
}
|
|
15
15
|
export declare const Input: (({ className, borderRef, startAccessory, endAccessory, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
16
|
-
Border: import("react").FunctionComponent<import("react").
|
|
16
|
+
Border: import("react").FunctionComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
17
|
+
ref?: Ref<HTMLDivElement>;
|
|
18
|
+
}>;
|
|
17
19
|
Input: ({ autoSelect, onFocus, onBlur, className, placeholders, placeholder, placeholdersIntervalMs, onValueChange, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
};
|
|
@@ -15,10 +15,14 @@ import { Input as BaseInput, } from '@base-ui/react/input';
|
|
|
15
15
|
import clsx from 'clsx';
|
|
16
16
|
import { withClassName } from '../../hooks.js';
|
|
17
17
|
import { useRotatingShuffledValue } from '../../hooks/useRotatingShuffledValue.js';
|
|
18
|
+
import { GroupScaleReset } from '../../systems/GroupScale.js';
|
|
18
19
|
import { inputInfo } from '../../systems/inputs.js';
|
|
19
20
|
export const inputClassName = clsx('layer-components:min-w-60px layer-components:flex-1 layer-components:select-auto layer-components:border-none layer-components:px-0 layer-components:py-1.25 layer-components:text-md layer-components:font-inherit layer-components:bg-transparent', 'layer-components:md:min-w-120px', 'layer-components:placeholder:color-gray-dark', 'layer-components:focus:outline-none', 'layer-components:focus-visible:outline-none', 'layer-components:first:rounded-l-inherit layer-components:first:pl-md', 'layer-components:last:rounded-r-inherit layer-components:last:pr-md');
|
|
20
|
-
const inputBorderClassName = clsx('layer-components:flex layer-components:flex-row layer-components:items-center layer-components:gap-xs layer-components:border-1 layer-components:rounded-lg layer-components:border-solid layer-components:text-md layer-components:shadow-sm layer-components:shadow-inset layer-components:transition-shadow layer-components:color-black layer-components:bg-white layer-components:border-gray-dark', 'layer-components:w-max-content layer-components:overflow-clip', 'layer-components:[&:has(input:disabled)]:shadow-none layer-components:[&:has(input:disabled)]:bg-transparent layer-components:[&:has(input:disabled)]:border-gray layer-components:[&:has(input:disabled)]:placeholder-gray-dark', 'layer-components:[&:has(input:focus-visible)]:outline-none layer-components:[&:has(input:focus-visible)]:ring layer-components:[&:has(input:focus-visible)]:ring-4 layer-components:[&:has(input:focus-visible)]:ring-accent', 'layer-variants:[&:has(input:focus[data-focus-clicked])]:outline-none layer-variants:[&:has(input:focus[data-focus-clicked])]:ring layer-variants:[&:has(input:focus[data-focus-clicked])]:ring-4 layer-variants:[&:has(input:focus[data-focus-clicked])]:bg-lighten-3 layer-variants:[&:has(input:focus[data-focus-clicked])]:ring-main-light', 'layer-components:[&:has(input:hover)]:border-black', 'layer-components:[&>.icon]:mx-sm');
|
|
21
|
-
|
|
21
|
+
const inputBorderClassName = clsx('layer-components:flex layer-components:flex-row layer-components:items-center layer-components:gap-xs layer-components:border-1 layer-components:rounded-lg layer-components:border-solid layer-components:text-md layer-components:shadow-sm layer-components:shadow-inset layer-components:transition-shadow layer-components:color-black layer-components:bg-white layer-components:border-gray-dark', 'layer-components:w-max-content layer-components:overflow-clip', 'layer-components:[&:has(input:disabled),&:has(textarea:disabled)]:shadow-none layer-components:[&:has(input:disabled),&:has(textarea:disabled)]:bg-transparent layer-components:[&:has(input:disabled),&:has(textarea:disabled)]:border-gray layer-components:[&:has(input:disabled),&:has(textarea:disabled)]:placeholder-gray-dark', 'layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:outline-none layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring-4 layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring-accent', 'layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:outline-none layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring-4 layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:bg-lighten-3 layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring-main-light', 'layer-components:[&:has(input:hover),&:has(textarea:hover)]:border-black', 'layer-components:[&>.icon]:mx-sm');
|
|
22
|
+
function InputBorderImpl(props) {
|
|
23
|
+
return (_jsx(GroupScaleReset, { children: _jsx("div", Object.assign({}, props)) }));
|
|
24
|
+
}
|
|
25
|
+
const InputBorder = withClassName(InputBorderImpl, inputBorderClassName);
|
|
22
26
|
const InnerInput = function InnerInput(_a) {
|
|
23
27
|
var { autoSelect, onFocus, onBlur, className, placeholders, placeholder, placeholdersIntervalMs = 5000, onValueChange } = _a, props = __rest(_a, ["autoSelect", "onFocus", "onBlur", "className", "placeholders", "placeholder", "placeholdersIntervalMs", "onValueChange"]);
|
|
24
28
|
const handleFocus = (ev) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/input/Input.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACN,KAAK,IAAI,SAAS,GAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CACjC,+GAA+G,EAC/G,mCAAmC,EACnC,gDAAgD,EAChD,uCAAuC,EACvC,+CAA+C,EAC/C,kDAAkD,EAClD,iDAAiD,CACjD,CAAC;AAEF,MAAM,oBAAoB,GAAG,IAAI,CAChC,8KAA8K,EAC9K,gDAAgD,EAChD,
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../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
@@ -3,7 +3,9 @@ import { Input } from './Input.js';
|
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: (({ className, borderRef, startAccessory, endAccessory, ...props }: import("./Input.js").InputProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
-
Border: import("react").FunctionComponent<import("react").
|
|
6
|
+
Border: import("react").FunctionComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
ref?: import("react").Ref<HTMLDivElement>;
|
|
8
|
+
}>;
|
|
7
9
|
Input: ({ autoSelect, onFocus, onBlur, className, placeholders, placeholder, placeholdersIntervalMs, onValueChange, ...props }: import("./Input.js").InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
};
|
|
9
11
|
argTypes: {
|
|
@@ -4,4 +4,9 @@ export interface NoteProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
color?: PaletteName;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
declare function NoteRoot({ className, color, children, ...rest }: NoteProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const NoteInput: import("react").FunctionComponent<import("../textArea/TextArea.js").TextAreaProps>;
|
|
9
|
+
export declare const Note: typeof NoteRoot & {
|
|
10
|
+
Input: import("react").FunctionComponent<import("../textArea/TextArea.js").TextAreaProps>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -12,8 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import classNames, { clsx } from 'clsx';
|
|
15
|
-
|
|
15
|
+
import { withClassName } from '../../hooks.js';
|
|
16
|
+
import { TextArea } from '../textArea/TextArea.js';
|
|
17
|
+
function NoteRoot(_a) {
|
|
16
18
|
var { className, color, children } = _a, rest = __rest(_a, ["className", "color", "children"]);
|
|
17
|
-
return (_jsx("div", Object.assign({ className: classNames(color && `palette-${color}`, className) }, rest, { children: _jsxs("div", { className: "layer-components:flex layer-components:flex-row", children: [_jsx("div", { className: clsx('layer-components:relative layer-components:flex-1 layer-components:border layer-components:border-solid layer-components:p-2 layer-components:text-sm layer-components:italic layer-components:color-black layer-components:bg-main-wash layer-components:bg-darken-1 layer-components:border-main-dark layer-variants:border-r-0', 'layer-variants:[&_input,&_textarea]:shadow-none'), children: children }), _jsxs("div", { className: "layer-components:flex layer-components:flex-[0_0_20px] layer-components:flex-col layer-components:items-stretch layer-components:justify-stretch", "aria-hidden": true, children: [_jsxs("div", { className: "layer-components:relative layer-components:h-[20px] layer-components:w-[20px] layer-components:flex-[0_0_20px] layer-components:border-0 layer-components:border-solid layer-components:border-main-dark layer-variants:border-b-1px layer-variants:border-l-1px", children: [_jsx("div", { className: `layer-components:box-content layer-components:h-0 layer-components:w-0 layer-components:transform-origin-br layer-components:translate--7px layer-components:rotate--45 layer-components:border-13px layer-components:border-solid layer-components:border-transparent layer-components:border-r-main-wash layer-components:border-r-darken-1` }), _jsx("div", { className: "layer-components:absolute layer-components:left-9px layer-components:top--3px layer-components:h-27px layer-components:w-0.5px layer-components:transform-origin-cc layer-components:rotate--45 layer-components:bg-main-dark" })] }), _jsx("div", { className: "layer-components:flex-1 layer-components:border-0 layer-components:border-solid layer-components:bg-main-wash layer-components:bg-darken-1 layer-components:border-main-dark layer-variants:border-b-1px layer-variants:border-r-1px" })] })] }) })));
|
|
19
|
+
return (_jsx("div", Object.assign({ className: classNames(color && `palette-${color}`, 'layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring-4 layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:ring-accent', 'layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring-4 layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:bg-lighten-3 layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:ring-main-light', className) }, rest, { children: _jsxs("div", { className: "layer-components:flex layer-components:flex-row", children: [_jsx("div", { className: clsx('layer-components:relative layer-components:flex-1 layer-components:border layer-components:border-solid layer-components:p-2 layer-components:text-sm layer-components:italic layer-components:color-black layer-components:bg-main-wash layer-components:bg-darken-1 layer-components:border-main-dark layer-variants:border-r-0', 'layer-variants:[&_input,&_textarea]:border-none layer-variants:[&_input,&_textarea]:p-0 layer-variants:[&_input,&_textarea]:shadow-none layer-variants:[&_input,&_textarea]:bg-transparent layer-variants:[&_input,&_textarea]:ring-none'), children: children }), _jsxs("div", { className: "layer-components:flex layer-components:flex-[0_0_20px] layer-components:flex-col layer-components:items-stretch layer-components:justify-stretch", "aria-hidden": true, children: [_jsxs("div", { className: "layer-components:relative layer-components:h-[20px] layer-components:w-[20px] layer-components:flex-[0_0_20px] layer-components:border-0 layer-components:border-solid layer-components:border-main-dark layer-variants:border-b-1px layer-variants:border-l-1px", children: [_jsx("div", { className: `layer-components:box-content layer-components:h-0 layer-components:w-0 layer-components:transform-origin-br layer-components:translate--7px layer-components:rotate--45 layer-components:border-13px layer-components:border-solid layer-components:border-transparent layer-components:border-r-main-wash layer-components:border-r-darken-1` }), _jsx("div", { className: "layer-components:absolute layer-components:left-9px layer-components:top--3px layer-components:h-27px layer-components:w-0.5px layer-components:transform-origin-cc layer-components:rotate--45 layer-components:bg-main-dark" })] }), _jsx("div", { className: "layer-components:flex-1 layer-components:border-0 layer-components:border-solid layer-components:bg-main-wash layer-components:bg-darken-1 layer-components:border-main-dark layer-variants:border-b-1px layer-variants:border-r-1px" })] })] }) })));
|
|
18
20
|
}
|
|
21
|
+
export const NoteInput = withClassName(TextArea.Input, 'layer-composed2:w-full layer-composed2:p-0');
|
|
22
|
+
export const Note = Object.assign(NoteRoot, {
|
|
23
|
+
Input: NoteInput,
|
|
24
|
+
});
|
|
19
25
|
//# sourceMappingURL=Note.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Note.js","sourceRoot":"","sources":["../../../../src/components/note/Note.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Note.js","sourceRoot":"","sources":["../../../../src/components/note/Note.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAOnD,SAAS,QAAQ,CAAC,EAAkD;QAAlD,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,OAAsB,EAAjB,IAAI,cAArC,kCAAuC,CAAF;IACtD,OAAO,CACN,4BACC,SAAS,EAAE,UAAU,CACpB,KAAK,IAAI,WAAW,KAAK,EAAE,EAC3B,uGAAuG,EACvG,8IAA8I,EAC9I,SAAS,CACT,IACG,IAAI,cAER,eAAK,SAAS,EAAC,kCAAkC,aAChD,cACC,SAAS,EAAE,IAAI,CACd,2JAA2J,EAC3J,4FAA4F,CAC5F,YAEA,QAAQ,GACJ,EACN,eACC,SAAS,EAAC,gFAAgF,kCAI1F,eAAK,SAAS,EAAC,iJAAiJ,aAE/J,cACC,SAAS,EAAE,uKAAuK,GACjL,EAEF,cAAK,SAAS,EAAC,0GAA0G,GAAG,IACvH,EAEN,cAAK,SAAS,EAAC,sIAAsI,GAAG,IACnJ,IACD,IACD,CACN,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CACrC,QAAQ,CAAC,KAAK,EACd,8BAA8B,CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC3C,KAAK,EAAE,SAAS;CAChB,CAAC,CAAC"}
|
|
@@ -2,7 +2,9 @@ import type { StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { Note } from './Note.js';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: (({ className, color, children, ...rest }: import("./Note.js").NoteProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
+
Input: import("react").FunctionComponent<import("../index.js").TextAreaProps>;
|
|
7
|
+
};
|
|
6
8
|
args: {
|
|
7
9
|
children: string;
|
|
8
10
|
};
|
|
@@ -15,3 +17,4 @@ declare const meta: {
|
|
|
15
17
|
export default meta;
|
|
16
18
|
type Story = StoryObj<typeof Note>;
|
|
17
19
|
export declare const Default: Story;
|
|
20
|
+
export declare const Editable: Story;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @unocss-include
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Note } from './Note.js';
|
|
3
4
|
const meta = {
|
|
4
5
|
title: 'Components/Note',
|
|
@@ -12,4 +13,9 @@ const meta = {
|
|
|
12
13
|
};
|
|
13
14
|
export default meta;
|
|
14
15
|
export const Default = {};
|
|
16
|
+
export const Editable = {
|
|
17
|
+
render(args) {
|
|
18
|
+
return (_jsx(Note, Object.assign({}, args, { children: _jsx(Note.Input, {}) })));
|
|
19
|
+
},
|
|
20
|
+
};
|
|
15
21
|
//# sourceMappingURL=Note.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Note.stories.js","sourceRoot":"","sources":["../../../../src/components/note/Note.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,IAAI;IAEf,IAAI,EAAE;QACL,QAAQ,EAAE,gBAAgB;KAC1B;IACD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CAC2B,CAAC;AAE9B,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"Note.stories.js","sourceRoot":"","sources":["../../../../src/components/note/Note.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,IAAI;IAEf,IAAI,EAAE;QACL,QAAQ,EAAE,gBAAgB;KAC1B;IACD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CAC2B,CAAC;AAE9B,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC9B,MAAM,CAAC,IAAI;QACV,OAAO,CACN,KAAC,IAAI,oBAAK,IAAI,cACb,KAAC,IAAI,CAAC,KAAK,KAAG,IACR,CACP,CAAC;IACH,CAAC;CACD,CAAC"}
|
|
@@ -8,6 +8,13 @@ export interface TextAreaProps extends InputProps {
|
|
|
8
8
|
placeholdersIntervalMs?: number;
|
|
9
9
|
rows?: number;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
declare function TextAreaInput({ ref, autoSize, padBottomPixels, onValueChange, className, rows, ...rest }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TextArea: (({ className, ...rest }: TextAreaProps & {
|
|
12
13
|
ref?: React.Ref<any>;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
15
|
+
Border: import("react").FunctionComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
16
|
+
ref?: import("react").Ref<HTMLDivElement>;
|
|
17
|
+
}>;
|
|
18
|
+
Input: typeof TextAreaInput;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -11,14 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import classNames from 'clsx';
|
|
14
|
+
import classNames, { clsx } from 'clsx';
|
|
15
15
|
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
16
|
+
import { withClassName } from '../../hooks.js';
|
|
16
17
|
import useMergedRef from '../../hooks/useMergedRef.js';
|
|
17
|
-
import { inputClassName } from '../input/index.js';
|
|
18
18
|
import { Input } from '../input/Input.js';
|
|
19
|
-
|
|
19
|
+
function TextAreaInput(_a) {
|
|
20
20
|
var _b;
|
|
21
|
-
var { ref, autoSize
|
|
21
|
+
var { ref, autoSize = true, padBottomPixels = 0, onValueChange, className, rows } = _a, rest = __rest(_a, ["ref", "autoSize", "padBottomPixels", "onValueChange", "className", "rows"]);
|
|
22
22
|
const innerRef = useRef(null);
|
|
23
23
|
const finalRef = useMergedRef(innerRef, ref);
|
|
24
24
|
const [innerValue, setInnerValue] = useState('');
|
|
@@ -42,9 +42,18 @@ export const TextArea = function TextArea(_a) {
|
|
|
42
42
|
onValueChange(value, eventDetails);
|
|
43
43
|
}
|
|
44
44
|
}, [onValueChange]);
|
|
45
|
-
return (_jsx(Input.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return (_jsx(Input.Input, Object.assign({ render: _jsx("textarea", { rows: autoSize ? 1 : rows }), ref: finalRef, className: classNames('layer-composed:[font-family:inherit] layer-composed:overflow-hidden layer-composed:color-inherit', 'layer-composed:py-md', {
|
|
46
|
+
'layer-variants:[resize:vertical]': !autoSize,
|
|
47
|
+
'layer-variants:resize-none': autoSize,
|
|
48
|
+
}, className), onValueChange: handleValueChange }, rest)));
|
|
49
|
+
}
|
|
50
|
+
const TextAreaBorder = withClassName(Input.Border, clsx('layer-composed:rounded-lg'));
|
|
51
|
+
const TextAreaDefault = function TextArea(_a) {
|
|
52
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
53
|
+
return (_jsx(TextAreaBorder, { className: className, children: _jsx(TextAreaInput, Object.assign({}, rest)) }));
|
|
49
54
|
};
|
|
55
|
+
export const TextArea = Object.assign(TextAreaDefault, {
|
|
56
|
+
Border: TextAreaBorder,
|
|
57
|
+
Input: TextAreaInput,
|
|
58
|
+
});
|
|
50
59
|
//# sourceMappingURL=TextArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../src/components/textArea/TextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../src/components/textArea/TextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAetD,SAAS,aAAa,CAAC,EAQP;;QARO,EACtB,GAAG,EACH,QAAQ,GAAG,IAAI,EACf,eAAe,GAAG,CAAC,EACnB,aAAa,EACb,SAAS,EACT,IAAI,OAEW,EADZ,IAAI,cAPe,4EAQtB,CADO;IAEP,MAAM,QAAQ,GAAG,MAAM,CAAM,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE7C,MAAM,CAAC,UA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P,CACF,CAAC;AACH,CAAC;AAED,MAAM,cAAc,GAAG,aAAa,CACnC,KAAK,CAAC,MAAM,EACZ,IAAI,CAAC,2BAA2B,CAAC,CACjC,CAAC;AAEF,MAAM,eAAe,GAAG,SAAS,QAAQ,CAAC,EAKzC;QALyC,EACzC,SAAS,OAIT,EAHG,IAAI,cAFkC,aAGzC,CADO;IAIP,OAAO,CACN,KAAC,cAAc,IAAC,SAAS,EAAE,SAAS,YACnC,KAAC,aAAa,oBAAK,IAAI,EAAI,GACX,CACjB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IACtD,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,aAAa;CACpB,CAAC,CAAC"}
|
|
@@ -2,9 +2,14 @@ import type { StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { TextArea } from './TextArea.js';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({
|
|
5
|
+
component: (({ className, ...rest }: import("./TextArea.js").TextAreaProps & {
|
|
6
6
|
ref?: React.Ref<any>;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
8
|
+
Border: import("react").FunctionComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
ref?: import("react").Ref<HTMLDivElement>;
|
|
10
|
+
}>;
|
|
11
|
+
Input: ({ ref, autoSize, padBottomPixels, onValueChange, className, rows, ...rest }: import("./TextArea.js").TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
};
|
|
8
13
|
argTypes: {};
|
|
9
14
|
parameters: {
|
|
10
15
|
controls: {
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { Ref } from 'react';
|
|
7
7
|
import { withClassName } from '../../hooks.js';
|
|
8
8
|
import { useRotatingShuffledValue } from '../../hooks/useRotatingShuffledValue.js';
|
|
9
|
+
import { GroupScaleReset } from '../../systems/GroupScale.js';
|
|
9
10
|
import { inputInfo } from '../../systems/inputs.js';
|
|
10
11
|
|
|
11
12
|
export const inputClassName = clsx(
|
|
@@ -21,14 +22,25 @@ export const inputClassName = clsx(
|
|
|
21
22
|
const inputBorderClassName = clsx(
|
|
22
23
|
'layer-components:(flex flex-row items-center gap-xs border-1 rounded-lg border-solid text-md shadow-sm shadow-inset transition-shadow color-black bg-white border-gray-dark)',
|
|
23
24
|
'layer-components:(w-max-content overflow-clip)',
|
|
24
|
-
'layer-components:[&:has(input:disabled)]:(shadow-none bg-transparent border-gray placeholder-gray-dark)',
|
|
25
|
-
'layer-components:[&:has(input:focus-visible)]:(outline-none ring ring-4 ring-accent)',
|
|
26
|
-
'layer-variants:[&:has(input:focus[data-focus-clicked])]:(outline-none ring ring-4 bg-lighten-3 ring-main-light)',
|
|
27
|
-
'layer-components:[&:has(input:hover)]:(border-black)',
|
|
25
|
+
'layer-components:[&:has(input:disabled),&:has(textarea:disabled)]:(shadow-none bg-transparent border-gray placeholder-gray-dark)',
|
|
26
|
+
'layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:(outline-none ring ring-4 ring-accent)',
|
|
27
|
+
'layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:(outline-none ring ring-4 bg-lighten-3 ring-main-light)',
|
|
28
|
+
'layer-components:[&:has(input:hover),&:has(textarea:hover)]:(border-black)',
|
|
28
29
|
'layer-components:[&>.icon]:(mx-sm)',
|
|
29
30
|
);
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
function InputBorderImpl(
|
|
33
|
+
props: React.HTMLAttributes<HTMLDivElement> & {
|
|
34
|
+
ref?: Ref<HTMLDivElement>;
|
|
35
|
+
},
|
|
36
|
+
) {
|
|
37
|
+
return (
|
|
38
|
+
<GroupScaleReset>
|
|
39
|
+
<div {...props} />
|
|
40
|
+
</GroupScaleReset>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
const InputBorder = withClassName(InputBorderImpl, inputBorderClassName);
|
|
32
44
|
|
|
33
45
|
const InnerInput = function InnerInput({
|
|
34
46
|
autoSelect,
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import classNames, { clsx } from 'clsx';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { withClassName } from '../../hooks.js';
|
|
3
4
|
import { PaletteName } from '../../uno/index.js';
|
|
5
|
+
import { TextArea } from '../textArea/TextArea.js';
|
|
4
6
|
|
|
5
7
|
export interface NoteProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
8
|
children?: ReactNode;
|
|
7
9
|
color?: PaletteName;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
function NoteRoot({ className, color, children, ...rest }: NoteProps) {
|
|
11
13
|
return (
|
|
12
14
|
<div
|
|
13
|
-
className={classNames(
|
|
15
|
+
className={classNames(
|
|
16
|
+
color && `palette-${color}`,
|
|
17
|
+
'layer-components:[&:has(input:focus-visible),&:has(textarea:focus-visible)]:(ring ring-4 ring-accent)',
|
|
18
|
+
'layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:(ring ring-4 bg-lighten-3 ring-main-light)',
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
14
21
|
{...rest}
|
|
15
22
|
>
|
|
16
23
|
<div className="layer-components:(flex flex-row)">
|
|
17
24
|
<div
|
|
18
25
|
className={clsx(
|
|
19
26
|
'layer-components:(relative flex-1 border border-solid p-2 text-sm italic color-black bg-main-wash bg-darken-1 border-main-dark) layer-variants:border-r-0',
|
|
20
|
-
'layer-variants:[&_input,&_textarea]:shadow-none',
|
|
27
|
+
'layer-variants:[&_input,&_textarea]:(border-none p-0 shadow-none bg-transparent ring-none)',
|
|
21
28
|
)}
|
|
22
29
|
>
|
|
23
30
|
{children}
|
|
@@ -42,3 +49,12 @@ export function Note({ className, color, children, ...rest }: NoteProps) {
|
|
|
42
49
|
</div>
|
|
43
50
|
);
|
|
44
51
|
}
|
|
52
|
+
|
|
53
|
+
export const NoteInput = withClassName(
|
|
54
|
+
TextArea.Input,
|
|
55
|
+
'layer-composed2:(w-full p-0)',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export const Note = Object.assign(NoteRoot, {
|
|
59
|
+
Input: NoteInput,
|
|
60
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import classNames from 'clsx';
|
|
1
|
+
import classNames, { clsx } from 'clsx';
|
|
2
2
|
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { withClassName } from '../../hooks.js';
|
|
3
4
|
import useMergedRef from '../../hooks/useMergedRef.js';
|
|
4
|
-
import { inputClassName } from '../input/index.js';
|
|
5
5
|
import { Input, InputProps } from '../input/Input.js';
|
|
6
6
|
|
|
7
7
|
export interface TextAreaProps extends InputProps {
|
|
@@ -17,17 +17,15 @@ export interface TextAreaProps extends InputProps {
|
|
|
17
17
|
|
|
18
18
|
type HandleChange = Exclude<InputProps['onValueChange'], undefined>;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function TextAreaInput({
|
|
21
21
|
ref,
|
|
22
|
-
autoSize,
|
|
23
|
-
className,
|
|
24
|
-
rows,
|
|
22
|
+
autoSize = true,
|
|
25
23
|
padBottomPixels = 0,
|
|
26
24
|
onValueChange,
|
|
25
|
+
className,
|
|
26
|
+
rows,
|
|
27
27
|
...rest
|
|
28
|
-
}: TextAreaProps
|
|
29
|
-
ref?: React.Ref<any>;
|
|
30
|
-
}) {
|
|
28
|
+
}: TextAreaProps) {
|
|
31
29
|
const innerRef = useRef<any>(null);
|
|
32
30
|
const finalRef = useMergedRef(innerRef, ref);
|
|
33
31
|
|
|
@@ -58,23 +56,43 @@ export const TextArea = function TextArea({
|
|
|
58
56
|
);
|
|
59
57
|
|
|
60
58
|
return (
|
|
61
|
-
<Input.
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'layer-variants:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
<Input.Input
|
|
60
|
+
render={<textarea rows={autoSize ? 1 : rows} />}
|
|
61
|
+
ref={finalRef}
|
|
62
|
+
className={classNames(
|
|
63
|
+
'layer-composed:([font-family:inherit] overflow-hidden color-inherit)',
|
|
64
|
+
'layer-composed:py-md',
|
|
65
|
+
{
|
|
66
|
+
'layer-variants:[resize:vertical]': !autoSize,
|
|
67
|
+
'layer-variants:resize-none': autoSize,
|
|
68
|
+
},
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
onValueChange={handleValueChange}
|
|
72
|
+
{...rest}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const TextAreaBorder = withClassName(
|
|
78
|
+
Input.Border,
|
|
79
|
+
clsx('layer-composed:rounded-lg'),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const TextAreaDefault = function TextArea({
|
|
83
|
+
className,
|
|
84
|
+
...rest
|
|
85
|
+
}: TextAreaProps & {
|
|
86
|
+
ref?: React.Ref<any>;
|
|
87
|
+
}) {
|
|
88
|
+
return (
|
|
89
|
+
<TextAreaBorder className={className}>
|
|
90
|
+
<TextAreaInput {...rest} />
|
|
91
|
+
</TextAreaBorder>
|
|
79
92
|
);
|
|
80
93
|
};
|
|
94
|
+
|
|
95
|
+
export const TextArea = Object.assign(TextAreaDefault, {
|
|
96
|
+
Border: TextAreaBorder,
|
|
97
|
+
Input: TextAreaInput,
|
|
98
|
+
});
|