@charcoal-ui/react-sandbox 3.10.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.
Files changed (41) hide show
  1. package/package.json +8 -17
  2. package/dist/components/Carousel/index.story.d.ts +0 -7
  3. package/dist/components/Carousel/index.story.d.ts.map +0 -1
  4. package/dist/components/CarouselButton/index.story.d.ts +0 -10
  5. package/dist/components/CarouselButton/index.story.d.ts.map +0 -1
  6. package/dist/components/Filter/index.story.d.ts +0 -9
  7. package/dist/components/Filter/index.story.d.ts.map +0 -1
  8. package/dist/components/HintText/index.story.d.ts +0 -12
  9. package/dist/components/HintText/index.story.d.ts.map +0 -1
  10. package/dist/components/Layout/index.story.d.ts +0 -14
  11. package/dist/components/Layout/index.story.d.ts.map +0 -1
  12. package/dist/components/MenuListItem/index.story.d.ts +0 -18
  13. package/dist/components/MenuListItem/index.story.d.ts.map +0 -1
  14. package/dist/components/Pager/index.story.d.ts +0 -39
  15. package/dist/components/Pager/index.story.d.ts.map +0 -1
  16. package/dist/components/SwitchCheckbox/index.story.d.ts +0 -10
  17. package/dist/components/SwitchCheckbox/index.story.d.ts.map +0 -1
  18. package/dist/components/TextEllipsis/index.story.d.ts +0 -9
  19. package/dist/components/TextEllipsis/index.story.d.ts.map +0 -1
  20. package/dist/components/WithIcon/index.story.d.ts +0 -15
  21. package/dist/components/WithIcon/index.story.d.ts.map +0 -1
  22. package/src/components/Carousel/__snapshots__/index.story.storyshot +0 -360
  23. package/src/components/Carousel/index.story.tsx +0 -85
  24. package/src/components/CarouselButton/__snapshots__/index.story.storyshot +0 -168
  25. package/src/components/CarouselButton/index.story.tsx +0 -43
  26. package/src/components/Filter/__snapshots__/index.story.storyshot +0 -239
  27. package/src/components/Filter/index.story.tsx +0 -82
  28. package/src/components/HintText/__snapshots__/index.story.storyshot +0 -119
  29. package/src/components/HintText/index.story.tsx +0 -18
  30. package/src/components/Layout/__snapshots__/index.story.storyshot +0 -1297
  31. package/src/components/Layout/index.story.tsx +0 -121
  32. package/src/components/MenuListItem/__snapshots__/index.story.storyshot +0 -1389
  33. package/src/components/MenuListItem/index.story.tsx +0 -142
  34. package/src/components/Pager/__snapshots__/index.story.storyshot +0 -1894
  35. package/src/components/Pager/index.story.tsx +0 -153
  36. package/src/components/SwitchCheckbox/__snapshots__/index.story.storyshot +0 -507
  37. package/src/components/SwitchCheckbox/index.story.tsx +0 -31
  38. package/src/components/TextEllipsis/__snapshots__/index.story.storyshot +0 -32
  39. package/src/components/TextEllipsis/index.story.tsx +0 -40
  40. package/src/components/WithIcon/__snapshots__/index.story.storyshot +0 -852
  41. package/src/components/WithIcon/index.story.tsx +0 -145
@@ -1,145 +0,0 @@
1
- import { boolean } from '@storybook/addon-knobs'
2
- import * as React from 'react'
3
- import styled, { css } from 'styled-components'
4
- import { theme } from '../../styled'
5
- import WithIcon from '.'
6
- import { applyEffect } from '@charcoal-ui/utils'
7
-
8
- export default {
9
- title: 'Sandbox/WithIcon',
10
- component: WithIcon,
11
- }
12
-
13
- export const Default = () => {
14
- const fit = boolean('fit', true)
15
- const bigger = boolean(
16
- 'Icon height bigger than line-height (`fit` is effective)',
17
- false
18
- )
19
- const prefix = boolean('prefix', false)
20
- const show = boolean('show', true)
21
- return (
22
- <Container>
23
- <WithIcon
24
- icon={<TestInlineIcon lineHeight={bigger ? 32 : 22} />}
25
- show={show}
26
- prefix={prefix}
27
- fit={fit}
28
- >
29
- Menu
30
- </WithIcon>
31
- </Container>
32
- )
33
- }
34
-
35
- export const Performance = () => (
36
- <Container>
37
- <WithIcon
38
- icon={<TestInlineIcon lineHeight={22} />}
39
- show
40
- fit
41
- // Hard-coded width (ResizeObserver free and NO measuring cost)
42
- width={16}
43
- >
44
- Menu
45
- </WithIcon>
46
- </Container>
47
- )
48
-
49
- export const Naive = () => (
50
- // NO measuring cost
51
- <Container>
52
- <WithIcon icon={<TestInlineIcon lineHeight={22} />} show>
53
- Menu
54
- </WithIcon>
55
- </Container>
56
- )
57
-
58
- export const Prefix = () => (
59
- <Container>
60
- <WithIcon icon={<TestIcon />} show prefix fit>
61
- Selection
62
- </WithIcon>
63
- </Container>
64
- )
65
-
66
- function Container(props: { className?: string; children?: React.ReactNode }) {
67
- return (
68
- <div
69
- css={css`
70
- ${theme((o) => [o.font.text1, o.typography(14).preserveHalfLeading])}
71
- display: flex;
72
- `}
73
- >
74
- <div
75
- css={css`
76
- background-color: ${({ theme }) =>
77
- applyEffect(theme.color.brand, theme.elementEffect.disabled)};
78
- `}
79
- {...props}
80
- />
81
- </div>
82
- )
83
- }
84
-
85
- export const Hide = () => (
86
- <Container>
87
- <WithIcon icon={<TestIcon />} show={false} prefix>
88
- Selection
89
- </WithIcon>
90
- </Container>
91
- )
92
-
93
- export const Collapse = () => (
94
- <Container>
95
- <WithIcon icon={<TestIcon />} show="collapse" prefix>
96
- Selection
97
- </WithIcon>
98
- </Container>
99
- )
100
-
101
- export const LongText = () => (
102
- <Container
103
- css={`
104
- width: 200px;
105
- `}
106
- >
107
- <WithIcon icon={<TestIcon />}>
108
- Long Long Long Long Long Long Long Long Long Long Text
109
- </WithIcon>
110
- </Container>
111
- )
112
-
113
- export const LongTextOverflow = () => (
114
- <Container
115
- css={`
116
- width: 200px;
117
- `}
118
- >
119
- <WithIcon icon={<TestIcon />} fixed>
120
- Long Long Long Long Long Long Long Long Long Long Text
121
- </WithIcon>
122
- </Container>
123
- )
124
-
125
- const TestIcon = styled.div`
126
- display: inline-block;
127
- width: 16px;
128
- height: 16px;
129
- background-color: currentColor;
130
- `
131
-
132
- const TestInlineIcon = styled.div<{ lineHeight: number }>`
133
- display: inline-flex;
134
- vertical-align: top;
135
- align-items: center;
136
- line-height: ${(p) => p.lineHeight}px;
137
- height: ${(p) => p.lineHeight}px;
138
- &::before {
139
- content: '';
140
- display: inline-block;
141
- height: 16px;
142
- width: 16px;
143
- background-color: currentColor;
144
- }
145
- `