@guardian/stand 0.0.23 → 0.0.24

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 (29) hide show
  1. package/dist/components/text-area/TextArea.cjs +35 -0
  2. package/dist/components/text-area/TextArea.js +12 -0
  3. package/dist/components/text-area/styles.cjs +47 -0
  4. package/dist/components/text-area/styles.js +44 -0
  5. package/dist/components/text-input/TextInput.cjs +8 -1
  6. package/dist/components/text-input/TextInput.js +2 -2
  7. package/dist/components/text-input/styles.cjs +12 -0
  8. package/dist/components/text-input/styles.js +12 -0
  9. package/dist/index.cjs +2 -0
  10. package/dist/index.js +1 -0
  11. package/dist/styleD/build/css/component/textArea.css +30 -0
  12. package/dist/styleD/build/css/component/textInput.css +2 -0
  13. package/dist/styleD/build/typescript/component/textArea.cjs +48 -0
  14. package/dist/styleD/build/typescript/component/textArea.js +46 -0
  15. package/dist/styleD/build/typescript/component/textInput.cjs +4 -0
  16. package/dist/styleD/build/typescript/component/textInput.js +4 -0
  17. package/dist/text-area.cjs +9 -0
  18. package/dist/text-area.js +2 -0
  19. package/dist/types/components/text-area/TextArea.d.ts +2 -0
  20. package/dist/types/components/text-area/sandbox.d.ts +5 -0
  21. package/dist/types/components/text-area/styles.d.ts +7 -0
  22. package/dist/types/components/text-area/types.d.ts +7 -0
  23. package/dist/types/components/text-input/TextInput.d.ts +1 -1
  24. package/dist/types/components/text-input/types.d.ts +4 -1
  25. package/dist/types/index.d.ts +2 -0
  26. package/dist/types/styleD/build/typescript/component/textArea.d.ts +48 -0
  27. package/dist/types/styleD/build/typescript/component/textInput.d.ts +4 -0
  28. package/dist/types/text-area.d.ts +20 -0
  29. package/package.json +11 -2
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var reactAriaComponents = require('react-aria-components');
5
+ var mergeDeep = require('../../util/mergeDeep.cjs');
6
+ var Form = require('../form/Form.cjs');
7
+ var styles = require('./styles.cjs');
8
+
9
+ function TextArea({
10
+ size = "md",
11
+ isInvalid = false,
12
+ theme = {},
13
+ placeholder,
14
+ ...props
15
+ }) {
16
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultTextAreaTheme, theme);
17
+ return /* @__PURE__ */ jsxRuntime.jsx(
18
+ Form.FormInputContainer,
19
+ {
20
+ as: reactAriaComponents.TextField,
21
+ size,
22
+ isInvalid,
23
+ ...props,
24
+ children: /* @__PURE__ */ jsxRuntime.jsx(
25
+ reactAriaComponents.TextArea,
26
+ {
27
+ placeholder,
28
+ css: styles.textAreaStyles(mergedTheme, { size, isInvalid })
29
+ }
30
+ )
31
+ }
32
+ );
33
+ }
34
+
35
+ exports.TextArea = TextArea;
@@ -0,0 +1,12 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import { TextField, TextArea as TextArea$1 } from 'react-aria-components';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { FormInputContainer } from '../form/Form.js';
5
+ import { textAreaStyles, defaultTextAreaTheme } from './styles.js';
6
+
7
+ function TextArea({ size = "md", isInvalid = false, theme = {}, placeholder, ...props }) {
8
+ const mergedTheme = mergeDeep(defaultTextAreaTheme, theme);
9
+ return jsx(FormInputContainer, { as: TextField, size, isInvalid, ...props, children: jsx(TextArea$1, { placeholder, css: textAreaStyles(mergedTheme, { size, isInvalid }) }) });
10
+ }
11
+
12
+ export { TextArea };
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var textArea = require('../../styleD/build/typescript/component/textArea.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+
7
+ const defaultTextAreaTheme = textArea.componentTextArea;
8
+ const textAreaStyles = (theme, { size, isInvalid }) => {
9
+ return react.css`
10
+ ${typography.convertTypographyToEmotionStringStyle(theme[size].typography)}
11
+ background-color: ${theme.shared["background-color"]};
12
+ border-radius: ${theme.shared["border-radius"]};
13
+ border: ${theme.shared.border};
14
+ color: ${theme.shared.color};
15
+ cursor: ${theme.shared.cursor};
16
+ height: ${theme.shared.height};
17
+ margin-top: ${theme.shared["margin-top"]};
18
+ padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
19
+ ${theme.shared.padding.bottom} ${theme.shared.padding.left};
20
+
21
+ ::placeholder {
22
+ color: ${theme.shared.placeholderColor};
23
+ }
24
+
25
+ &[data-disabled] {
26
+ background-color: ${theme.shared.disabled.backgroundColor};
27
+ border: ${theme.shared.disabled.border};
28
+ color: ${theme.shared.disabled.color};
29
+ cursor: ${theme.shared.disabled.cursor};
30
+
31
+ ::placeholder {
32
+ color: ${theme.shared.disabled.color};
33
+ }
34
+ }
35
+
36
+ &[data-focused] {
37
+ outline: ${theme.shared.focused.outline};
38
+ }
39
+
40
+ ${isInvalid && react.css`
41
+ border: ${theme.shared.error.border};
42
+ `}
43
+ `;
44
+ };
45
+
46
+ exports.defaultTextAreaTheme = defaultTextAreaTheme;
47
+ exports.textAreaStyles = textAreaStyles;
@@ -0,0 +1,44 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentTextArea } from '../../styleD/build/typescript/component/textArea.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+
5
+ const defaultTextAreaTheme = componentTextArea;
6
+ const textAreaStyles = (theme, { size, isInvalid }) => {
7
+ return css`
8
+ ${convertTypographyToEmotionStringStyle(theme[size].typography)}
9
+ background-color: ${theme.shared["background-color"]};
10
+ border-radius: ${theme.shared["border-radius"]};
11
+ border: ${theme.shared.border};
12
+ color: ${theme.shared.color};
13
+ cursor: ${theme.shared.cursor};
14
+ height: ${theme.shared.height};
15
+ margin-top: ${theme.shared["margin-top"]};
16
+ padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
17
+ ${theme.shared.padding.bottom} ${theme.shared.padding.left};
18
+
19
+ ::placeholder {
20
+ color: ${theme.shared.placeholderColor};
21
+ }
22
+
23
+ &[data-disabled] {
24
+ background-color: ${theme.shared.disabled.backgroundColor};
25
+ border: ${theme.shared.disabled.border};
26
+ color: ${theme.shared.disabled.color};
27
+ cursor: ${theme.shared.disabled.cursor};
28
+
29
+ ::placeholder {
30
+ color: ${theme.shared.disabled.color};
31
+ }
32
+ }
33
+
34
+ &[data-focused] {
35
+ outline: ${theme.shared.focused.outline};
36
+ }
37
+
38
+ ${isInvalid && css`
39
+ border: ${theme.shared.error.border};
40
+ `}
41
+ `;
42
+ };
43
+
44
+ export { defaultTextAreaTheme, textAreaStyles };
@@ -10,6 +10,7 @@ function TextInput({
10
10
  size = "md",
11
11
  isInvalid = false,
12
12
  theme = {},
13
+ placeholder,
13
14
  ...props
14
15
  }) {
15
16
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultTextInputTheme, theme);
@@ -20,7 +21,13 @@ function TextInput({
20
21
  size,
21
22
  isInvalid,
22
23
  ...props,
23
- children: /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Input, { css: styles.textInputStyles(mergedTheme, { size, isInvalid }) })
24
+ children: /* @__PURE__ */ jsxRuntime.jsx(
25
+ reactAriaComponents.Input,
26
+ {
27
+ placeholder,
28
+ css: styles.textInputStyles(mergedTheme, { size, isInvalid })
29
+ }
30
+ )
24
31
  }
