@charcoal-ui/react 3.0.0-beta.2 → 3.0.0-beta.3

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 (174) hide show
  1. package/dist/_lib/compat.d.ts +1 -1
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/index.d.ts +1 -2
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.story.d.ts +1 -2
  6. package/dist/components/Button/index.story.d.ts.map +1 -1
  7. package/dist/components/Button/index.test.d.ts +4 -0
  8. package/dist/components/Button/index.test.d.ts.map +1 -0
  9. package/dist/components/Checkbox/index.d.ts +1 -1
  10. package/dist/components/Checkbox/index.d.ts.map +1 -1
  11. package/dist/components/Checkbox/index.story.d.ts +1 -2
  12. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  13. package/dist/components/Clickable/index.d.ts +1 -1
  14. package/dist/components/Clickable/index.d.ts.map +1 -1
  15. package/dist/components/Clickable/index.story.d.ts +1 -2
  16. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  17. package/dist/components/DropdownSelector/Divider.d.ts +3 -0
  18. package/dist/components/DropdownSelector/Divider.d.ts.map +1 -1
  19. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts +7 -0
  20. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -0
  21. package/dist/components/DropdownSelector/DropdownPopover.d.ts +8 -8
  22. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
  23. package/dist/components/DropdownSelector/ListItem/index.d.ts +18 -0
  24. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -0
  25. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +9 -0
  26. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -0
  27. package/dist/components/DropdownSelector/MenuItem/index.d.ts +11 -0
  28. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -0
  29. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts +9 -0
  30. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts.map +1 -0
  31. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts +10 -0
  32. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts.map +1 -0
  33. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts +14 -0
  34. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts.map +1 -0
  35. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts +10 -0
  36. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts.map +1 -0
  37. package/dist/components/DropdownSelector/MenuList/index.d.ts +18 -0
  38. package/dist/components/DropdownSelector/MenuList/index.d.ts.map +1 -0
  39. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +11 -0
  40. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -0
  41. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts +11 -0
  42. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts.map +1 -0
  43. package/dist/components/DropdownSelector/Popover/index.d.ts +17 -0
  44. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -0
  45. package/dist/components/DropdownSelector/Popover/index.story.d.ts +9 -0
  46. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -0
  47. package/dist/components/DropdownSelector/index.d.ts +3 -10
  48. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  49. package/dist/components/DropdownSelector/index.story.d.ts +4 -4
  50. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  51. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts +12 -0
  52. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts.map +1 -0
  53. package/dist/components/FieldLabel/index.d.ts +1 -1
  54. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  55. package/dist/components/Icon/index.d.ts +1 -1
  56. package/dist/components/Icon/index.d.ts.map +1 -1
  57. package/dist/components/Icon/index.story.d.ts +2 -3
  58. package/dist/components/Icon/index.story.d.ts.map +1 -1
  59. package/dist/components/IconButton/index.d.ts +1 -2
  60. package/dist/components/IconButton/index.d.ts.map +1 -1
  61. package/dist/components/IconButton/index.story.d.ts +1 -2
  62. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  63. package/dist/components/LoadingSpinner/index.d.ts +1 -2
  64. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  65. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  66. package/dist/components/Modal/index.d.ts +1 -1
  67. package/dist/components/Modal/index.d.ts.map +1 -1
  68. package/dist/components/Modal/index.story.d.ts.map +1 -1
  69. package/dist/components/MultiSelect/context.d.ts +1 -1
  70. package/dist/components/MultiSelect/context.d.ts.map +1 -1
  71. package/dist/components/MultiSelect/index.d.ts +5 -6
  72. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  73. package/dist/components/MultiSelect/index.story.d.ts +7 -14
  74. package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
  75. package/dist/components/Radio/index.d.ts +1 -1
  76. package/dist/components/Radio/index.d.ts.map +1 -1
  77. package/dist/components/Radio/index.story.d.ts +1 -2
  78. package/dist/components/Radio/index.story.d.ts.map +1 -1
  79. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  80. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  81. package/dist/components/SegmentedControl/index.d.ts +1 -1
  82. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  83. package/dist/components/SegmentedControl/index.story.d.ts +1 -2
  84. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  85. package/dist/components/Switch/index.d.ts +1 -1
  86. package/dist/components/Switch/index.d.ts.map +1 -1
  87. package/dist/components/TagItem/index.d.ts +3 -3
  88. package/dist/components/TagItem/index.d.ts.map +1 -1
  89. package/dist/components/TagItem/index.story.d.ts +2 -3
  90. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  91. package/dist/components/TextArea/TextArea.story.d.ts +28 -0
  92. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -0
  93. package/dist/components/TextArea/index.d.ts +28 -0
  94. package/dist/components/TextArea/index.d.ts.map +1 -0
  95. package/dist/components/TextField/TextField.story.d.ts +29 -0
  96. package/dist/components/TextField/TextField.story.d.ts.map +1 -0
  97. package/dist/components/TextField/index.d.ts +2 -1
  98. package/dist/components/TextField/index.d.ts.map +1 -1
  99. package/dist/components/TextField/index.story.d.ts +4 -5
  100. package/dist/components/TextField/index.story.d.ts.map +1 -1
  101. package/dist/core/CharcoalProvider.d.ts +1 -1
  102. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  103. package/dist/core/ComponentAbstraction.d.ts +1 -1
  104. package/dist/core/ComponentAbstraction.d.ts.map +1 -1
  105. package/dist/index.cjs.js +744 -493
  106. package/dist/index.cjs.js.map +1 -1
  107. package/dist/index.d.ts +3 -2
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.esm.js +689 -452
  110. package/dist/index.esm.js.map +1 -1
  111. package/dist/styled.d.ts +13 -13
  112. package/dist/types/CustomJSXElement.d.ts +3 -0
  113. package/dist/types/CustomJSXElement.d.ts.map +1 -0
  114. package/package.json +7 -7
  115. package/src/_lib/compat.ts +1 -1
  116. package/src/components/Button/__snapshots__/index.test.tsx.snap +385 -0
  117. package/src/components/Button/index.story.tsx +1 -1
  118. package/src/components/Button/index.test.tsx +24 -0
  119. package/src/components/Button/index.tsx +2 -2
  120. package/src/components/Checkbox/index.story.tsx +0 -1
  121. package/src/components/Checkbox/index.tsx +2 -1
  122. package/src/components/Clickable/index.story.tsx +0 -1
  123. package/src/components/Clickable/index.tsx +1 -1
  124. package/src/components/DropdownSelector/Divider.tsx +3 -0
  125. package/src/components/DropdownSelector/DropdownMenuItem.tsx +40 -0
  126. package/src/components/DropdownSelector/DropdownPopover.tsx +21 -42
  127. package/src/components/DropdownSelector/ListItem/index.story.tsx +51 -0
  128. package/src/components/DropdownSelector/ListItem/index.tsx +58 -0
  129. package/src/components/DropdownSelector/MenuItem/index.tsx +32 -0
  130. package/src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx +43 -0
  131. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +55 -0
  132. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +43 -0
  133. package/src/components/DropdownSelector/MenuList/MenuListContext.ts +17 -0
  134. package/src/components/DropdownSelector/MenuList/index.story.tsx +52 -0
  135. package/src/components/DropdownSelector/MenuList/index.tsx +51 -0
  136. package/src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx +35 -0
  137. package/src/components/DropdownSelector/Popover/index.story.tsx +65 -0
  138. package/src/components/DropdownSelector/Popover/index.tsx +69 -0
  139. package/src/components/DropdownSelector/index.story.tsx +56 -21
  140. package/src/components/DropdownSelector/index.tsx +21 -64
  141. package/src/components/DropdownSelector/utils/findPreviewRecursive.tsx +38 -0
  142. package/src/components/FieldLabel/index.tsx +1 -1
  143. package/src/components/Icon/index.story.tsx +0 -1
  144. package/src/components/Icon/index.tsx +1 -1
  145. package/src/components/IconButton/index.story.tsx +0 -1
  146. package/src/components/IconButton/index.tsx +2 -2
  147. package/src/components/LoadingSpinner/index.story.tsx +1 -1
  148. package/src/components/LoadingSpinner/index.tsx +18 -19
  149. package/src/components/Modal/ModalPlumbing.tsx +0 -1
  150. package/src/components/Modal/index.story.tsx +0 -1
  151. package/src/components/Modal/index.tsx +2 -1
  152. package/src/components/MultiSelect/context.ts +2 -2
  153. package/src/components/MultiSelect/index.story.tsx +16 -29
  154. package/src/components/MultiSelect/index.test.tsx +5 -23
  155. package/src/components/MultiSelect/index.tsx +19 -24
  156. package/src/components/Radio/index.story.tsx +0 -1
  157. package/src/components/Radio/index.test.tsx +0 -1
  158. package/src/components/Radio/index.tsx +2 -1
  159. package/src/components/SegmentedControl/RadioGroupContext.tsx +2 -1
  160. package/src/components/SegmentedControl/index.story.tsx +0 -1
  161. package/src/components/SegmentedControl/index.tsx +10 -4
  162. package/src/components/Switch/index.story.tsx +1 -1
  163. package/src/components/Switch/index.tsx +2 -1
  164. package/src/components/TagItem/index.story.tsx +0 -1
  165. package/src/components/TagItem/index.tsx +1 -6
  166. package/src/components/TextField/index.story.tsx +0 -1
  167. package/src/components/TextField/index.tsx +2 -7
  168. package/src/components/a11y.test.tsx +0 -1
  169. package/src/core/CharcoalProvider.tsx +1 -1
  170. package/src/core/ComponentAbstraction.tsx +2 -1
  171. package/src/index.ts +7 -4
  172. package/src/components/DropdownSelector/OptionItem.tsx +0 -85
  173. package/src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx +0 -12
  174. package/src/components/DropdownSelector/utils/handleFocusByKeyBoard.tsx +0 -20
