@instructure/ui-radio-input 9.8.1 → 9.9.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.
@@ -1,6 +1,8 @@
1
+ /** @jsx jsx */
1
2
  import React, { Component } from 'react';
2
3
  import { RadioInput } from '../RadioInput';
3
4
  import type { RadioInputProps } from '../RadioInput/props';
5
+ import { jsx } from '@instructure/emotion';
4
6
  import type { RadioInputGroupProps, RadioInputGroupState } from './props';
5
7
  type RadioInputChild = React.ComponentElement<RadioInputProps, RadioInput>;
6
8
  /**
@@ -23,6 +25,7 @@ declare class RadioInputGroup extends Component<RadioInputGroupProps, RadioInput
23
25
  size?: "small" | "medium" | "large";
24
26
  layout?: "stacked" | "columns" | "inline";
25
27
  children?: React.ReactNode;
28
+ isRequired?: boolean;
26
29
  })[];
27
30
  static propTypes: import("@instructure/shared-types").PropValidators<keyof {
28
31
  name: string;
@@ -37,6 +40,7 @@ declare class RadioInputGroup extends Component<RadioInputGroupProps, RadioInput
37
40
  size?: "small" | "medium" | "large";
38
41
  layout?: "stacked" | "columns" | "inline";
39
42
  children?: React.ReactNode;
43
+ isRequired?: boolean;
40
44
  }>;
41
45
  static defaultProps: {
42
46
  disabled: boolean;
@@ -50,10 +54,11 @@ declare class RadioInputGroup extends Component<RadioInputGroupProps, RadioInput
50
54
  handleRef: (el: Element | null) => void;
51
55
  constructor(props: RadioInputGroupProps);
52
56
  get hasMessages(): boolean;
57
+ get invalid(): boolean;
53
58
  handleChange: RadioInputProps['onChange'];
54
59
  get value(): string | number | undefined;
55
60
  renderChildren(): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | RadioInputChild)[] | null | undefined;
56
- render(): React.JSX.Element;
61
+ render(): jsx.JSX.Element;
57
62
  }
58
63
  export default RadioInputGroup;
59
64
  export { RadioInputGroup };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/RadioInputGroup/index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EAAa,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGzE,KAAK,eAAe,GAAG,KAAK,CAAC,gBAAgB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;AAE1E;;;;GAIG;AACH,cAGM,eAAgB,SAAQ,SAAS,CACrC,oBAAoB,EACpB,oBAAoB,CACrB;IACC,MAAM,CAAC,QAAQ,CAAC,WAAW,qBAAoB;IAE/C,MAAM,CAAC,YAAY;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;MAMlB;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAEpC,SAAS,OAAQ,OAAO,GAAG,IAAI,UAE9B;gBAEW,KAAK,EAAE,oBAAoB;IAYvC,IAAI,WAAW,YAEd;IAED,IAAI,OAAO,YAIV;IAED,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,CAexC;IAED,IAAI,KAAK,gCAIR;IAED,cAAc;IA+Bd,MAAM;CAkCP;AAED,eAAe,eAAe,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,8 +1,16 @@
1
1
  import React from 'react';
2
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
2
3
  import type { FormMessage } from '@instructure/ui-form-field';
3
- import type { OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
4
+ import type { OtherHTMLAttributes, PropValidators, RadioInputGroupTheme } from '@instructure/shared-types';
4
5
  import type { WithDeterministicIdProps } from '@instructure/ui-react-utils';
5
6
  type RadioInputGroupOwnProps = {
7
+ /**
8
+ * This prop sets the
9
+ * [same low level HTML attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#defining_a_radio_group)
10
+ *
11
+ * **Must be unique across the DOM** otherwise groups will interfere with
12
+ * each other
13
+ */
6
14
  name: string;
7
15
  description: React.ReactNode;
8
16
  /**
@@ -25,7 +33,7 @@ type RadioInputGroupOwnProps = {
25
33
  /**
26
34
  * Array of objects with shape: `{
27
35
  * text: ReactNode,
28
- * type: One of: ['error', 'hint', 'success', 'screenreader-only']
36
+ * type: One of: ['error', 'newError', 'hint', 'success', 'screenreader-only']
29
37
  * }`
30
38
  */
31
39
  messages?: FormMessage[];
@@ -36,15 +44,20 @@ type RadioInputGroupOwnProps = {
36
44
  * any children (ones that aren't `RadioInput` are passed through)
37
45
  */
38
46
  children?: React.ReactNode;
47
+ /**
48
+ * Setting this to `true` adds and asterisk after the description (group label). It does not cause any behavioural change.
49
+ */
50
+ isRequired?: boolean;
39
51
  };
40
52
  type PropKeys = keyof RadioInputGroupOwnProps;
41
53
  type AllowedPropKeys = Readonly<Array<PropKeys>>;
42
- type RadioInputGroupProps = RadioInputGroupOwnProps & OtherHTMLAttributes<RadioInputGroupOwnProps> & WithDeterministicIdProps;
54
+ type RadioInputGroupProps = RadioInputGroupOwnProps & WithStyleProps<RadioInputGroupTheme, RadioInputGroupStyle> & OtherHTMLAttributes<RadioInputGroupOwnProps> & WithDeterministicIdProps;
43
55
  type RadioInputGroupState = {
44
56
  value?: string | number;
45
57
  };
58
+ type RadioInputGroupStyle = ComponentStyle<'invalidAsterisk'>;
46
59
  declare const propTypes: PropValidators<PropKeys>;
47
60
  declare const allowedProps: AllowedPropKeys;
48
- export type { RadioInputGroupProps, RadioInputGroupState };
61
+ export type { RadioInputGroupProps, RadioInputGroupState, RadioInputGroupStyle };
49
62
  export { propTypes, allowedProps };
50
63
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/RadioInputGroup/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7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AAQ,CAAA;IAEzC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,KAAK,QAAQ,GAAG,MAAM,uBAAuB,CAAA;AAE7C,KAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,KAAK,oBAAoB,GAAG,uBAAuB,GACjD,cAAc,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,GAC1D,mBAAmB,CAAC,uBAAuB,CAAC,GAC5C,wBAAwB,CAAA;AAE1B,KAAK,oBAAoB,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,KAAK,oBAAoB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAA;AAE7D,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAgBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAanB,CAAA;AAED,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,CAAA;AAChF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { RadioInputGroupTheme } from '@instructure/shared-types';
2
+ import type { RadioInputGroupStyle } from './props';
3
+ /**
4
+ * ---
5
+ * private: true
6
+ * ---
7
+ * Generates the style object from the theme and provided additional information
8
+ * @param {Object} componentTheme The theme variable object.
9
+ * @return {Object} The final style object, which will be used in the component
10
+ */
11
+ declare const generateStyle: (componentTheme: RadioInputGroupTheme) => RadioInputGroupStyle;
12
+ export default generateStyle;
13
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/RadioInputGroup/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,mBACD,oBAAoB,KACnC,oBAQF,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { Theme } from '@instructure/ui-themes';
2
+ import { RadioInputGroupTheme } from '@instructure/shared-types';
3
+ /**
4
+ * Generates the theme object for the component from the theme and provided additional information
5
+ * @param {Object} theme The actual theme object.
6
+ * @return {Object} The final theme object with the overrides and component variables
7
+ */
8
+ declare const generateComponentTheme: (theme: Theme) => RadioInputGroupTheme;
9
+ export default generateComponentTheme;
10
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/RadioInputGroup/theme.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,UAAW,KAAK,KAAG,oBAU9C,CAAA;AAED,eAAe,sBAAsB,CAAA"}