25
32
  );
26
33
  }
@@ -4,9 +4,9 @@ import { mergeDeep } from '../../util/mergeDeep.js';
4
4
  import { FormInputContainer } from '../form/Form.js';
5
5
  import { textInputStyles, defaultTextInputTheme } from './styles.js';
6
6
 
7
- function TextInput({ size = "md", isInvalid = false, theme = {}, ...props }) {
7
+ function TextInput({ size = "md", isInvalid = false, theme = {}, placeholder, ...props }) {
8
8
  const mergedTheme = mergeDeep(defaultTextInputTheme, theme);
9
- return jsx(FormInputContainer, { as: TextField, size, isInvalid, ...props, children: jsx(Input, { css: textInputStyles(mergedTheme, { size, isInvalid }) }) });
9
+ return jsx(FormInputContainer, { as: TextField, size, isInvalid, ...props, children: jsx(Input, { placeholder, css: textInputStyles(mergedTheme, { size, isInvalid }) }) });
10
10
  }
11
11
 
12
12
  export { TextInput };
@@ -18,11 +18,23 @@ const textInputStyles = (theme, { size, isInvalid }) => {
18
18
  padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
19
19
  ${theme.shared.padding.bottom} ${theme.shared.padding.left};
20
20
 
21
+ ::placeholder {
22
+ color: ${theme.shared.placeholderColor};
23
+ }
24
+
21
25
  &[data-disabled] {
22
26
  background-color: ${theme.shared.disabled.backgroundColor};
23
27
  border: ${theme.shared.disabled.border};
24
28
  color: ${theme.shared.disabled.color};
25
29
  cursor: ${theme.shared.disabled.cursor};
30
+
31
+ ::placeholder {
32
+ color: ${theme.shared.disabled.color};
33
+ }
34
+ }
35
+
36
+ &[data-focused] {
37
+ outline: ${theme.shared.focused.outline};
26
38
  }
27
39
 
28
40
  ${isInvalid && react.css`
@@ -16,11 +16,23 @@ const textInputStyles = (theme, { size, isInvalid }) => {
16
16
  padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
17
17
  ${theme.shared.padding.bottom} ${theme.shared.padding.left};
18
18
 
19
+ ::placeholder {
20
+ color: ${theme.shared.placeholderColor};
21
+ }
22
+
19
23
  &[data-disabled] {
20
24
  background-color: ${theme.shared.disabled.backgroundColor};
21
25
  border: ${theme.shared.disabled.border};
22
26
  color: ${theme.shared.disabled.color};
23
27
  cursor: ${theme.shared.disabled.cursor};
28
+
29
+ ::placeholder {
30
+ color: ${theme.shared.disabled.color};
31
+ }
32
+ }
33
+
34
+ &[data-focused] {
35
+ outline: ${theme.shared.focused.outline};
24
36
  }
25
37
 
26
38
  ${isInvalid && css`
package/dist/index.cjs CHANGED
@@ -11,6 +11,7 @@ var icon = require('./styleD/build/typescript/component/icon.cjs');
11
11
  var favicon = require('./styleD/build/typescript/component/favicon.cjs');
12
12
  var radioGroup = require('./styleD/build/typescript/component/radioGroup.cjs');
13
13
  var checkbox = require('./styleD/build/typescript/component/checkbox.cjs');
14
+ var textArea = require('./styleD/build/typescript/component/textArea.cjs');
14
15
  var textInput = require('./styleD/build/typescript/component/textInput.cjs');
15
16
  var inlineMessage = require('./styleD/build/typescript/component/inlineMessage.cjs');
16
17
  var select = require('./styleD/build/typescript/component/select.cjs');
@@ -40,6 +41,7 @@ exports.componentIcon = icon.componentIcon;
40
41
  exports.componentFavicon = favicon.componentFavicon;
41
42
  exports.componentRadioGroup = radioGroup.componentRadioGroup;
42
43
  exports.componentCheckbox = checkbox.componentCheckbox;
44
+ exports.componentTextArea = textArea.componentTextArea;
43
45
  exports.componentTextInput = textInput.componentTextInput;
44
46
  exports.componentInlineMessage = inlineMessage.componentInlineMessage;
45
47
  exports.componentSelect = select.componentSelect;
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export { componentIcon } from './styleD/build/typescript/component/icon.js';
9
9
  export { componentFavicon } from './styleD/build/typescript/component/favicon.js';
10
10
  export { componentRadioGroup } from './styleD/build/typescript/component/radioGroup.js';
11
11
  export { componentCheckbox } from './styleD/build/typescript/component/checkbox.js';
12
+ export { componentTextArea } from './styleD/build/typescript/component/textArea.js';
12
13
  export { componentTextInput } from './styleD/build/typescript/component/textInput.js';
13
14
  export { componentInlineMessage } from './styleD/build/typescript/component/inlineMessage.js';
14
15
  export { componentSelect } from './styleD/build/typescript/component/select.js';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ :root {
6
+ --component-text-area-shared-color: #000000;
7
+ --component-text-area-shared-cursor: text;
8
+ --component-text-area-shared-padding-top: 0.5rem;
9
+ --component-text-area-shared-padding-right: 0.75rem;
10
+ --component-text-area-shared-padding-bottom: 0.5rem;
11
+ --component-text-area-shared-padding-left: 0.75rem;
12
+ --component-text-area-shared-height: 144px;
13
+ --component-text-area-shared-margin-top: 0.5rem; /** spacing between the input itself and the previous element (label or description) minus the flex gap (default 4px), e.g. if the spacing between label and input should be 12px, then margin-top should be 8px */
14
+ --component-text-area-shared-border-radius: 0.25rem;
15
+ --component-text-area-shared-border: 0.0625rem solid #545454;
16
+ --component-text-area-shared-background-color: #ffffff;
17
+ --component-text-area-shared-placeholder-color: #545454;
18
+ --component-text-area-shared-disabled-background-color: #ffffff;
19
+ --component-text-area-shared-disabled-cursor: not-allowed;
20
+ --component-text-area-shared-disabled-color: #999999;
21
+ --component-text-area-shared-disabled-border: 0.0625rem solid #dcdcdc;
22
+ --component-text-area-shared-focused-outline: 0.125rem auto #0072a9;
23
+ --component-text-area-shared-error-border: 0.0625rem solid #b42a19;
24
+ --component-text-area-sm-typography-font: normal 460 0.875rem/1.3 'Open Sans';
25
+ --component-text-area-sm-typography-letter-spacing: 0;
26
+ --component-text-area-sm-typography-font-width: 95;
27
+ --component-text-area-md-typography-font: normal 460 1rem/1.3 'Open Sans';
28
+ --component-text-area-md-typography-letter-spacing: 0;
29
+ --component-text-area-md-typography-font-width: 95;
30
+ }
@@ -13,10 +13,12 @@
13
13
  --component-text-input-shared-border-radius: 0.25rem;
14
14
  --component-text-input-shared-border: 0.0625rem solid #545454;
15
15
  --component-text-input-shared-background-color: #ffffff;
16
+ --component-text-input-shared-placeholder-color: #545454;
16
17
  --component-text-input-shared-disabled-background-color: #ffffff;
17
18
  --component-text-input-shared-disabled-cursor: not-allowed;
18
19
  --component-text-input-shared-disabled-color: #999999;
19
20
  --component-text-input-shared-disabled-border: 0.0625rem solid #dcdcdc;
21
+ --component-text-input-shared-focused-outline: 0.125rem auto #0072a9;
20
22
  --component-text-input-shared-error-border: 0.0625rem solid #b42a19;
21
23
  --component-text-input-sm-height: 2rem;
22
24
  --component-text-input-sm-typography-font: normal 460 0.875rem/1.3 'Open Sans';
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ const componentTextArea = {
4
+ shared: {
5
+ color: "#000000",
6
+ cursor: "text",
7
+ padding: {
8
+ top: "0.5rem",
9
+ right: "0.75rem",
10
+ bottom: "0.5rem",
11
+ left: "0.75rem"
12
+ },
13
+ height: "144px",
14
+ "margin-top": "0.5rem",
15
+ "border-radius": "0.25rem",
16
+ border: "0.0625rem solid #545454",
17
+ "background-color": "#ffffff",
18
+ placeholderColor: "#545454",
19
+ disabled: {
20
+ backgroundColor: "#ffffff",
21
+ cursor: "not-allowed",
22
+ color: "#999999",
23
+ border: "0.0625rem solid #dcdcdc"
24
+ },
25
+ focused: {
26
+ outline: "0.125rem auto #0072a9"
27
+ },
28
+ error: {
29
+ border: "0.0625rem solid #b42a19"
30
+ }
31
+ },
32
+ sm: {
33
+ typography: {
34
+ font: "normal 460 0.875rem/1.3 Open Sans",
35
+ letterSpacing: "0rem",
36
+ fontWidth: 95
37
+ }
38
+ },
39
+ md: {
40
+ typography: {
41
+ font: "normal 460 1rem/1.3 Open Sans",
42
+ letterSpacing: "0rem",
43
+ fontWidth: 95
44
+ }
45
+ }
46
+ };
47
+
48
+ exports.componentTextArea = componentTextArea;
@@ -0,0 +1,46 @@
1
+ const componentTextArea = {
2
+ shared: {
3
+ color: "#000000",
4
+ cursor: "text",
5
+ padding: {
6
+ top: "0.5rem",
7
+ right: "0.75rem",
8
+ bottom: "0.5rem",
9
+ left: "0.75rem"
10
+ },
11
+ height: "144px",
12
+ "margin-top": "0.5rem",
13
+ "border-radius": "0.25rem",
14
+ border: "0.0625rem solid #545454",
15
+ "background-color": "#ffffff",
16
+ placeholderColor: "#545454",
17
+ disabled: {
18
+ backgroundColor: "#ffffff",
19
+ cursor: "not-allowed",
20
+ color: "#999999",
21
+ border: "0.0625rem solid #dcdcdc"
22
+ },
23
+ focused: {
24
+ outline: "0.125rem auto #0072a9"
25
+ },
26
+ error: {
27
+ border: "0.0625rem solid #b42a19"
28
+ }
29
+ },
30
+ sm: {
31
+ typography: {
32
+ font: "normal 460 0.875rem/1.3 Open Sans",
33
+ letterSpacing: "0rem",
34
+ fontWidth: 95
35
+ }
36
+ },
37
+ md: {
38
+ typography: {
39
+ font: "normal 460 1rem/1.3 Open Sans",
40
+ letterSpacing: "0rem",
41
+ fontWidth: 95
42
+ }
43
+ }
44
+ };
45
+
46
+ export { componentTextArea };
@@ -14,12 +14,16 @@ const componentTextInput = {
14
14
  "border-radius": "0.25rem",
15
15
  border: "0.0625rem solid #545454",
16
16
  "background-color": "#ffffff",
17
+ placeholderColor: "#545454",
17
18
  disabled: {
18
19
  backgroundColor: "#ffffff",
19
20
  cursor: "not-allowed",
20
21
  color: "#999999",
21
22
  border: "0.0625rem solid #dcdcdc"
22
23
  },
24
+ focused: {
25
+ outline: "0.125rem auto #0072a9"
26
+ },
23
27
  error: {
24
28
  border: "0.0625rem solid #b42a19"
25
29
  }
@@ -12,12 +12,16 @@ const componentTextInput = {
12
12
  "border-radius": "0.25rem",
13
13
  border: "0.0625rem solid #545454",
14
14
  "background-color": "#ffffff",
15
+ placeholderColor: "#545454",
15
16
  disabled: {
16
17
  backgroundColor: "#ffffff",
17
18
  cursor: "not-allowed",
18
19
  color: "#999999",
19
20
  border: "0.0625rem solid #dcdcdc"
20
21
  },
22
+ focused: {
23
+ outline: "0.125rem auto #0072a9"
24
+ },
21
25
  error: {
22
26
  border: "0.0625rem solid #b42a19"
23
27
  }
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var TextArea = require('./components/text-area/TextArea.cjs');
4
+ var textArea = require('./styleD/build/typescript/component/textArea.cjs');
5
+
6
+
7
+
8
+ exports.TextArea = TextArea.TextArea;
9
+ exports.componentTextArea = textArea.componentTextArea;
@@ -0,0 +1,2 @@
1
+ export { TextArea } from './components/text-area/TextArea.js';
2
+ export { componentTextArea } from './styleD/build/typescript/component/textArea.js';
@@ -0,0 +1,2 @@
1
+ import type { TextAreaProps } from './types';
2
+ export declare function TextArea({ size, isInvalid, theme, placeholder, ...props }: TextAreaProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const componentName = "TextArea";
2
+ export declare const componentTsx = "import { TextArea } from '@guardian/stand/text-area';\n\nexport const Component = () => (\n\t<TextArea\n\t\t\tlabel=\"Description\"\n\t\t\tdescription=\"This is a description for the text area.\"\n\t\t/>\n);\n";
3
+ export declare const componentCss = "\n/* import the textarea, form and inline message styles */\n@import '@guardian/stand/component/inlineMessage.css';\n@import '@guardian/stand/component/form.css';\n@import '@guardian/stand/component/textArea.css';\n\n/* inline message styles - error */\n.stand-inline-message {\n display: var(--component-inline-message-shared-display);\n align-items: var(--component-inline-message-shared-align-items);\n gap: var(--component-inline-message-shared-gap);\n font: var(--component-inline-message-shared-typography-font);\n letter-spacing: var(\n --component-inline-message-shared-typography-letter-spacing\n );\n font-variation-settings: \"wdth\"\n var(--component-inline-message-shared-typography-font-width);\n}\n\n.stand-inline-message > .material-symbols {\n font-size: var(--component-inline-message-shared-icon-size);\n}\n\n.stand-inline-message > svg {\n width: var(--component-inline-message-shared-icon-size);\n height: var(--component-inline-message-shared-icon-size);\n}\n\n.stand-inline-message-error {\n color: var(--component-inline-message-error-color);\n fill: var(--component-inline-message-error-color);\n}\n\n.stand-text-area {\n\tdisplay: var(--component-textArea-shared-display);\n}\n\n/* form input container styles */\n\n.stand-form-input-container {\n\tdisplay: var(--component-form-input-shared-container-display);\n\tflex-direction: var(--component-form-input-shared-container-flex-direction);\n\tgap: var(--component-form-input-shared-container-gap);\n\twidth: var(--component-form-input-shared-container-width);\n}\n\n.stand-form-input-container.sm {\n\tmax-width: var(--component-form-input-sm-container-max-width);\n}\n\n.stand-form-input-container.md {\n\tmax-width: var(--component-form-input-md-container-max-width);\n}\n\n.stand-form-input-container > label {\n\tcolor: var(--component-form-input-shared-label-color);\n\tfont: var(--component-form-input-md-label-typography-font);\n\tletter-spacing: var(--component-form-input-md-label-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-form-input-md-label-typography-font-width);\n}\n\n.stand-form-input-container[data-disabled] > label {\n\tcolor: var(--component-form-input-shared-label-disabled-color);\n}\n\n.stand-form-input-container > span.description {\n\tcolor: var(--component-form-input-shared-description-color);\n\tfont: var(--component-form-input-shared-description-typography-font);\n\tletter-spacing: var(--component-form-input-shared-description-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-form-input-shared-description-typography-font-width);\n}\n\n.stand-form-input-container[data-disabled] > span.description {\n\tcolor: var(--component-form-input-shared-description-disabled-color);\n}\n\n/* text area styles */\n\n.stand-text-area {\n\tbackground-color: var(--component-text-area-shared-background-color);\n\tborder-radius: var(--component-text-area-shared-border-radius);\n\tborder: var(--component-text-area-shared-border);\n\tcolor: var(--component-text-area-shared-color);\n\tcursor: var(--component-text-area-shared-cursor);\n\tmargin-top: var(--component-text-area-shared-margin-top);\n\tpadding-top: var(--component-text-area-shared-padding-top);\n\tpadding-right: var(--component-text-area-shared-padding-right);\n\tpadding-bottom: var(--component-text-area-shared-padding-bottom);\n\tpadding-left: var(--component-text-area-shared-padding-left);\n}\n\n.stand-text-area[disabled] {\n\tbackground-color: var(--component-text-area-shared-disabled-background-color);\n\tborder: var(--component-text-area-shared-disabled-border);\n\tcolor: var(--component-text-area-shared-disabled-color);\n\tcursor: var(--component-text-area-shared-disabled-cursor);\n}\n\n.stand-text-area[data-invalid] {\n\tborder: var(--component-text-area-shared-error-border);\n}\n\n.stand-text-area.md {\n\theight: var(--component-text-area-shared-height);\n\tfont: var(--component-text-area-md-typography-font);\n\tletter-spacing: var(--component-text-area-md-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-text-area-md-typography-font-width);\n}\n\n.stand-text-area.sm {\n\theight: var(--component-text-area-shared-height);\n\tfont: var(--component-text-area-sm-typography-font);\n\tletter-spacing: var(--component-text-area-sm-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-text-area-sm-typography-font-width);\n}\n";
4
+ export declare const componentHtml = "<div class=\"container\">\n\t<div class=\"stand-form-input-container md\">\n\t\t<label for=\"name\">Name</label>\n\t\t<span class=\"description\">This is a description for the text area.</span>\n\t\t<textarea id=\"name\" class=\"stand-text-area md\" type=\"text\"></textarea>\n\t</div>\n\t<div class=\"stand-form-input-container sm\">\n\t\t<label for=\"story\">Tell us a story</label>\n\t\t<textarea\n\t\t\tid=\"story\"\n\t\t\tclass=\"stand-text-area sm\"\n\t\t\ttype=\"text\"\n\t\t\tdata-invalid\n\t\t>It was a dark and stormy night...</textarea>\n\t\t<span class=\"stand-inline-message stand-inline-message-error\"><span class=\"material-symbols\">warning</span> Story is below character count</span>\n\t</div>\n\t<div class=\"stand-form-input-container md\" data-disabled>\n\t\t<label for=\"notes\">Notes</label>\n\t\t<textarea\n\t\t\tid=\"notes\"\n\t\t\tclass=\"stand-text-area md\"\n\t\t\ttype=\"text\"\n\t\t\tdisabled\n\t\t></textarea>\n\t</div>\n</div>\n";
5
+ export declare const componentJs = "\nimport { componentTextArea, componentForm, componentInlineMessage } from \"@guardian/stand\";\n\n// example of creating a stylesheet in js\nconst sheet = new CSSStyleSheet();\n\n// apply the rules to the sheet\nsheet.replaceSync(`\n/* inline message styles - error */\n.js-stand-inline-message {\n display: ${componentInlineMessage.shared.display};\n align-items: ${componentInlineMessage.shared['align-items']};\n gap: ${componentInlineMessage.shared.gap};\n font: ${componentInlineMessage.shared.typography.font};\n letter-spacing: ${componentInlineMessage.shared.typography.letterSpacing};\n font-variation-settings: \"wdth\" ${componentInlineMessage.shared.typography.fontWidth};\n}\n\n.js-stand-inline-message > .material-symbols {\n font-size: ${componentInlineMessage.shared.icon.size};\n}\n\n.js-stand-inline-message > svg {\n width: ${componentInlineMessage.shared.icon.size};\n height: ${componentInlineMessage.shared.icon.size};\n}\n\n.js-stand-inline-message-error {\n color: ${componentInlineMessage.error.color};\n fill: ${componentInlineMessage.error.color};\n}\n\n/* form input container styles */\n\n.js-stand-form-input-container {\n\tdisplay: ${componentForm.input.shared.container.display};\n\tflex-direction: ${componentForm.input.shared.container['flex-direction']};\n\tgap: ${componentForm.input.shared.container.gap};\n\twidth: ${componentForm.input.shared.container.width};\n}\n\n.js-stand-form-input-container.sm {\n\tmax-width: ${componentForm.input.sm.container['max-width']};\n}\n\n.js-stand-form-input-container.md {\n\tmax-width: ${componentForm.input.md.container['max-width']};\n}\n\n.js-stand-form-input-container > label {\n\tcolor: ${componentForm.input.shared.label.color};\n\tfont: ${componentForm.input.md.label.typography.font};\n\tletter-spacing: ${componentForm.input.md.label.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentForm.input.md.label.typography.fontWidth};\n}\n\n.js-stand-form-input-container[data-disabled] > label {\n\tcolor: ${componentForm.input.shared.label.disabled.color};\n}\n\n.js-stand-form-input-container > span.description {\n\tcolor: ${componentForm.input.shared.description.color};\n\tfont: ${componentForm.input.shared.description.typography.font};\n\tletter-spacing: ${componentForm.input.shared.description.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentForm.input.shared.description.typography.fontWidth};\n}\n\n.js-stand-form-input-container[data-disabled] > span.description {\n\tcolor: ${componentForm.input.shared.description.disabled.color};\n}\n\n/* text area styles */\n\n.js-stand-text-area {\n\tbackground-color: ${componentTextArea.shared['background-color']};\n\tborder-radius: ${componentTextArea.shared['border-radius']};\n\tborder: ${componentTextArea.shared.border};\n\tcolor: ${componentTextArea.shared.color};\n\tcursor: ${componentTextArea.shared.cursor};\n\tmargin-top: ${componentTextArea.shared['margin-top']};\n\tpadding-top: ${componentTextArea.shared.padding.top};\n\tpadding-right: ${componentTextArea.shared.padding.right};\n\tpadding-bottom: ${componentTextArea.shared.padding.bottom};\n\tpadding-left: ${componentTextArea.shared.padding.left};\n}\n\n.js-stand-text-area[disabled] {\n\tbackground-color: ${componentTextArea.shared.disabled.backgroundColor};\n\tborder: ${componentTextArea.shared.disabled.border};\n\tcolor: ${componentTextArea.shared.disabled.color};\n\tcursor: ${componentTextArea.shared.disabled.cursor};\n}\n\n.js-stand-text-area[data-invalid] {\n\tborder: ${componentTextArea.shared.errorBorder};\n}\n\n.js-stand-text-area.md {\n\theight: ${componentTextArea.shared.height};\n\tfont: ${componentTextArea.md.typography.font};\n\tletter-spacing: ${componentTextArea.md.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentTextArea.md.typography.fontWidth};\n}\n\n.js-stand-text-area.sm {\n\theight: ${componentTextArea.shared.height};\n\tfont: ${componentTextArea.sm.typography.font};\n\tletter-spacing: ${componentTextArea.sm.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentTextArea.sm.typography.fontWidth};\n}\n`);\n\n// update the document with the sheet\ndocument.adoptedStyleSheets.push(sheet);\n\n// modify the dom with the button components using the generated stylesheet\ndocument.getElementById(\"app\").innerHTML = `\n<div class=\"container flow-column\">\n\t<div class=\"js-stand-form-input-container md\">\n\t\t<label for=\"name\">Name</label>\n\t\t<span class=\"description\">This is a description for the text input.</span>\n\t\t<textarea id=\"name\" class=\"js-stand-text-area md\"></textarea>\n\t</div>\n\t<div class=\"js-stand-form-input-container sm\">\n\t\t<label for=\"story\">Story</label>\n\t\t<textarea\n\t\t\tid=\"story\"\n\t\t\tclass=\"js-stand-text-area sm\"\n\t\t>It was a dark and stormy night...</textarea>\n\t\t<span class=\"js-stand-inline-message js-stand-inline-message-error\"><span class=\"material-symbols\">warning</span> Username is already taken</span>\n\t</div>\n\t<div class=\"js-stand-form-input-container md\" data-disabled>\n\t\t<label for=\"notes\">Notes</label>\n\t\t<textarea\n\t\t\tid=\"notes\"\n\t\t\tclass=\"js-stand-text-area md\"\n\t\t\ttype=\"text\"\n\t\t\tdisabled\n\t\t </textarea>\n\t</div>\n</div>\n`;\n";
@@ -0,0 +1,7 @@
1
+ import type { SerializedStyles } from '@emotion/react';
2
+ import type { ComponentTextArea } from '../../styleD/build/typescript/component/textArea';
3
+ import type { Prettify } from '../../util/types';
4
+ import type { TextAreaProps } from './types';
5
+ export type TextAreaTheme = Prettify<ComponentTextArea>;
6
+ export declare const defaultTextAreaTheme: TextAreaTheme;
7
+ export declare const textAreaStyles: (theme: TextAreaTheme, { size, isInvalid }: Required<Pick<TextAreaProps, 'size' | 'isInvalid'>>) => SerializedStyles;
@@ -0,0 +1,7 @@
1
+ import type { TextFieldProps as RACTextAreaProps } from 'react-aria-components';
2
+ import type { FormInputContainerDefaultProps } from '../form/types';
3
+ import type { TextAreaTheme } from './styles';
4
+ export interface TextAreaProps extends FormInputContainerDefaultProps<RACTextAreaProps, TextAreaTheme> {
5
+ /** Temporary text that occupies the text area when it is empty */
6
+ placeholder?: string;
7
+ }
@@ -1,2 +1,2 @@
1
1
  import type { TextInputProps } from './types';
2
- export declare function TextInput({ size, isInvalid, theme, ...props }: TextInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare function TextInput({ size, isInvalid, theme, placeholder, ...props }: TextInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,4 +1,7 @@
1
1
  import type { TextFieldProps as RACTextInputProps } from 'react-aria-components';
2
2
  import type { FormInputContainerDefaultProps } from '../form/types';
3
3
  import type { TextInputTheme } from './styles';
4
- export type TextInputProps = FormInputContainerDefaultProps<RACTextInputProps, TextInputTheme>;
4
+ export interface TextInputProps extends FormInputContainerDefaultProps<RACTextInputProps, TextInputTheme> {
5
+ /** Temporary text that occupies the text input when it is empty */
6
+ placeholder?: string;
7
+ }
@@ -30,6 +30,8 @@ export { componentRadioGroup } from './styleD/build/typescript/component/radioGr
30
30
  export type { ComponentRadioGroup } from './styleD/build/typescript/component/radioGroup';
31
31
  export { componentCheckbox } from './styleD/build/typescript/component/checkbox';
32
32
  export type { ComponentCheckbox } from './styleD/build/typescript/component/checkbox';
33
+ export { componentTextArea } from './styleD/build/typescript/component/textArea';
34
+ export type { ComponentTextArea } from './styleD/build/typescript/component/textArea';
33
35
  export { componentTextInput } from './styleD/build/typescript/component/textInput';
34
36
  export type { ComponentTextInput } from './styleD/build/typescript/component/textInput';
35
37
  export { componentInlineMessage } from './styleD/build/typescript/component/inlineMessage';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ export declare const componentTextArea: {
5
+ shared: {
6
+ color: string;
7
+ cursor: string;
8
+ padding: {
9
+ top: string;
10
+ right: string;
11
+ bottom: string;
12
+ left: string;
13
+ };
14
+ height: string;
15
+ 'margin-top': string;
16
+ 'border-radius': string;
17
+ border: string;
18
+ 'background-color': string;
19
+ placeholderColor: string;
20
+ disabled: {
21
+ backgroundColor: string;
22
+ cursor: string;
23
+ color: string;
24
+ border: string;
25
+ };
26
+ focused: {
27
+ outline: string;
28
+ };
29
+ error: {
30
+ border: string;
31
+ };
32
+ };
33
+ sm: {
34
+ typography: {
35
+ font: string;
36
+ letterSpacing: string;
37
+ fontWidth: number;
38
+ };
39
+ };
40
+ md: {
41
+ typography: {
42
+ font: string;
43
+ letterSpacing: string;
44
+ fontWidth: number;
45
+ };
46
+ };
47
+ };
48
+ export type ComponentTextArea = typeof componentTextArea;
@@ -15,12 +15,16 @@ export declare const componentTextInput: {
15
15
  'border-radius': string;
16
16
  border: string;
17
17
  'background-color': string;
18
+ placeholderColor: string;
18
19
  disabled: {
19
20
  backgroundColor: string;
20
21
  cursor: string;
21
22
  color: string;
22
23
  border: string;
23
24
  };
25
+ focused: {
26
+ outline: string;
27
+ };
24
28
  error: {
25
29
  border: string;
26
30
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * TextArea component entry point
3
+ *
4
+ * Peer dependencies required to use these components:
5
+ * - `@emotion/react`
6
+ * - `react`
7
+ * - `react-dom`
8
+ * - `react-aria-components`
9
+ * - `typescript`
10
+ *
11
+ * See the `peerDependencies` section of package.json for compatible versions.
12
+ *
13
+ * If you only need the built CSS (./component/textArea.css),
14
+ * you don't need to install these.
15
+ */
16
+ export { TextArea } from './components/text-area/TextArea';
17
+ export type { TextAreaProps } from './components/text-area/types';
18
+ export type { TextAreaTheme } from './components/text-area/styles';
19
+ export { componentTextArea } from './styleD/build/typescript/component/textArea';
20
+ export type { ComponentTextArea } from './styleD/build/typescript/component/textArea';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/stand",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "//exports": "Each component has its own entry point for optimal tree-shaking. Main entry point only includes design tokens and utilities. New components/foundations should follow the same pattern.",
6
6
  "exports": {
@@ -99,6 +99,11 @@
99
99
  "import": "./dist/checkbox.js",
100
100
  "require": "./dist/checkbox.cjs"
101
101
  },
102
+ "./text-area": {
103
+ "types": "./dist/types/text-area.d.ts",
104
+ "import": "./dist/text-area.js",
105
+ "require": "./dist/text-area.cjs"
106
+ },
102
107
  "./byline": {
103
108
  "types": "./dist/types/byline.d.ts",
104
109
  "import": "./dist/byline.js",
@@ -149,7 +154,8 @@
149
154
  "./component/select.css": "./dist/styleD/build/css/component/select.css",
150
155
  "./component/textInput.css": "./dist/styleD/build/css/component/textInput.css",
151
156
  "./component/radioGroup.css": "./dist/styleD/build/css/component/radioGroup.css",
152
- "./component/checkbox.css": "./dist/styleD/build/css/component/checkbox.css"
157
+ "./component/checkbox.css": "./dist/styleD/build/css/component/checkbox.css",
158
+ "./component/textArea.css": "./dist/styleD/build/css/component/textArea.css"
153
159
  },
154
160
  "//typesVersions": "Provides backward compatibility for TypeScript moduleResolution: node - maps subpath imports to correct type definition files. When adding new components with their own entry points, ensure to add them here.",
155
161
  "typesVersions": {
@@ -219,6 +225,9 @@
219
225
  ],
220
226
  "checkbox": [
221
227
  "./dist/types/checkbox.d.ts"
228
+ ],
229
+ "text-area": [
230
+ "./dist/types/text-area.d.ts"
222
231
  ]
223
232
  }
224
233
  },