@atom-learning/components 2.9.0 → 2.9.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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,10 @@
1
- # [2.9.0](https://github.com/Atom-Learning/components/compare/v2.8.0...v2.9.0) (2022-10-19)
1
+ ## [2.9.2](https://github.com/Atom-Learning/components/compare/v2.9.1...v2.9.2) (2022-10-19)
2
2
 
3
3
 
4
- ### Features
4
+ ### Bug Fixes
5
5
 
6
- * Add new theme to AccordianTrigger ([e280e0f](https://github.com/Atom-Learning/components/commit/e280e0fed25a3e7ca0dd9f0e3ebb69d3e26144da))
6
+ * change size prop to optional ([04f5d0f](https://github.com/Atom-Learning/components/commit/04f5d0f9f55aa8812008895d16fda06437797b3b))
7
+ * consolidate field element props ([b82f96d](https://github.com/Atom-Learning/components/commit/b82f96db924f58dca8829499653ee925b6e4500c))
7
8
 
8
9
  # [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
9
10
 
@@ -1,14 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Checkbox } from '../../components/checkbox';
3
- import { ValidationOptions } from '../../components/form';
4
- import { CSS } from '../../stitches';
5
- declare type CheckboxFieldProps = {
6
- css?: CSS;
7
- defaultChecked?: boolean;
8
- label: string;
9
- description?: string;
10
- name: string;
11
- validation?: ValidationOptions;
12
- } & React.ComponentProps<typeof Checkbox>;
3
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
4
+ declare type CheckboxFieldProps = React.ComponentProps<typeof Checkbox> & FieldElementWrapperProps;
13
5
  export declare const CheckboxField: React.FC<CheckboxFieldProps>;
14
6
  export {};
@@ -1 +1 @@
1
- import*as l from"react";import{useFormContext as s,Controller as h}from"react-hook-form";import{Checkbox as C}from"../checkbox/Checkbox.js";import"../field-wrapper/FieldWrapper.js";import{InlineFieldWrapper as k}from"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as F}from"../form/useFieldError.js";var b=(e=>(e.ON="on",e.OFF="off",e))(b||{});const i=({css:e,defaultChecked:r=!1,label:m,name:t,validation:o,description:d,...c})=>{const{control:f}=s(),{error:n}=F(t);return l.createElement(h,{control:f,name:t,defaultValue:r,rules:o,render:({onChange:u,value:a,name:p})=>l.createElement(k,{css:e,description:d,error:n,label:m,required:Boolean(o==null?void 0:o.required)},l.createElement(C,{defaultChecked:r,defaultValue:r?"on":"off",checked:a,name:p,onCheckedChange:u,value:a?"on":"off",...n&&{state:"error"},...c}))})};i.displayName="CheckboxField";export{i as CheckboxField};
1
+ import*as n from"react";import{useFormContext as p,Controller as C}from"react-hook-form";import{Checkbox as h}from"../checkbox/Checkbox.js";import"../field-wrapper/FieldWrapper.js";import{InlineFieldWrapper as F}from"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as k}from"../form/useFieldError.js";var b=(e=>(e.ON="on",e.OFF="off",e))(b||{});const i=({css:e,defaultChecked:r=!1,label:m,name:t,validation:o,description:d,...c})=>{const{control:f}=p(),{error:a}=k(t);return n.createElement(C,{control:f,name:t,defaultValue:r,rules:o,render:({onChange:u,value:l,name:s})=>n.createElement(F,{css:e,description:d,error:a,label:m,required:Boolean(o==null?void 0:o.required)},n.createElement(h,{defaultChecked:r,defaultValue:r?"on":"off",checked:l,name:s,onCheckedChange:u,value:l?"on":"off",...a&&{state:"error"},...c}))})};i.displayName="CheckboxField";export{i as CheckboxField};
@@ -1,17 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DateInputProps } from '../../components/date-input';
3
- import { ValidationOptions } from '../../components/form';
4
- import type { CSS } from '../../stitches';
5
- declare type DateFieldProps = DateInputProps & {
6
- css?: CSS;
7
- description?: string;
8
- label: string;
9
- name: string;
10
- prompt?: {
11
- link: string;
12
- label: string;
13
- };
14
- validation?: ValidationOptions;
15
- };
3
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
4
+ declare type DateFieldProps = DateInputProps & FieldElementWrapperProps;
16
5
  export declare const DateField: React.FC<DateFieldProps>;
17
6
  export {};
@@ -1 +1 @@
1
- import*as i from"react";import{useFormContext as f}from"react-hook-form";import{DateInput as u}from"../date-input/DateInput.js";import{FieldWrapper as F}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as g}from"../form/useFieldError.js";const a=({css:m,label:p,name:r,validation:e,prompt:l,description:d,...n})=>{const{register:t,trigger:s}=f(),{error:o}=g(r),c=e?t(e):t;return i.createElement(F,{css:m,description:d,error:o,fieldId:r,label:p,prompt:l,required:Boolean(e==null?void 0:e.required)},i.createElement(u,{id:r,name:r,ref:c,...o&&{state:"error"},...n,revalidate:s}))};a.displayName="DateField";export{a as DateField};
1
+ import*as i from"react";import{useFormContext as f}from"react-hook-form";import{DateInput as u}from"../date-input/DateInput.js";import{FieldWrapper as F}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as g}from"../form/useFieldError.js";const m=({css:a,label:p,name:r,validation:e,prompt:l,description:d,...n})=>{const{register:t,trigger:s}=f(),{error:o}=g(r),c=e?t(e):t;return i.createElement(F,{css:a,description:d,error:o,fieldId:r,label:p,prompt:l,required:Boolean(e==null?void 0:e.required)},i.createElement(u,{id:r,name:r,ref:c,...o&&{state:"error"},...n,revalidate:s}))};m.displayName="DateField";export{m as DateField};
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { ValidationOptions } from '../../components/form';
2
3
  import type { CSS } from '../../stitches';
3
4
  export declare type FieldWrapperProps = {
4
5
  css?: CSS;
@@ -13,4 +14,8 @@ export declare type FieldWrapperProps = {
13
14
  required?: boolean;
14
15
  hideLabel?: boolean;
15
16
  };
17
+ export declare type FieldElementWrapperProps = Omit<FieldWrapperProps, 'fieldId'> & {
18
+ name: string;
19
+ validation?: ValidationOptions;
20
+ };
16
21
  export declare const FieldWrapper: React.FC<FieldWrapperProps>;
@@ -1,3 +1,3 @@
1
- export type { FieldWrapperProps } from './FieldWrapper';
1
+ export type { FieldWrapperProps, FieldElementWrapperProps } from './FieldWrapper';
2
2
  export { FieldWrapper } from './FieldWrapper';
3
3
  export { InlineFieldWrapper } from './InlineFieldWrapper';
@@ -1,17 +1,6 @@
1
1
  import * as React from 'react';
2
- import { ValidationOptions } from '../../components/form';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
3
3
  import { InputProps } from '../../components/input';
4
- import type { CSS } from '../../stitches';
5
- declare type InputFieldProps = InputProps & {
6
- css?: CSS;
7
- description?: string;
8
- label: string;
9
- name: string;
10
- prompt?: {
11
- link: string;
12
- label: string;
13
- };
14
- validation?: ValidationOptions;
15
- };
4
+ declare type InputFieldProps = InputProps & FieldElementWrapperProps;
16
5
  export declare const InputField: React.FC<InputFieldProps>;
17
6
  export {};
@@ -1 +1 @@
1
- import*as i from"react";import{useFormContext as u}from"react-hook-form";import{FieldWrapper as c}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as f}from"../form/useFieldError.js";import{Input as F}from"../input/Input.js";const p=({css:m,label:l,name:r,validation:e,prompt:n,description:d,...a})=>{const{register:o}=u(),{error:t}=f(r),s=e?o(e):o;return i.createElement(c,{css:m,description:d,error:t,fieldId:r,label:l,prompt:n,required:Boolean(e==null?void 0:e.required)},i.createElement(F,{id:r,name:r,ref:s,...t&&{state:"error"},...a}))};p.displayName="InputField";export{p as InputField};
1
+ import*as i from"react";import{useFormContext as u}from"react-hook-form";import{FieldWrapper as c}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as f}from"../form/useFieldError.js";import{Input as F}from"../input/Input.js";const p=({css:m,label:l,name:r,validation:e,prompt:n,description:a,...d})=>{const{register:o}=u(),{error:t}=f(r),s=e?o(e):o;return i.createElement(c,{css:m,description:a,error:t,fieldId:r,label:l,prompt:n,required:Boolean(e==null?void 0:e.required)},i.createElement(F,{id:r,name:r,ref:s,...t&&{state:"error"},...d}))};p.displayName="InputField";export{p as InputField};
@@ -1,17 +1,8 @@
1
1
  import * as React from 'react';
2
- import type { ValidationOptions } from '../../components/form';
3
- import { InputProps } from '../../components/input';
4
- declare type PasswordFieldProps = InputProps & {
5
- description?: string;
6
- hidePasswordText?: string;
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
3
+ import { PasswordInput } from '../../components/password-input';
4
+ declare type PasswordFieldProps = React.ComponentProps<typeof PasswordInput> & Omit<FieldElementWrapperProps, 'label'> & {
7
5
  label?: string;
8
- name: string;
9
- prompt?: {
10
- label: string;
11
- link: string;
12
- };
13
- showPasswordText?: string;
14
- validation?: ValidationOptions;
15
6
  };
16
7
  export declare const PasswordField: React.FC<PasswordFieldProps>;
17
8
  export {};
@@ -1 +1 @@
1
- import*as t from"react";import{useFormContext as c}from"react-hook-form";import{FieldWrapper as u}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as f}from"../form/useFieldError.js";import{PasswordInput as w}from"../password-input/PasswordInput.js";const i=({css:s={},label:m="Password",name:r,prompt:p=void 0,description:a,validation:e,...d})=>{const{register:o}=c(),{error:l}=f(r),n=e?o(e):o;return t.createElement(u,{css:{...s,position:"relative"},description:a,error:l,fieldId:r,label:m,prompt:p,required:Boolean(e==null?void 0:e.required)},t.createElement(w,{autoComplete:"current-password",name:r,id:r,ref:n,...d}))};i.displayName="PasswordField";export{i as PasswordField};
1
+ import*as t from"react";import{useFormContext as c}from"react-hook-form";import{FieldWrapper as u}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as f}from"../form/useFieldError.js";import{PasswordInput as w}from"../password-input/PasswordInput.js";const i=({css:s={},label:m="Password",name:r,prompt:p=void 0,description:a,validation:o,...d})=>{const{register:e}=c(),{error:l}=f(r),n=o?e(o):e;return t.createElement(u,{css:{...s,position:"relative"},description:a,error:l,fieldId:r,label:m,prompt:p,required:Boolean(o==null?void 0:o.required)},t.createElement(w,{autoComplete:"current-password",name:r,id:r,ref:n,...d}))};i.displayName="PasswordField";export{i as PasswordField};
@@ -1,17 +1,8 @@
1
1
  import * as React from 'react';
