@charcoal-ui/react-sandbox 4.0.1 → 4.2.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.
Files changed (40) hide show
  1. package/dist/_lib/ComponentAbstraction.d.ts +4 -3
  2. package/dist/_lib/ComponentAbstraction.d.ts.map +1 -1
  3. package/dist/components/Carousel/index.d.ts +1 -1
  4. package/dist/components/Carousel/index.d.ts.map +1 -1
  5. package/dist/components/CarouselButton/index.d.ts +2 -2
  6. package/dist/components/CarouselButton/index.d.ts.map +1 -1
  7. package/dist/components/Filter/index.d.ts +1 -1
  8. package/dist/components/Filter/index.d.ts.map +1 -1
  9. package/dist/components/HintText/index.d.ts +1 -1
  10. package/dist/components/HintText/index.d.ts.map +1 -1
  11. package/dist/components/Layout/index.d.ts +4 -4
  12. package/dist/components/Layout/index.d.ts.map +1 -1
  13. package/dist/components/LeftMenu/index.d.ts +2 -2
  14. package/dist/components/LeftMenu/index.d.ts.map +1 -1
  15. package/dist/components/MenuListItem/index.d.ts +4 -4
  16. package/dist/components/MenuListItem/index.d.ts.map +1 -1
  17. package/dist/components/Pager/index.d.ts +1 -1
  18. package/dist/components/Pager/index.d.ts.map +1 -1
  19. package/dist/components/icons/Base.d.ts +2 -2
  20. package/dist/components/icons/Base.d.ts.map +1 -1
  21. package/dist/components/icons/DotsIcon.d.ts +1 -1
  22. package/dist/components/icons/DotsIcon.d.ts.map +1 -1
  23. package/dist/components/icons/InfoIcon.d.ts +1 -1
  24. package/dist/components/icons/InfoIcon.d.ts.map +1 -1
  25. package/dist/components/icons/NextIcon.d.ts +1 -1
  26. package/dist/components/icons/NextIcon.d.ts.map +1 -1
  27. package/dist/components/icons/WedgeIcon.d.ts +1 -1
  28. package/dist/components/icons/WedgeIcon.d.ts.map +1 -1
  29. package/dist/index.cjs.js +7 -11
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +7 -11
  32. package/dist/index.esm.js.map +1 -1
  33. package/package.json +13 -17
  34. package/src/_lib/ComponentAbstraction.tsx +2 -1
  35. package/src/components/Carousel/index.tsx +4 -4
  36. package/src/components/Filter/index.tsx +8 -7
  37. package/src/components/HintText/index.tsx +5 -4
  38. package/src/components/Pager/index.tsx +2 -2
  39. package/src/components/WithIcon/index.tsx +8 -3
  40. package/src/type.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react-sandbox",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -21,30 +21,26 @@
21
21
  "test": "vitest run --passWithNoTests"
22
22
  },
23
23
  "devDependencies": {
24
- "@charcoal-ui/esbuild-plugin-styled-components": "^4.0.1",
24
+ "@charcoal-ui/esbuild-plugin-styled-components": "^4.2.0",
25
25
  "@storybook/addon-actions": "^7.4.1",
26
26
  "@storybook/addon-knobs": "^7.0.2",
27
27
  "@storybook/addons": "^7.4.1",
28
28
  "@storybook/api": "^7.4.1",
29
29
  "@storybook/components": "^7.4.1",
30
30
  "@storybook/core-events": "^7.4.1",
31
- "@storybook/react": "^7.4.1",
32
- "@storybook/theming": "^7.4.1",
33
31
  "@testing-library/jest-dom": "^5.16.1",
34
32
  "@testing-library/react": "^12.1.2",
35
33
  "@testing-library/user-event": "^13.5.0",
36
- "@types/jest": "^27.4.0",
37
- "@types/jest-axe": "^3.5.3",
38
- "@types/react": "^17.0.38",
34
+ "@types/react": "^18.3.3",
35
+ "@types/react-dom": "^18.3.0",
39
36
  "@types/react-router-dom": "^5.3.3",
40
37
  "@types/styled-components": "^5.1.21",
41
38
  "@types/warning": "^3.0.0",
42
39
  "@vitejs/plugin-react": "^4.3.1",
43
- "jest-axe": "^5.0.1",
44
40
  "jsdom": "^24.1.0",
45
41
  "npm-run-all": "^4.1.5",
46
- "react": "^17.0.2",
47
- "react-dom": "^17.0.2",
42
+ "react": "^18.3.1",
43
+ "react-dom": "^18.3.1",
48
44
  "react-router-dom": "^6.2.1",
49
45
  "rimraf": "^3.0.2",
50
46
  "styled-components": "^5.3.3",
@@ -54,18 +50,18 @@
54
50
  "vitest": "^2.0.2"
55
51
  },