package/dist/styled.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export declare const theme: (specFn: (o: Record<string, unknown> & Readonly<{
2
2
  bg: Record<string, unknown> & {
3
- readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
4
3
  readonly border: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
4
+ readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
5
5
  readonly transparent: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
6
6
  readonly background1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
7
7
  readonly background2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
@@ -31,8 +31,8 @@ export declare const theme: (specFn: (o: Record<string, unknown> & Readonly<{
31
31
  readonly callToAction: (direction: "to top" | "to bottom" | "to left" | "to right") => import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
32
32
  };
33
33
  font: {
34
- readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
35
34
  readonly border: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
35
+ readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
36
36
  readonly transparent: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
37
37
  readonly background1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
38
38
  readonly background2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
@@ -61,35 +61,35 @@ export declare const theme: (specFn: (o: Record<string, unknown> & Readonly<{
61
61
  }> & {
62
62
  readonly typography: (size: keyof import("@charcoal-ui/theme").Typography) => import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "bold" | "monospace" | "preserveHalfLeading">;
63
63
  } & {
64
- readonly margin: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440]>;
65
- readonly padding: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440]>;
64
+ readonly margin: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "left" | "right" | "top" | "bottom", [0 | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440 | "auto"]>;
65
+ readonly padding: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "left" | "right" | "top" | "bottom", [0 | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440 | "auto"]>;
66
66
  } & {
67
- readonly height: Readonly<{
68
- px: (size: 0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
67
+ readonly width: Readonly<{
68
+ px: (size: 0 | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440 | "auto") => import("@charcoal-ui/styled/dist/internals").Internal;
69
69
  column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
70
70
  auto: import("@charcoal-ui/styled/dist/internals").Internal;
71
71
  full: import("@charcoal-ui/styled/dist/internals").Internal;
72
72
  }>;
73
- readonly width: Readonly<{
74
- px: (size: 0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
73
+ readonly height: Readonly<{
74
+ px: (size: 0 | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440 | "auto") => import("@charcoal-ui/styled/dist/internals").Internal;
75
75
  column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
76
76
  auto: import("@charcoal-ui/styled/dist/internals").Internal;
77
77
  full: import("@charcoal-ui/styled/dist/internals").Internal;
78
78
  }>;
79
79
  } & import("@charcoal-ui/styled/dist/internals").Internal & {
80
- readonly hover: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "press" | "disabled">;
81
- readonly press: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "disabled">;
80
+ readonly hover: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "disabled" | "press">;
81
+ readonly press: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "disabled" | "hover">;
82
82
  readonly disabled: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
83
83
  } & Readonly<{
84
84
  border: {
85
- readonly default: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "bottom" | "left" | "right" | "top">;
85
+ readonly default: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "left" | "right" | "top" | "bottom">;
86
86
  };
87
87
  }> & Readonly<{
88
- borderRadius: (radius: "none" | 4 | 8 | 16 | 24 | "oval") => import("@charcoal-ui/styled/dist/internals").Internal;
88
+ borderRadius: (radius: 4 | 8 | 16 | 24 | "none" | "oval") => import("@charcoal-ui/styled/dist/internals").Internal;
89
89
  }> & Readonly<{
90
90
  outline: {
91
- readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "focus">;
92
91
  readonly default: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "focus">;
92
+ readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "focus">;
93
93
  };
94
94
  }>) => import("@charcoal-ui/styled/dist/util").ArrayOrSingle<import("@charcoal-ui/styled/dist/internals").Internal | (false | null | undefined)>) => import("@charcoal-ui/styled").ThemeProp<import("styled-components").DefaultTheme>;
95
95
  //# sourceMappingURL=styled.d.ts.map
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export type CustomJSXElement = keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>;
3
+ //# sourceMappingURL=CustomJSXElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomJSXElement.d.ts","sourceRoot":"","sources":["../../src/types/CustomJSXElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,gBAAgB,GACxB,MAAM,GAAG,CAAC,iBAAiB,GAE3B,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -49,10 +49,10 @@
49
49
  "typescript": "^4.9.5"
50
50
  },
51
51
  "dependencies": {
52
- "@charcoal-ui/icons": "^3.0.0-beta.2",
53
- "@charcoal-ui/styled": "^3.0.0-beta.2",
54
- "@charcoal-ui/theme": "^3.0.0-beta.2",
55
- "@charcoal-ui/utils": "^3.0.0-beta.2",
52
+ "@charcoal-ui/icons": "^3.0.0-beta.3",
53
+ "@charcoal-ui/styled": "^3.0.0-beta.3",
54
+ "@charcoal-ui/theme": "^3.0.0-beta.3",
55
+ "@charcoal-ui/utils": "^3.0.0-beta.3",
56
56
  "@react-aria/button": "^3.7.0",
57
57
  "@react-aria/checkbox": "^3.8.0",
58
58
  "@react-aria/dialog": "^3.5.0",
@@ -73,7 +73,7 @@
73
73
  "warning": "^4.0.3"
74
74
  },
75
75
  "peerDependencies": {
76
- "react": ">=16.13.1",
76
+ "react": ">=17.0.0",
77
77
  "styled-components": ">=5.1.1"
78
78
  },
79
79
  "files": [
@@ -88,5 +88,5 @@
88
88
  "url": "https://github.com/pixiv/charcoal.git",
89
89
  "directory": "packages/react"
90
90
  },
91
- "gitHead": "dbf33f97e67fc6eabc4283fa38ac9af0b89292f4"
91
+ "gitHead": "3d302a3e0becea0868d0f020c233ba68fa1d0974"
92
92
  }
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import * as React from 'react'
2
2
 
3
3
  /**
4
4
  * import { Story } from '@storybook/react/types-6-0'
@@ -0,0 +1,385 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Basic <Button>Hello</Button> 1`] = `
4
+ .c0 {
5
+ -webkit-appearance: none;
6
+ -moz-appearance: none;
7
+ appearance: none;
8
+ background: transparent;
9
+ padding: 0;
10
+ border-style: none;
11
+ outline: none;
12
+ color: inherit;
13
+ text-rendering: inherit;
14
+ -webkit-letter-spacing: inherit;
15
+ -moz-letter-spacing: inherit;
16
+ -ms-letter-spacing: inherit;
17
+ letter-spacing: inherit;
18
+ word-spacing: inherit;
19
+ font: inherit;
20
+ margin: 0;
21
+ overflow: visible;
22
+ text-transform: none;
23
+ cursor: pointer;
24
+ }
25
+
26
+ .c0:focus {
27
+ outline: none;
28
+ }
29
+
30
+ .c0::-moz-focus-inner {
31
+ border-style: none;
32
+ padding: 0;
33
+ }
34
+
35
+ .c0:disabled,
36
+ .c0[aria-disabled]:not([aria-disabled=false]) {
37
+ cursor: default;
38
+ }
39
+
40
+ .c1 {
41
+ width: -webkit-min-content;
42
+ width: -moz-min-content;
43
+ width: min-content;
44
+ display: inline-grid;
45
+ -webkit-align-items: center;
46
+ -webkit-box-align: center;
47
+ -ms-flex-align: center;
48
+ align-items: center;
49
+ -webkit-box-pack: center;
50
+ -webkit-justify-content: center;
51
+ -ms-flex-pack: center;
52
+ justify-content: center;
53
+ cursor: pointer;
54
+ -webkit-user-select: none;
55
+ -moz-user-select: none;
56
+ -ms-user-select: none;
57
+ user-select: none;
58
+ white-space: nowrap;
59
+ color: var(--charcoal-text2);
60
+ background-color: var(--charcoal-surface3);
61
+ font-size: 14px;
62
+ line-height: 22px;
63
+ font-weight: bold;
64
+ padding-right: 24px;
65
+ padding-left: 24px;
66
+ border-radius: 999999px;
67
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
68
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
69
+ height: 40px;
70
+ }
71
+
72
+ .c1:hover:not(:disabled):not([aria-disabled]),
73
+ .c1:hover[aria-disabled=false] {
74
+ color: var(--charcoal-text2-hover);
75
+ }
76
+
77
+ .c1:active:not(:disabled):not([aria-disabled]),
78
+ .c1:active[aria-disabled=false] {
79
+ color: var(--charcoal-text2-press);
80
+ }
81
+
82
+ .c1:hover:not(:disabled):not([aria-disabled]),
83
+ .c1:hover[aria-disabled=false] {
84
+ background-color: var(--charcoal-surface3-hover);
85
+ }
86
+
87
+ .c1:active:not(:disabled):not([aria-disabled]),
88
+ .c1:active[aria-disabled=false] {
89
+ background-color: var(--charcoal-surface3-press);
90
+ }
91
+
92
+ .c1:disabled,
93
+ .c1[aria-disabled]:not([aria-disabled=false]) {
94
+ opacity: 0.32;
95
+ }
96
+
97
+ .c1:not(:disabled):not([aria-disabled]):focus,
98
+ .c1[aria-disabled=false]:focus,
99
+ .c1:not(:disabled):not([aria-disabled]):active,
100
+ .c1[aria-disabled=false]:active {
101
+ outline: none;
102
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
103
+ }
104
+
105
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
106
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
107
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
108
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
109
+ outline: none;
110
+ }
111
+
112
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
113
+ .c1[aria-disabled=false]:focus-visible {
114
+ outline: none;
115
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
116
+ }
117
+
118
+ <button
119
+ className="c0 c1"
120
+ disabled={false}
121
+ height={40}
122
+ size="M"
123
+ >
124
+ Hello
125
+ </button>
126
+ `;
127
+
128
+ exports[`Link <Button to="#">Hello</Button> 1`] = `
129
+ .c0 {
130
+ color: inherit;
131
+ cursor: pointer;
132
+ }
133
+
134
+ .c0:focus {
135
+ outline: none;
136
+ }
137
+
138
+ .c0 .text {
139
+ top: calc(1em + 2em);
140
+ }
141
+
142
+ .c0:disabled,
143
+ .c0[aria-disabled]:not([aria-disabled=false]) {
144
+ cursor: default;
145
+ }
146
+
147
+ .c1 {
148
+ width: -webkit-min-content;
149
+ width: -moz-min-content;
150
+ width: min-content;
151
+ display: inline-grid;
152
+ -webkit-align-items: center;
153
+ -webkit-box-align: center;
154
+ -ms-flex-align: center;
155
+ align-items: center;
156
+ -webkit-box-pack: center;
157
+ -webkit-justify-content: center;
158
+ -ms-flex-pack: center;
159
+ justify-content: center;
160
+ cursor: pointer;
161
+ -webkit-user-select: none;
162
+ -moz-user-select: none;
163
+ -ms-user-select: none;
164
+ user-select: none;
165
+ white-space: nowrap;
166
+ color: var(--charcoal-text2);
167
+ background-color: var(--charcoal-surface3);
168
+ font-size: 14px;
169
+ line-height: 22px;
170
+ font-weight: bold;
171
+ padding-right: 24px;
172
+ padding-left: 24px;
173
+ border-radius: 999999px;
174
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
175
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
176
+ height: 40px;
177
+ }
178
+
179
+ .c1:hover:not(:disabled):not([aria-disabled]),
180
+ .c1:hover[aria-disabled=false] {
181
+ color: var(--charcoal-text2-hover);
182
+ }
183
+
184
+ .c1:active:not(:disabled):not([aria-disabled]),
185
+ .c1:active[aria-disabled=false] {
186
+ color: var(--charcoal-text2-press);
187
+ }
188
+
189
+ .c1:hover:not(:disabled):not([aria-disabled]),
190
+ .c1:hover[aria-disabled=false] {
191
+ background-color: var(--charcoal-surface3-hover);
192
+ }
193
+
194
+ .c1:active:not(:disabled):not([aria-disabled]),
195
+ .c1:active[aria-disabled=false] {
196
+ background-color: var(--charcoal-surface3-press);
197
+ }
198
+
199
+ .c1:disabled,
200
+ .c1[aria-disabled]:not([aria-disabled=false]) {
201
+ opacity: 0.32;
202
+ }
203
+
204
+ .c1:not(:disabled):not([aria-disabled]):focus,
205
+ .c1[aria-disabled=false]:focus,
206
+ .c1:not(:disabled):not([aria-disabled]):active,
207
+ .c1[aria-disabled=false]:active {
208
+ outline: none;
209
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
210
+ }
211
+
212
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
213
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
214
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
215
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
216
+ outline: none;
217
+ }
218
+
219
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
220
+ .c1[aria-disabled=false]:focus-visible {
221
+ outline: none;
222
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
223
+ }
224
+
225
+ <a
226
+ aria-disabled={false}
227
+ background="surface3"
228
+ className="c0 c1"
229
+ font="text2"
230
+ height={40}
231
+ href="#"
232
+ padding={24}
233
+ size="M"
234
+ theme={
235
+ Object {
236
+ "border": Object {
237
+ "default": Object {
238
+ "color": "rgba(0,0,0,0.08)",
239
+ },
240
+ },
241
+ "borderRadius": Object {
242
+ "16": 16,
243
+ "24": 24,
244
+ "4": 4,
245
+ "8": 8,
246
+ "none": 0,
247
+ "oval": 999999,
248
+ },
249
+ "breakpoint": Object {
250
+ "screen1": 744,
251
+ "screen2": 952,
252
+ "screen3": 1160,
253
+ "screen4": 1368,
254
+ },
255
+ "color": Object {
256
+ "assertive": "#ff2b00",
257
+ "background1": "#ffffff",
258
+ "background2": "#f5f5f5",
259
+ "border": "rgba(0,0,0,0.08)",
260
+ "brand": "#0096fa",
261
+ "icon6": "rgba(255,255,255,0.28)",
262
+ "link1": "#3d7699",
263
+ "link2": "rgba(255,255,255,0.36)",
264
+ "success": "#b1cc29",
265
+ "surface1": "#ffffff",
266
+ "surface10": "rgba(0,0,0,0.16)",
267
+ "surface2": "rgba(0,0,0,0.02)",
268
+ "surface3": "rgba(0,0,0,0.04)",
269
+ "surface4": "rgba(0,0,0,0.32)",
270
+ "surface6": "rgba(0,0,0,0.88)",
271
+ "surface7": "rgba(0,0,0,0.02)",
272
+ "surface8": "rgba(0,0,0,0.88)",
273
+ "surface9": "#ffffff",
274
+ "text1": "#1f1f1f",
275
+ "text2": "#474747",
276
+ "text3": "#858585",
277
+ "text4": "#adadad",
278
+ "text5": "#ffffff",
279
+ "transparent": "rgba(0,0,0,0)",
280
+ "updatedItem": "rgba(0,150,250,0.04)",
281
+ "warning": "#ffaf0f",
282
+ },
283
+ "effect": Object {
284
+ "hover": Object {
285
+ "color": "rgba(0,0,0,0.04)",
286
+ "type": "alpha",
287
+ },
288
+ "press": Object {
289
+ "color": "rgba(0,0,0,0.16)",
290
+ "type": "alpha",
291
+ },
292
+ },
293
+ "elementEffect": Object {
294
+ "disabled": Object {
295
+ "opacity": 0.32,
296
+ "type": "opacity",
297
+ },
298
+ },
299
+ "gradientColor": Object {
300
+ "callToAction": Array [
301
+ Object {
302
+ "color": "#d1ff1a",
303
+ "ratio": 0,
304
+ },
305
+ Object {
306
+ "color": "#1ad1ff",
307
+ "ratio": 100,
308
+ },
309
+ ],
310
+ "surface5": Array [
311
+ Object {
312
+ "color": "rgba(0,0,0,0.32)",
313
+ "ratio": 0,
314
+ },
315
+ Object {
316
+ "color": "rgba(0,0,0,0)",
317
+ "ratio": 100,
318
+ },
319
+ ],
320
+ },
321
+ "grid": Object {
322
+ "unit": Object {
323
+ "column": 80,
324
+ "gutter": 24,
325
+ },
326
+ },
327
+ "outline": Object {
328
+ "assertive": Object {
329
+ "color": "rgba(255,43,0,0.32)",
330
+ "weight": 4,
331
+ },
332
+ "default": Object {
333
+ "color": "rgba(0,150,250,0.32)",
334
+ "weight": 4,
335
+ },
336
+ },
337
+ "spacing": Object {
338
+ "0": 0,
339
+ "104": 104,
340
+ "16": 16,
341
+ "168": 168,
342
+ "24": 24,
343
+ "272": 272,
344
+ "4": 4,
345
+ "40": 40,
346
+ "440": 440,
347
+ "64": 64,
348
+ "8": 8,
349
+ },
350
+ "transition": Object {
351
+ "default": Object {
352
+ "duration": 0.2,
353
+ },
354
+ },
355
+ "typography": Object {
356
+ "size": Object {
357
+ "12": Object {
358
+ "fontSize": 12,
359
+ "lineHeight": 20,
360
+ },
361
+ "14": Object {
362
+ "fontSize": 14,
363
+ "lineHeight": 22,
364
+ },
365
+ "16": Object {
366
+ "fontSize": 16,
367
+ "lineHeight": 24,
368
+ },
369
+ "20": Object {
370
+ "fontSize": 20,
371
+ "lineHeight": 28,
372
+ },
373
+ "32": Object {
374
+ "fontSize": 32,
375
+ "lineHeight": 40,
376
+ },
377
+ },
378
+ },
379
+ }
380
+ }
381
+ variant="Default"
382
+ >
383
+ Hello
384
+ </a>
385
+ `;
@@ -1,5 +1,5 @@
1
1
  import { action } from '@storybook/addon-actions'
2
- import React, { useRef } from 'react'
2
+ import { useRef } from 'react'
3
3
  import { Story } from '../../_lib/compat'
4
4
  import { ClickableElement } from '../Clickable'
5
5
  import Button, { ButtonProps } from '.'
@@ -0,0 +1,24 @@
1
+ import 'jest-styled-components'
2
+
3
+ import Button from '.'
4
+ import renderder from 'react-test-renderer'
5
+ import { ThemeProvider } from 'styled-components'
6
+ import { light } from '@charcoal-ui/theme'
7
+
8
+ export function render(children: JSX.Element) {
9
+ return renderder
10
+ .create(<ThemeProvider theme={light}>{children}</ThemeProvider>)
11
+ .toJSON()
12
+ }
13
+
14
+ describe('Basic', () => {
15
+ test('<Button>Hello</Button>', () => {
16
+ expect(render(<Button>Hello</Button>)).toMatchSnapshot()
17
+ })
18
+ })
19
+
20
+ describe('Link', () => {
21
+ test('<Button to="#">Hello</Button>', () => {
22
+ expect(render(<Button to="#">Hello</Button>)).toMatchSnapshot()
23
+ })
24
+ })
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import { forwardRef } from 'react'
2
2
  import styled from 'styled-components'
3
3
  import { unreachable } from '../../_lib'
4
4
  import { theme } from '../../styled'
@@ -24,7 +24,7 @@ interface StyledProps {
24
24
 
25
25
  export type ButtonProps = Partial<StyledProps> & ClickableProps
26
26
 
27
- const Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(
27
+ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
28
28
  {
29
29
  children,
30
30
  variant = 'Default',
@@ -1,5 +1,4 @@
1
1
  import { action } from '@storybook/addon-actions'
2
- import React from 'react'
3
2
  import Checkbox from '.'
4
3
  import { Story } from '../../_lib/compat'
5
4
 
@@ -1,4 +1,5 @@
1
- import React, { forwardRef, memo, useMemo } from 'react'
1
+ import { forwardRef, memo, useMemo } from 'react'
2
+ import * as React from 'react'
2
3
  import styled, { css } from 'styled-components'
3
4
  import { useCheckbox } from '@react-aria/checkbox'
4
5
  import { useObjectRef } from '@react-aria/utils'
@@ -1,5 +1,4 @@
1
1
  import { action } from '@storybook/addon-actions'
2
- import React from 'react'
3
2
  import Clickable from '.'
4
3
 
5
4
  export default {
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import * as React from 'react'
2
2
  import styled, { css } from 'styled-components'
3
3
  import {
4
4
  LinkProps,
@@ -1,5 +1,8 @@
1
1
  import styled from 'styled-components'
2
2
 
3
+ /**
4
+ * 水平方向の直線
5
+ */
3
6
  export const Divider = styled.div.attrs({ role: 'separator' })`
4
7
  display: flex;
5
8
 
@@ -0,0 +1,40 @@
1
+ import styled from 'styled-components'
2
+ import MenuItem, { MenuItemProps } from './MenuItem'
3
+ import { MenuListContext } from './MenuList/MenuListContext'
4
+ import React, { useContext } from 'react'
5
+ import { theme } from '../../styled'
6
+ import Icon from '../Icon'
7
+
8
+ export type DropdownMenuItemProps = Omit<MenuItemProps<'div'>, 'as'>
9
+
10
+ /**
11
+ * DropdownSelectorの選択肢として使うMenuItem
12
+ */
13
+ export default function DropdownMenuItem(props: DropdownMenuItemProps) {
14
+ const { value: ctxValue } = useContext(MenuListContext)
15
+ const isSelected = props.value === ctxValue
16
+ const { children, ...rest } = props
17
+
18
+ return (
19
+ <MenuItem {...rest}>
20
+ {isSelected && <Text2ColorIcon name="16/Check" />}
21
+ <StyledSpan isSelected={isSelected}>{props.children}</StyledSpan>
22
+ </MenuItem>
23
+ )
24
+ }
25
+
26
+ /**
27
+ * アイコンがない時を考慮して20px(16pxのwidthと4pxのgap)の余白をとる
28
+ */
29
+ const StyledSpan = styled.span<{ isSelected?: boolean }>`
30
+ ${theme((o) => [o.typography(14), o.font.text2])};
31
+ display: flex;
32
+ align-items: center;
33
+ width: 100%;
34
+ margin-left: ${({ isSelected }) => (isSelected === true ? 0 : 20)}px;
35
+ `
36
+
37
+ const Text2ColorIcon = styled(Icon)`
38
+ ${theme((o) => [o.font.text2])}
39
+ padding-right: 4px;
40
+ `