@yumehiko/jp-ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/icon-button/IconButton.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/docs/llm/components/Accordion.md +42 -0
- package/docs/llm/components/AlertDialog.md +66 -0
- package/docs/llm/components/Autocomplete.md +95 -0
- package/docs/llm/components/Avatar.md +33 -0
- package/docs/llm/components/Button.md +54 -0
- package/docs/llm/components/Checkbox.md +173 -0
- package/docs/llm/components/CheckboxGroup.md +201 -0
- package/docs/llm/components/Collapsible.md +40 -0
- package/docs/llm/components/Combobox.md +269 -0
- package/docs/llm/components/ContextMenu.md +489 -0
- package/docs/llm/components/Dialog.md +79 -0
- package/docs/llm/components/Field.md +80 -0
- package/docs/llm/components/Fieldset.md +50 -0
- package/docs/llm/components/Form.md +105 -0
- package/docs/llm/components/IconButton.md +46 -0
- package/docs/llm/components/Input.md +19 -0
- package/docs/llm/components/InputBox.md +85 -0
- package/docs/llm/components/Menu.md +591 -0
- package/docs/llm/components/Menubar.md +545 -0
- package/docs/llm/components/Meter.md +22 -0
- package/docs/llm/components/NavigationMenu.md +461 -0
- package/docs/llm/components/NumberField.md +205 -0
- package/docs/llm/components/Popover.md +39 -0
- package/docs/llm/components/PreviewCard.md +181 -0
- package/docs/llm/components/Progress.md +38 -0
- package/docs/llm/components/Radio.md +174 -0
- package/docs/llm/components/ScrollArea.md +45 -0
- package/docs/llm/components/Select.md +75 -0
- package/docs/llm/components/Slider.md +31 -0
- package/docs/llm/components/Switch.md +188 -0
- package/docs/llm/components/Tabs.md +48 -0
- package/docs/llm/components/Toast.md +102 -0
- package/docs/llm/components/Toolbar.md +53 -0
- package/docs/llm/components/Tooltip.md +85 -0
- package/docs/llm/components/node-graph/CanvasBackground.md +58 -0
- package/docs/llm/components/node-graph/MarqueeSelection.md +65 -0
- package/docs/llm/components/node-graph/Node.md +72 -0
- package/docs/llm/components/node-graph/Pin.md +55 -0
- package/docs/llm/components/node-graph/Port.md +49 -0
- package/docs/llm/components/node-graph/PortAddButton.md +53 -0
- package/docs/llm/components/node-graph/PortLabel.md +42 -0
- package/docs/llm/components/node-graph/Wire.md +76 -0
- package/docs/llm/pages/ColorsPage.md +158 -0
- package/docs/llm/pages/ExampleAppPage.md +1533 -0
- package/docs/llm/pages/NodeEditorSamplePage.md +619 -0
- package/docs/llm/pages/RecipesPage.md +916 -0
- package/docs/llm/pages/ThemePreviewPage.md +121 -0
- package/docs/llm/pages/TogglePage.md +236 -0
- package/docs/llm/pages/TypesettingPage.md +111 -0
- package/package.json +2 -1
- package/dist/components/button/IconButton.d.ts.map +0 -1
- /package/dist/components/{button → icon-button}/IconButton.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAI7D,KAAK,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAC/D,KAAK,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpC,KAAK,eAAe,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,UAAU,CAAC,GAAG;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,UAAU,qFAgBtB,CAAC"}
|
|
@@ -4,7 +4,7 @@ export * from './autocomplete/Autocomplete';
|
|
|
4
4
|
export * from './autocomplete/AutocompleteInputBox';
|
|
5
5
|
export * from './avatar/Avatar';
|
|
6
6
|
export * from './button/Button';
|
|
7
|
-
export * from './button/IconButton';
|
|
7
|
+
export * from './icon-button/IconButton';
|
|
8
8
|
export * from './checkbox/Checkbox';
|
|
9
9
|
export * from './checkbox-group/CheckboxGroup';
|
|
10
10
|
export * from './collapsible/Collapsible';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
Source: src/components/accordion/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
AccordionContent,
|
|
10
|
+
AccordionHeader,
|
|
11
|
+
AccordionItem,
|
|
12
|
+
AccordionPanel,
|
|
13
|
+
AccordionRoot,
|
|
14
|
+
AccordionTrigger,
|
|
15
|
+
} from '..';
|
|
16
|
+
|
|
17
|
+
export function Example() {
|
|
18
|
+
return (
|
|
19
|
+
<AccordionRoot>
|
|
20
|
+
<AccordionItem>
|
|
21
|
+
<AccordionHeader>
|
|
22
|
+
<AccordionTrigger>Accordion Example</AccordionTrigger>
|
|
23
|
+
</AccordionHeader>
|
|
24
|
+
<AccordionPanel>
|
|
25
|
+
<AccordionContent className="typesetting-body">
|
|
26
|
+
パネルの内容は後で調整できます。必要なら専用デザインを選択して下さい。
|
|
27
|
+
</AccordionContent>
|
|
28
|
+
</AccordionPanel>
|
|
29
|
+
</AccordionItem>
|
|
30
|
+
</AccordionRoot>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Source: dist/components/accordion/Accordion.d.ts
|
|
37
|
+
|
|
38
|
+
## Types
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
type AccordionContentProps = useRender.ComponentProps<'div'>;
|
|
42
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Alert Dialog
|
|
2
|
+
|
|
3
|
+
Source: src/components/alert-dialog/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Button } from '..';
|
|
9
|
+
import {
|
|
10
|
+
AlertDialogActions,
|
|
11
|
+
AlertDialogBackdrop,
|
|
12
|
+
AlertDialogCaption,
|
|
13
|
+
AlertDialogClose,
|
|
14
|
+
AlertDialogContent,
|
|
15
|
+
AlertDialogDescription,
|
|
16
|
+
AlertDialogPopup,
|
|
17
|
+
AlertDialogPortal,
|
|
18
|
+
AlertDialogRoot,
|
|
19
|
+
AlertDialogTrigger,
|
|
20
|
+
AlertDialogTitle,
|
|
21
|
+
AlertDialogViewport,
|
|
22
|
+
} from '..';
|
|
23
|
+
|
|
24
|
+
export function Example() {
|
|
25
|
+
return (
|
|
26
|
+
<AlertDialogRoot>
|
|
27
|
+
<AlertDialogTrigger render={(props) => <Button {...props}>AlertDialogを開く</Button>} />
|
|
28
|
+
<AlertDialogPortal>
|
|
29
|
+
<AlertDialogBackdrop />
|
|
30
|
+
<AlertDialogViewport>
|
|
31
|
+
<AlertDialogPopup>
|
|
32
|
+
<AlertDialogContent>
|
|
33
|
+
<AlertDialogTitle>Discard draft?</AlertDialogTitle>
|
|
34
|
+
<AlertDialogDescription>You can't undo this action.</AlertDialogDescription>
|
|
35
|
+
<AlertDialogCaption>Changes will be lost permanently.</AlertDialogCaption>
|
|
36
|
+
</AlertDialogContent>
|
|
37
|
+
<AlertDialogActions>
|
|
38
|
+
<AlertDialogClose
|
|
39
|
+
render={(props) => (
|
|
40
|
+
<Button {...props} variant="ghost">
|
|
41
|
+
キャンセル
|
|
42
|
+
</Button>
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
<AlertDialogClose render={(props) => <Button {...props}>破棄する</Button>} />
|
|
46
|
+
</AlertDialogActions>
|
|
47
|
+
</AlertDialogPopup>
|
|
48
|
+
</AlertDialogViewport>
|
|
49
|
+
</AlertDialogPortal>
|
|
50
|
+
</AlertDialogRoot>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Source: dist/components/alert-dialog/AlertDialog.d.ts
|
|
57
|
+
|
|
58
|
+
## Types
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
type AlertDialogContentProps = useRender.ComponentProps<'div'>;
|
|
62
|
+
|
|
63
|
+
type AlertDialogActionsProps = useRender.ComponentProps<'div'>;
|
|
64
|
+
|
|
65
|
+
type AlertDialogCaptionProps = useRender.ComponentProps<'p'>;
|
|
66
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Autocomplete
|
|
2
|
+
|
|
3
|
+
Source: src/components/autocomplete/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { AutocompleteInputBox } from '..';
|
|
10
|
+
import {
|
|
11
|
+
AutocompletePortal,
|
|
12
|
+
AutocompletePositioner,
|
|
13
|
+
AutocompletePopup,
|
|
14
|
+
AutocompleteList,
|
|
15
|
+
AutocompleteItem,
|
|
16
|
+
AutocompleteEmpty,
|
|
17
|
+
} from '..';
|
|
18
|
+
|
|
19
|
+
const tags = [
|
|
20
|
+
'feature',
|
|
21
|
+
'fix',
|
|
22
|
+
'bug',
|
|
23
|
+
'docs',
|
|
24
|
+
'internal',
|
|
25
|
+
'mobile',
|
|
26
|
+
'component: accordion',
|
|
27
|
+
'component: alert dialog',
|
|
28
|
+
'component: autocomplete',
|
|
29
|
+
'component: avatar',
|
|
30
|
+
'component: checkbox',
|
|
31
|
+
'component: dialog',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export function Example() {
|
|
35
|
+
const [value, setValue] = React.useState('com');
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<AutocompleteInputBox
|
|
39
|
+
items={tags}
|
|
40
|
+
value={value}
|
|
41
|
+
onValueChange={setValue}
|
|
42
|
+
placeholder="e.g. feature"
|
|
43
|
+
rootProps={{ defaultOpen: true }}
|
|
44
|
+
fieldProps={{ label: 'Search tags' }}
|
|
45
|
+
>
|
|
46
|
+
<AutocompletePortal>
|
|
47
|
+
<AutocompletePositioner sideOffset={8}>
|
|
48
|
+
<AutocompletePopup>
|
|
49
|
+
<AutocompleteEmpty>No tags found.</AutocompleteEmpty>
|
|
50
|
+
<AutocompleteList>
|
|
51
|
+
{(tag: string) => (
|
|
52
|
+
<AutocompleteItem key={tag} value={tag}>
|
|
53
|
+
{tag}
|
|
54
|
+
</AutocompleteItem>
|
|
55
|
+
)}
|
|
56
|
+
</AutocompleteList>
|
|
57
|
+
</AutocompletePopup>
|
|
58
|
+
</AutocompletePositioner>
|
|
59
|
+
</AutocompletePortal>
|
|
60
|
+
</AutocompleteInputBox>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Source: dist/components/autocomplete/AutocompleteInputBox.d.ts
|
|
67
|
+
|
|
68
|
+
## Types
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
type AutocompleteRootProps = React.ComponentPropsWithoutRef<typeof AutocompleteRoot>;
|
|
72
|
+
|
|
73
|
+
type InputBoxProps = React.ComponentPropsWithoutRef<typeof InputBox>;
|
|
74
|
+
|
|
75
|
+
type FieldProps = Omit<React.ComponentPropsWithoutRef<typeof Field>, 'children'>;
|
|
76
|
+
|
|
77
|
+
type ControlledAutocompleteInputBoxProps = {
|
|
78
|
+
value: string;
|
|
79
|
+
defaultValue?: never;
|
|
80
|
+
onValueChange: (value: string) => void;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type UncontrolledAutocompleteInputBoxProps = {
|
|
84
|
+
value?: undefined;
|
|
85
|
+
defaultValue?: string;
|
|
86
|
+
onValueChange?: (value: string) => void;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type AutocompleteInputBoxProps = Omit<InputBoxProps, 'inputComponent' | 'value' | 'defaultValue' | 'onValueChange'> & {
|
|
90
|
+
items: AutocompleteRootProps['items'];
|
|
91
|
+
rootProps?: Omit<AutocompleteRootProps, 'items' | 'value' | 'defaultValue' | 'onValueChange' | 'children'>;
|
|
92
|
+
fieldProps?: FieldProps;
|
|
93
|
+
children?: React.ReactNode;
|
|
94
|
+
} & (ControlledAutocompleteInputBoxProps | UncontrolledAutocompleteInputBoxProps);
|
|
95
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
Source: src/components/avatar/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import avatarImage from '../../assets/images/avator.jpg';
|
|
9
|
+
import { AvatarFallback, AvatarImage, AvatarRoot } from '..';
|
|
10
|
+
|
|
11
|
+
export function Example() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<AvatarRoot>
|
|
15
|
+
<AvatarImage src={avatarImage} width="96" height="96" alt="" />
|
|
16
|
+
<AvatarFallback>YM</AvatarFallback>
|
|
17
|
+
</AvatarRoot>
|
|
18
|
+
<AvatarRoot>
|
|
19
|
+
<AvatarFallback>YM</AvatarFallback>
|
|
20
|
+
</AvatarRoot>
|
|
21
|
+
<AvatarRoot
|
|
22
|
+
style={{
|
|
23
|
+
['--avatar-size' as string]: '32px',
|
|
24
|
+
['--avatar-text-offset' as string]: '0.06em',
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<AvatarFallback>YM</AvatarFallback>
|
|
28
|
+
</AvatarRoot>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
Source: src/components/button/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Button } from '..';
|
|
10
|
+
|
|
11
|
+
type ExampleProps = React.ComponentProps<typeof Button>;
|
|
12
|
+
|
|
13
|
+
export function Example(props: ExampleProps) {
|
|
14
|
+
const { children = 'Submit', variant = 'filled', ...rest } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Button {...rest} variant={variant}>
|
|
18
|
+
{children}
|
|
19
|
+
</Button>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Source: dist/components/button/Button.d.ts
|
|
26
|
+
|
|
27
|
+
## Types
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'ghost';
|
|
31
|
+
|
|
32
|
+
type ButtonSize = 'large' | 'small';
|
|
33
|
+
|
|
34
|
+
type ButtonProps = React.ComponentPropsWithoutRef<typeof BaseButton> & {
|
|
35
|
+
variant?: ButtonVariant;
|
|
36
|
+
size?: ButtonSize;
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Source: dist/components/button/IconButton.d.ts
|
|
41
|
+
|
|
42
|
+
## Types
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'ghost';
|
|
46
|
+
|
|
47
|
+
type ButtonSize = 'large' | 'small';
|
|
48
|
+
|
|
49
|
+
type IconButtonProps = React.ComponentPropsWithoutRef<typeof BaseButton> & {
|
|
50
|
+
'aria-label': string;
|
|
51
|
+
variant?: ButtonVariant;
|
|
52
|
+
size?: ButtonSize;
|
|
53
|
+
};
|
|
54
|
+
```
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
Source: src/components/checkbox/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Checkbox } from '..';
|
|
10
|
+
import styles from './Checkbox.module.css';
|
|
11
|
+
|
|
12
|
+
type ExampleProps = React.ComponentProps<typeof Checkbox>;
|
|
13
|
+
|
|
14
|
+
const labelClassName = `typesetting-label typesetting-tsumegumi ${styles.Label}`;
|
|
15
|
+
|
|
16
|
+
export function Example(props: ExampleProps) {
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
19
|
+
<label className={labelClassName}>
|
|
20
|
+
<Checkbox {...props} />
|
|
21
|
+
通知を有効にする
|
|
22
|
+
</label>
|
|
23
|
+
<label className={labelClassName}>
|
|
24
|
+
<Checkbox {...props} defaultChecked />
|
|
25
|
+
通知を有効にする(選択済み)
|
|
26
|
+
</label>
|
|
27
|
+
<label className={labelClassName}>
|
|
28
|
+
<Checkbox {...props} disabled />
|
|
29
|
+
通知を有効にする(無効)
|
|
30
|
+
</label>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Source: src/components/checkbox/Checkbox.module.css
|
|
38
|
+
|
|
39
|
+
## Styles
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
.Label {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
color: var(--on-surface);
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.Label:has(.Checkbox[data-disabled]) {
|
|
51
|
+
opacity: 0.2;
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.Checkbox {
|
|
56
|
+
position: relative;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
width: 24px;
|
|
59
|
+
height: 24px;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
padding: 0;
|
|
63
|
+
margin: 0;
|
|
64
|
+
border: 0;
|
|
65
|
+
background-color: transparent;
|
|
66
|
+
color: var(--inverse-on-surface);
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
outline: none;
|
|
69
|
+
|
|
70
|
+
--checkbox-state-opacity: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.Checkbox::after {
|
|
74
|
+
content: "";
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: calc(-1 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
77
|
+
top: calc(-1 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
78
|
+
width: calc(24px + 2 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
79
|
+
height: calc(24px + 2 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
80
|
+
border: var(--focus-ring-width) solid var(--focus-ring-color);
|
|
81
|
+
border-radius: var(--radius-full);
|
|
82
|
+
opacity: 0;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.Box {
|
|
87
|
+
position: absolute;
|
|
88
|
+
left: 4px;
|
|
89
|
+
top: 4px;
|
|
90
|
+
width: 16px;
|
|
91
|
+
height: 16px;
|
|
92
|
+
border-radius: var(--radius-xs);
|
|
93
|
+
border: 1px solid var(--outline);
|
|
94
|
+
background-color: transparent;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.StateLayer {
|
|
98
|
+
position: absolute;
|
|
99
|
+
left: -4px;
|
|
100
|
+
top: -4px;
|
|
101
|
+
width: 32px;
|
|
102
|
+
height: 32px;
|
|
103
|
+
border-radius: var(--radius-full);
|
|
104
|
+
background-color: var(--on-surface);
|
|
105
|
+
opacity: var(--checkbox-state-opacity);
|
|
106
|
+
transition: opacity 150ms ease-out;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.Indicator {
|
|
111
|
+
position: absolute;
|
|
112
|
+
left: 6px;
|
|
113
|
+
top: 6px;
|
|
114
|
+
width: 12px;
|
|
115
|
+
height: 12px;
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
color: var(--inverse-on-surface);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.Icon {
|
|
123
|
+
width: 12px;
|
|
124
|
+
height: 12px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.Checkbox[data-unchecked] .Indicator {
|
|
128
|
+
opacity: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.Checkbox[data-checked] .Box {
|
|
132
|
+
border: 0;
|
|
133
|
+
background-color: var(--inverse-surface);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.Checkbox[data-disabled] {
|
|
137
|
+
opacity: 0.2;
|
|
138
|
+
cursor: not-allowed;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.Checkbox[data-disabled] .StateLayer {
|
|
142
|
+
opacity: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.Checkbox:focus-visible,
|
|
146
|
+
.Checkbox[data-focused] {
|
|
147
|
+
--checkbox-state-opacity: 0.12;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.Checkbox:focus-visible::after,
|
|
151
|
+
.Checkbox[data-focused]::after {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@media (hover: hover) {
|
|
156
|
+
.Checkbox:hover:not([data-disabled]) {
|
|
157
|
+
--checkbox-state-opacity: 0.08;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.Label:hover .Checkbox:not([data-disabled]) {
|
|
161
|
+
--checkbox-state-opacity: 0.08;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.Checkbox:active:not([data-disabled]) {
|
|
166
|
+
--checkbox-state-opacity: 0.16;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.Label:active .Checkbox:not([data-disabled]) {
|
|
170
|
+
--checkbox-state-opacity: 0.16;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
```
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Checkbox Group
|
|
2
|
+
|
|
3
|
+
Source: src/components/checkbox-group/Example.tsx
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Checkbox } from '..';
|
|
10
|
+
import checkboxStyles from '../checkbox/Checkbox.module.css';
|
|
11
|
+
import { CheckboxGroup } from '..';
|
|
12
|
+
import styles from './CheckboxGroup.module.css';
|
|
13
|
+
|
|
14
|
+
const labelClassName = `typesetting-label typesetting-tsumegumi ${checkboxStyles.Label}`;
|
|
15
|
+
|
|
16
|
+
const options = [
|
|
17
|
+
{ label: 'お知らせを受け取る', value: 'news' },
|
|
18
|
+
{ label: 'アップデートを受け取る', value: 'updates' },
|
|
19
|
+
{ label: 'ヒントを受け取る', value: 'tips' },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export function Example() {
|
|
23
|
+
const id = React.useId();
|
|
24
|
+
return (
|
|
25
|
+
<CheckboxGroup aria-labelledby={id} defaultValue={['news']}>
|
|
26
|
+
<div id={id} className={styles.Caption}>
|
|
27
|
+
通知設定
|
|
28
|
+
</div>
|
|
29
|
+
{options.map((option) => (
|
|
30
|
+
<label key={option.value} className={labelClassName}>
|
|
31
|
+
<Checkbox name="notifications" value={option.value} />
|
|
32
|
+
{option.label}
|
|
33
|
+
</label>
|
|
34
|
+
))}
|
|
35
|
+
</CheckboxGroup>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Source: src/components/checkbox/Checkbox.module.css
|
|
42
|
+
|
|
43
|
+
## Styles
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
.Label {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
color: var(--on-surface);
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.Label:has(.Checkbox[data-disabled]) {
|
|
55
|
+
opacity: 0.2;
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.Checkbox {
|
|
60
|
+
position: relative;
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
padding: 0;
|
|
67
|
+
margin: 0;
|
|
68
|
+
border: 0;
|
|
69
|
+
background-color: transparent;
|
|
70
|
+
color: var(--inverse-on-surface);
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
outline: none;
|
|
73
|
+
|
|
74
|
+
--checkbox-state-opacity: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.Checkbox::after {
|
|
78
|
+
content: "";
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: calc(-1 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
81
|
+
top: calc(-1 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
82
|
+
width: calc(24px + 2 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
83
|
+
height: calc(24px + 2 * (var(--focus-ring-offset) + var(--focus-ring-width)));
|
|
84
|
+
border: var(--focus-ring-width) solid var(--focus-ring-color);
|
|
85
|
+
border-radius: var(--radius-full);
|
|
86
|
+
opacity: 0;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.Box {
|
|
91
|
+
position: absolute;
|
|
92
|
+
left: 4px;
|
|
93
|
+
top: 4px;
|
|
94
|
+
width: 16px;
|
|
95
|
+
height: 16px;
|
|
96
|
+
border-radius: var(--radius-xs);
|
|
97
|
+
border: 1px solid var(--outline);
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.StateLayer {
|
|
102
|
+
position: absolute;
|
|
103
|
+
left: -4px;
|
|
104
|
+
top: -4px;
|
|
105
|
+
width: 32px;
|
|
106
|
+
height: 32px;
|
|
107
|
+
border-radius: var(--radius-full);
|
|
108
|
+
background-color: var(--on-surface);
|
|
109
|
+
opacity: var(--checkbox-state-opacity);
|
|
110
|
+
transition: opacity 150ms ease-out;
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.Indicator {
|
|
115
|
+
position: absolute;
|
|
116
|
+
left: 6px;
|
|
117
|
+
top: 6px;
|
|
118
|
+
width: 12px;
|
|
119
|
+
height: 12px;
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
color: var(--inverse-on-surface);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.Icon {
|
|
127
|
+
width: 12px;
|
|
128
|
+
height: 12px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.Checkbox[data-unchecked] .Indicator {
|
|
132
|
+
opacity: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.Checkbox[data-checked] .Box {
|
|
136
|
+
border: 0;
|
|
137
|
+
background-color: var(--inverse-surface);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.Checkbox[data-disabled] {
|
|
141
|
+
opacity: 0.2;
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.Checkbox[data-disabled] .StateLayer {
|
|
146
|
+
opacity: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.Checkbox:focus-visible,
|
|
150
|
+
.Checkbox[data-focused] {
|
|
151
|
+
--checkbox-state-opacity: 0.12;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.Checkbox:focus-visible::after,
|
|
155
|
+
.Checkbox[data-focused]::after {
|
|
156
|
+
opacity: 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (hover: hover) {
|
|
160
|
+
.Checkbox:hover:not([data-disabled]) {
|
|
161
|
+
--checkbox-state-opacity: 0.08;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.Label:hover .Checkbox:not([data-disabled]) {
|
|
165
|
+
--checkbox-state-opacity: 0.08;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.Checkbox:active:not([data-disabled]) {
|
|
170
|
+
--checkbox-state-opacity: 0.16;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.Label:active .Checkbox:not([data-disabled]) {
|
|
174
|
+
--checkbox-state-opacity: 0.16;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Source: src/components/checkbox-group/CheckboxGroup.module.css
|
|
180
|
+
|
|
181
|
+
## Styles
|
|
182
|
+
|
|
183
|
+
```css
|
|
184
|
+
.Group {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: flex-start;
|
|
188
|
+
gap: var(--space-3);
|
|
189
|
+
color: var(--on-surface);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.Caption {
|
|
193
|
+
font-family: var(--font-brand);
|
|
194
|
+
font-size: var(--font-size-label);
|
|
195
|
+
font-weight: var(--font-weight-label);
|
|
196
|
+
line-height: var(--line-height-label);
|
|
197
|
+
letter-spacing: var(--letter-spacing-label);
|
|
198
|
+
color: var(--on-surface);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
```
|