2
- import { ValidationOptions } from '../../components/form';
3
- import { CSS } from '../../stitches';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
3
+ import { RadioButtonGroup } from '../../components/radio-button';
4
4
  import { RadioField } from './RadioField';
5
- declare type RadioButtonFieldProps = {
6
- css?: CSS;
7
- defaultValue?: string;
8
- label: string;
9
- name: string;
10
- direction?: 'row' | 'column';
11
- description?: string;
12
- validation?: ValidationOptions;
13
- onValueChange?: (value: string) => void;
14
- };
5
+ declare type RadioButtonFieldProps = React.ComponentProps<typeof RadioButtonGroup> & FieldElementWrapperProps;
15
6
  export declare const RadioButtonField: React.FC<RadioButtonFieldProps> & {
16
7
  Item: typeof RadioField;
17
8
  };
@@ -1 +1 @@
1
- import*as e from"react";import{useFormContext as g,Controller as C}from"react-hook-form";import{Description as F}from"../field-wrapper/FieldDescription.js";import"../form/Form.js";import{useFieldError as V}from"../form/useFieldError.js";import{Label as b}from"../label/Label.js";import"../radio-button/RadioButton.js";import{RadioButtonGroup as h}from"../radio-button/RadioButtonGroup.js";import{InlineMessage as v}from"../inline-message/InlineMessage.js";import{styled as B}from"../../stitches.js";import{RadioField as R}from"./RadioField.js";const $=B("fieldset",{all:"unset"}),r=({children:s,css:d,direction:u="column",defaultValue:t,description:l,label:c,name:n,validation:o,onValueChange:a})=>{const{control:p}=g(),{error:i}=V(n);return e.createElement($,{css:d},e.createElement(b,{as:"legend",css:{p:0,mb:"$3"},required:Boolean(o==null?void 0:o.required)},c),l&&e.createElement(F,{css:{mb:"$3"}},l),e.createElement(C,{control:p,name:n,rules:o,defaultValue:t,render:({onChange:f,value:E})=>e.createElement(h,{direction:u,defaultValue:t,onValueChange:m=>{f(m),a==null||a(m)},value:E},s)}),i&&e.createElement(v,{css:{mt:"$2"}},i))};r.Item=R,r.displayName="RadioButtonField";export{r as RadioButtonField};
1
+ import*as e from"react";import{useFormContext as F,Controller as g}from"react-hook-form";import{Description as C}from"../field-wrapper/FieldDescription.js";import"../form/Form.js";import{useFieldError as V}from"../form/useFieldError.js";import{Label as b}from"../label/Label.js";import"../radio-button/RadioButton.js";import{RadioButtonGroup as h}from"../radio-button/RadioButtonGroup.js";import{InlineMessage as v}from"../inline-message/InlineMessage.js";import{styled as B}from"../../stitches.js";import{RadioField as R}from"./RadioField.js";const $=B("fieldset",{all:"unset"}),r=({children:s,css:d,direction:u="column",defaultValue:t,description:l,label:c,name:n,validation:o,onValueChange:a})=>{const{control:p}=F(),{error:m}=V(n);return e.createElement($,{css:d},e.createElement(b,{as:"legend",css:{p:0,mb:"$3"},required:Boolean(o==null?void 0:o.required)},c),l&&e.createElement(C,{css:{mb:"$3"}},l),e.createElement(g,{control:p,name:n,rules:o,defaultValue:t,render:({onChange:f,value:E})=>e.createElement(h,{direction:u,defaultValue:t,onValueChange:i=>{f(i),a==null||a(i)},value:E},s)}),m&&e.createElement(v,{css:{mt:"$2"}},m))};r.Item=R,r.displayName="RadioButtonField";export{r as RadioButtonField};
@@ -1,15 +1,6 @@
1
1
  import * as React from 'react';