56
52
  "dependencies": {
57
- "@charcoal-ui/foundation": "^4.0.1",
58
- "@charcoal-ui/react": "^4.0.1",
59
- "@charcoal-ui/styled": "^4.0.1",
60
- "@charcoal-ui/theme": "^4.0.1",
61
- "@charcoal-ui/utils": "^4.0.1",
53
+ "@charcoal-ui/foundation": "^4.2.0",
54
+ "@charcoal-ui/react": "^4.2.0",
55
+ "@charcoal-ui/styled": "^4.2.0",
56
+ "@charcoal-ui/theme": "^4.2.0",
57
+ "@charcoal-ui/utils": "^4.2.0",
62
58
  "polished": "^4.1.4",
63
59
  "react-spring": "^9.0.0",
64
60
  "warning": "^4.0.3"
65
61
  },
66
62
  "peerDependencies": {
67
63
  "react": ">=17.0.0",
68
- "react-dom": ">=16.13.1",
64
+ "react-dom": ">=17.0.0",
69
65
  "styled-components": ">=5.1.1"
70
66
  },
71
67
  "files": [
@@ -80,5 +76,5 @@
80
76
  "url": "https://github.com/pixiv/charcoal.git",
81
77
  "directory": "packages/react-sandbox"
82
78
  },
83
- "gitHead": "42466af3a62cb99358f735a2ce16b237591a2579"
79
+ "gitHead": "45c93231d4b0feffe8f3a6bef2cdab96302c8eb4"
84
80
  }
@@ -18,8 +18,9 @@ export const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
18
18
  }
19
19
  )
20
20
 
21
+ type DefaultLinkProps = LinkProps & React.RefAttributes<HTMLAnchorElement>
21
22
  export interface Components {
22
- Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>
23
+ Link: React.ComponentType<React.PropsWithoutRef<DefaultLinkProps>>
23
24
  }
24
25
 
25
26
  const DefaultValue: Components = {
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState, useCallback, useRef } from 'react'
2
2
  import * as React from 'react'
3
- import { animated, useSpring } from 'react-spring'
3
+ import { animated, AnimatedComponent, useSpring } from 'react-spring'
4
4
  import styled, { css } from 'styled-components'
5
5
  import { useDebounceAnimationState } from '../../foundation/hooks'
6
6
  import { passiveEvents, isEdge } from '../../foundation/support'
