@charcoal-ui/react-sandbox 1.0.0 → 1.0.1-alpha.2
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/Carousel/index.story.d.ts +1 -1
- package/dist/components/Carousel/index.story.d.ts.map +1 -1
- package/dist/components/Filter/index.story.d.ts.map +1 -1
- package/dist/components/Pager/index.d.ts.map +1 -1
- package/dist/components/Pager/index.story.d.ts.map +1 -1
- package/dist/foundation/hooks.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +41 -41
- 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 +12 -7
- package/src/components/Carousel/index.story.tsx +1 -1
- package/src/components/Filter/index.story.tsx +4 -1
- package/src/components/Pager/index.story.tsx +7 -4
- package/src/components/Pager/index.tsx +1 -3
- package/src/foundation/hooks.ts +1 -0
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
decorators: [withKnobs],
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const
|
|
26
|
+
export const _Carousel = () => {
|
|
27
27
|
const hasGradient = boolean('Gradient', false)
|
|
28
28
|
const fadeInGradient = boolean('FadeInGradient', false)
|
|
29
29
|
const buttonOffset = number('buttonOffset', 0)
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Route,
|
|
8
8
|
useParams,
|
|
9
9
|
useNavigate,
|
|
10
|
+
Routes,
|
|
10
11
|
} from 'react-router-dom'
|
|
11
12
|
import Filter, { FilterButton, FilterLink } from '.'
|
|
12
13
|
import { ComponentAbstraction } from '@charcoal-ui/react'
|
|
@@ -27,7 +28,9 @@ export function Default() {
|
|
|
27
28
|
initialEntries={Array.from({ length: 5 }).map((_, i) => makeUrl(i + 1))}
|
|
28
29
|
initialIndex={0}
|
|
29
30
|
>
|
|
30
|
-
<
|
|
31
|
+
<Routes>
|
|
32
|
+
<Route path="/:page" element={<FilterButtons />} />
|
|
33
|
+
</Routes>
|
|
31
34
|
</Router>
|
|
32
35
|
</ComponentAbstraction>
|
|
33
36
|
)
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Route,
|
|
5
5
|
Link as RouterLink,
|
|
6
6
|
useParams,
|
|
7
|
+
Routes,
|
|
7
8
|
} from 'react-router-dom'
|
|
8
9
|
import { Story } from '../../_lib/compat'
|
|
9
10
|
import Pager, { LinkPager } from '.'
|
|
@@ -56,10 +57,12 @@ const LinkStory: Story<Props> = ({ page: defaultPage, pageCount }) => (
|
|
|
56
57
|
)}
|
|
57
58
|
initialIndex={defaultPage - 1}
|
|
58
59
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
<Routes>
|
|
61
|
+
<Route
|
|
62
|
+
path="/:page"
|
|
63
|
+
element={<CurrentPager pageCount={pageCount}></CurrentPager>}
|
|
64
|
+
/>
|
|
65
|
+
</Routes>
|
|
63
66
|
</Router>
|
|
64
67
|
</ComponentAbstraction>
|
|
65
68
|
)
|
|
@@ -6,8 +6,6 @@ import DotsIcon from '../icons/DotsIcon'
|
|
|
6
6
|
import WedgeIcon, { WedgeDirection } from '../icons/WedgeIcon'
|
|
7
7
|
import { useComponentAbstraction } from '@charcoal-ui/react'
|
|
8
8
|
|
|
9
|
-
declare const __DEV__: object | undefined // actually object|false, but using undefined allows ! assertion
|
|
10
|
-
|
|
11
9
|
function usePagerWindow(page: number, pageCount: number, windowSize = 7) {
|
|
12
10
|
// ページャーのリンク生成例:
|
|
13
11
|
//
|
|
@@ -25,7 +23,7 @@ function usePagerWindow(page: number, pageCount: number, windowSize = 7) {
|
|
|
25
23
|
//
|
|
26
24
|
// デザインの意図: 前後移動時のカーソル移動を最小限にする。
|
|
27
25
|
|
|
28
|
-
if (
|
|
26
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
27
|
warning((page | 0) === page, `\`page\` must be interger (${page})`)
|
|
30
28
|
warning(
|
|
31
29
|
(pageCount | 0) === pageCount,
|
package/src/foundation/hooks.ts
CHANGED
|
@@ -97,6 +97,7 @@ function measure(ref: Element | null): ElementSize | undefined {
|
|
|
97
97
|
|
|
98
98
|
export function useElementSize(
|
|
99
99
|
ref: React.RefObject<Element>,
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
101
|
deps: any[] = []
|
|
101
102
|
) {
|
|
102
103
|
// _don't_ call measure synchronously here even if you somehow can
|