@primer/components 0.0.0-2021113214714 → 0.0.0-202111613730

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.
package/lib/Checkbox.d.ts CHANGED
@@ -25,5 +25,5 @@ export declare type CheckboxProps = {
25
25
  /**
26
26
  * An accessible, native checkbox component
27
27
  */
28
- declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "indeterminate" | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
28
+ declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "validationStatus" | "indeterminate"> & React.RefAttributes<HTMLInputElement>>;
29
29
  export default Checkbox;
package/lib/Radio.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import React, { InputHTMLAttributes } from 'react';
2
+ import { SxProp } from './sx';
3
+ export declare type RadioProps = {
4
+ /**
5
+ * A unique value that is never shown to the user.
6
+ * Used during form submission and to identify which radio button in a group is selected
7
+ */
8
+ value: string;
9
+ /**
10
+ * Name attribute of the input element. Required for grouping radio inputs
11
+ */
12
+ name: string;
13
+ /**
14
+ * Apply inactive visual appearance to the radio button
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * Indicates whether the radio button is selected
19
+ */
20
+ checked?: boolean;
21
+ /**
22
+ * Forward a ref to the underlying input element
23
+ */
24
+ ref?: React.RefObject<HTMLInputElement>;
25
+ /**
26
+ * Indicates whether the radio button must be checked before the form can be submitted
27
+ */
28
+ required?: boolean;
29
+ /**
30
+ * Indicates whether the radio button validation state is non-standard
31
+ */
32
+ validationStatus?: 'error' | 'success';
33
+ } & InputHTMLAttributes<HTMLInputElement> & SxProp;
34
+ /**
35
+ * An accessible, native radio component for selecting one option from a list.
36
+ */
37
+ declare const Radio: React.ForwardRefExoticComponent<Pick<RadioProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
38
+ export default Radio;
package/lib/Radio.js ADDED
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _sx = _interopRequireDefault(require("./sx"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
+
18
+ const StyledRadio = _styledComponents.default.input.withConfig({
19
+ displayName: "Radio__StyledRadio",
20
+ componentId: "sc-1ak1fjg-0"
21
+ })(["cursor:pointer;", " ", ""], props => props.disabled && `cursor: not-allowed;`, _sx.default);
22
+ /**
23
+ * An accessible, native radio component for selecting one option from a list.
24
+ */
25
+
26
+
27
+ const Radio = /*#__PURE__*/_react.default.forwardRef(({
28
+ checked,
29
+ disabled,
30
+ sx: sxProp,
31
+ required,
32
+ validationStatus,
33
+ value,
34
+ name,
35
+ ...rest
36
+ }, ref) => {
37
+ return /*#__PURE__*/_react.default.createElement(StyledRadio, _extends({
38
+ type: "radio",
39
+ value: value,
40
+ name: name,
41
+ ref: ref,
42
+ disabled: disabled,
43
+ "aria-disabled": disabled ? 'true' : 'false',
44
+ checked: checked,
45
+ "aria-checked": checked ? 'true' : 'false',
46
+ required: required,
47
+ "aria-required": required ? 'true' : 'false',
48
+ "aria-invalid": validationStatus === 'error' ? 'true' : 'false',
49
+ sx: sxProp
50
+ }, rest));
51
+ });
52
+
53
+ Radio.displayName = 'Radio';
54
+ var _default = Radio;
55
+ exports.default = _default;
package/lib/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export { useOpenAndCloseFocus } from './hooks/useOpenAndCloseFocus';
21
21
  export { useOnEscapePress } from './hooks/useOnEscapePress';
22
22
  export { useOverlay } from './hooks/useOverlay';
23
23
  export { useConfirm } from './Dialog/ConfirmationDialog';
24
+ export { default as Radio } from './Radio';
25
+ export type { RadioProps } from './Radio';
24
26
  export { ActionList } from './ActionList';
25
27
  export { ActionMenu } from './ActionMenu';
26
28
  export type { ActionMenuProps } from './ActionMenu';
package/lib/index.js CHANGED
@@ -141,6 +141,12 @@ Object.defineProperty(exports, "ConfirmationDialog", {
141
141
  return _ConfirmationDialog.ConfirmationDialog;
142
142
  }
143
143
  });
144
+ Object.defineProperty(exports, "Radio", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _Radio.default;
148
+ }
149
+ });
144
150
  Object.defineProperty(exports, "ActionList", {
145
151
  enumerable: true,
146
152
  get: function () {
@@ -546,6 +552,8 @@ var _useOverlay = require("./hooks/useOverlay");
546
552
 
547
553
  var _ConfirmationDialog = require("./Dialog/ConfirmationDialog");
548
554
 
555
+ var _Radio = _interopRequireDefault(require("./Radio"));
556
+
549
557
  var _ActionList = require("./ActionList");
550
558
 
551
559
  var _ActionMenu = require("./ActionMenu");
@@ -25,5 +25,5 @@ export declare type CheckboxProps = {
25
25
  /**
26
26
  * An accessible, native checkbox component
27
27
  */
28
- declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "indeterminate" | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
28
+ declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "validationStatus" | "indeterminate"> & React.RefAttributes<HTMLInputElement>>;
29
29
  export default Checkbox;
@@ -0,0 +1,38 @@
1
+ import React, { InputHTMLAttributes } from 'react';
2
+ import { SxProp } from './sx';
3
+ export declare type RadioProps = {
4
+ /**
5
+ * A unique value that is never shown to the user.
6
+ * Used during form submission and to identify which radio button in a group is selected
7
+ */
8
+ value: string;
9
+ /**
10
+ * Name attribute of the input element. Required for grouping radio inputs
11
+ */
12
+ name: string;
13
+ /**
14
+ * Apply inactive visual appearance to the radio button
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * Indicates whether the radio button is selected
19
+ */
20
+ checked?: boolean;
21
+ /**
22
+ * Forward a ref to the underlying input element
23
+ */
24
+ ref?: React.RefObject<HTMLInputElement>;
25
+ /**
26
+ * Indicates whether the radio button must be checked before the form can be submitted
27
+ */
28
+ required?: boolean;
29
+ /**
30
+ * Indicates whether the radio button validation state is non-standard
31
+ */
32
+ validationStatus?: 'error' | 'success';
33
+ } & InputHTMLAttributes<HTMLInputElement> & SxProp;
34
+ /**
35
+ * An accessible, native radio component for selecting one option from a list.
36
+ */
37
+ declare const Radio: React.ForwardRefExoticComponent<Pick<RadioProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
38
+ export default Radio;
@@ -0,0 +1,40 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import styled from 'styled-components';
4
+ import React from 'react';
5
+ import sx from './sx';
6
+ const StyledRadio = styled.input.withConfig({
7
+ displayName: "Radio__StyledRadio",
8
+ componentId: "sc-1ak1fjg-0"
9
+ })(["cursor:pointer;", " ", ""], props => props.disabled && `cursor: not-allowed;`, sx);
10
+ /**
11
+ * An accessible, native radio component for selecting one option from a list.
12
+ */
13
+
14
+ const Radio = /*#__PURE__*/React.forwardRef(({
15
+ checked,
16
+ disabled,
17
+ sx: sxProp,
18
+ required,
19
+ validationStatus,
20
+ value,
21
+ name,
22
+ ...rest
23
+ }, ref) => {
24
+ return /*#__PURE__*/React.createElement(StyledRadio, _extends({
25
+ type: "radio",
26
+ value: value,
27
+ name: name,
28
+ ref: ref,
29
+ disabled: disabled,
30
+ "aria-disabled": disabled ? 'true' : 'false',
31
+ checked: checked,
32
+ "aria-checked": checked ? 'true' : 'false',
33
+ required: required,
34
+ "aria-required": required ? 'true' : 'false',
35
+ "aria-invalid": validationStatus === 'error' ? 'true' : 'false',
36
+ sx: sxProp
37
+ }, rest));
38
+ });
39
+ Radio.displayName = 'Radio';
40
+ export default Radio;
@@ -21,6 +21,8 @@ export { useOpenAndCloseFocus } from './hooks/useOpenAndCloseFocus';
21
21
  export { useOnEscapePress } from './hooks/useOnEscapePress';
22
22
  export { useOverlay } from './hooks/useOverlay';
23
23
  export { useConfirm } from './Dialog/ConfirmationDialog';
24
+ export { default as Radio } from './Radio';
25
+ export type { RadioProps } from './Radio';
24
26
  export { ActionList } from './ActionList';
25
27
  export { ActionMenu } from './ActionMenu';
26
28
  export type { ActionMenuProps } from './ActionMenu';
package/lib-esm/index.js CHANGED
@@ -17,6 +17,7 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
17
17
  export { useOverlay } from './hooks/useOverlay';
18
18
  export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
19
19
 
20
+ export { default as Radio } from './Radio';
20
21
  export { ActionList } from './ActionList';
21
22
  export { ActionMenu } from './ActionMenu';
22
23
  export { default as Autocomplete } from './Autocomplete';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-2021113214714",
3
+ "version": "0.0.0-202111613730",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",