@charcoal-ui/react 2.0.0-alpha.0 → 2.0.0-alpha.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/dist/_lib/compat.d.ts +2 -3
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/components/Radio/index.story.d.ts +4 -2
- package/dist/components/Radio/index.story.d.ts.map +1 -1
- package/dist/components/Select/context.d.ts +14 -0
- package/dist/components/Select/context.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +24 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.story.d.ts +75 -0
- package/dist/components/Select/index.story.d.ts.map +1 -0
- package/dist/components/Select/index.test.d.ts +2 -0
- package/dist/components/Select/index.test.d.ts.map +1 -0
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/index.story.d.ts +9 -3
- package/dist/components/TextField/index.story.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.modern.js +76 -31
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/styled.d.ts +10 -0
- package/dist/styled.d.ts.map +1 -1
- package/package.json +11 -6
- package/src/_lib/compat.ts +1 -4
- package/src/components/Select/context.ts +23 -0
- package/src/components/Select/index.story.tsx +153 -0
- package/src/components/Select/index.test.tsx +281 -0
- package/src/components/Select/index.tsx +210 -0
- package/src/components/TextField/index.tsx +26 -10
- package/src/components/a11y.test.tsx +2 -2
- package/src/index.ts +6 -0
package/dist/_lib/compat.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ import React from 'react';
|
|
|
8
8
|
* node_modules/@types/styled-components/ts3.7/index.d.ts
|
|
9
9
|
* `Type alias 'Interpolation' circularly references itself. ts(2456)`
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
12
|
-
(args: P): React.ReactNode;
|
|
11
|
+
export declare type Story<P> = React.ComponentType<P> & {
|
|
13
12
|
args?: P;
|
|
14
|
-
}
|
|
13
|
+
};
|
|
15
14
|
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../src/_lib/compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../src/_lib/compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AACH,oBAAY,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Radio from '.';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
@@ -28,5 +28,7 @@ interface Props {
|
|
|
28
28
|
forceChecked: boolean;
|
|
29
29
|
readonly: boolean;
|
|
30
30
|
}
|
|
31
|
-
export declare const Default:
|
|
31
|
+
export declare const Default: React.FunctionComponent<Partial<Props>> & {
|
|
32
|
+
args?: Partial<Props> | undefined;
|
|
33
|
+
};
|
|
32
34
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/index.story.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/index.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAqB,MAAM,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;AAKrC,wBAgBC;AAED,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,EAAE,OAAO,CAAA;CAClB;AA2CD,eAAO,MAAM,OAAO;;CAAoB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare type SelectGroupContext = {
|
|
2
|
+
name: string;
|
|
3
|
+
selected: string[];
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
readonly: boolean;
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
onChange: ({ value, selected }: {
|
|
8
|
+
value: string;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const SelectGroupContext: import("react").Context<SelectGroupContext>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/Select/context.ts"],"names":[],"mappings":"AAEA,aAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CAC9E,CAAA;AAED,eAAO,MAAM,kBAAkB,6CAW7B,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type SelectProps = React.PropsWithChildren<{
|
|
3
|
+
value: string;
|
|
4
|
+
forceChecked?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
variant?: 'default' | 'overlay';
|
|
7
|
+
onChange?: (payload: {
|
|
8
|
+
value: string;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
}>;
|
|
12
|
+
export default function Select({ value, forceChecked, disabled, onChange, variant, children, }: SelectProps): JSX.Element;
|
|
13
|
+
export declare type SelectGroupProps = React.PropsWithChildren<{
|
|
14
|
+
className?: string;
|
|
15
|
+
name: string;
|
|
16
|
+
ariaLabel: string;
|
|
17
|
+
selected: string[];
|
|
18
|
+
onChange: (selected: string[]) => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
hasError?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function SelectGroup({ className, name, ariaLabel, selected, onChange, disabled, readonly, hasError, children, }: SelectGroupProps): JSX.Element;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAA;AAQnE,oBAAY,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CACnE,CAAC,CAAA;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAK,EACL,YAAoB,EACpB,QAAgB,EAChB,QAAQ,EACR,OAAmB,EACnB,QAAQ,GACT,EAAE,WAAW,eAsDb;AAyED,oBAAY,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,QAAQ,GACT,EAAE,gBAAgB,eAsClB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Story } from '../../_lib/compat';
|
|
3
|
+
import { default as Select } from '.';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: typeof Select;
|
|
7
|
+
argTypes: {
|
|
8
|
+
name: {
|
|
9
|
+
control: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
ariaLabel: {
|
|
14
|
+
control: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
selected: {
|
|
19
|
+
control: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
firstOptionForceChecked: {
|
|
24
|
+
control: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
disabled: {
|
|
29
|
+
control: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly: {
|
|
34
|
+
control: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
hasError: {
|
|
39
|
+
control: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
variant: {
|
|
44
|
+
control: {
|
|
45
|
+
type: string;
|
|
46
|
+
options: string[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|
|
52
|
+
declare type Props = {
|
|
53
|
+
name: string;
|
|
54
|
+
ariaLabel: string;
|
|
55
|
+
selected: boolean;
|
|
56
|
+
firstOptionForceChecked: boolean;
|
|
57
|
+
onChange: (selected: string[]) => void;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
readonly?: boolean;
|
|
60
|
+
hasError?: boolean;
|
|
61
|
+
variant?: 'default' | 'overlay';
|
|
62
|
+
};
|
|
63
|
+
export declare const Default: React.FunctionComponent<Props> & {
|
|
64
|
+
args?: Props | undefined;
|
|
65
|
+
};
|
|
66
|
+
declare type PlaygroundProps = {
|
|
67
|
+
name: string;
|
|
68
|
+
ariaLabel: string;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
readonly?: boolean;
|
|
71
|
+
hasError?: boolean;
|
|
72
|
+
variant?: 'default' | 'overlay';
|
|
73
|
+
};
|
|
74
|
+
export declare const Playground: Story<PlaygroundProps>;
|
|
75
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAO,EAAe,OAAO,IAAI,MAAM,EAAE,MAAM,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElD,wBA8CC;AAED,aAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,uBAAuB,EAAE,OAAO,CAAA;IAChC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAChC,CAAA;AA8CD,eAAO,MAAM,OAAO;;CAAoB,CAAA;AAcxC,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,eAAe,CAY7C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAEvE,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAK3D,UAAU,kBACR,SAAQ,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9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AQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAA;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CACxB;AAED,oBAAY,cAAc,GAAG,wBAAwB,GAAG,uBAAuB,CAAA;AAC/E,aAAK,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AAoB9D,QAAA,MAAM,SAAS,yFAQd,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -15,9 +15,15 @@ declare const _default: {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export default _default;
|
|
18
|
-
export declare const Default:
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export declare const Default: React.FunctionComponent<Partial<TextFieldProps>> & {
|
|
19
|
+
args?: Partial<TextFieldProps> | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const HasLabel: React.FunctionComponent<Partial<TextFieldProps>> & {
|
|
22
|
+
args?: Partial<TextFieldProps> | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const HasCount: React.FunctionComponent<Partial<TextFieldProps>> & {
|
|
25
|
+
args?: Partial<TextFieldProps> | undefined;
|
|
26
|
+
};
|
|
21
27
|
export declare const HasAffix: Story<Partial<SingleLineTextFieldProps>>;
|
|
22
28
|
export declare const AutoHeight: Story<Partial<MultiLineTextFieldProps>>;
|
|
23
29
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/index.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAkB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACf,MAAM,GAAG,CAAA;;;;;;;;;;;;;;AAGV,wBAYC;AAsCD,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/index.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAkB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACf,MAAM,GAAG,CAAA;;;;;;;;;;;;;;AAGV,wBAYC;AAsCD,eAAO,MAAM,OAAO;;CAAoB,CAAA;AAExC,eAAO,MAAM,QAAQ;;CAAoB,CAAA;AAOzC,eAAO,MAAM,QAAQ;;CAAoB,CAAA;AAMzC,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAE7D,CAAA;AAQD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAE9D,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=require("react"),n=require("styled-components"),t=require("@charcoal-ui/styled"),r=require("@charcoal-ui/utils"),a=require("warning"),i=require("@react-aria/switch"),o=require("react-stately"),l=require("@react-aria/textfield"),u=require("@react-aria/visually-hidden");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/d(e),c=/*#__PURE__*/d(n),f=/*#__PURE__*/d(t),p=/*#__PURE__*/d(a);function h(){return h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},h.apply(this,arguments)}function v(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(a[t]=e[t]);return a}function b(e,n){return n||(n=e.slice(0)),e.raw=n,e}function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function x(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return g(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var m=["to","children"],y={Link:s.default.forwardRef(function(e,n){var t=e.to,r=e.children,a=v(e,m);/*#__PURE__*/return s.default.createElement("a",h({href:t,ref:n},a),r)})},w=s.default.createContext(y);function E(){return e.useContext(w)}var k,R,C,S,P,q,z,L,O,T,N,D,M,H,j,F,A,I,X,B,G,V,Y,J,U,$,K,Q,W,Z,_=f.default(c.default),ee=["onClick","disabled"],ne=s.default.forwardRef(function(e,n){var t=E().Link;if("to"in e){var r=e.onClick,a=e.disabled,i=void 0!==a&&a,o=v(e,ee);/*#__PURE__*/return s.default.createElement(ae,h({},o,{as:i?void 0:t,onClick:i?void 0:r,"aria-disabled":i,ref:n}))}/*#__PURE__*/return s.default.createElement(re,h({},e,{ref:n}))}),te=n.css(k||(k=b(["\n /* Clickable style */\n cursor: pointer;\n\n "," {\n cursor: default;\n }\n"])),r.disabledSelector),re=c.default.button(R||(R=b(["\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ","\n"])),te),ae=c.default.span(C||(C=b(["\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ","\n"])),te),ie=["children","variant","size","fixed","disabled"],oe=s.default.forwardRef(function(e,n){var t=e.children,r=e.variant,a=void 0===r?"Default":r,i=e.size,o=void 0===i?"M":i,l=e.fixed,u=void 0!==l&&l,d=e.disabled,c=void 0!==d&&d,f=v(e,ie);/*#__PURE__*/return s.default.createElement(le,h({},f,{disabled:c,variant:a,size:o,fixed:u,ref:n}),t)}),le=c.default(ne).withConfig({shouldForwardProp:function(e){return"fixed"!==e}}).attrs(function(e){return h({},e,function(e){switch(e){case"Overlay":return{font:"text5",background:"surface4"};case"Default":return{font:"text2",background:"surface3"};case"Primary":return{font:"text5",background:"brand"};case"Navigation":return{font:"text5",background:"surface6"};case"Danger":return{font:"text5",background:"assertive"};default:return function(e){throw new Error(0===arguments.length?"unreachable":"unreachable ("+JSON.stringify(e)+")")}(e)}}(e.variant),function(e){switch(e){case"S":return{height:32,padding:16};case"M":return{height:40,padding:24}}}(e.size))})(S||(S=b(["\n width: ",";\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ","\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ","px;\n"])),function(e){return e.fixed?"stretch":"min-content"},function(e){return _(function(n){return[n.font[e.font].hover.press,n.bg[e.background].hover.press,n.typography(14).bold.preserveHalfLeading,n.padding.horizontal(e.padding),n.disabled,n.borderRadius("oval"),n.outline.default.focus]})},function(e){return e.height}),ue=["variant","size","icon"],de=s.default.forwardRef(function(e,n){var t=e.variant,r=void 0===t?"Default":t,a=e.size,i=void 0===a?"M":a,o=e.icon,l=v(e,ue);return function(e,n){var t;switch(e){case"XS":t="16";break;case"S":case"M":t="24"}var r=/^[0-9]*/.exec(n);if(null==r)throw new Error("Invalid icon name");var a=r[0];a!==t&&console.warn('IconButton with size "'+e+'" expect icon size "'+t+', but got "'+a+'"')}(i,o),/*#__PURE__*/s.default.createElement(se,h({},l,{ref:n,variant:r,size:i}),/*#__PURE__*/s.default.createElement("pixiv-icon",{name:o}))}),se=c.default(ne).attrs(function(e){return h({},e,function(e){switch(e){case"Default":return{font:"text3",background:"transparent"};case"Overlay":return{font:"text5",background:"surface4"}}}(e.variant),function(e){switch(e){case"XS":return{width:20,height:20};case"S":return{width:32,height:32};case"M":return{width:40,height:40}}}(e.size))})(P||(P=b(["\n user-select: none;\n\n width: ","px;\n height: ","px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ","\n"])),function(e){return e.width},function(e){return e.height},function(e){var n=e.font,t=e.background;return _(function(e){return[e.font[n],e.bg[t].hover.press,e.disabled,e.borderRadius("oval"),e.outline.default.focus]})}),ce=c.default.label(q||(q=b(["\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ",";\n align-items: center;\n cursor: pointer;\n\n ","\n"])),function(e){return r.px(e.theme.spacing[4])},_(function(e){return[e.disabled]})),fe=c.default.input.attrs({type:"radio"})(z||(z=b(["\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ",";\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ",";\n }\n\n &:checked {\n ","\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ","\n }\n }\n\n ","\n }\n"])),function(e){var n=e.hasError,t=void 0!==n&&n;return _(function(e){return[e.borderRadius("oval"),e.bg.text5.hover.press,t&&e.outline.assertive]})},function(e){return e.theme.color.text4},_(function(e){return e.bg.brand.hover.press}),_(function(e){return[e.bg.text5.hover.press,e.borderRadius("oval")]}),_(function(e){return e.outline.default.focus})),pe=c.default.div(L||(L=b(["\n ","\n"])),_(function(e){return[e.typography(14)]})),he=c.default.div(O||(O=b(["\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ",";\n"])),function(e){return r.px(e.theme.spacing[8])}),ve=s.default.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,hasError:!1,onChange:function(){throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?")}}),be=["className","type"],ge=c.default.label(T||(T=b(["\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ",";\n cursor: pointer;\n outline: 0;\n\n ","\n\n "," {\n cursor: default;\n }\n"])),function(e){return r.px(e.theme.spacing[4])},_(function(e){return e.disabled}),r.disabledSelector),xe=c.default.div(N||(N=b(["\n ","\n"])),_(function(e){return e.typography(14)})),me=c.default.input.attrs({type:"checkbox"})(D||(D=b(["\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ","\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ","\n }\n\n &:checked {\n ","\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n"])),_(function(e){return[e.borderRadius(16),e.height.px(16),e.bg.text4.hover.press,e.outline.default.focus]}),_(function(e){return[e.bg.text5.hover.press,e.borderRadius("oval")]}),_(function(e){return e.bg.brand.hover.press})),ye=["style","className","label","required","requiredText","subLabel"],we=s.default.forwardRef(function(e,n){var t=e.style,r=e.className,a=e.label,i=e.required,o=void 0!==i&&i,l=e.requiredText,u=e.subLabel,d=v(e,ye);/*#__PURE__*/return s.default.createElement(Se,{style:t,className:r},/*#__PURE__*/s.default.createElement(ke,h({ref:n},d),a),o&&/*#__PURE__*/s.default.createElement(Re,null,l),/*#__PURE__*/s.default.createElement(Ce,null,/*#__PURE__*/s.default.createElement("span",null,u)))}),Ee=f.default(c.default),ke=c.default.label(M||(M=b(["\n ","\n"])),Ee(function(e){return[e.typography(14).bold,e.font.text1]})),Re=c.default.span(H||(H=b(["\n ","\n"])),Ee(function(e){return[e.typography(14),e.font.text3]})),Ce=c.default.div(j||(j=b(["\n ","\n"])),Ee(function(e){return[e.typography(14),e.font.text3.hover.press,e.outline.default.focus]})),Se=c.default.div(F||(F=b(["\n display: inline-flex;\n align-items: center;\n\n > "," {\n ","\n }\n\n > "," {\n ","\n }\n"])),Re,Ee(function(e){return e.margin.left(4)}),Ce,Ee(function(e){return e.margin.left("auto")})),Pe=["onChange"],qe=["onChange"],ze=f.default(c.default);function Le(){var e=arguments;return function(n){for(var t,r=x([].slice.call(e));!(t=r()).done;){var a=t.value;"function"==typeof a?a(n):null!==a&&(a.current=n)}}}function Oe(e){return[].concat(e).length}var Te=s.default.forwardRef(function(e,n){/*#__PURE__*/return s.default.createElement(void 0!==e.multiline&&e.multiline?De:Ne,h({ref:n},e))}),Ne=s.default.forwardRef(function(n,t){var r,a=n.onChange,i=v(n,Pe),o=i.className,d=i.showLabel,c=void 0!==d&&d,f=i.showCount,p=void 0!==f&&f,b=i.label,g=i.requiredText,x=i.subLabel,m=i.disabled,y=void 0!==m&&m,w=i.required,E=i.invalid,k=void 0!==E&&E,R=i.assistiveText,C=i.maxLength,S=i.prefix,P=void 0===S?"":S,q=i.suffix,z=void 0===q?"":q,L=u.useVisuallyHidden().visuallyHiddenProps,O=e.useRef(null),T=e.useRef(null),N=e.useRef(null),D=e.useState(Oe(null!=(r=i.value)?r:"")),M=D[0],H=D[1],j=e.useState(0),F=j[0],A=j[1],I=e.useState(0),X=I[0],B=I[1],G=e.useCallback(function(e){var n=Oe(e);void 0!==C&&n>C||(H(n),null==a||a(e))},[C,a]),V=l.useTextField(h({inputElementType:"input",isDisabled:y,isRequired:w,validationState:k?"invalid":"valid",description:!k&&R,errorMessage:k&&R,onChange:G},i),O),Y=V.inputProps,J=V.labelProps,U=V.descriptionProps,$=V.errorMessageProps;return e.useEffect(function(){var e=new ResizeObserver(function(e){A(e[0].contentRect.width)}),n=new ResizeObserver(function(e){B(e[0].contentRect.width)});return null!==T.current&&e.observe(T.current),null!==N.current&&n.observe(N.current),function(){n.disconnect(),e.disconnect()}},[]),/*#__PURE__*/s.default.createElement(Me,{className:o,isDisabled:y},/*#__PURE__*/s.default.createElement(He,h({label:b,requiredText:g,required:w,subLabel:x},J,c?{}:L)),/*#__PURE__*/s.default.createElement(je,null,/*#__PURE__*/s.default.createElement(Fe,{ref:T},/*#__PURE__*/s.default.createElement(Ie,null,P)),/*#__PURE__*/s.default.createElement(Xe,h({ref:Le(t,O),invalid:k,extraLeftPadding:F,extraRightPadding:X},Y)),/*#__PURE__*/s.default.createElement(Ae,{ref:N},/*#__PURE__*/s.default.createElement(Ie,null,z),p&&C&&/*#__PURE__*/s.default.createElement(Ve,null,M,"/",C))),null!=R&&0!==R.length&&/*#__PURE__*/s.default.createElement(Je,h({invalid:k},k?$:U),R))}),De=s.default.forwardRef(function(n,t){var r,a=n.onChange,i=v(n,qe),o=i.className,d=i.showCount,c=void 0!==d&&d,f=i.showLabel,p=void 0!==f&&f,b=i.label,g=i.requiredText,x=i.subLabel,m=i.disabled,y=void 0!==m&&m,w=i.required,E=i.invalid,k=void 0!==E&&E,R=i.assistiveText,C=i.maxLength,S=i.autoHeight,P=void 0!==S&&S,q=i.rows,z=void 0===q?4:q,L=u.useVisuallyHidden().visuallyHiddenProps,O=e.useRef(null),T=e.useRef(null),N=e.useState(Oe(null!=(r=i.value)?r:"")),D=N[0],M=N[1],H=e.useState(z),j=H[0],F=H[1],A=e.useCallback(function(e){var n,t,r=null!=(n=null==(t=(e.value+"\n").match(/\n/g))?void 0:t.length)?n:1;z<=r&&F(r)},[z]),I=e.useCallback(function(e){var n=Oe(e);void 0!==C&&n>C||(M(n),P&&null!==O.current&&A(O.current),null==a||a(e))},[P,C,a,A]),X=l.useTextField(h({inputElementType:"textarea",isDisabled:y,isRequired:w,validationState:k?"invalid":"valid",description:!k&&R,errorMessage:k&&R,onChange:I},i),T),B=X.inputProps,G=X.labelProps,V=X.descriptionProps,Y=X.errorMessageProps;return e.useEffect(function(){P&&null!==O.current&&A(O.current)},[P,A]),/*#__PURE__*/s.default.createElement(Me,{className:o,isDisabled:y},/*#__PURE__*/s.default.createElement(He,h({label:b,requiredText:g,required:w,subLabel:x},G,p?L:{})),/*#__PURE__*/s.default.createElement(Be,{rows:j},/*#__PURE__*/s.default.createElement(Ge,h({ref:Le(O,t,T),invalid:k,rows:j},B)),c&&/*#__PURE__*/s.default.createElement(Ye,null,D)),null!=R&&0!==R.length&&/*#__PURE__*/s.default.createElement(Je,h({invalid:k},k?Y:V),R))}),Me=c.default.div(A||(A=b(["\n display: flex;\n flex-direction: column;\n\n ","\n"])),function(e){return e.isDisabled&&{opacity:e.theme.elementEffect.disabled.opacity}}),He=c.default(we)(I||(I=b(["\n ","\n"])),ze(function(e){return e.margin.bottom(8)})),je=c.default.div(X||(X=b(["\n height: 40px;\n display: grid;\n position: relative;\n"]))),Fe=c.default.span(B||(B=b(["\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n"]))),Ae=c.default.span(G||(G=b(["\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n"]))),Ie=c.default.span(V||(V=b(["\n user-select: none;\n\n ","\n"])),ze(function(e){return[e.typography(14).preserveHalfLeading,e.font.text2]})),Xe=c.default.input(Y||(Y=b(["\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-top: calc(9px / 0.875);\n padding-bottom: calc(9px / 0.875);\n padding-left: calc((8px + ","px) / 0.875);\n padding-right: calc((8px + ","px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ","\n\n &::placeholder {\n ","\n }\n"])),function(e){return e.extraLeftPadding},function(e){return e.extraRightPadding},function(e){return ze(function(n){return[n.bg.surface3.hover,n.outline.default.focus,e.invalid&&n.outline.assertive,n.font.text2]})},ze(function(e){return e.font.text3})),Be=c.default.div(J||(J=b(["\n display: grid;\n position: relative;\n\n ",";\n"])),function(e){var t=e.rows;return n.css(U||(U=b(["\n max-height: calc(22px * "," + 18px);\n "])),t)}),Ge=c.default.textarea($||($=b(["\n border: none;\n box-sizing: border-box;\n outline: none;\n resize: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) calc(8px / 0.875);\n border-radius: calc(4px / 0.875);\n\n ",";\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ","\n\n &::placeholder {\n ","\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n"])),function(e){var t=e.rows;return n.css(K||(K=b(["\n height: calc(22px / 0.875 * "," + 18px / 0.875);\n "])),t)},function(e){return ze(function(n){return[n.bg.surface3.hover,n.outline.default.focus,e.invalid&&n.outline.assertive,n.font.text2]})},ze(function(e){return e.font.text3})),Ve=c.default.span(Q||(Q=b(["\n ","\n"])),ze(function(e){return[e.typography(14).preserveHalfLeading,e.font.text3]})),Ye=c.default.span(W||(W=b(["\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ","\n"])),ze(function(e){return[e.typography(14).preserveHalfLeading,e.font.text3]})),Je=c.default.p(Z||(Z=b(["\n ","\n"])),function(e){return ze(function(n){return[n.typography(14),n.margin.top(8),n.margin.bottom(0),n.font[e.invalid?"assertive":"text1"]]})});exports.Button=oe,exports.Clickable=ne,exports.ComponentAbstraction=function(e){var n=e.children;/*#__PURE__*/return s.default.createElement(w.Provider,{value:h({},y,e.components)},n)},exports.IconButton=de,exports.Radio=function(n){var t=n.value,r=n.forceChecked,a=void 0!==r&&r,i=n.disabled,o=void 0!==i&&i,l=n.children,u=e.useContext(ve),d=u.name,c=u.selected,f=u.disabled,h=u.readonly,v=u.hasError,b=u.onChange;p.default(void 0!==d,'"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?');var g=t===c,x=o||f,m=h&&!g,y=e.useCallback(function(e){b(e.currentTarget.value)},[b]);/*#__PURE__*/return s.default.createElement(ce,{"aria-disabled":x||m},/*#__PURE__*/s.default.createElement(fe,{name:d,value:t,checked:a||g,hasError:v,onChange:y,disabled:x||m}),null!=l&&/*#__PURE__*/s.default.createElement(pe,null,l))},exports.RadioGroup=function(n){var t=n.className,r=n.value,a=n.label,i=n.name,o=n.onChange,l=n.disabled,u=n.readonly,d=n.hasError,c=n.children,f=e.useCallback(function(e){o(e)},[o]);/*#__PURE__*/return s.default.createElement(ve.Provider,{value:{name:i,selected:r,disabled:null!=l&&l,readonly:null!=u&&u,hasError:null!=d&&d,onChange:f}},/*#__PURE__*/s.default.createElement(he,{role:"radiogroup","aria-orientation":"vertical","aria-label":a,"aria-invalid":d,className:t},c))},exports.Switch=function(n){var t=n.disabled,r=n.className,a=e.useMemo(function(){return h({},n,{"aria-label":"children"in n?void 0:n.label,isDisabled:n.disabled,isSelected:n.checked})},[n]),l=o.useToggleState(a),u=e.useRef(null),d=v(i.useSwitch(a,l,u).inputProps,be);/*#__PURE__*/return s.default.createElement(ge,{className:r,"aria-disabled":t},/*#__PURE__*/s.default.createElement(me,h({},d,{ref:u})),"children"in n?/*#__PURE__*/s.default.createElement(xe,null,n.children):void 0)},exports.TextField=Te,exports.useComponentAbstraction=E;
|
|
1
|
+
var e=require("react"),n=require("styled-components"),t=require("@charcoal-ui/styled"),r=require("@charcoal-ui/utils"),a=require("warning"),i=require("@react-aria/switch"),o=require("react-stately"),l=require("@react-aria/textfield"),u=require("@react-aria/visually-hidden");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/d(e),c=/*#__PURE__*/d(n),f=/*#__PURE__*/d(t),p=/*#__PURE__*/d(a);function h(){return h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},h.apply(this,arguments)}function v(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(a[t]=e[t]);return a}function b(e,n){return n||(n=e.slice(0)),e.raw=n,e}function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function x(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return g(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var m=["to","children"],y={Link:s.default.forwardRef(function(e,n){var t=e.to,r=e.children,a=v(e,m);/*#__PURE__*/return s.default.createElement("a",h({href:t,ref:n},a),r)})},w=s.default.createContext(y);function E(){return e.useContext(w)}var C,k,S,R,P,z,q,L,T,O,N,D,M,H,j,A,F,I,G,B,X,V,Y,J,U,$,K,Q,W,Z,_,ee,ne,te,re,ae=f.default(c.default),ie=["onClick","disabled"],oe=s.default.forwardRef(function(e,n){var t=E().Link;if("to"in e){var r=e.onClick,a=e.disabled,i=void 0!==a&&a,o=v(e,ie);/*#__PURE__*/return s.default.createElement(de,h({},o,{as:i?void 0:t,onClick:i?void 0:r,"aria-disabled":i,ref:n}))}/*#__PURE__*/return s.default.createElement(ue,h({},e,{ref:n}))}),le=n.css(C||(C=b(["\n /* Clickable style */\n cursor: pointer;\n\n "," {\n cursor: default;\n }\n"])),r.disabledSelector),ue=c.default.button(k||(k=b(["\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ","\n"])),le),de=c.default.span(S||(S=b(["\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ","\n"])),le),se=["children","variant","size","fixed","disabled"],ce=s.default.forwardRef(function(e,n){var t=e.children,r=e.variant,a=void 0===r?"Default":r,i=e.size,o=void 0===i?"M":i,l=e.fixed,u=void 0!==l&&l,d=e.disabled,c=void 0!==d&&d,f=v(e,se);/*#__PURE__*/return s.default.createElement(fe,h({},f,{disabled:c,variant:a,size:o,fixed:u,ref:n}),t)}),fe=c.default(oe).withConfig({shouldForwardProp:function(e){return"fixed"!==e}}).attrs(function(e){return h({},e,function(e){switch(e){case"Overlay":return{font:"text5",background:"surface4"};case"Default":return{font:"text2",background:"surface3"};case"Primary":return{font:"text5",background:"brand"};case"Navigation":return{font:"text5",background:"surface6"};case"Danger":return{font:"text5",background:"assertive"};default:return function(e){throw new Error(0===arguments.length?"unreachable":"unreachable ("+JSON.stringify(e)+")")}(e)}}(e.variant),function(e){switch(e){case"S":return{height:32,padding:16};case"M":return{height:40,padding:24}}}(e.size))})(R||(R=b(["\n width: ",";\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ","\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ","px;\n"])),function(e){return e.fixed?"stretch":"min-content"},function(e){return ae(function(n){return[n.font[e.font].hover.press,n.bg[e.background].hover.press,n.typography(14).bold.preserveHalfLeading,n.padding.horizontal(e.padding),n.disabled,n.borderRadius("oval"),n.outline.default.focus]})},function(e){return e.height}),pe=["variant","size","icon"],he=s.default.forwardRef(function(e,n){var t=e.variant,r=void 0===t?"Default":t,a=e.size,i=void 0===a?"M":a,o=e.icon,l=v(e,pe);return function(e,n){var t;switch(e){case"XS":t="16";break;case"S":case"M":t="24"}var r=/^[0-9]*/.exec(n);if(null==r)throw new Error("Invalid icon name");var a=r[0];a!==t&&console.warn('IconButton with size "'+e+'" expect icon size "'+t+', but got "'+a+'"')}(i,o),/*#__PURE__*/s.default.createElement(ve,h({},l,{ref:n,variant:r,size:i}),/*#__PURE__*/s.default.createElement("pixiv-icon",{name:o}))}),ve=c.default(oe).attrs(function(e){return h({},e,function(e){switch(e){case"Default":return{font:"text3",background:"transparent"};case"Overlay":return{font:"text5",background:"surface4"}}}(e.variant),function(e){switch(e){case"XS":return{width:20,height:20};case"S":return{width:32,height:32};case"M":return{width:40,height:40}}}(e.size))})(P||(P=b(["\n user-select: none;\n\n width: ","px;\n height: ","px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ","\n"])),function(e){return e.width},function(e){return e.height},function(e){var n=e.font,t=e.background;return ae(function(e){return[e.font[n],e.bg[t].hover.press,e.disabled,e.borderRadius("oval"),e.outline.default.focus]})}),be=c.default.label(z||(z=b(["\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ",";\n align-items: center;\n cursor: pointer;\n\n ","\n"])),function(e){return r.px(e.theme.spacing[4])},ae(function(e){return[e.disabled]})),ge=c.default.input.attrs({type:"radio"})(q||(q=b(["\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ",";\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ",";\n }\n\n &:checked {\n ","\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ","\n }\n }\n\n ","\n }\n"])),function(e){var n=e.hasError,t=void 0!==n&&n;return ae(function(e){return[e.borderRadius("oval"),e.bg.text5.hover.press,t&&e.outline.assertive]})},function(e){return e.theme.color.text4},ae(function(e){return e.bg.brand.hover.press}),ae(function(e){return[e.bg.text5.hover.press,e.borderRadius("oval")]}),ae(function(e){return e.outline.default.focus})),xe=c.default.div(L||(L=b(["\n ","\n"])),ae(function(e){return[e.typography(14)]})),me=c.default.div(T||(T=b(["\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ",";\n"])),function(e){return r.px(e.theme.spacing[8])}),ye=s.default.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,hasError:!1,onChange:function(){throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?")}}),we=e.createContext({name:void 0,selected:[],disabled:!1,readonly:!1,hasError:!1,onChange:function(){throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?")}}),Ee=c.default.label(O||(O=b(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n "," {\n cursor: default;\n }\n gap: ",";\n ","\n"])),r.disabledSelector,function(e){return r.px(e.theme.spacing[4])},ae(function(e){return e.disabled})),Ce=c.default.div(N||(N=b(["\n display: flex;\n align-items: center;\n ","\n"])),ae(function(e){return[e.typography(14),e.font.text1]})),ke=c.default.input.attrs({type:"checkbox"})(D||(D=b(["\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ","\n }\n\n ",";\n }\n"])),ae(function(e){return e.bg.brand.hover.press}),function(e){var n=e.hasError,t=e.overlay;return ae(function(e){return[e.bg.text3.hover.press,e.borderRadius("oval"),n&&!t&&e.outline.assertive,t&&e.bg.surface4]})}),Se=c.default.div(M||(M=b(["\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ","\n\n ","\n"])),function(e){var n=e.hasError,t=e.overlay;return ae(function(e){return[e.width.px(24),e.height.px(24),e.borderRadius("oval"),e.font.text5,n&&t&&e.outline.assertive]})},function(e){return e.overlay&&n.css(H||(H=b(["\n border-color: ",";\n border-width: 2px;\n border-style: solid;\n "])),function(e){return e.theme.color.text5})}),Re=["className","type"],Pe=c.default.label(j||(j=b(["\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ",";\n cursor: pointer;\n outline: 0;\n\n ","\n\n "," {\n cursor: default;\n }\n"])),function(e){return r.px(e.theme.spacing[4])},ae(function(e){return e.disabled}),r.disabledSelector),ze=c.default.div(A||(A=b(["\n ","\n"])),ae(function(e){return e.typography(14)})),qe=c.default.input.attrs({type:"checkbox"})(F||(F=b(["\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ","\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ","\n }\n\n &:checked {\n ","\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n"])),ae(function(e){return[e.borderRadius(16),e.height.px(16),e.bg.text4.hover.press,e.outline.default.focus]}),ae(function(e){return[e.bg.text5.hover.press,e.borderRadius("oval")]}),ae(function(e){return e.bg.brand.hover.press})),Le=["style","className","label","required","requiredText","subLabel"],Te=s.default.forwardRef(function(e,n){var t=e.style,r=e.className,a=e.label,i=e.required,o=void 0!==i&&i,l=e.requiredText,u=e.subLabel,d=v(e,Le);/*#__PURE__*/return s.default.createElement(He,{style:t,className:r},/*#__PURE__*/s.default.createElement(Ne,h({ref:n},d),a),o&&/*#__PURE__*/s.default.createElement(De,null,l),/*#__PURE__*/s.default.createElement(Me,null,/*#__PURE__*/s.default.createElement("span",null,u)))}),Oe=f.default(c.default),Ne=c.default.label(I||(I=b(["\n ","\n"])),Oe(function(e){return[e.typography(14).bold,e.font.text1]})),De=c.default.span(G||(G=b(["\n ","\n"])),Oe(function(e){return[e.typography(14),e.font.text3]})),Me=c.default.div(B||(B=b(["\n ","\n"])),Oe(function(e){return[e.typography(14),e.font.text3.hover.press,e.outline.default.focus]})),He=c.default.div(X||(X=b(["\n display: inline-flex;\n align-items: center;\n\n > "," {\n ","\n }\n\n > "," {\n ","\n }\n"])),De,Oe(function(e){return e.margin.left(4)}),Me,Oe(function(e){return e.margin.left("auto")})),je=["onChange"],Ae=["onChange"],Fe=f.default(c.default);function Ie(){var e=arguments;return function(n){for(var t,r=x([].slice.call(e));!(t=r()).done;){var a=t.value;"function"==typeof a?a(n):null!==a&&(a.current=n)}}}function Ge(e){return Array.from(e).length}var Be=s.default.forwardRef(function(e,n){/*#__PURE__*/return s.default.createElement(void 0!==e.multiline&&e.multiline?Ve:Xe,h({ref:n},e))}),Xe=s.default.forwardRef(function(n,t){var r,a=n.onChange,i=v(n,je),o=i.className,d=i.showLabel,c=void 0!==d&&d,f=i.showCount,p=void 0!==f&&f,b=i.label,g=i.requiredText,x=i.subLabel,m=i.disabled,y=void 0!==m&&m,w=i.required,E=i.invalid,C=void 0!==E&&E,k=i.assistiveText,S=i.maxLength,R=i.prefix,P=void 0===R?"":R,z=i.suffix,q=void 0===z?"":z,L=u.useVisuallyHidden().visuallyHiddenProps,T=e.useRef(null),O=e.useRef(null),N=e.useRef(null),D=e.useState(Ge(null!=(r=i.value)?r:"")),M=D[0],H=D[1],j=e.useState(0),A=j[0],F=j[1],I=e.useState(0),G=I[0],B=I[1],X=void 0===i.value,V=e.useCallback(function(e){var n=Ge(e);void 0!==S&&n>S||(X&&H(n),null==a||a(e))},[S,X,a]);e.useEffect(function(){var e;H(Ge(null!=(e=i.value)?e:""))},[i.value]);var Y=l.useTextField(h({inputElementType:"input",isDisabled:y,isRequired:w,validationState:C?"invalid":"valid",description:!C&&k,errorMessage:C&&k,onChange:V},i),T),J=Y.inputProps,U=Y.labelProps,$=Y.descriptionProps,K=Y.errorMessageProps;return e.useEffect(function(){var e=new ResizeObserver(function(e){F(e[0].contentRect.width)}),n=new ResizeObserver(function(e){B(e[0].contentRect.width)});return null!==O.current&&e.observe(O.current),null!==N.current&&n.observe(N.current),function(){n.disconnect(),e.disconnect()}},[]),/*#__PURE__*/s.default.createElement(Ye,{className:o,isDisabled:y},/*#__PURE__*/s.default.createElement(Je,h({label:b,requiredText:g,required:w,subLabel:x},U,c?{}:L)),/*#__PURE__*/s.default.createElement(Ue,null,/*#__PURE__*/s.default.createElement($e,{ref:O},/*#__PURE__*/s.default.createElement(Qe,null,P)),/*#__PURE__*/s.default.createElement(We,h({ref:Ie(t,T),invalid:C,extraLeftPadding:A,extraRightPadding:G},J)),/*#__PURE__*/s.default.createElement(Ke,{ref:N},/*#__PURE__*/s.default.createElement(Qe,null,q),p&&S&&/*#__PURE__*/s.default.createElement(en,null,M,"/",S))),null!=k&&0!==k.length&&/*#__PURE__*/s.default.createElement(tn,h({invalid:C},C?K:$),k))}),Ve=s.default.forwardRef(function(n,t){var r,a=n.onChange,i=v(n,Ae),o=i.className,d=i.showCount,c=void 0!==d&&d,f=i.showLabel,p=void 0!==f&&f,b=i.label,g=i.requiredText,x=i.subLabel,m=i.disabled,y=void 0!==m&&m,w=i.required,E=i.invalid,C=void 0!==E&&E,k=i.assistiveText,S=i.maxLength,R=i.autoHeight,P=void 0!==R&&R,z=i.rows,q=void 0===z?4:z,L=u.useVisuallyHidden().visuallyHiddenProps,T=e.useRef(null),O=e.useRef(null),N=e.useState(Ge(null!=(r=i.value)?r:"")),D=N[0],M=N[1],H=e.useState(q),j=H[0],A=H[1],F=e.useCallback(function(e){var n,t,r=null!=(n=null==(t=(e.value+"\n").match(/\n/g))?void 0:t.length)?n:1;q<=r&&A(r)},[q]),I=void 0===i.value,G=e.useCallback(function(e){var n=Ge(e);void 0!==S&&n>S||(I&&M(n),P&&null!==T.current&&F(T.current),null==a||a(e))},[P,S,I,a,F]);e.useEffect(function(){var e;M(Ge(null!=(e=i.value)?e:""))},[i.value]);var B=l.useTextField(h({inputElementType:"textarea",isDisabled:y,isRequired:w,validationState:C?"invalid":"valid",description:!C&&k,errorMessage:C&&k,onChange:G},i),O),X=B.inputProps,V=B.labelProps,Y=B.descriptionProps,J=B.errorMessageProps;return e.useEffect(function(){P&&null!==T.current&&F(T.current)},[P,F]),/*#__PURE__*/s.default.createElement(Ye,{className:o,isDisabled:y},/*#__PURE__*/s.default.createElement(Je,h({label:b,requiredText:g,required:w,subLabel:x},V,p?L:{})),/*#__PURE__*/s.default.createElement(Ze,{rows:j},/*#__PURE__*/s.default.createElement(_e,h({ref:Ie(T,t,O),invalid:C,rows:j},X)),c&&/*#__PURE__*/s.default.createElement(nn,null,D)),null!=k&&0!==k.length&&/*#__PURE__*/s.default.createElement(tn,h({invalid:C},C?J:Y),k))}),Ye=c.default.div(V||(V=b(["\n display: flex;\n flex-direction: column;\n\n ","\n"])),function(e){return e.isDisabled&&{opacity:e.theme.elementEffect.disabled.opacity}}),Je=c.default(Te)(Y||(Y=b(["\n ","\n"])),Fe(function(e){return e.margin.bottom(8)})),Ue=c.default.div(J||(J=b(["\n height: 40px;\n display: grid;\n position: relative;\n"]))),$e=c.default.span(U||(U=b(["\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n"]))),Ke=c.default.span($||($=b(["\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n"]))),Qe=c.default.span(K||(K=b(["\n user-select: none;\n\n ","\n"])),Fe(function(e){return[e.typography(14).preserveHalfLeading,e.font.text2]})),We=c.default.input(Q||(Q=b(["\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-top: calc(9px / 0.875);\n padding-bottom: calc(9px / 0.875);\n padding-left: calc((8px + ","px) / 0.875);\n padding-right: calc((8px + ","px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ","\n\n &::placeholder {\n ","\n }\n"])),function(e){return e.extraLeftPadding},function(e){return e.extraRightPadding},function(e){return Fe(function(n){return[n.bg.surface3.hover,n.outline.default.focus,e.invalid&&n.outline.assertive,n.font.text2]})},Fe(function(e){return e.font.text3})),Ze=c.default.div(W||(W=b(["\n display: grid;\n position: relative;\n\n ",";\n"])),function(e){var t=e.rows;return n.css(Z||(Z=b(["\n max-height: calc(22px * "," + 18px);\n "])),t)}),_e=c.default.textarea(_||(_=b(["\n border: none;\n box-sizing: border-box;\n outline: none;\n resize: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) calc(8px / 0.875);\n border-radius: calc(4px / 0.875);\n\n ",";\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ","\n\n &::placeholder {\n ","\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n"])),function(e){var t=e.rows;return n.css(ee||(ee=b(["\n height: calc(22px / 0.875 * "," + 18px / 0.875);\n "])),t)},function(e){return Fe(function(n){return[n.bg.surface3.hover,n.outline.default.focus,e.invalid&&n.outline.assertive,n.font.text2]})},Fe(function(e){return e.font.text3})),en=c.default.span(ne||(ne=b(["\n ","\n"])),Fe(function(e){return[e.typography(14).preserveHalfLeading,e.font.text3]})),nn=c.default.span(te||(te=b(["\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ","\n"])),Fe(function(e){return[e.typography(14).preserveHalfLeading,e.font.text3]})),tn=c.default.p(re||(re=b(["\n ","\n"])),function(e){return Fe(function(n){return[n.typography(14),n.margin.top(8),n.margin.bottom(0),n.font[e.invalid?"assertive":"text1"]]})});exports.Button=ce,exports.Clickable=oe,exports.ComponentAbstraction=function(e){var n=e.children;/*#__PURE__*/return s.default.createElement(w.Provider,{value:h({},y,e.components)},n)},exports.IconButton=he,exports.Radio=function(n){var t=n.value,r=n.forceChecked,a=void 0!==r&&r,i=n.disabled,o=void 0!==i&&i,l=n.children,u=e.useContext(ye),d=u.name,c=u.selected,f=u.disabled,h=u.readonly,v=u.hasError,b=u.onChange;p.default(void 0!==d,'"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?');var g=t===c,x=o||f,m=h&&!g,y=e.useCallback(function(e){b(e.currentTarget.value)},[b]);/*#__PURE__*/return s.default.createElement(be,{"aria-disabled":x||m},/*#__PURE__*/s.default.createElement(ge,{name:d,value:t,checked:a||g,hasError:v,onChange:y,disabled:x||m}),null!=l&&/*#__PURE__*/s.default.createElement(xe,null,l))},exports.RadioGroup=function(n){var t=n.className,r=n.value,a=n.label,i=n.name,o=n.onChange,l=n.disabled,u=n.readonly,d=n.hasError,c=n.children,f=e.useCallback(function(e){o(e)},[o]);/*#__PURE__*/return s.default.createElement(ye.Provider,{value:{name:i,selected:r,disabled:null!=l&&l,readonly:null!=u&&u,hasError:null!=d&&d,onChange:f}},/*#__PURE__*/s.default.createElement(me,{role:"radiogroup","aria-orientation":"vertical","aria-label":a,"aria-invalid":d,className:t},c))},exports.Select=function(n){var t=n.value,r=n.forceChecked,a=void 0!==r&&r,i=n.disabled,o=void 0!==i&&i,l=n.onChange,u=n.variant,d=void 0===u?"default":u,c=n.children,f=e.useContext(we),h=f.name,v=f.selected,b=f.disabled,g=f.readonly,x=f.hasError,m=f.onChange;p.default(void 0!==h,'"name" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?');var y=v.includes(t)||a,w=o||b||g,E=e.useCallback(function(e){e.currentTarget instanceof HTMLInputElement&&(l&&l({value:t,selected:e.currentTarget.checked}),m({value:t,selected:e.currentTarget.checked}))},[l,m,t]);/*#__PURE__*/return s.default.createElement(Ee,{"aria-disabled":w},/*#__PURE__*/s.default.createElement(ke,{name:h,value:t,hasError:x,checked:y,disabled:w,onChange:E,overlay:"overlay"===d,"aria-invalid":x}),/*#__PURE__*/s.default.createElement(Se,{overlay:"overlay"===d,hasError:x,"aria-hidden":!0},/*#__PURE__*/s.default.createElement("pixiv-icon",{name:"24/Check","unsafe-non-guideline-scale":16/24})),Boolean(c)&&/*#__PURE__*/s.default.createElement(Ce,null,c))},exports.SelectGroup=function(n){var t=n.className,r=n.name,a=n.ariaLabel,i=n.selected,o=n.onChange,l=n.disabled,u=void 0!==l&&l,d=n.readonly,c=void 0!==d&&d,f=n.hasError,p=void 0!==f&&f,h=n.children,v=e.useCallback(function(e){var n=i.indexOf(e.value);e.selected?n<0&&o([].concat(i,[e.value])):n>=0&&o([].concat(i.slice(0,n),i.slice(n+1)))},[o,i]);/*#__PURE__*/return s.default.createElement(we.Provider,{value:{name:r,selected:Array.from(new Set(i)),disabled:u,readonly:c,hasError:p,onChange:v}},/*#__PURE__*/s.default.createElement("div",{className:t,"aria-label":a,"data-testid":"SelectGroup"},h))},exports.Switch=function(n){var t=n.disabled,r=n.className,a=e.useMemo(function(){return h({},n,{"aria-label":"children"in n?void 0:n.label,isDisabled:n.disabled,isSelected:n.checked})},[n]),l=o.useToggleState(a),u=e.useRef(null),d=v(i.useSwitch(a,l,u).inputProps,Re);/*#__PURE__*/return s.default.createElement(Pe,{className:r,"aria-disabled":t},/*#__PURE__*/s.default.createElement(qe,h({},d,{ref:u})),"children"in n?/*#__PURE__*/s.default.createElement(ze,null,n.children):void 0)},exports.TextField=Be,exports.useComponentAbstraction=E;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/core/ComponentAbstraction.tsx","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/Switch/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/TextField/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\ninterface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","import styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.text5.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ${({ theme }) => px(theme.spacing[4])};\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => o.typography(14))}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport createTheme from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: string\n readonly suffix?: string\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countStringInCodePoints(string: string) {\n return [...string].length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = '',\n suffix = '',\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countStringInCodePoints(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const handleChange = useCallback(\n (value: string) => {\n const count = countStringInCodePoints(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n setCount(count)\n onChange?.(value)\n },\n [maxLength, onChange]\n )\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && maxLength && (\n <SingleLineCounter>\n {count}/{maxLength}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countStringInCodePoints(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = `${textarea.value}\\n`.match(/\\n/gu)?.length ?? 1\n if (initialRows <= rows) {\n setRows(rows)\n }\n },\n [initialRows]\n )\n\n const handleChange = useCallback(\n (value: string) => {\n const count = countStringInCodePoints(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n setCount(count)\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, onChange, syncHeight]\n )\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer rows={rows}>\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n invalid={invalid}\n rows={rows}\n {...inputProps}\n />\n {showCount && <MultiLineCounter>{count}</MultiLineCounter>}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-top: calc(9px / 0.875);\n padding-bottom: calc(9px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number }>`\n display: grid;\n position: relative;\n\n ${({ rows }) => css`\n max-height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ invalid: boolean }>`\n border: none;\n box-sizing: border-box;\n outline: none;\n resize: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) calc(8px / 0.875);\n border-radius: calc(4px / 0.875);\n\n ${({ rows }) => css`\n height: calc(22px / 0.875 * ${rows} + 18px / 0.875);\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n"],"names":["DefaultValue","Link","React","forwardRef","ref","to","children","rest","href","ComponentAbstractionContext","createContext","useComponentAbstraction","useContext","theme","createTheme","styled","Clickable","props","onClick","disabled","A","as","undefined","Button","clickableCss","css","disabledSelector","button","span","variant","size","fixed","StyledButton","withConfig","shouldForwardProp","prop","attrs","font","background","value","Error","arguments","length","JSON","stringify","unreachable","variantToProps","height","padding","sizeToProps","p","o","hover","press","bg","typography","bold","preserveHalfLeading","horizontal","borderRadius","outline","focus","IconButton","icon","requiredIconSize","result","exec","iconSize","console","warn","validateIconSize","StyledIconButton","name","width","RadioRoot","label","px","spacing","RadioInput","input","type","hasError","text5","assertive","color","text4","brand","RadioLabel","div","StyledRadioGroup","RadioGroupContext","selected","readonly","onChange","Label","LabelInner","SwitchInput","FieldLabel","style","className","required","requiredText","subLabel","labelProps","FieldLabelWrapper","RequiredText","SubLabelClickable","text1","text3","margin","left","mergeRefs","current","countStringInCodePoints","string","TextField","multiline","MultiLineTextField","SingleLineTextField","showLabel","showCount","invalid","assistiveText","maxLength","prefix","suffix","visuallyHiddenProps","useVisuallyHidden","ariaRef","useRef","prefixRef","suffixRef","useState","count","setCount","prefixWidth","setPrefixWidth","suffixWidth","setSuffixWidth","handleChange","useCallback","useTextField","inputElementType","isDisabled","isRequired","validationState","description","errorMessage","inputProps","descriptionProps","errorMessageProps","useEffect","prefixObserver","ResizeObserver","entries","contentRect","suffixObserver","observe","disconnect","TextFieldRoot","TextFieldLabel","StyledInputContainer","PrefixContainer","Affix","StyledInput","extraLeftPadding","extraRightPadding","SuffixContainer","SingleLineCounter","AssistiveText","autoHeight","rows","initialRows","textareaRef","setRows","syncHeight","textarea","match","_$match","StyledTextareaContainer","StyledTextarea","MultiLineCounter","opacity","elementEffect","bottom","text2","surface3","top","Provider","components","forceChecked","isParentDisabled","warning","isSelected","isReadonly","e","currentTarget","checked","next","role","ariaSwitchProps","useMemo","state","useToggleState","useSwitch"],"mappings":"ooDAuBMA,EAA2B,CAC/BC,KAfyBC,UAAMC,WAC/B,WAAgDC,OAAzBC,IAAAA,GAAIC,IAAAA,SAAaC,sBACtC,OACEL,+BAAGM,KAAMH,EAAID,IAAKA,GAASG,GACxBD,MAcHG,EAA8BP,UAAMQ,cAAcV,YAiBxCW,IACd,OAAOC,aAAWH,mEC3CPI,EAAQC,UAAYC,qCCyB3BC,GAAYd,UAAMC,WACtB,SAAmBc,EAAOb,GACxB,IAAQH,EAASU,IAATV,KACR,GAAI,OAAQgB,EAAO,CACjB,IAAQC,EAAuCD,EAAvCC,UAAuCD,EAA9BE,SAAAA,gBAAqBZ,IAASU,mBAC/C,OACEf,wBAACkB,QACKb,GACJc,GAAIF,OAAWG,EAAYrB,EAC3BiB,QAASC,OAAWG,EAAYJ,EAChC,gBAAeC,EACff,IAAKA,kBAIT,OAAOF,wBAACqB,QAAWN,GAAOb,IAAKA,OAM/BoB,GAAeC,0GAIjBC,oBAKEH,GAASR,UAAOY,utBAkClBH,IAGEJ,GAAIL,UAAOa,uKAYbJ,wDChFED,GAASrB,UAAMC,WAA0C,WAS7DC,OAPEE,IAAAA,aACAuB,QAAAA,aAAU,gBACVC,KAAAA,aAAO,UACPC,MAAAA,oBACAZ,SAAAA,gBACGZ,uBAIL,OACEL,wBAAC8B,QACKzB,GACJY,SAAUA,EACVU,QAASA,EACTC,KAAMA,EACNC,MAAOA,EACP3B,IAAKA,IAEJE,KAMD0B,GAAejB,UAAOC,IACzBiB,WAAwB,CACvBC,2BAAkBC,GAEhB,MAAgB,UAATA,KAGVC,MAwBH,SAAqBnB,GACnB,YACKA,EAMP,SAAwBY,GACtB,OAAQA,GACN,IAAK,UACH,MAAO,CAAEQ,KAAM,QAASC,WAAY,YACtC,IAAK,UACH,MAAO,CAAED,KAAM,QAASC,WAAY,YACtC,IAAK,UACH,MAAO,CAAED,KAAM,QAASC,WAAY,SACtC,IAAK,aACH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ACzBhH,SAAUA,EACVY,SAAU8C,EACVxH,SAAU4H,GAAcmD,IAEb,MAAZ5L,gBAAoBJ,wBAACqF,QAAYjF,wCAyGtC6F,IAAAA,UACA5D,IAAAA,MACAoC,IAAAA,MACAH,IAAAA,KACAqB,IAAAA,SACA1E,IAAAA,SACAyE,IAAAA,SACAX,IAAAA,SACA3E,IAAAA,SAEMqI,EAAeC,cACnB,SAAC0D,GACCzG,EAASyG,IAEX,CAACzG,iBAGH,OACE3F,wBAACwF,GAAkBkG,UACjBrJ,MAAO,CACLiC,KAAAA,EACAmB,SAAUpD,EACVpB,eAAUA,GAAAA,EACVyE,eAAUA,GAAAA,EACVX,eAAUA,GAAAA,EACVY,SAAU8C,iBAGZzI,wBAACuF,IACC8G,KAAK,aACL,mBAAiB,WACjB,aAAY5H,EACZ,eAAcM,EACdkB,UAAWA,GAEV7F,6BCzK8BW,GACrC,IAAQE,EAAwBF,EAAxBE,SAAUgF,EAAclF,EAAdkF,UAEZqG,EAAmCC,UACvC,uBACKxL,GAGH,aAAc,aAAcA,OAAQK,EAAYL,EAAM0D,MACtDoE,WAAY9H,EAAME,SAClB8K,WAAYhL,EAAMoL,WAEpB,CAACpL,IAGGyL,EAAQC,iBAAeH,GACvBpM,EAAM6H,SAAyB,MAEkB1H,IACnDqM,YAAUJ,EAAiBE,EAAOtM,GADpCgJ,4BAGF,OACElJ,wBAAC4F,IAAMK,UAAWA,EAAW,gBAAehF,gBAC1CjB,wBAAC8F,QAAgBzF,GAAMH,IAAKA,KAC3B,aAAca,eAEbf,wBAAC6F,QAAY9E,EAAMX,eACjBgB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/core/ComponentAbstraction.tsx","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/Select/context.ts","../src/components/Select/index.tsx","../src/components/Switch/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/TextField/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\ninterface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","import styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.text5.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import { createContext } from 'react'\n\ntype SelectGroupContext = {\n name: string\n selected: string[]\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: ({ value, selected }: { value: string; selected: boolean }) => void\n}\n\nexport const SelectGroupContext = createContext<SelectGroupContext>({\n name: undefined as never,\n selected: [],\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?'\n )\n },\n})\n","import React, { ChangeEvent, useCallback, useContext } from 'react'\nimport styled, { css } from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nimport { SelectGroupContext } from './context'\n\nexport type SelectProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n variant?: 'default' | 'overlay'\n onChange?: (payload: { value: string; selected: boolean }) => void\n}>\n\nexport default function Select({\n value,\n forceChecked = false,\n disabled = false,\n onChange,\n variant = 'default',\n children,\n}: SelectProps) {\n const {\n name,\n selected,\n disabled: parentDisabled,\n readonly,\n hasError,\n onChange: parentOnChange,\n } = useContext(SelectGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?`\n )\n\n const isSelected = selected.includes(value) || forceChecked\n const isDisabled = disabled || parentDisabled || readonly\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!(event.currentTarget instanceof HTMLInputElement)) {\n return\n }\n if (onChange) onChange({ value, selected: event.currentTarget.checked })\n parentOnChange({ value, selected: event.currentTarget.checked })\n },\n [onChange, parentOnChange, value]\n )\n\n return (\n <SelectRoot aria-disabled={isDisabled}>\n <SelectInput\n {...{\n name,\n value,\n hasError,\n }}\n checked={isSelected}\n disabled={isDisabled}\n onChange={handleChange}\n overlay={variant === 'overlay'}\n aria-invalid={hasError}\n />\n <SelectInputOverlay\n overlay={variant === 'overlay'}\n hasError={hasError}\n aria-hidden={true}\n >\n <pixiv-icon name=\"24/Check\" unsafe-non-guideline-scale={16 / 24} />\n </SelectInputOverlay>\n {Boolean(children) && <SelectLabel>{children}</SelectLabel>}\n </SelectRoot>\n )\n}\n\nconst SelectRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => o.disabled)}\n`\n\nconst SelectLabel = styled.div`\n display: flex;\n align-items: center;\n ${theme((o) => [o.typography(14), o.font.text1])}\n`\n\nconst SelectInput = styled.input.attrs({ type: 'checkbox' })<{\n hasError: boolean\n overlay: boolean\n}>`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.bg.text3.hover.press,\n o.borderRadius('oval'),\n hasError && !overlay && o.outline.assertive,\n overlay && o.bg.surface4,\n ])};\n }\n`\n\nconst SelectInputOverlay = styled.div<{ overlay: boolean; hasError: boolean }>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.width.px(24),\n o.height.px(24),\n o.borderRadius('oval'),\n o.font.text5,\n hasError && overlay && o.outline.assertive,\n ])}\n\n ${({ overlay }) =>\n overlay &&\n css`\n border-color: ${({ theme }) => theme.color.text5};\n border-width: 2px;\n border-style: solid;\n `}\n`\n\nexport type SelectGroupProps = React.PropsWithChildren<{\n className?: string\n name: string\n ariaLabel: string\n selected: string[]\n onChange: (selected: string[]) => void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\nexport function SelectGroup({\n className,\n name,\n ariaLabel,\n selected,\n onChange,\n disabled = false,\n readonly = false,\n hasError = false,\n children,\n}: SelectGroupProps) {\n const handleChange = useCallback(\n (payload: { value: string; selected: boolean }) => {\n const index = selected.indexOf(payload.value)\n\n if (payload.selected) {\n if (index < 0) {\n onChange([...selected, payload.value])\n }\n } else {\n if (index >= 0) {\n onChange([...selected.slice(0, index), ...selected.slice(index + 1)])\n }\n }\n },\n [onChange, selected]\n )\n\n return (\n <SelectGroupContext.Provider\n value={{\n name,\n selected: Array.from(new Set(selected)),\n disabled,\n readonly,\n hasError,\n onChange: handleChange,\n }}\n >\n <div\n className={className}\n aria-label={ariaLabel}\n data-testid=\"SelectGroup\"\n >\n {children}\n </div>\n </SelectGroupContext.Provider>\n )\n}\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ${({ theme }) => px(theme.spacing[4])};\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => o.typography(14))}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport createTheme from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: string\n readonly suffix?: string\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = '',\n suffix = '',\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && maxLength && (\n <SingleLineCounter>\n {count}/{maxLength}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = `${textarea.value}\\n`.match(/\\n/gu)?.length ?? 1\n if (initialRows <= rows) {\n setRows(rows)\n }\n },\n [initialRows]\n )\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, nonControlled, onChange, syncHeight]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer rows={rows}>\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n invalid={invalid}\n rows={rows}\n {...inputProps}\n />\n {showCount && <MultiLineCounter>{count}</MultiLineCounter>}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-top: calc(9px / 0.875);\n padding-bottom: calc(9px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number }>`\n display: grid;\n position: relative;\n\n ${({ rows }) => css`\n max-height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ invalid: boolean }>`\n border: none;\n box-sizing: border-box;\n outline: none;\n resize: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) calc(8px / 0.875);\n border-radius: calc(4px / 0.875);\n\n ${({ rows }) => css`\n height: calc(22px / 0.875 * ${rows} + 18px / 0.875);\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n"],"names":["DefaultValue","Link","React","forwardRef","ref","to","children","rest","href","ComponentAbstractionContext","createContext","useComponentAbstraction","useContext","theme","createTheme","styled","Clickable","props","onClick","disabled","A","as","undefined","Button","clickableCss","css","disabledSelector","button","span","variant","size","fixed","StyledButton","withConfig","shouldForwardProp","prop","attrs","font","background","value","Error","arguments","length","JSON","stringify","unreachable","variantToProps","height","padding","sizeToProps","p","o","hover","press","bg","typography","bold","preserveHalfLeading","horizontal","borderRadius","outline","focus","IconButton","icon","requiredIconSize","result","exec","iconSize","console","warn","validateIconSize","StyledIconButton","name","width","RadioRoot","label","px","spacing","RadioInput","input","type","hasError","text5","assertive","color","text4","brand","RadioLabel","div","StyledRadioGroup","RadioGroupContext","selected","readonly","onChange","SelectGroupContext","SelectRoot","SelectLabel","text1","SelectInput","overlay","text3","surface4","SelectInputOverlay","Label","LabelInner","SwitchInput","FieldLabel","style","className","required","requiredText","subLabel","labelProps","FieldLabelWrapper","RequiredText","SubLabelClickable","margin","left","mergeRefs","current","countCodePointsInString","string","Array","from","TextField","multiline","MultiLineTextField","SingleLineTextField","showLabel","showCount","invalid","assistiveText","maxLength","prefix","suffix","visuallyHiddenProps","useVisuallyHidden","ariaRef","useRef","prefixRef","suffixRef","useState","count","setCount","prefixWidth","setPrefixWidth","suffixWidth","setSuffixWidth","nonControlled","handleChange","useCallback","useEffect","useTextField","inputElementType","isDisabled","isRequired","validationState","description","errorMessage","inputProps","descriptionProps","errorMessageProps","prefixObserver","ResizeObserver","entries","contentRect","suffixObserver","observe","disconnect","TextFieldRoot","TextFieldLabel","StyledInputContainer","PrefixContainer","Affix","StyledInput","extraLeftPadding","extraRightPadding","SuffixContainer","SingleLineCounter","AssistiveText","autoHeight","rows","initialRows","textareaRef","setRows","syncHeight","textarea","match","_$match","StyledTextareaContainer","StyledTextarea","MultiLineCounter","opacity","elementEffect","bottom","text2","surface3","top","Provider","components","forceChecked","isParentDisabled","warning","isSelected","isReadonly","e","currentTarget","checked","next","role","parentDisabled","parentOnChange","includes","event","HTMLInputElement","Boolean","ariaLabel","payload","index","indexOf","slice","Set","ariaSwitchProps","useMemo","state","useToggleState","useSwitch"],"mappings":"ooDAuBMA,EAA2B,CAC/BC,KAfyBC,UAAMC,WAC/B,WAAgDC,OAAzBC,IAAAA,GAAIC,IAAAA,SAAaC,sBACtC,OACEL,+BAAGM,KAAMH,EAAID,IAAKA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ACApC,IAAAA,KACAgJ,IAAAA,UACA7H,IAAAA,SACAE,IAAAA,aACA1E,SAAAA,oBACAyE,SAAAA,oBACAX,SAAAA,gBACA3E,IAAAA,SAEM+I,EAAeC,cACnB,SAACmE,GACC,IAAMC,EAAQ/H,EAASgI,QAAQF,EAAQlL,OAEnCkL,EAAQ9H,SACN+H,EAAQ,GACV7H,YAAaF,GAAU8H,EAAQlL,SAG7BmL,GAAS,GACX7H,YAAaF,EAASiI,MAAM,EAAGF,GAAW/H,EAASiI,MAAMF,EAAQ,MAIvE,CAAC7H,EAAUF,iBAGb,OACEzF,wBAAC4F,GAAmBwG,UAClB/J,MAAO,CACLiC,KAAAA,EACAmB,SAAU+B,MAAMC,KAAK,IAAIkG,IAAIlI,IAC7BxE,SAAAA,EACAyE,SAAAA,EACAX,SAAAA,EACAY,SAAUwD,iBAGZnJ,+BACE0G,UAAWA,EACX,aAAY4G,EACZ,cAAY,eAEXlN,6BCpL8BW,GACrC,IAAQE,EAAwBF,EAAxBE,SAAUyF,EAAc3F,EAAd2F,UAEZkH,EAAmCC,UACvC,uBACK9M,GAGH,aAAc,aAAcA,OAAQK,EAAYL,EAAM0D,MACtD+E,WAAYzI,EAAME,SAClBwL,WAAY1L,EAAM8L,WAEpB,CAAC9L,IAGG+M,EAAQC,iBAAeH,GACvB1N,EAAMsI,SAAyB,MAEkBnI,IACnD2N,YAAUJ,EAAiBE,EAAO5N,GADpC2J,4BAGF,OACE7J,wBAACqG,IAAMK,UAAWA,EAAW,gBAAezF,gBAC1CjB,wBAACuG,QAAgBlG,GAAMH,IAAKA,KAC3B,aAAca,eAEbf,wBAACsG,QAAYvF,EAAMX,eACjBgB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Button, type ButtonProps } from './components/Button';
|
|
|
3
3
|
export { default as Clickable, type ClickableProps, type ClickableElement, } from './components/Clickable';
|
|
4
4
|
export { default as IconButton, type IconButtonProps, } from './components/IconButton';
|
|
5
5
|
export { default as Radio, type RadioProps, RadioGroup, type RadioGroupProps, } from './components/Radio';
|
|
6
|
+
export { default as Select, type SelectProps, SelectGroup, type SelectGroupProps, } from './components/Select';
|
|
6
7
|
export { default as Switch, type SwitchProps } from './components/Switch';
|
|
7
8
|
export { default as TextField, type TextFieldProps, } from './components/TextField';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|