@atom-learning/components 1.19.0 → 1.21.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.
package/CHANGELOG.md CHANGED
@@ -1,37 +1,9 @@
1
- # [1.19.0](https://github.com/Atom-Learning/components/compare/v1.18.2...v1.19.0) (2022-07-14)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * add component invariant ([1c09b25](https://github.com/Atom-Learning/components/commit/1c09b257fdf6d7d59e8f8ae8a784263f908576a7))
7
- * add test case for invariant error ([3c5bf57](https://github.com/Atom-Learning/components/commit/3c5bf57cdcdd680d0e3c2e19a6f2da15a759d67a))
8
- * allow optional labels ([0a7e7ca](https://github.com/Atom-Learning/components/commit/0a7e7ca5a316e9c0d619ea373ba202ddc1bf51df))
9
- * correct step state changes ([1ee0983](https://github.com/Atom-Learning/components/commit/1ee0983e90fb55a478d27b92911d3b009f888337))
10
- * errors in documentation ([179e098](https://github.com/Atom-Learning/components/commit/179e09814d9f91e2c49096a71c6e9c7cc691232e))
11
- * extract sub-components ([1cbc7c8](https://github.com/Atom-Learning/components/commit/1cbc7c8feab5b6a2f3d0822a0c6794c5b5dd896a))
12
- * prevent calling onStepChange for controlled component ([3413ca8](https://github.com/Atom-Learning/components/commit/3413ca82f9aab994e6728951b7d219ee020eaa38))
13
- * remove invalid aria attribute ([a2463c1](https://github.com/Atom-Learning/components/commit/a2463c1572c34a4ff70a0722840f89bb3b8d2e4e))
14
- * remove unnecessary step ([27ba9b3](https://github.com/Atom-Learning/components/commit/27ba9b36f6544a55957486981277a28edd75e6dd))
15
- * rename similarly named component ([3a0e700](https://github.com/Atom-Learning/components/commit/3a0e70009d29e69f36f364b5ef468ae8f7713166))
16
- * replace normal status name to default ([3e38829](https://github.com/Atom-Learning/components/commit/3e38829d526cc3567a39db684d0899ced8816833))
17
- * replace orientation in api with direction ([abc5831](https://github.com/Atom-Learning/components/commit/abc583147dad98fa50ba5de0b939be7749afb571))
18
- * replaced hardcoded strings with enums ([4ba4c76](https://github.com/Atom-Learning/components/commit/4ba4c76b07102adbc7a6ef1ee7ffbfad73949d49))
19
- * replaced with size key to remove unnecessary styles ([2152f38](https://github.com/Atom-Learning/components/commit/2152f388325f30dd77bfa76731926da87d84a4cc))
20
- * revert to initial changes ([7867714](https://github.com/Atom-Learning/components/commit/7867714e373fef8f77e2df42e397a0f9999d5a22))
21
- * update documentation ([65ddcda](https://github.com/Atom-Learning/components/commit/65ddcda5312a537e04317892a0ea300f9b0c6aa5))
22
- * update provider stepCount type to be required ([1464571](https://github.com/Atom-Learning/components/commit/146457113121e19b79614f8f3683e404602597bc))
23
- * update test, remove data-testid ([67849ed](https://github.com/Atom-Learning/components/commit/67849ed0b8e23715beb8db813ebc3571370e71f3))
24
- * update types, labels and names for variants and functions ([397c58f](https://github.com/Atom-Learning/components/commit/397c58f7a8548ee1b44bdb265b81883bfdd5cfcf))
25
- * updated snapshot test ([221a802](https://github.com/Atom-Learning/components/commit/221a80294ebd67010f8f309f37c407ce3fb261dc))
26
- * updated types to prevent type repetition ([551cf36](https://github.com/Atom-Learning/components/commit/551cf369c441256ce489ad627804246d58b0489e))
27
- * updated with component variants and required styles ([db05c28](https://github.com/Atom-Learning/components/commit/db05c2851521a996b37939e8d398d5a77baea71f))
28
- * updated with generic copy ([11264d6](https://github.com/Atom-Learning/components/commit/11264d6e7ef0d8ec1a9ad0bef6c8668842d5b966))
29
- * updated with optional props for controlled/uncontrolled components ([e44984a](https://github.com/Atom-Learning/components/commit/e44984a65bb1c22d9382e31305bb927396742bc1))
1
+ # [1.21.0](https://github.com/Atom-Learning/components/compare/v1.20.1...v1.21.0) (2022-07-19)
30
2
 
31
3
 
32
4
  ### Features
33
5
 
34
- * add new states and orientation/implement ability to use labels ([329640f](https://github.com/Atom-Learning/components/commit/329640fd0551c477f80087d669b7c30ba960a531))
6
+ * add support for hiding step labels ([fa98736](https://github.com/Atom-Learning/components/commit/fa987366fdba545825623334a8eaec678b7b7876))
35
7
 
36
8
  # [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
37
9
 
@@ -1,3 +1,4 @@
1
+ import { CarouselProvider } from 'pure-react-carousel';
1
2
  import * as React from 'react';
2
3
  import { CSSWrapper } from '../../utilities';
3
4
  import { CarouselArrowNext, CarouselArrowPrevious } from './CarouselArrows';
@@ -16,7 +17,7 @@ declare type CarouselSubComponents = {
16
17
  Slide: typeof CarouselSlide;
17
18
  Slider: typeof CarouselSlider;
18
19
  };
19
- export declare const Carousel: React.FC<CarouselProps & React.ComponentProps<typeof CSSWrapper>> & CarouselSubComponents;
20
+ export declare const Carousel: React.FC<CarouselProps & Omit<React.ComponentProps<typeof CarouselProvider>, 'naturalSlideWidth' | 'naturalSlideHeight' | 'totalSlides'> & React.ComponentProps<typeof CSSWrapper>> & CarouselSubComponents;
20
21
  /**
21
22
  * Documentation about the hook usage
22
23
  * https://github.com/express-labs/pure-react-carousel#hooks-and-usecontext
@@ -1 +1 @@
1
- import{CarouselProvider as s,CarouselContext as m}from"pure-react-carousel";import*as e from"react";import{CarouselArrowNext as u,CarouselArrowPrevious as d}from"./CarouselArrows.js";import{CarouselPagination as n}from"./CarouselPagination.js";import{CarouselSlide as C}from"./CarouselSlide.js";import{CarouselSlider as p}from"./CarouselSlider.js";import{CSSWrapper as S}from"../../utilities/css-wrapper/CSSWrapper.js";const r=({children:o,css:i,slideHeight:t,slideWidth:l,numSlides:a})=>e.createElement(S,{css:i},e.createElement(s,{naturalSlideWidth:l,naturalSlideHeight:t,totalSlides:a},o)),f=()=>e.useContext(m);r.ArrowNext=u,r.ArrowPrevious=d,r.Pagination=n,r.Slide=C,r.Slider=p,r.displayName="Carousel";export{r as Carousel,f as useCarousel};
1
+ import{CarouselProvider as m,CarouselContext as u}from"pure-react-carousel";import*as e from"react";import{CarouselArrowNext as d,CarouselArrowPrevious as n}from"./CarouselArrows.js";import{CarouselPagination as C}from"./CarouselPagination.js";import{CarouselSlide as p}from"./CarouselSlide.js";import{CarouselSlider as S}from"./CarouselSlider.js";import{CSSWrapper as f}from"../../utilities/css-wrapper/CSSWrapper.js";const r=({children:o,css:i,slideHeight:t,slideWidth:l,numSlides:a,...s})=>e.createElement(f,{css:i},e.createElement(m,{naturalSlideWidth:l,naturalSlideHeight:t,totalSlides:a,...s},o)),c=()=>e.useContext(u);r.ArrowNext=d,r.ArrowPrevious=n,r.Pagination=C,r.Slide=p,r.Slider=S,r.displayName="Carousel";export{r as Carousel,c as useCarousel};
@@ -1,8 +1,8 @@
1
1
  import { Description, Title, Trigger } from '@radix-ui/react-dialog';
2
2
  import * as React from 'react';
3
+ import { DialogBackground } from './DialogBackground';
3
4
  import { DialogClose } from './DialogClose';
4
5
  import { DialogContent } from './DialogContent';
5
- import { DialogBackground } from './DialogBackground';
6
6
  declare const StyledDialog: import("@stitches/react/types/styled-component").StyledComponent<React.FC<import("@radix-ui/react-dialog").DialogProps>, {}, {
7
7
  sm: string;
8
8
  md: string;
@@ -1 +1 @@
1
- import{Root as t,Description as i,Title as e,Trigger as m}from"@radix-ui/react-dialog";import*as l from"react";import{styled as a}from"../../stitches.js";import{DialogClose as g}from"./DialogClose.js";import{DialogContent as n}from"./DialogContent.js";import{DialogBackground as p}from"./DialogBackground.js";const s=a(t,{}),o=r=>l.createElement(s,{...r});o.Background=p,o.Close=g,o.Content=n,o.Description=i,o.Title=e,o.Trigger=m,o.displayName="Dialog";export{o as Dialog};
1
+ import{Root as t,Description as i,Title as e,Trigger as m}from"@radix-ui/react-dialog";import*as l from"react";import{styled as a}from"../../stitches.js";import{DialogBackground as g}from"./DialogBackground.js";import{DialogClose as n}from"./DialogClose.js";import{DialogContent as p}from"./DialogContent.js";const s=a(t,{}),o=r=>l.createElement(s,{...r});o.Background=g,o.Close=n,o.Content=p,o.Description=i,o.Title=e,o.Trigger=m,o.displayName="Dialog";export{o as Dialog};
@@ -1 +1 @@
1
- import S from"invariant";import*as r from"react";import{Box as d}from"../box/Box.js";import{StepperProvider as c}from"./stepper-context/StepperContext.js";import{StepperStepBack as f}from"./StepperStepBack.js";import{StepperStepForward as h}from"./StepperStepForward.js";import{StepperSteps as u}from"./StepperSteps.js";const e=({children:i,stepCount:o,allowSkip:n,onComplete:s,onStepChange:l,direction:a="horizontal",steps:t,css:m})=>{S(!(o&&t),"`Stepper` should only be given one of `stepCount` or `steps`. When both are provided, `steps` will be used and `stepCount` will be ignored.");const p=(t==null?void 0:t.length)||o||0;return r.createElement(c,{stepCount:p,allowSkip:n,onComplete:s,onStepChange:o?l:void 0,direction:a,steps:t||Array(p).fill("")},r.createElement(d,{"aria-label":"progress",css:{width:"100%",...m}},i))};e.StepBack=f,e.StepForward=h,e.Steps=u,e.displayName="Stepper";export{e as Stepper};
1
+ import S from"invariant";import*as r from"react";import{Box as c}from"../box/Box.js";import{StepperProvider as h}from"./stepper-context/StepperContext.js";import{StepperStepBack as f}from"./StepperStepBack.js";import{StepperStepForward as u}from"./StepperStepForward.js";import{StepperSteps as C}from"./StepperSteps.js";const e=({children:i,stepCount:o,allowSkip:s,onComplete:n,onStepChange:l,direction:a="horizontal",steps:t,hideLabels:m=!1,css:d})=>{S(!(o&&t),"`Stepper` should only be given one of `stepCount` or `steps`. When both are provided, `steps` will be used and `stepCount` will be ignored.");const p=(t==null?void 0:t.length)||o||0;return r.createElement(h,{stepCount:p,allowSkip:s,onComplete:n,onStepChange:o?l:void 0,direction:a,steps:t||Array(p).fill(""),hideLabels:m},r.createElement(c,{"aria-label":"progress",css:{width:"100%",...d}},i))};e.StepBack=f,e.StepForward=u,e.Steps=C,e.displayName="Stepper";export{e as Stepper};
@@ -1 +1 @@
1
- import{Ok as E}from"@atom-learning/icons";import*as i from"react";import{styled as f}from"../../stitches.js";import{Flex as v}from"../flex/Flex.js";import{Icon as b}from"../icon/Icon.js";import{StepperStepLabel as C}from"./StepperStepLabel.js";import{StepperStepContainer as h}from"./StepperStepContainer.js";import{StepperStepBullet as $}from"./StepperStepBullet.js";import{useStepper as D}from"./stepper-context/StepperContext.js";import{Status as r}from"./types.js";const I=f(v,{justifyContent:"space-between",variants:{direction:{vertical:{flexDirection:"column"},horizontal:{flexDirection:"row",alignItems:"center"}}}}),g=({css:m})=>{const{steps:o,goToStep:p,activeStep:c,viewedSteps:a,allowSkip:l,direction:n}=D(),u=e=>{const t=o[e];return t.status?t.status:c===e?r.ACTIVE:a.includes(e)?r.VIEWED:r.DEFAULT},S=e=>{var t;const s=(t=o[e])==null?void 0:t.status;return s===r.SUCCESS?r.SUCCESS:s===r.VIEWED||e<Math.max(...a)?r.ACTIVE:r.DEFAULT};return i.createElement(I,{css:m,direction:n},o.map((e,t)=>{const s=u(t),d=S(t);return i.createElement(h,{key:`step_${t}`,direction:n,separator:d,css:n==="horizontal"?{width:`calc(100% / ${o.length})`}:{height:`calc(100% / ${o.length})`}},i.createElement($,{as:l?"button":"div",onClick:()=>l&&a.includes(t)?p==null?void 0:p(t):void 0,status:s,"aria-current":t===c?"step":void 0,"aria-label":e.label?"":`step ${t+1}`,"aria-labelledby":e.label?`step-${t}`:void 0,css:{cursor:l&&a.includes(t)?"pointer":"auto"}},e.status==="success"?i.createElement(b,{is:E}):t+1),e.label&&i.createElement(C,{as:"span",id:`step-${t}`,direction:n,status:s},e.label))}))};export{g as StepperSteps};
1
+ import{Ok as f}from"@atom-learning/icons";import*as i from"react";import{styled as b}from"../../stitches.js";import{Flex as v}from"../flex/Flex.js";import{Icon as h}from"../icon/Icon.js";import{StepperStepLabel as C}from"./StepperStepLabel.js";import{StepperStepContainer as g}from"./StepperStepContainer.js";import{StepperStepBullet as D}from"./StepperStepBullet.js";import{useStepper as I}from"./stepper-context/StepperContext.js";import{Status as r}from"./types.js";const $=b(v,{justifyContent:"space-between",variants:{direction:{vertical:{flexDirection:"column"},horizontal:{flexDirection:"row",alignItems:"center"}}}}),w=({css:m})=>{const{steps:o,goToStep:p,activeStep:c,viewedSteps:a,allowSkip:l,direction:n,hideLabels:u}=I(),d=t=>{const e=o[t];return e.status?e.status:c===t?r.ACTIVE:a.includes(t)?r.VIEWED:r.DEFAULT},S=t=>{var e;const s=(e=o[t])==null?void 0:e.status;return s===r.SUCCESS?r.SUCCESS:s===r.VIEWED||t<Math.max(...a)?r.ACTIVE:r.DEFAULT};return i.createElement($,{css:m,direction:n},o.map((t,e)=>{const s=d(e),E=S(e);return i.createElement(g,{key:`step_${e}`,direction:n,separator:E,css:n==="horizontal"?{width:`calc(100% / ${o.length})`}:{height:`calc(100% / ${o.length})`}},i.createElement(D,{as:l?"button":"div",onClick:()=>l&&a.includes(e)?p==null?void 0:p(e):void 0,status:s,"aria-current":e===c?"step":void 0,"aria-label":t.label?"":`step ${e+1}`,"aria-labelledby":t.label?`step-${e}`:void 0,css:{cursor:l&&a.includes(e)?"pointer":"auto"}},t.status==="success"?i.createElement(h,{is:f}):e+1),t.label&&!u&&i.createElement(C,{as:"span",id:`step-${e}`,direction:n,status:s},t.label))}))};export{w as StepperSteps};
@@ -1 +1 @@
1
- import*as o from"react";const u=o.createContext({steps:[],goToPreviousStep:()=>null,goToNextStep:()=>null,goToStep:()=>null,activeStep:0,viewedSteps:[],allowSkip:!1,direction:"horizontal"}),h=({children:r,stepCount:n,allowSkip:S,onComplete:s,onStepChange:p,direction:a,steps:c})=>{const[t,i]=o.useState(0),[v,d]=o.useState([0]),l=!n;o.useEffect(()=>{d(e=>e.includes(t)?e:[...e,t]),p==null||p(t)},[t,p]);const w=()=>{if(s&&t===n-1)return s();if(t<n-1)return i(e=>e+1)},f=()=>{i(e=>e-1)},g=e=>{i(e)};return o.createElement(u.Provider,{value:{steps:c||Array(n).fill(""),goToPreviousStep:l?void 0:f,goToNextStep:l?void 0:w,goToStep:l?void 0:g,activeStep:t,viewedSteps:v,allowSkip:S,direction:a}},r)},m=()=>{const r=o.useContext(u);if(!r)throw new Error("Ensure that you wrap any components with the root component Stepper");return r};export{h as StepperProvider,m as useStepper};
1
+ import*as o from"react";const a=o.createContext({steps:[],goToPreviousStep:()=>null,goToNextStep:()=>null,goToStep:()=>null,activeStep:0,viewedSteps:[],allowSkip:!1,direction:"horizontal",hideLabels:!1}),T=({children:r,stepCount:n,allowSkip:u,onComplete:s,onStepChange:p,direction:S,steps:c,hideLabels:d})=>{const[t,i]=o.useState(0),[v,h]=o.useState([0]),l=!n;o.useEffect(()=>{h(e=>e.includes(t)?e:[...e,t]),p==null||p(t)},[t,p]);const w=()=>{if(s&&t===n-1)return s();if(t<n-1)return i(e=>e+1)},f=()=>{i(e=>e-1)},g=e=>{i(e)};return o.createElement(a.Provider,{value:{steps:c||Array(n).fill(""),goToPreviousStep:l?void 0:f,goToNextStep:l?void 0:w,goToStep:l?void 0:g,activeStep:t,viewedSteps:v,allowSkip:u,direction:S,hideLabels:d}},r)},m=()=>{const r=o.useContext(a);if(!r)throw new Error("Ensure that you wrap any components with the root component Stepper");return r};export{T as StepperProvider,m as useStepper};
@@ -19,6 +19,7 @@ export declare type Context = {
19
19
  viewedSteps: number[];
20
20
  allowSkip?: boolean;
21
21
  direction?: Direction;
22
+ hideLabels: boolean;
22
23
  };
23
24
  export declare type StepperProviderProps = {
24
25
  stepCount: number;
@@ -27,6 +28,7 @@ export declare type StepperProviderProps = {
27
28
  onStepChange?: (activeStep: number) => void;
28
29
  direction?: Direction;
29
30
  steps: Step[];
31
+ hideLabels: boolean;
30
32
  };
31
33
  export interface IStepperProps {
32
34
  css?: CSS;
@@ -36,6 +38,7 @@ export interface IStepperProps {
36
38
  onStepChange?: (activeStep: number) => void;
37
39
  direction?: Direction;
38
40
  steps?: Step[];
41
+ hideLabels?: boolean;
39
42
  }
40
43
  export interface IStepperNavigateProps {
41
44
  label?: (currentStep?: number) => string;
@@ -1 +1 @@
1
- import{styled as r}from"../../stitches.js";import*as d from"react";import{TableRow as i}from"./TableRow.js";const a=r("tbody",{variants:{striped:{true:{[`${i}`]:{"&:nth-child(odd)":{bg:"white"},"&:nth-child(even)":{bg:"$tonal50"}}},false:{bg:"white"}}}}),t=({striped:e=!0,...o})=>d.createElement(a,{striped:e,...o});t.displayName="TableBody";export{t as TableBody};
1
+ import*as r from"react";import{styled as d}from"../../stitches.js";import{TableRow as i}from"./TableRow.js";const a=d("tbody",{variants:{striped:{true:{[`${i}`]:{"&:nth-child(odd)":{bg:"white"},"&:nth-child(even)":{bg:"$tonal50"}}},false:{bg:"white"}}}}),t=({striped:e=!0,...o})=>r.createElement(a,{striped:e,...o});t.displayName="TableBody";export{t as TableBody};