@ilo-org/react 0.0.14 → 0.0.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ilo-org/react
2
2
 
3
+ ## 0.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - f7f448c65: Fixes to React radio button, SearchField, add ability to serve different langauge fonts
8
+ - f4b7bcb7f: Local nav fixes for mobile
9
+ - 0dfb90274: Patchfix for Feature card wide version
10
+ - Updated dependencies [f7f448c65]
11
+ - Updated dependencies [f4b7bcb7f]
12
+ - Updated dependencies [0dfb90274]
13
+ - @ilo-org/fonts@0.0.3
14
+ - @ilo-org/styles@0.1.11
15
+ - @ilo-org/themes@0.1.11
16
+ - @ilo-org/utils@0.0.7
17
+ - @ilo-org/icons-react@0.0.13
18
+
3
19
  ## 0.0.14
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ilo-org/react",
3
3
  "description": "React components for the ILO's Design System",
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "author": "@justintemps",
6
6
  "license": "Apache-2.0",
7
7
  "main": "lib/index.js",
@@ -24,11 +24,11 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@ilo-org/brand-assets": "0.0.1",
27
- "@ilo-org/fonts": "0.0.2",
28
- "@ilo-org/icons-react": "0.0.12",
29
- "@ilo-org/styles": "0.1.10",
30
- "@ilo-org/themes": "0.1.10",
31
- "@ilo-org/utils": "0.0.6",
27
+ "@ilo-org/fonts": "0.0.3",
28
+ "@ilo-org/icons-react": "0.0.13",
29
+ "@ilo-org/styles": "0.1.11",
30
+ "@ilo-org/themes": "0.1.11",
31
+ "@ilo-org/utils": "0.0.7",
32
32
  "classnames": "^2.3.1",
33
33
  "dom-helpers": "^5.2.1",
34
34
  "global": "^4.4.0",
@@ -4,7 +4,7 @@ import RadioArgs from "../Radio/Radio.args";
4
4
 
5
5
  const checkboxfields = [];
6
6
  const radiofields = [];
7
- const radioid = `radio${Math.random() * (1000 - 1) + 1}`;
7
+ const radioid = `radio${Math.floor(Math.random() * (1000 - 1) + 1)}`;
8
8
 