@@ -281,8 +281,6 @@ export default function Carousel({
281
281
  return (
282
282
  <Container ref={visibleAreaRef}>
283
283
  <ScrollArea
284
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
285
- // @ts-expect-error
286
284
  ref={ref}
287
285
  scrollLeft={styles.scroll}
288
286
  onScroll={handleScrollMove}
@@ -360,7 +358,9 @@ const ScrollArea = styled(animated.div)`
360
358
  }
361
359
 
362
360
  scrollbar-width: none;
363
- `
361
+ ` as unknown as React.ComponentType<
362
+ Omit<React.ComponentProps<AnimatedComponent<'div'>>, 'css'>
363
+ >
364
364
 
365
365
  const GradientContainer = styled.div<{ fadeInGradient: boolean }>`
366
366
  /* NOTE: LeftGradientがはみ出るためhidden */
@@ -109,7 +109,7 @@ interface ButtonCssProps {
109
109
  reactive?: boolean
110
110
  }
111
111
 
112
- const buttonCss = css`
112
+ const buttonCss = css<ButtonCssProps>`
113
113
  display: block;
114
114
  outline: none;
115
115
  border: none;
@@ -128,13 +128,13 @@ const buttonCss = css`
128
128
  color: ${({ theme }) => theme.color.text2};
129
129
  }
130
130
 
131
- ${({ hover = false }: ButtonCssProps) =>
131
+ ${({ hover = false }) =>
132
132
  hover &&
133
133
  css`
134
134
  color: ${({ theme }) => theme.color.text2};
135
135
  `}
136
136
 
137
- ${({ active = false }: ButtonCssProps) =>
137
+ ${({ active = false }) =>
138
138
  active &&
139
139
  css`
140
140
  background-color: ${({ theme }) => theme.color.surface3};
@@ -161,18 +161,19 @@ const padding0Css = css`
161
161
  }
162
162
  `
163
163
 
164
- const ButtonLike = styled.button`
164
+ const ButtonLike = styled.button<ButtonCssProps>`
165
165
  ${buttonCss}
166
166
  `
167
167
 
168
- const PlainElement = styled.span`
168
+ const PlainElement = styled.span<ButtonCssProps>`
169
169
  ${buttonCss}
170
170
  `
171
171
 
172
- const StyledButtonLike = styled(ButtonLike)<{
172
+ type StyledButtonLikeProps = {
173
173
  buttonWidth: number | undefined
174
174
  buttonHeight: number | undefined
175
- }>`
175
+ }
176
+ const StyledButtonLike = styled(ButtonLike)<StyledButtonLikeProps>`
176
177
  ${padding0Css};
177
178
  ${(p) => p.buttonWidth !== undefined && `width: ${p.buttonWidth}px;`}
178
179
  ${(p) => p.buttonHeight !== undefined && `height: ${p.buttonHeight}px;`}
@@ -13,7 +13,10 @@ interface Props {
13
13
 
14
14
  export default function HintText({ children, context, className }: Props) {
15
15
  return (
16
- <Container className={className} context={context}>
16
+ <Container
17
+ className={className}
18
+ {...styledProps({ children, context, className })}
19
+ >
17
20
  <IconWrap>
18
21
  <InfoIcon />
19
22
  </IconWrap>
@@ -22,9 +25,7 @@ export default function HintText({ children, context, className }: Props) {
22
25
  )
23
26
  }
24
27
 
25
- const Container = styled.div.attrs<Props, ReturnType<typeof styledProps>>(
26
- styledProps
27
- )`
28
+ const Container = styled.div<ReturnType<typeof styledProps>>`
28
29
  ${(p) =>
29
30
  theme((o) => [
30
31
  o.bg.surface3,
@@ -197,7 +197,7 @@ const PagerContainer = styled.nav`
197
197
  align-items: center;
198
198
  `
199
199
 
200
- const CircleButton = styled.button`
200
+ const CircleButton = styled.button<{ noBackground?: boolean }>`
201
201
  font-size: 1rem;
202
202
  line-height: calc(1em + 8px);
203
203
  text-decoration: none;
@@ -249,7 +249,7 @@ const CircleButton = styled.button`
249
249
  color: ${({ theme }) => theme.color.text5};
250
250
  }
251
251
 
252
- ${({ noBackground = false }: { noBackground?: boolean }) =>
252
+ ${({ noBackground = false }) =>
253
253
  noBackground &&
254
254
  css`
255
255
  /* stylelint-disable-next-line no-duplicate-selectors */
@@ -103,8 +103,13 @@ const forceCenteringCss = css`
103
103
  }
104
104
  `
105
105
 
106
- const iconAnchorCss = css`
107
- ${(p: { show: boolean | 'collapse'; pre: boolean }) =>
106
+ type IconAnchorProps = {
107
+ show: boolean | 'collapse'
108
+ pre: boolean
109
+ }
110
+
111
+ const iconAnchorCss = css<IconAnchorProps>`
112
+ ${(p) =>
108
113
  p.show === 'collapse'
109
114
  ? css`
110
115
  display: none;
@@ -122,7 +127,7 @@ const iconAnchorCss = css`
122
127
  `}
123
128
  `
124
129
 
125
- const IconAnchorNaive = styled.div`
130
+ const IconAnchorNaive = styled.div<IconAnchorProps>`
126
131
  display: flex;
127
132
  align-items: center;
128
133
 
package/src/type.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ThemeProp } from '@charcoal-ui/styled'
2
2
  import { CharcoalTheme } from '@charcoal-ui/theme'
3
- import { CSSProp, DefaultTheme } from 'styled-components'
3
+ import type { CSSProp, DefaultTheme } from 'styled-components'
4
4
 
5
5
  declare module 'react' {
6
6
  interface Attributes {