@charcoal-ui/react 4.6.1 → 4.7.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.
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import './index.css';
3
+ export type HintTextContext = 'page' | 'section';
4
+ export interface HintTextProps {
5
+ children: ReactNode;
6
+ context: HintTextContext;
7
+ className?: string;
8
+ }
9
+ export default function HintText({ children, context, className, }: HintTextProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/HintText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGjC,OAAO,aAAa,CAAA;AAGpB,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAA;AAChD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,EAAE,eAAe,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,aAAa,2CAWf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -49,7 +49,7 @@
49
49
  "tsup": "^6.5.0",
50
50
  "typescript": "^4.9.5",
51
51
  "vitest": "^2.0.1",
52
- "@charcoal-ui/esbuild-plugin-styled-components": "4.6.1"
52
+ "@charcoal-ui/esbuild-plugin-styled-components": "4.7.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "@react-aria/button": "^3.9.1",
@@ -67,10 +67,10 @@
67
67
  "react-spring": "^9.0.0",
68
68
  "react-stately": "^3.26.0",
69
69
  "warning": "^4.0.3",
70
- "@charcoal-ui/foundation": "4.6.1",
71
- "@charcoal-ui/theme": "4.6.1",
72
- "@charcoal-ui/utils": "4.6.1",
73
- "@charcoal-ui/icons": "4.6.1"
70
+ "@charcoal-ui/foundation": "4.7.0",
71
+ "@charcoal-ui/theme": "4.7.0",
72
+ "@charcoal-ui/icons": "4.7.0",
73
+ "@charcoal-ui/utils": "4.7.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "react": ">=17.0.0",
@@ -0,0 +1,57 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storybook Tests > react/HintText > Default 1`] = `
4
+ <div>
5
+ <div
6
+ data-dark="false"
7
+ >
8
+ <div
9
+ class="charcoal-hint-text"
10
+ data-context="section"
11
+ >
12
+ <div
13
+ class="charcoal-hint-text-icon"
14
+ >
15
+ <pixiv-icon
16
+ name="16/Info"
17
+ />
18
+ </div>
19
+ <p
20
+ class="charcoal-hint-text-message"
21
+ >
22
+ HintText
23
+ </p>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ `;
28
+
29
+ exports[`Storybook Tests > react/HintText > NarrowWidth 1`] = `
30
+ <div>
31
+ <div
32
+ data-dark="false"
33
+ >
34
+ <div
35
+ style="width: 200px;"
36
+ >
37
+ <div
38
+ class="charcoal-hint-text"
39
+ data-context="section"
40
+ >
41
+ <div
42
+ class="charcoal-hint-text-icon"
43
+ >
44
+ <pixiv-icon
45
+ name="16/Info"
46
+ />
47
+ </div>
48
+ <p
49
+ class="charcoal-hint-text-message"
50
+ >
51
+ LongLongLongLongLongLongLongLongLongText
52
+ </p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ `;
@@ -0,0 +1,35 @@
1
+ .charcoal-hint-text {
2
+ background-color: var(--charcoal-surface3);
3
+ border-radius: 8px;
4
+ padding: 12px 16px;
5
+ display: flex;
6
+ align-items: flex-start;
7
+ }
8
+
9
+ .charcoal-hint-text[data-context='page'] {
10
+ justify-content: center;
11
+ }
12
+
13
+ @media (min-width: 744px) {
14
+ .charcoal-hint-text[data-context='page'] {
15
+ padding: 20px 40px;
16
+ }
17
+ }
18
+
19
+ .charcoal-hint-text-icon {
20
+ display: flex;
21
+ align-items: center;
22
+ color: var(--charcoal-text3);
23
+ height: 22px;
24
+ margin: 0 4px 0 0;
25
+ }
26
+
27
+ .charcoal-hint-text-message {
28
+ color: var(--charcoal-text2);
29
+ font-size: 14px;
30
+ line-height: 22px;
31
+ display: flow-root;
32
+ margin: 0;
33
+ min-width: 0;
34
+ overflow-wrap: break-word;
35
+ }
@@ -0,0 +1,39 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import HintText from '.'
3
+
4
+ export default {
5
+ title: 'react/HintText',
6
+ component: HintText,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ argTypes: {
11
+ children: { type: 'string' },
12
+ context: {
13
+ control: {
14
+ type: 'select',
15
+ options: ['page', 'section'],
16
+ },
17
+ },
18
+ },
19
+ } as Meta<typeof HintText>
20
+
21
+ export const Default: StoryObj<typeof HintText> = {
22
+ args: {
23
+ children: 'HintText',
24
+ context: 'section',
25
+ },
26
+ render: (props) => <HintText {...props} />,
27
+ }
28
+
29
+ export const NarrowWidth: StoryObj<typeof HintText> = {
30
+ args: {
31
+ children: 'LongLongLongLongLongLongLongLongLongText',
32
+ context: 'section',
33
+ },
34
+ render: (props) => (
35
+ <div style={{ width: 200 }}>
36
+ <HintText {...props} />
37
+ </div>
38
+ ),
39
+ }
@@ -0,0 +1,29 @@
1
+ import { ReactNode } from 'react'
2
+ import Icon from '../Icon'
3
+
4
+ import './index.css'
5
+ import { useClassNames } from '../../_lib/useClassNames'
6
+
7
+ export type HintTextContext = 'page' | 'section'
8
+ export interface HintTextProps {
9
+ children: ReactNode
10
+ context: HintTextContext
11
+ className?: string
12
+ }
13
+
14
+ export default function HintText({
15
+ children,
16
+ context,
17
+ className,
18
+ }: HintTextProps) {
19
+ const classNames = useClassNames('charcoal-hint-text', className)
20
+
21
+ return (
22
+ <div className={classNames} data-context={context}>
23
+ <div className="charcoal-hint-text-icon">
24
+ <Icon name="16/Info" />
25
+ </div>
26
+ <p className="charcoal-hint-text-message">{children}</p>
27
+ </div>
28
+ )
29
+ }