9
9
  for (let i = 0; i < 5; i++) {
10
10
  const checkboxargs = { ...CheckboxArgs.basic };
@@ -17,6 +17,7 @@ for (let i = 0; i < 5; i++) {
17
17
  radiofields.push(radioargs);
18
18
  radiofields[i].label = `Radio ${i}`;
19
19
  radiofields[i].name = radioid;
20
+ radiofields[i].id = `${radioid}${i}`;
20
21
  radiofields[i].type = "radio";
21
22
  }
22
23
 
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
1
+ import { FC, useState } from "react";
2
2
  import { ChoiceGroupProps } from "./ChoiceGroup.props";
3
3
  import { Checkbox } from "../Checkbox";
4
4
  import { Fieldset } from "../Fieldset";
@@ -16,6 +16,12 @@ const ChoiceGroup: FC<ChoiceGroupProps> = ({
16
16
  // whatever type the first item has we expect from the other items
17
17
  const sanitzeditems = items.filter((item: any) => item !== items[0].type);
18
18
 
19
+ const [radio, setRadio] = useState(false);
20
+
21
+ const radioChangeHandler = (e: any) => {
22
+ setRadio(e.target.value);
23
+ };
24
+
19
25
  return (
20
26
  <Fieldset
21
27
  className={`ilo--choice-group ${className ? className : ""}`}
@@ -26,12 +32,18 @@ const ChoiceGroup: FC<ChoiceGroupProps> = ({
26
32
  grouptooltip={grouptooltip}
27
33
  >
28
34
  {sanitzeditems.map((item: any, i: any) => {
29
- console.log(item);
30
35
  if (item?.type === "checkbox") {
31
36
  return <Checkbox {...(item as any)} key={i} />;
32
37
  }
33
38
  if (item?.type === "radio") {
34
- return <Radio {...(item as any)} key={i} />;
39
+ return (
40
+ <Radio
41
+ {...(item as any)}
42
+ callback={radioChangeHandler}
43
+ selected={radio}
44
+ key={i}
45
+ />
46
+ );
35
47
  }
36
48
  })}
37
49
  ;
@@ -55,7 +55,7 @@ const Fieldset: FC<FieldsetProps> = ({
55
55
  {child.props.label && (
56
56
  <label
57
57
  className={`${baseClass}--label`}
58
- htmlFor={child.props.id}
58
+ htmlFor={child.props.id ? child.props.id : child.props.name}
59
59
  >
60
60
  {child.props.label}
61
61
  {child.props.tooltip && (
@@ -44,6 +44,11 @@ export interface RadioProps {
44
44
  */
45
45
  required?: boolean;
46
46
 
47
+ /**
48
+ * Which radio button has been selected?
49
+ */
50
+ selected?: string | boolean;
51
+
47
52
  /**
48
53
  * Does this Radio have a tooltip?
49
54
  */
@@ -1,4 +1,4 @@
1
- import { FC, useState } from "react";
1
+ import { FC } from "react";
2
2
  import classNames from "classnames";
3
3
  import useGlobalSettings from "../../hooks/useGlobalSettings";
4
4
  import { RadioProps } from "./Radio.props";
@@ -13,6 +13,7 @@ const Radio: FC<RadioProps> = ({
13
13
  label,
14
14
  name,
15
15
  required,
16
+ selected,
16
17
  tooltip,
17
18
  value,
18
19
  }) => {
@@ -24,14 +25,10 @@ const Radio: FC<RadioProps> = ({
24
25
  [`error`]: error,
25
26
  });
26
27
 
27
- const [checked, setChecked] = useState(false);
28
-
29
28
  /**
30
29
  * On change, if there is a callback, call it
31
30
  */
32
31
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
33
- setChecked(e.target.checked);
34
-
35
32
  if (callback) {
36
33
  callback(e);
37
34
  }
@@ -54,7 +51,7 @@ const Radio: FC<RadioProps> = ({
54
51
  required={required as any}
55
52
  type={"radio"}
56
53
  className={RadioClasses}
57
- checked={checked}
54
+ checked={selected == value}
58
55
  value={value}
59
56
  />
60
57
  </FormElement>
@@ -22,14 +22,18 @@ const SearchField: FC<SearchFieldProps> = ({
22
22
  /**
23
23
  * On click, if there is a callback, call it
24
24
  */
25
- const handleClick = (e: React.MouseEvent<Element, MouseEvent>) => {
25
+ const handleSubmit = (e: React.SyntheticEvent) => {
26
26
  if (callback) {
27
27
  callback(e);
28
28
  }
29
29
  };
30
30
 
31
31
  return (
32
- <form className={SearchFieldClasses} action={action}>
32
+ <form
33
+ className={SearchFieldClasses}
34
+ action={action}
35
+ onSubmit={(e) => handleSubmit(e)}
36
+ >
33
37
  <Input
34
38
  id={input.id}
35
39
  name={input.name}
@@ -42,12 +46,7 @@ const SearchField: FC<SearchFieldProps> = ({
42
46
  type={input.type}
43
47
  className={`${prefix}--input`}
44
48
  />
45
- <input
46
- className={buttonClass}
47
- disabled={input.disabled}
48
- type="submit"
49
- onClick={(e) => handleClick(e)}
50
- />
49
+ <input className={buttonClass} disabled={input.disabled} type="submit" />
51
50
  </form>
52
51
  );
53
52
  };
@@ -338,7 +338,7 @@
338
338
  /* eslint-enable object-shorthand */
339
339
  })
340
340
  );
341
- };</script><link href="static/css/main.d45ebb04.css" rel="stylesheet"><style>#root[hidden],
341
+ };</script><link href="static/css/main.acddc31a.css" rel="stylesheet"><style>#root[hidden],
342
342
  #docs-root[hidden] {
343
343
  display: none !important;
344
344
  }</style></head><body><div class="sb-preparing-story sb-wrapper"><div class="sb-loader"></div></div><div class="sb-preparing-docs sb-wrapper"><div class="sb-previewBlock"><div class="sb-previewBlock_header"><div class="sb-previewBlock_icon"></div><div class="sb-previewBlock_icon"></div><div class="sb-previewBlock_icon"></div><div class="sb-previewBlock_icon"></div></div><div class="sb-previewBlock_body"><div class="sb-loader"></div></div></div><table aria-hidden="true" class="sb-argstableBlock"><thead class="sb-argstableBlock-head"><tr><th><span>Name</span></th><th><span>Description</span></th><th><span>Default</span></th><th><span>Control</span></th></tr></thead><tbody class="sb-argstableBlock-body"><tr><td><span>propertyName</span><span title="Required">*</span></td><td><div><span>This is a short description</span></div><div class="sb-argstableBlock-summary"><div><span class="sb-argstableBlock-code">summary</span></div></div></td><td><div><span class="sb-argstableBlock-code">defaultValue</span></div></td><td><button>Set string</button></td></tr><tr><td><span>propertyName</span><span>*</span></td><td><div><span>This is a short description</span></div><div class="sb-argstableBlock-summary"><div><span class="sb-argstableBlock-code">summary</span></div></div></td><td><div><span class="sb-argstableBlock-code">defaultValue</span></div></td><td><button>Set string</button></td></tr><tr><td><span>propertyName</span><span>*</span></td><td><div><span>This is a short description</span></div><div class="sb-argstableBlock-summary"><div><span class="sb-argstableBlock-code">summary</span></div></div></td><td><div><span class="sb-argstableBlock-code">defaultValue</span></div></td><td><button>Set string</button></td></tr></tbody></table></div><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><pre id="error-message" class="sb-heading"></pre><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><div id="docs-root"></div><script>window['CONFIG_TYPE'] = "PRODUCTION";
@@ -361,4 +361,4 @@
361
361
 
362
362
 
363
363
 
364
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.3bae6a4f.iframe.bundle.js"></script><script src="212.faba6ad0.iframe.bundle.js"></script><script src="main.22c1d441.iframe.bundle.js"></script></body></html>
364
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.3bae6a4f.iframe.bundle.js"></script><script src="212.faba6ad0.iframe.bundle.js"></script><script src="main.7bfb35c8.iframe.bundle.js"></script></body></html>