2
- import { ValidationOptions } from '../../components/form';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
3
3
  import { SearchInputProps } from '../../components/search-input';
4
- declare type SearchFieldProps = SearchInputProps & {
5
- description?: string;
6
- label: string;
7
- name: string;
8
- prompt?: {
9
- link: string;
10
- label: string;
11
- };
12
- validation?: ValidationOptions;
13
- };
4
+ declare type SearchFieldProps = SearchInputProps & FieldElementWrapperProps;
14
5
  export declare const SearchField: React.FC<SearchFieldProps>;
15
6
  export {};
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { Input } from '../../components/input';
3
3
  import { CSS } from '../../stitches';
4
4
  export declare type SearchInputProps = React.ComponentProps<typeof Input> & {
5
- size: 'sm' | 'md';
5
+ size?: 'sm' | 'md';
6
6
  css?: CSS;
7
7
  value?: string;
8
8
  clearText?: string;
@@ -1,15 +1,6 @@
1
1
  import * as React from 'react';
2
- import { FieldWrapperProps } from '../../components/field-wrapper';
3
- import { ValidationOptions } from '../../components/form';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
4
3
  import { SelectProps } from '../../components/select';
5
- declare type SelectFieldProps = SelectProps & FieldWrapperProps & {
6
- description?: string;
7
- name: string;
8
- prompt?: {
9
- link: string;
10
- label: string;
11
- };
12
- validation?: ValidationOptions;
13
- };
4
+ declare type SelectFieldProps = SelectProps & FieldElementWrapperProps;
14
5
  export declare const SelectField: React.FC<SelectFieldProps>;
15
6
  export {};
@@ -1 +1 @@
1
- import*as i from"react";import{useFormContext as u}from"react-hook-form";import{FieldWrapper as F}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as b}from"../form/useFieldError.js";import{Select as h}from"../select/Select.js";const l=({css:m=void 0,children:d,name:e,label:p,validation:r,prompt:a,description:n,hideLabel:s,...c})=>{const{register:o}=u(),{error:t}=b(e),f=r?o(r):o;return i.createElement(F,{css:m,description:n,error:t,fieldId:e,label:p,prompt:a,required:Boolean(r==null?void 0:r.required),hideLabel:s},i.createElement(h,{name:e,id:e,...c,ref:f,...t&&{state:"error"}},d))};l.displayName="SelectField";export{l as SelectField};
1
+ import*as t from"react";import{useFormContext as u}from"react-hook-form";import{FieldWrapper as F}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as b}from"../form/useFieldError.js";import{Select as h}from"../select/Select.js";const l=({css:m=void 0,children:d,name:e,label:p,validation:r,prompt:a,description:n,hideLabel:s,...c})=>{const{register:o}=u(),{error:i}=b(e),f=r?o(r):o;return t.createElement(F,{css:m,description:n,error:i,fieldId:e,label:p,prompt:a,required:Boolean(r==null?void 0:r.required),hideLabel:s},t.createElement(h,{name:e,id:e,...c,ref:f,...i&&{state:"error"}},d))};l.displayName="SelectField";export{l as SelectField};
@@ -1,13 +1,8 @@
1
1
  import React from 'react';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
