@charcoal-ui/icons 3.10.1-beta.1 → 3.11.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.
@@ -1,45 +1,8 @@
1
- import * as React from 'react';
2
- import { Props } from './PixivIcon';
3
- interface Story<P> {
4
- (args: P): React.ReactNode;
5
- args?: P;
6
- }
7
- declare const _default: {
8
- title: string;
9
- argTypes: {
10
- color: {
11
- control: {
12
- type: string;
13
- };
14
- };
15
- name: {
16
- control: {
17
- type: string;
18
- options: string[];
19
- };
20
- };
21
- scale: {
22
- control: {
23
- type: string;
24
- options: number[];
25
- };
26
- };
27
- };
28
- parameters: {
29
- storyshots: {
30
- disable: boolean;
31
- };
32
- };
33
- };
1
+ import { Props } from '.';
2
+ import type { StoryObj } from '@storybook/react';
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-bf5e6555").R, Props>;
34
4
  export default _default;
35
- export declare const Default: Story<{
36
- scale: NonNullable<Props['scale']>;
37
- color: string;
38
- }>;
39
- export declare const WithAttributes: Story<Props & {
40
- color: string;
41
- }>;
42
- export declare const WithUnsafe: Story<Props & {
43
- color: string;
44
- }>;
5
+ export declare const Default: StoryObj<Props>;
6
+ export declare const WithAttributes: StoryObj<Props>;
7
+ export declare const WithUnsafe: StoryObj<Props>;
45
8
  //# sourceMappingURL=PixivIcon.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PixivIcon.story.d.ts","sourceRoot":"","sources":["../src/PixivIcon.story.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAInC,UAAU,KAAK,CAAC,CAAC;IACf,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,CAAC,CAAA;CACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOD,wBA2BC;AA0FD,eAAO,MAAM,OAAO;WAvBX,YAAY,KAAK,CAAC,OAAO,CAAC,CAAC;WAC3B,MAAM;EAsB6B,CAAA;AAI5C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAY3D,CAAA;AAID,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAYvD,CAAA"}
1
+ {"version":3,"file":"PixivIcon.story.d.ts","sourceRoot":"","sources":["../src/PixivIcon.story.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,EAAE,MAAM,GAAG,CAAA;AAEpC,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;;AAOtD,wBA8CgB;AAkEhB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,KAAK,CAEnC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,KAAK,CAe1C,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,KAAK,CAqBtC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/icons",
3
- "version": "3.10.1-beta.1",
3
+ "version": "3.11.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -20,6 +20,7 @@
20
20
  "clean": "rimraf dist .tsbuildinfo"
21
21
  },
22
22
  "devDependencies": {
23
+ "@storybook/react": "^8.0.5",
23
24
  "@types/dompurify": "^2.3.3",
24
25
  "@types/jest": "^27.4.0",
25
26
  "@types/react": "^17.0.38",
@@ -32,7 +33,7 @@
32
33
  "typescript": "^4.9.5"
33
34
  },
34
35
  "dependencies": {
35
- "@charcoal-ui/icon-files": "^3.10.1-beta.1",
36
+ "@charcoal-ui/icon-files": "^3.11.0",
36
37
  "dompurify": "^2.3.6",
37
38
  "warning": "^4.0.3"
38
39
  },
@@ -49,5 +50,5 @@
49
50
  "url": "https://github.com/pixiv/charcoal.git",
50
51
  "directory": "packages/icons"
51
52
  },
52
- "gitHead": "f36f447ec52c5dc78bea2a40bd9b7bf7751d9849"
53
+ "gitHead": "503ef7c22e3eb46b39b8ddd93e8389025afdd411"
53
54
  }
@@ -1,16 +1,10 @@
1
1
  /// <reference types='@types/webpack-env' />
2
2
 
3
- import * as React from 'react'
4
3
  import styled, { createGlobalStyle } from 'styled-components'
5
4
  import TestIconThatNeverExists from './16/TestIconThatNeverExists.svg'
6
- import { Props } from './PixivIcon'
7
- import { PixivIcon } from '.'
5
+ import { PixivIcon, Props } from '.'
8
6
  import { KnownIconFile, KNOWN_ICON_FILES } from './charcoalIconFiles'
9
-
10
- interface Story<P> {
11
- (args: P): React.ReactNode
12
- args?: P
13
- }
7
+ import type { Meta, StoryObj } from '@storybook/react'
14
8
 
15
9
  PixivIcon.extend({
16
10
  // かぶらなそうな名前をつける
@@ -38,13 +32,32 @@ export default {
38
32
  },
39
33
  },
40
34
  },
41
-
42
35
  parameters: {
43
36
  storyshots: {
44
37
  disable: true,
45
38
  },
46
39
  },
