@bootsmonday/corncob-design-language-react 0.1.0 → 0.2.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.
Files changed (133) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist-types/common/choice-name.d.ts +8 -0
  3. package/dist-types/common/field.d.ts +22 -0
  4. package/dist-types/common/form-item.d.ts +11 -0
  5. package/dist-types/components/badges/badge.d.ts +12 -0
  6. package/dist-types/components/button-bars/button-bar.d.ts +12 -0
  7. package/dist-types/components/buttons/button.d.ts +16 -0
  8. package/dist-types/components/checkboxes/checkbox-group.d.ts +13 -0
  9. package/dist-types/components/checkboxes/checkbox.d.ts +20 -0
  10. package/dist-types/components/expandables/expandable.d.ts +43 -0
  11. package/dist-types/components/footers/footer.d.ts +62 -0
  12. package/dist-types/components/headers/header.d.ts +72 -0
  13. package/dist-types/components/links/link.d.ts +22 -0
  14. package/dist-types/components/messages/message.d.ts +42 -0
  15. package/dist-types/components/modals/modal.d.ts +30 -0
  16. package/dist-types/components/panel-menus/panel-menu.d.ts +33 -0
  17. package/dist-types/components/panels/panel.d.ts +11 -0
  18. package/dist-types/components/popovers/popover.d.ts +35 -0
  19. package/dist-types/components/radio-buttons/radio-button-group.d.ts +13 -0
  20. package/dist-types/components/radio-buttons/radio-button.d.ts +18 -0
  21. package/dist-types/components/selects/select.d.ts +14 -0
  22. package/dist-types/components/sliders/slider.d.ts +7 -0
  23. package/dist-types/components/text-inputs/text-input.d.ts +6 -0
  24. package/dist-types/components/toasts/toast.d.ts +7 -0
  25. package/dist-types/components/toggles/toggle.d.ts +13 -0
  26. package/dist-types/components/tooltips/tooltip.d.ts +8 -0
  27. package/dist-types/custom-elements.d.ts +3 -0
  28. package/dist-types/index.d.ts +24 -0
  29. package/dist-types/utils/assign-ref.d.ts +7 -0
  30. package/dist-types/utils/class-names.d.ts +14 -0
  31. package/package.json +29 -8
  32. package/src/common/choice-name.js +7 -0
  33. package/src/common/field.jsx +17 -0
  34. package/src/common/form-item.jsx +5 -0
  35. package/src/components/badges/badge.jsx +5 -0
  36. package/src/components/button-bars/button-bar.jsx +5 -1
  37. package/src/components/buttons/button.jsx +5 -1
  38. package/src/components/checkboxes/checkbox-group.jsx +5 -0
  39. package/src/components/checkboxes/checkbox.jsx +5 -0
  40. package/src/components/expandables/expandable.jsx +20 -0
  41. package/src/components/footers/footer.jsx +30 -0
  42. package/src/components/headers/header.jsx +35 -0
  43. package/src/components/links/link.jsx +10 -0
  44. package/src/components/messages/message.jsx +20 -0
  45. package/src/components/modals/modal.jsx +15 -0
  46. package/src/components/panel-menus/panel-menu.jsx +15 -0
  47. package/src/components/panels/panel.jsx +5 -0
  48. package/src/components/popovers/popover.jsx +15 -0
  49. package/src/components/radio-buttons/radio-button-group.jsx +5 -0
  50. package/src/components/radio-buttons/radio-button.jsx +5 -0
  51. package/src/components/selects/select.jsx +10 -0
  52. package/src/components/sliders/slider.jsx +5 -0
  53. package/src/components/text-inputs/text-input.jsx +5 -0
  54. package/src/components/toasts/toast.jsx +5 -0
  55. package/src/components/toggles/toggle.jsx +10 -0
  56. package/src/components/tooltips/tooltip.jsx +5 -0
  57. package/src/custom-elements.d.ts +9 -0
  58. package/src/utils/assign-ref.js +6 -0
  59. package/src/utils/class-names.js +12 -0
  60. package/.changelog/README.md +0 -33
  61. package/jest.config.cjs +0 -17
  62. package/jest.setup.cjs +0 -19
  63. package/src/common/choice-name.test.js +0 -46
  64. package/src/common/field.test.js +0 -33
  65. package/src/common/form-item.test.js +0 -45
  66. package/src/components/badges/badge.stickersheet.jsx +0 -39
  67. package/src/components/badges/badge.test.js +0 -69
  68. package/src/components/button-bars/button-bar.stickersheet.jsx +0 -86
  69. package/src/components/button-bars/button-bar.test.js +0 -58
  70. package/src/components/buttons/button.stickersheet.jsx +0 -204
  71. package/src/components/buttons/button.test.js +0 -84
  72. package/src/components/checkboxes/checkbox.stickersheet.jsx +0 -53
  73. package/src/components/checkboxes/checkbox.test.js +0 -154
  74. package/src/components/expandables/expandable.stickersheet.jsx +0 -100
  75. package/src/components/expandables/expandable.test.js +0 -125
  76. package/src/components/footers/footer.stickersheet.jsx +0 -77
  77. package/src/components/footers/footer.test.js +0 -64
  78. package/src/components/headers/header.stickersheet.jsx +0 -63
  79. package/src/components/headers/header.test.js +0 -63
  80. package/src/components/links/link.stickersheet.jsx +0 -75
  81. package/src/components/links/link.test.js +0 -70
  82. package/src/components/messages/message.stickersheet.jsx +0 -96
  83. package/src/components/messages/message.test.js +0 -92
  84. package/src/components/modals/modal.stickersheet.jsx +0 -44
  85. package/src/components/modals/modal.test.js +0 -32
  86. package/src/components/panel-menus/panel-menu.stickersheet.jsx +0 -34
  87. package/src/components/panel-menus/panel-menu.test.js +0 -98
  88. package/src/components/panels/panel.stickersheet.jsx +0 -13
  89. package/src/components/panels/panel.test.js +0 -54
  90. package/src/components/popovers/popover.stickersheet.jsx +0 -236
  91. package/src/components/popovers/popover.test.js +0 -98
  92. package/src/components/radio-buttons/radio-button.stickersheet.jsx +0 -40
  93. package/src/components/radio-buttons/radio-button.test.js +0 -119
  94. package/src/components/selects/select.stickersheet.jsx +0 -34
  95. package/src/components/selects/select.test.js +0 -119
  96. package/src/components/sliders/slider.stickersheet.jsx +0 -29
  97. package/src/components/sliders/slider.test.js +0 -81
  98. package/src/components/text-inputs/text-input.stickersheet.jsx +0 -41
  99. package/src/components/text-inputs/text-input.test.js +0 -83
  100. package/src/components/toasts/toast.stickersheet.jsx +0 -54
  101. package/src/components/toasts/toast.test.js +0 -50
  102. package/src/components/toggles/toggle.stickersheet.jsx +0 -81
  103. package/src/components/toggles/toggle.test.js +0 -165
  104. package/src/components/tooltips/tooltip.stickersheet.jsx +0 -34
  105. package/src/components/tooltips/tooltip.test.js +0 -60
  106. package/src/stickersheets/badges.html +0 -31
  107. package/src/stickersheets/button-bars.html +0 -29
  108. package/src/stickersheets/buttons-standard.html +0 -33
  109. package/src/stickersheets/checkboxes.html +0 -32
  110. package/src/stickersheets/expandables.html +0 -29
  111. package/src/stickersheets/footers.html +0 -29
  112. package/src/stickersheets/headers.html +0 -29
  113. package/src/stickersheets/index.html +0 -56
  114. package/src/stickersheets/links.html +0 -29
  115. package/src/stickersheets/messages.html +0 -29
  116. package/src/stickersheets/modals.html +0 -29
  117. package/src/stickersheets/panel-menus.html +0 -29
  118. package/src/stickersheets/panels.html +0 -29
  119. package/src/stickersheets/popovers.html +0 -29
  120. package/src/stickersheets/radio-buttons.html +0 -32
  121. package/src/stickersheets/select.html +0 -31
  122. package/src/stickersheets/sliders.html +0 -31
  123. package/src/stickersheets/src/stickersheet-controls.html +0 -13
  124. package/src/stickersheets/src/stickersheet-header.html +0 -17
  125. package/src/stickersheets/src/stickersheet-react-header.html +0 -17
  126. package/src/stickersheets/src/stickersheet.css +0 -17
  127. package/src/stickersheets/src/stickersheet.js +0 -80
  128. package/src/stickersheets/text-inputs.html +0 -31
  129. package/src/stickersheets/toasts.html +0 -29
  130. package/src/stickersheets/toggles.html +0 -32
  131. package/src/stickersheets/tooltips.html +0 -29
  132. package/src/utils/assign-ref.test.js +0 -35
  133. package/src/utils/class-names.test.js +0 -21
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Joins multiple class name parts into a single string, filtering out falsy values.
3
+ * @param {...string} parts The class name parts to join.
4
+ * @returns {string} The joined class name string.
5
+ */
6
+ export declare function joinClassNames(...parts: string[]): string;
7
+ /**
8
+ * Generates a modifier class name based on the given prefix and value, optionally omitting certain values.
9
+ * @param {string} prefix The prefix for the modifier class.
10
+ * @param {string|boolean|null|undefined} value The value to append to the prefix.
11
+ * @param {Array<string>} omit The list of values to omit.
12
+ * @returns {string} The generated modifier class name or an empty string if omitted.
13
+ */
14
+ export declare function modifierClass(prefix: string, value: string | boolean | null | undefined, omit?: Array<string>): string;
package/package.json CHANGED
@@ -1,18 +1,39 @@
1
1
  {
2
2
  "name": "@bootsmonday/corncob-design-language-react",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "React wrappers for Corncob EDL",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "module": "src/index.js",
8
+ "types": "./dist-types/index.d.ts",
8
9
  "exports": {
9
- ".": "./src/index.js"
10
+ ".": {
11
+ "types": "./dist-types/index.d.ts",
12
+ "default": "./src/index.js"
13
+ }
10
14
  },
11
15
  "sideEffects": [
12
16
  "./src/custom-elements.js"
13
17
  ],
18
+ "files": [
19
+ "src/**/*.js",
20
+ "src/**/*.jsx",
21
+ "src/**/*.d.ts",
22
+ "dist-types/**/*.d.ts",
23
+ "CHANGELOG.md",
24
+ "!src/**/*.test.js",
25
+ "!src/**/*.stickersheet.jsx",
26
+ "!src/stickersheets/**",
27
+ "!dist-types/**/*.test.d.ts",
28
+ "!dist-types/**/*stickersheet*"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "registry": "https://registry.npmjs.org/"
33
+ },
14
34
  "scripts": {
15
- "build": "echo \"@bootsmonday/corncob-design-language-react has no build step\"",
35
+ "build": "node ./scripts/build-types.mjs",
36
+ "typecheck": "node ./scripts/build-types.mjs --check",
16
37
  "test": "jest --config ./jest.config.cjs"
17
38
  },
18
39
  "repository": {
@@ -24,13 +45,13 @@
24
45
  },
25
46
  "homepage": "https://github.com/bootsmonday/corncob-design-language",
26
47
  "peerDependencies": {
27
- "@bootsmonday/corncob-design-language": "^0.0.1",
48
+ "@bootsmonday/corncob-design-language": "^0.3.2",
28
49
  "react": "^19.0.0",
29
50
  "react-dom": "^19.0.0"
30
51
  },
31
- "peerDependenciesMeta": {
32
- "@bootsmonday/corncob-design-language": {
33
- "optional": true
34
- }
52
+ "devDependencies": {
53
+ "@types/react": "^19.3.0",
54
+ "@types/react-dom": "^19.3.0",
55
+ "typescript": "^7.0.2"
35
56
  }
36
57
  }
@@ -1,5 +1,12 @@
1
1
  import { Children, cloneElement, isValidElement } from 'react';
2
2
 
3
+ /**
4
+ * Takes React children and assigns a name prop to those of specified types if they don't already have one.
5
+ * @param {React.ReactNode} children
6
+ * @param {string} name
7
+ * @param {Array<React.ElementType>} types
8
+ * @returns {React.ReactNode}
9
+ */
3
10
  export function withChoiceName(children, name, types) {
4
11
  const allowed = new Set(types);
5
12
 
@@ -1,15 +1,32 @@
1
1
  import { joinClassNames } from '../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Resolves the label for a field based on the provided label and children.
5
+ * @param {string} label
6
+ * @param {React.ReactNode} children
7
+ * @returns {string|null}
8
+ */
3
9
  export function resolveFieldLabel(label, children) {
4
10
  if (label != null && label !== '') return label;
5
11
  if (children != null && children !== '') return children;
6
12
  return null;
7
13
  }
8
14
 
15
+ /**
16
+ * Returns the class name for a field item based on the status variant and additional class names.
17
+ * @param {string} statusVariant
18
+ * @param {string} itemClassName
19
+ * @returns {string}
20
+ */
9
21
  export function fieldItemClassName(statusVariant, itemClassName = '') {
10
22
  return joinClassNames(statusVariant && `corn-status--${statusVariant}`, itemClassName);
11
23
  }
12
24
 
25
+ /**
26
+ * Returns the status element for a field if the status is provided.
27
+ * @param {{ status: string }} param0
28
+ * @returns {JSX.Element|null}
29
+ */
13
30
  export function FieldStatus({ status }) {
14
31
  if (status == null) return null;
15
32
  return <div className="corn-status">{status}</div>;
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a form item component with the specified props and children.
5
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} props
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornFormItem({ ref, as: Component = 'div', className = '', children, ...props }) {
4
9
  return (
5
10
  <Component {...props} ref={ref} className={joinClassNames('corn-form--item', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames, modifierClass } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a badge component with the specified variant, size, and children.
5
+ * @param {{ ref?: React.Ref<any>, variant?: string, size?: string, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornBadge({ ref, variant = 'neutral', size = 'md', className = '', children, ...props }) {
4
9
  const classNames = joinClassNames('corn-badge', modifierClass('corn-badge--', variant, ['neutral']), modifierClass('corn-badge--', size, ['md']), className);
5
10
 
@@ -1,6 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
  import '../../custom-elements.js';
3
-
3
+ /**
4
+ * Renders a button bar component with the specified overflow label and children.
5
+ * @param {{ ref?: React.Ref<any>, className?: string, overflowLabel?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
4
8
  export function CornButtonBar({ ref, className = '', overflowLabel, children, ...props }) {
5
9
  return (
6
10
  <corn-button-bar {...props} ref={ref} className={joinClassNames('corn-button-bar', className)} overflow-label={overflowLabel}>
@@ -1,6 +1,10 @@
1
1
  import { useFormStatus } from 'react-dom';
2
2
  import { joinClassNames, modifierClass } from '../../utils/class-names.js';
3
-
3
+ /**
4
+ * Renders a button component with the specified variant, size, icon, type, and children.
5
+ * @param {{ ref?: React.Ref<any>, variant?: string, size?: string, icon?: boolean, type?: string, as?: React.ElementType, className?: string, disabled?: boolean, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
4
8
  export function CornButton({ ref, variant = 'primary', size = 'md', icon = false, type = 'button', as: Component = 'button', className = '', disabled, children, ...props }) {
5
9
  const { pending } = useFormStatus();
6
10
  const isNativeButton = Component === 'button';
@@ -3,6 +3,11 @@ import { withChoiceName } from '../../common/choice-name.js';
3
3
  import { joinClassNames } from '../../utils/class-names.js';
4
4
  import { CornCheckbox } from './checkbox.jsx';
5
5
 
6
+ /**
7
+ * Renders a checkbox group component with the specified legend, name, inline display, and children.
8
+ * @param {{ ref?: React.Ref<any>, legend?: string, name: string, inline?: boolean, className?: string, children: React.ReactNode }} param0
9
+ * @returns {JSX.Element}
10
+ */
6
11
  export function CornCheckboxGroup({ ref, legend, name, inline = false, className = '', children, ...props }) {
7
12
  return (
8
13
  <CornFormItem {...props} ref={ref} as="fieldset" className={joinClassNames('corn-checkbox-group', inline && 'corn-checkbox-group--inline', className)}>
@@ -2,6 +2,11 @@ import { useCallback, useEffect, useId, useRef } from 'react';
2
2
  import { assignRef } from '../../utils/assign-ref.js';
3
3
  import { joinClassNames, modifierClass } from '../../utils/class-names.js';
4
4
 
5
+ /**
6
+ * Renders a checkbox component with the specified size, task style, indeterminate state, and other input properties.
7
+ * @param {{ ref?: React.Ref<any>, size?: string, task?: boolean, indeterminate?: boolean, id?: string, name?: string, label?: React.ReactNode, className?: string, checked?: boolean, defaultChecked?: boolean, onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void, value?: string, children?: React.ReactNode }} param0
8
+ * @returns {JSX.Element}
9
+ */
5
10
  export function CornCheckbox({ ref, size = 'md', task = false, indeterminate = false, id, name, label, className = '', checked, defaultChecked = false, onChange, value, children, ...inputProps }) {
6
11
  const generatedId = useId();
7
12
  const inputId = id ?? generatedId;
@@ -1,6 +1,11 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
  import '../../custom-elements.js';
3
3
 
4
+ /**
5
+ * Renders an expandable component with the specified open state, name, and children.
6
+ * @param {{ ref?: React.Ref<any>, className?: string, open?: boolean, name?: string, children: React.ReactNode }} param0
7
+ * @returns {JSX.Element}
8
+ */
4
9
  export function CornExpandable({ ref, className = '', open, name, children, ...props }) {
5
10
  return (
6
11
  <corn-expandable {...props} ref={ref} className={joinClassNames('corn-expandable', className)} open={open}>
@@ -11,6 +16,11 @@ export function CornExpandable({ ref, className = '', open, name, children, ...p
11
16
  );
12
17
  }
13
18
 
19
+ /**
20
+ * Renders an expandable summary component with the specified class name and children.
21
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
22
+ * @returns {JSX.Element}
23
+ */
14
24
  export function CornExpandableSummary({ ref, className = '', children, ...props }) {
15
25
  return (
16
26
  <summary {...props} ref={ref} className={joinClassNames('corn-expandable-button', className)}>
@@ -19,6 +29,11 @@ export function CornExpandableSummary({ ref, className = '', children, ...props
19
29
  );
20
30
  }
21
31
 
32
+ /**
33
+ * Renders an expandable content component with the specified class name and children.
34
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
35
+ * @returns {JSX.Element}
36
+ */
22
37
  export function CornExpandableContent({ ref, className = '', children, ...props }) {
23
38
  return (
24
39
  <div {...props} ref={ref} className={joinClassNames('corn-expandable--content', className)}>
@@ -27,6 +42,11 @@ export function CornExpandableContent({ ref, className = '', children, ...props
27
42
  );
28
43
  }
29
44
 
45
+ /**
46
+ * Renders an accordion component with the specified class name and children.
47
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
48
+ * @returns {JSX.Element}
49
+ */
30
50
  export function CornAccordion({ ref, className = '', children, ...props }) {
31
51
  return (
32
52
  <div {...props} ref={ref} className={joinClassNames('corn-accordion', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a footer component with the specified class name and children.
5
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornFooter({ ref, className = '', children, ...props }) {
4
9
  return (
5
10
  <footer {...props} ref={ref} className={joinClassNames('corn-footer', className)}>
@@ -8,6 +13,11 @@ export function CornFooter({ ref, className = '', children, ...props }) {
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a footer intro component with the specified class name and children.
18
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornFooterIntro({ ref, className = '', children, ...props }) {
12
22
  return (
13
23
  <div {...props} ref={ref} className={joinClassNames('corn-footer--intro', className)}>
@@ -16,6 +26,11 @@ export function CornFooterIntro({ ref, className = '', children, ...props }) {
16
26
  );
17
27
  }
18
28
 
29
+ /**
30
+ * Renders a footer content component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
19
34
  export function CornFooterContent({ ref, className = '', children, ...props }) {
20
35
  return (
21
36
  <div {...props} ref={ref} className={joinClassNames('corn-footer--content', className)}>
@@ -24,6 +39,11 @@ export function CornFooterContent({ ref, className = '', children, ...props }) {
24
39
  );
25
40
  }
26
41
 
42
+ /**
43
+ * Renders a footer section component with the specified class name, title, and children.
44
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, title?: React.ReactNode, children: React.ReactNode }} param0
45
+ * @returns {JSX.Element}
46
+ */
27
47
  export function CornFooterSection({ ref, as: Component = 'div', className = '', title, children, ...props }) {
28
48
  return (
29
49
  <Component {...props} ref={ref} className={joinClassNames('corn-footer--content--section', className)}>
@@ -33,6 +53,11 @@ export function CornFooterSection({ ref, as: Component = 'div', className = '',
33
53
  );
34
54
  }
35
55
 
56
+ /**
57
+ * Renders a footer social component with the specified class name and children.
58
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
59
+ * @returns {JSX.Element}
60
+ */
36
61
  export function CornFooterSocial({ ref, className = '', children, ...props }) {
37
62
  return (
38
63
  <div {...props} ref={ref} className={joinClassNames('corn-footer--social', className)}>
@@ -41,6 +66,11 @@ export function CornFooterSocial({ ref, className = '', children, ...props }) {
41
66
  );
42
67
  }
43
68
 
69
+ /**
70
+ * Renders a footer copyright component with the specified class name and children.
71
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
72
+ * @returns {JSX.Element}
73
+ */
44
74
  export function CornFooterCopyright({ ref, className = '', children, ...props }) {
45
75
  return (
46
76
  <div {...props} ref={ref} className={joinClassNames('corn-footer--copyright', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a header component with the specified class name and children.
5
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornHeader({ ref, className = '', children, ...props }) {
4
9
  return (
5
10
  <header {...props} ref={ref} className={joinClassNames('corn-header', className)}>
@@ -8,6 +13,11 @@ export function CornHeader({ ref, className = '', children, ...props }) {
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a header company component with the specified class name and children.
18
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornHeaderCompany({ ref, className = '', children, ...props }) {
12
22
  return (
13
23
  <div {...props} ref={ref} className={joinClassNames('corn-company', className)}>
@@ -16,6 +26,11 @@ export function CornHeaderCompany({ ref, className = '', children, ...props }) {
16
26
  );
17
27
  }
18
28
 
29
+ /**
30
+ * Renders a header company logo component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
19
34
  export function CornHeaderCompanyLogo({ ref, className = '', children, ...props }) {
20
35
  return (
21
36
  <div {...props} ref={ref} className={joinClassNames('corn-company--logo', className)}>
@@ -24,6 +39,11 @@ export function CornHeaderCompanyLogo({ ref, className = '', children, ...props
24
39
  );
25
40
  }
26
41
 
42
+ /**
43
+ * Renders a header company name component with the specified class name and children.
44
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} param0
45
+ * @returns {JSX.Element}
46
+ */
27
47
  export function CornHeaderCompanyName({ ref, as: Component = 'div', className = '', children, ...props }) {
28
48
  return (
29
49
  <Component {...props} ref={ref} className={joinClassNames('corn-company--name', className)}>
@@ -32,6 +52,11 @@ export function CornHeaderCompanyName({ ref, as: Component = 'div', className =
32
52
  );
33
53
  }
34
54
 
55
+ /**
56
+ * Renders a header title component with the specified class name and children.
57
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} param0
58
+ * @returns {JSX.Element}
59
+ */
35
60
  export function CornHeaderTitle({ ref, as: Component = 'div', className = '', children, ...props }) {
36
61
  return (
37
62
  <Component {...props} ref={ref} className={joinClassNames('corn-header--title', className)}>
@@ -40,6 +65,11 @@ export function CornHeaderTitle({ ref, as: Component = 'div', className = '', ch
40
65
  );
41
66
  }
42
67
 
68
+ /**
69
+ * Renders a header navigation component with the specified class name and children.
70
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
71
+ * @returns {JSX.Element}
72
+ */
43
73
  export function CornHeaderNav({ ref, className = '', children, ...props }) {
44
74
  return (
45
75
  <nav {...props} ref={ref} className={joinClassNames('corn-header--nav', className)}>
@@ -48,6 +78,11 @@ export function CornHeaderNav({ ref, className = '', children, ...props }) {
48
78
  );
49
79
  }
50
80
 
81
+ /**
82
+ * Renders a header actions component with the specified class name and children.
83
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
84
+ * @returns {JSX.Element}
85
+ */
51
86
  export function CornHeaderActions({ ref, className = '', children, ...props }) {
52
87
  return (
53
88
  <div {...props} ref={ref} className={joinClassNames('corn-header--actions', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a link component with the specified class name, underline option, and children.
5
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, underline?: boolean, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornLink({ ref, as: Component = 'a', underline = false, className = '', children, ...props }) {
4
9
  return (
5
10
  <Component {...props} ref={ref} className={joinClassNames('corn-link', underline && 'corn-link--underline', className)}>
@@ -8,6 +13,11 @@ export function CornLink({ ref, as: Component = 'a', underline = false, classNam
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a link list component with the specified class name and children.
18
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornLinkList({ ref, className = '', children, ...props }) {
12
22
  return (
13
23
  <ul {...props} ref={ref} className={joinClassNames('corn-link-list', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames, modifierClass } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a message component with the specified variant, class name, and children.
5
+ * @param {{ ref?: React.Ref<any>, variant?: 'info' | 'success' | 'warning' | 'error', className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornMessage({ ref, variant = 'info', className = '', children, ...props }) {
4
9
  return (
5
10
  <div {...props} ref={ref} className={joinClassNames('corn-message', modifierClass('corn-message--', variant), className)}>
@@ -8,6 +13,11 @@ export function CornMessage({ ref, variant = 'info', className = '', children, .
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a message status component with the specified class name and children.
18
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornMessageStatus({ ref, className = '', children, ...props }) {
12
22
  return (
13
23
  <div {...props} ref={ref} className={joinClassNames('corn-message--status', className)}>
@@ -16,6 +26,11 @@ export function CornMessageStatus({ ref, className = '', children, ...props }) {
16
26
  );
17
27
  }
18
28
 
29
+ /**
30
+ * Renders a message content component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
19
34
  export function CornMessageContent({ ref, className = '', children, ...props }) {
20
35
  return (
21
36
  <div {...props} ref={ref} className={joinClassNames('corn-message--content', className)}>
@@ -24,6 +39,11 @@ export function CornMessageContent({ ref, className = '', children, ...props })
24
39
  );
25
40
  }
26
41
 
42
+ /**
43
+ * Renders a message title component with the specified class name and children.
44
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} param0
45
+ * @returns {JSX.Element}
46
+ */
27
47
  export function CornMessageTitle({ ref, as: Component = 'h3', className = '', children, ...props }) {
28
48
  return (
29
49
  <Component {...props} ref={ref} className={joinClassNames('corn-message--title', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a modal component with the specified class name and children.
5
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornModal({ ref, className = '', children, ...props }) {
4
9
  return (
5
10
  <dialog {...props} ref={ref} className={joinClassNames('corn-modal', 'corn-panel', className)}>
@@ -8,6 +13,11 @@ export function CornModal({ ref, className = '', children, ...props }) {
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a modal header component with the specified class name and children.
18
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornModalHeader({ ref, className = '', children, ...props }) {
12
22
  return (
13
23
  <div {...props} ref={ref} className={joinClassNames('corn-modal--header', className)}>
@@ -16,6 +26,11 @@ export function CornModalHeader({ ref, className = '', children, ...props }) {
16
26
  );
17
27
  }
18
28
 
29
+ /**
30
+ * Renders a modal content component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
19
34
  export function CornModalContent({ ref, className = '', children, ...props }) {
20
35
  return (
21
36
  <div {...props} ref={ref} className={joinClassNames('corn-modal--content', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a panel menu component with the specified class name and children.
5
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornPanelMenu({ ref, as: Component = 'div', className = '', children, ...props }) {
4
9
  return (
5
10
  <Component {...props} ref={ref} className={joinClassNames('corn-panel-menu', className)}>
@@ -8,6 +13,11 @@ export function CornPanelMenu({ ref, as: Component = 'div', className = '', chil
8
13
  );
9
14
  }
10
15
 
16
+ /**
17
+ * Renders a panel menu item component with the specified class name, active state, and children.
18
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, active?: boolean, className?: string, children: React.ReactNode }} param0
19
+ * @returns {JSX.Element}
20
+ */
11
21
  export function CornPanelMenuItem({ ref, as: Component = 'a', active = false, className = '', children, ...props }) {
12
22
  return (
13
23
  <Component {...props} ref={ref} className={joinClassNames('corn-panel-menu--item', active && 'corn-panel-menu--item--active', className)} aria-current={active ? 'page' : props['aria-current']}>
@@ -16,6 +26,11 @@ export function CornPanelMenuItem({ ref, as: Component = 'a', active = false, cl
16
26
  );
17
27
  }
18
28
 
29
+ /**
30
+ * Renders a panel menu submenu component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
19
34
  export function CornPanelMenuSubmenu({ ref, className = '', children, ...props }) {
20
35
  return (
21
36
  <div {...props} ref={ref} className={joinClassNames('corn-panel-menu--submenu', className)}>
@@ -1,5 +1,10 @@
1
1
  import { joinClassNames } from '../../utils/class-names.js';
2
2
 
3
+ /**
4
+ * Renders a panel component with the specified class name and children.
5
+ * @param {{ ref?: React.Ref<any>, as?: React.ElementType, className?: string, children: React.ReactNode }} param0
6
+ * @returns {JSX.Element}
7
+ */
3
8
  export function CornPanel({ ref, as: Component = 'div', className = '', children, ...props }) {
4
9
  return (
5
10
  <Component {...props} ref={ref} className={joinClassNames('corn-panel', className)}>
@@ -7,6 +7,11 @@ export const CORN_POPOVER_POSITIONS = ['top', 'top-right', 'top-left', 'right',
7
7
 
8
8
  const PopoverContext = createContext(null);
9
9
 
10
+ /**
11
+ * Renders a popover trigger component with the specified class name and children.
12
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
13
+ * @returns {JSX.Element}
14
+ */
10
15
  export function CornPopoverTrigger({ ref, children, className = '', ...props }) {
11
16
  const context = useContext(PopoverContext);
12
17
 
@@ -21,6 +26,11 @@ export function CornPopoverTrigger({ ref, children, className = '', ...props })
21
26
  );
22
27
  }
23
28
 
29
+ /**
30
+ * Renders a popover content component with the specified class name and children.
31
+ * @param {{ ref?: React.Ref<any>, className?: string, children: React.ReactNode }} param0
32
+ * @returns {JSX.Element}
33
+ */
24
34
  export function CornPopoverContent({ ref, children, className = '', ...props }) {
25
35
  const context = useContext(PopoverContext);
26
36
 
@@ -35,6 +45,11 @@ export function CornPopoverContent({ ref, children, className = '', ...props })
35
45
  );
36
46
  }
37
47
 
48
+ /**
49
+ * Renders a popover component with the specified class name, anchor class name, and children.
50
+ * @param {{ ref?: React.Ref<any>, id?: string, position?: string, className?: string, anchorClassName?: string, children: React.ReactNode }} param0
51
+ * @returns {JSX.Element}
52
+ */
38
53
  export function CornPopover({ ref, id, position = 'top', className = '', anchorClassName = '', children, ...props }) {
39
54
  const generatedId = useId();
40
55
  const popoverId = id ?? generatedId;
@@ -3,6 +3,11 @@ import { withChoiceName } from '../../common/choice-name.js';
3
3
  import { joinClassNames } from '../../utils/class-names.js';
4
4
  import { CornRadioButton } from './radio-button.jsx';
5
5
 
6
+ /**
7
+ * Renders a radio button group component with the specified legend, name, inline state, class name, and children.
8
+ * @param {{ ref?: React.Ref<any>, legend?: string, name: string, inline?: boolean, className?: string, children: React.ReactNode }} param0
9
+ * @returns {JSX.Element}
10
+ */
6
11
  export function CornRadioButtonGroup({ ref, legend, name, inline = false, className = '', children, ...props }) {
7
12
  return (
8
13
  <CornFormItem {...props} ref={ref} as="fieldset" className={joinClassNames('corn-radio-button-group', inline && 'corn-radio-button-group--inline', className)}>
@@ -1,6 +1,11 @@
1
1
  import { useId } from 'react';
2
2
  import { joinClassNames, modifierClass } from '../../utils/class-names.js';
3
3
 
4
+ /**
5
+ * Renders a radio button component with the specified size, id, name, label, class name, checked state, default checked state, change handler, value, and children.
6
+ * @param {{ ref?: React.Ref<any>, size?: string, id?: string, name: string, label?: string, className?: string, checked?: boolean, defaultChecked?: boolean, onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void, value?: string, children: React.ReactNode }} param0
7
+ * @returns {JSX.Element}
8
+ */
4
9
  export function CornRadioButton({ ref, size = 'md', id, name, label, className = '', checked, defaultChecked = false, onChange, value, children, ...inputProps }) {
5
10
  const generatedId = useId();
6
11
  const inputId = id ?? generatedId;
@@ -6,6 +6,11 @@ import '../../custom-elements.js';
6
6
 
7
7
  export const CORN_SELECT_SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];
8
8
 
9
+ /**
10
+ * Renders a select option component with the specified ref, value, and children.
11
+ * @param {*} param0 The props for the CornSelectOption component.
12
+ * @returns {JSX.Element} The rendered CornSelectOption component.
13
+ */
9
14
  export function CornSelectOption({ ref, value, children, ...props }) {
10
15
  return (
11
16
  <option {...props} ref={ref} value={value ?? children}>
@@ -14,6 +19,11 @@ export function CornSelectOption({ ref, value, children, ...props }) {
14
19
  );
15
20
  }
16
21
 
22
+ /**
23
+ * Renders a select component with the specified ref, id, class name, size, label, name, placeholder, multiple state, required state, disabled state, value, status, status variant, item class name, and children.
24
+ * @param {*} param0 The props for the CornSelect component.
25
+ * @returns {JSX.Element} The rendered CornSelect component.
26
+ */
17
27
  export function CornSelect({ ref, id, className = '', size = 'md', label, name, placeholder, multiple = false, required = false, disabled = false, value, status, statusVariant, itemClassName = '', children, ...props }) {
18
28
  const generatedId = useId();
19
29
  const selectId = id ?? name ?? generatedId;
@@ -5,6 +5,11 @@ import { joinClassNames, modifierClass } from '../../utils/class-names.js';
5
5
 
6
6
  export const CORN_SLIDER_SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];
7
7
 
8
+ /**
9
+ * Renders a slider component with the specified ref, id, name, label, size, class name, item class name, label class name, status, status variant, min, max, step, value, default value, disabled state, change handler, and children.
10
+ * @param {*} param0 The props for the CornSlider component.
11
+ * @returns {JSX.Element} The rendered CornSlider component.
12
+ */
8
13
  export function CornSlider({ ref, id, name, label, size = 'md', className = '', itemClassName = '', labelClassName = '', status, statusVariant, min = 0, max = 100, step, value, defaultValue = 50, disabled = false, onChange, children, ...inputProps }) {
9
14
  const generatedId = useId();
10
15
  const sliderId = id ?? name ?? generatedId;