2
3
  import { SliderProps } from '../../components/slider';
3
4
  import { SliderStepsType } from '../../components/slider/SliderSteps';
4
- import type { CSS } from '../../stitches';
5
5
  import { SliderValueType } from '../slider/SliderValue';
6
- declare type SliderFieldProps = SliderProps & SliderStepsType & SliderValueType & {
7
- css?: CSS;
8
- label: string;
9
- name: string;
10
- defaultValue: number[];
11
- };
6
+ declare type SliderFieldProps = SliderProps & SliderStepsType & SliderValueType & FieldElementWrapperProps;
12
7
  export declare const SliderField: React.FC<SliderFieldProps>;
13
8
  export {};
@@ -1 +1 @@
1
- import e from"react";import{useFormContext as x,Controller as E}from"react-hook-form";import{FieldWrapper as V}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import{Slider as l}from"../slider/Slider.js";const n=({css:u,label:i,name:t,defaultValue:a,outputLabel:d,min:r=0,max:m=100,steps:p=[],...s})=>{const{control:c}=x();return e.createElement(V,{css:u,fieldId:t,label:i},e.createElement(E,{control:c,name:t,defaultValue:a,render:({onChange:f,value:o})=>e.createElement(l,{name:t,defaultValue:a,onValueChange:f,value:o,min:r,max:m,...s},e.createElement(l.Steps,{min:r,max:m,steps:p}),e.createElement(l.Value,{value:o||a,outputLabel:d}))}))};n.displayName="SliderField";export{n as SliderField};
1
+ import e from"react";import{useFormContext as x,Controller as E}from"react-hook-form";import{FieldWrapper as V}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import{Slider as l}from"../slider/Slider.js";const n=({css:u,label:i,name:t,defaultValue:a,outputLabel:p,min:r=0,max:m=100,steps:d=[],...s})=>{const{control:c}=x();return e.createElement(V,{css:u,fieldId:t,label:i},e.createElement(E,{control:c,name:t,defaultValue:a,render:({onChange:f,value:o})=>e.createElement(l,{name:t,defaultValue:a,onValueChange:f,value:o,min:r,max:m,...s},e.createElement(l.Steps,{min:r,max:m,steps:d}),e.createElement(l.Value,{value:o||a,outputLabel:p}))}))};n.displayName="SliderField";export{n as SliderField};
@@ -1,10 +1,6 @@
1
1
  import * as React from 'react';
2
- import type { FieldWrapperProps } from '../../components/field-wrapper';
3
- import { ValidationOptions } from '../../components/form';
2
+ import { FieldElementWrapperProps } from '../../components/field-wrapper';
4
3
  import { TextareaProps } from '../../components/textarea';
5
- declare type TextareaFieldProps = TextareaProps & FieldWrapperProps & {
6
- name: string;
7
- validation?: ValidationOptions;
8
- };
4
+ declare type TextareaFieldProps = TextareaProps & FieldElementWrapperProps;
9
5
  export declare const TextareaField: React.FC<TextareaFieldProps>;
10
6
  export {};