47
- }
40
+ render: ({ scale, color }) => (
41
+ <>
42
+ {Object.entries(groupedIcons).map(([groupName, icons]) => (
43
+ <Group key={groupName}>
44
+ <Heading>
45
+ {groupName} (scale: {scale})
46
+ </Heading>
47
+ <Grid>
48
+ {icons.map((name) => (
49
+ <IconDef color={color} key={name}>
50
+ <pixiv-icon key={scale} name={name} scale={scale} />
51
+ <div>{name}</div>
52
+ </IconDef>
53
+ ))}
54
+ </Grid>
55
+ </Group>
56
+ ))}
57
+ <Global />
58
+ </>
59
+ ),
60
+ } as Meta<Props>
48
61
 
49
62
  const groupedIcons = KNOWN_ICON_FILES.reduce<Record<string, KnownIconFile[]>>(
50
63
  (map, icon) => {
@@ -84,8 +97,8 @@ const Group = styled.div`
84
97
  }
85
98
  `
86
99
 
87
- const IconDef = styled.div<{ color: string }>`
88
- color: ${({ color }) => color};
100
+ const IconDef = styled.div<{ color?: string }>`
101
+ color: ${({ color }) => color ?? '#000000'};
89
102
  display: inline-flex;
90
103
  align-items: center;
91
104
  min-height: 32px;
@@ -110,62 +123,46 @@ const Heading = styled.h2`
110
123
  margin: 16px 0;
111
124
  `
112
125
 
113
- const DefaultStory: Story<{
114
- scale: NonNullable<Props['scale']>
115
- color: string
116
- }> = ({ scale, color }) => (
117
- <>
118
- {Object.entries(groupedIcons).map(([groupName, icons]) => (
119
- <Group key={groupName}>
120
- <Heading>
121
- {groupName} (scale: {scale})
122
- </Heading>
123
- <Grid>
124
- {icons.map((name) => (
125
- <IconDef color={color} key={name}>
126
- <pixiv-icon key={scale} name={name} scale={scale} />
127
- <div>{name}</div>
128
- </IconDef>
129
- ))}
130
- </Grid>
131
- </Group>
132
- ))}
133
- <Global />
134
- </>
135
- )
136
-
137
- export const Default = DefaultStory.bind({})
138
-
139
- Default.args = { scale: 1, color: '#000000' }
140
-
141
- export const WithAttributes: Story<Props & { color: string }> = ({
142
- name,
143
- scale,
144
- color,
145
- }) => (
146
- <>
147
- <IconDef color={color}>
148
- <pixiv-icon class="icon-class" name={name} scale={scale} />
149
- <div>アイコンと文字</div>
150
- </IconDef>
151
- <Global />
152
- </>
153
- )
126
+ export const Default: StoryObj<Props> = {
127
+ args: { scale: 1, color: '#000000' },
128
+ }
154
129
 
155
- WithAttributes.args = { name: '16/Add', scale: 1, color: '#000000' }
156
-
157
- export const WithUnsafe: Story<Props & { color: string }> = ({
158
- name,
159
- scale,
160
- color,
161
- }) => (
162
- <>
163
- <IconDef color={color}>
164
- <pixiv-icon unsafe-non-guideline-scale="3.75" name={name} scale={scale} />
165
- アイコンと文字
166
- </IconDef>
167
- <Global />
168
- </>
169
- )
130
+ export const WithAttributes: StoryObj<Props> = {
131
+ render: ({ color, name, scale }) => (
132
+ <div>
133
+ <IconDef color={color}>
134
+ <pixiv-icon class="icon-class" name={name} scale={scale} />
135
+ <div>アイコンと文字</div>
136
+ </IconDef>
137
+ <Global />
138
+ </div>
139
+ ),
140
+ args: {
141
+ name: '16/Add',
142
+ scale: 1,
143
+ color: '#000000',
144
+ },
145
+ }
170
146
 
171
- WithUnsafe.args = { name: '16/Add', scale: 1, color: '#000000' }
147
+ export const WithUnsafe: StoryObj<Props> = {
148
+ render: ({ color, name, scale, ...args }) => {
149
+ return (
150
+ <>
151
+ <IconDef color={color}>
152
+ <pixiv-icon
153
+ unsafe-non-guideline-scale={args['unsafe-non-guideline-scale']}
154
+ name={name}
155
+ scale={scale}
156
+ />
157
+ アイコンと文字
158
+ </IconDef>
159
+ <Global />
160
+ </>
161
+ )
162
+ },
163
+ args: {
164
+ name: '16/Add',
165
+ 'unsafe-non-guideline-scale': '3.75',
166
+ color: '#000000',
167
+ },
168
+ }