@equinor/amplify-component-lib 8.18.0 → 8.18.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.
@@ -13,5 +13,8 @@ import{colors as t}from"../../atoms/style/colors.js";import o from"styled-compon
13
13
 
14
14
  div:has(> button) {
15
15
  outline-width: 1px;
16
+ > button:focus-visible {
17
+ outline: none;
18
+ }
16
19
  }
17
20
  `;export{e as DatePickerWrapper};
@@ -7,6 +7,7 @@ export interface ToggleEventProps<T> {
7
7
  export interface OptionDrawerProps<T extends {
8
8
  id: string;
9
9
  label: string;
10
+ disabled?: boolean;
10
11
  parentId?: string;
11
12
  children?: T[];
12
13
  }> {
@@ -22,14 +23,14 @@ export interface OptionDrawerProps<T extends {
22
23
  openAll?: boolean;
23
24
  showIntermediateParent?: boolean;
24
25
  parentHasNestedItems?: boolean;
25
- disabled?: boolean;
26
26
  }
27
27
  export declare const OptionDrawer: {
28
28
  <T extends {
29
29
  id: string;
30
30
  label: string;
31
+ disabled?: boolean;
31
32
  parentId?: string;
32
33
  children?: T[];
33
- }>({ item, onToggle, section, selectedItems, singleSelect, siblings, animateCheck, animateUncheck, animateParent, openAll, showIntermediateParent, parentHasNestedItems, disabled, }: OptionDrawerProps<T>): import("react/jsx-runtime").JSX.Element;
34
+ }>({ item, onToggle, section, selectedItems, singleSelect, siblings, animateCheck, animateUncheck, animateParent, openAll, showIntermediateParent, parentHasNestedItems, }: OptionDrawerProps<T>): import("react/jsx-runtime").JSX.Element;
34
35
  displayName: string;
35
36
  };
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n,useEffect as i}from"react";import{Button as r,Checkbox as d}from"@equinor/eds-core-react";import{chevron_down as o,chevron_right as a}from"@equinor/eds-icons";import{StyledOptionWrapper as l,StyledOptionItem as c,StyledIcon as s,StyledOption as E}from"./OptionDrawer.styles.js";const m=e=>{if(0===e.length)return[];let t=[];return e.forEach((e=>{const n=m(e?.children??[]);t=[e,...t,...n]})),t},h=(e,t,n,i)=>{if(void 0!==t.find((t=>t.id===e.id)))return"CHECKED";if(void 0===e.children||0===e.children.length||n&&!i)return"NONE";const r=m(e?.children).map((e=>void 0!==t.find((t=>t.id===e.id))));return!n&&r.every(Boolean)?"CHECKED":r.every((e=>!e))?"NONE":"INTERMEDIATE"},p=({item:m,onToggle:g,section:C=0,selectedItems:N=[],singleSelect:f=!1,siblings:D,animateCheck:u,animateUncheck:I,animateParent:T,openAll:v,showIntermediateParent:H=!1,parentHasNestedItems:O=!1,disabled:K=!1})=>{const[k,y]=n(!1),[A,$]=n(h(m,N,f,H)),[w,b]=n(!1);i((()=>{$(h(m,N,f,H))}),[m,N,f,H]),i((()=>{y(!!v)}),[v]);const M=e=>{const t=0===m.children?.length||f||void 0===m.children?[m]:[...m.children];"CHECKED"===A?(g({items:t,toggle:!1,event:e}),y(!1)):"NONE"!==A&&"INTERMEDIATE"!==A||(g({items:t,toggle:!0,event:e}),y(!0)),b(!1)},P=(e,t)=>{t&&T?(T(!0),$("CHECKED"===A?"NONE":"CHECKED"),setTimeout((()=>{M(e)}),400)):D?M(e):(b(!0),$("CHECKED"===A?"NONE":"CHECKED"),setTimeout((()=>{M(e)}),400))},R=e=>{if(D&&T){const t=N.filter((e=>e.id.includes(m.parentId??""))).length;if(!e&&u&&t===D-1)return!0;if(e&&I&&1===t)return!0}return!1},S=e=>{"CHECKED"===A&&I?P(e,R(!0)):"NONE"!==A&&"INTERMEDIATE"!==A||!u?M(e):P(e,R(!1))},j=m.children&&0!==m.children.length;return e(l,{$section:C,$animationActive:w,"data-testid":w?"animated-"+m.id:m.id,children:[e(c,{$paddedLeft:O&&!j,children:[j&&t(r,{variant:"ghost_icon",onClick:()=>{y((e=>!e))},"data-testid":"chevron-toggler-option-drawer",children:t(s,{data:k?o:a})}),e(E,{$section:C,onClick:e=>{K||(m.children&&0!==m.children.length&&y((e=>!e)),S(e))},children:[t(d,{indeterminate:"INTERMEDIATE"===A,checked:"CHECKED"===A,color:"secondary"}),m.label]})]}),k&&m.children?.map((e=>t(p,{section:C+1,onToggle:g,selectedItems:N,item:e,singleSelect:f,siblings:m.children?.length,animateCheck:u,animateUncheck:I,animateParent:b,openAll:v,showIntermediateParent:H,parentHasNestedItems:!0,disabled:K},`OptionDrawer-${e.id}`)))]},w?`animated-StyledOptionWrapper-${m.id}`:`StyledOptionWrapper-${m.id}`)};p.displayName="OptionDrawer";export{p as OptionDrawer};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{Button as r,Checkbox as d}from"@equinor/eds-core-react";import{chevron_down as o,chevron_right as a}from"@equinor/eds-icons";import{StyledOptionWrapper as l,StyledOptionItem as c,StyledIcon as s,StyledOption as E}from"./OptionDrawer.styles.js";const m=e=>{if(0===e.length)return[];let t=[];return e.forEach((e=>{const i=m(e?.children??[]);t=[e,...t,...i]})),t},h=(e,t,i,n)=>{if(void 0!==t.find((t=>t.id===e.id)))return"CHECKED";if(void 0===e.children||0===e.children.length||i&&!n)return"NONE";const r=m(e?.children).map((e=>void 0!==t.find((t=>t.id===e.id))));return!i&&r.every(Boolean)?"CHECKED":r.every((e=>!e))?"NONE":"INTERMEDIATE"},p=({item:m,onToggle:g,section:C=0,selectedItems:N=[],singleSelect:f=!1,siblings:D,animateCheck:u,animateUncheck:I,animateParent:T,openAll:v,showIntermediateParent:H=!1,parentHasNestedItems:O=!1})=>{const[K,b]=i(!1),[k,y]=i(h(m,N,f,H)),[A,$]=i(!1);n((()=>{y(h(m,N,f,H))}),[m,N,f,H]),n((()=>{b(!!v)}),[v]);const w=e=>{const t=0===m.children?.length||f||void 0===m.children?[m]:[...m.children];"CHECKED"===k?(g({items:t,toggle:!1,event:e}),b(!1)):"NONE"!==k&&"INTERMEDIATE"!==k||(g({items:t,toggle:!0,event:e}),b(!0)),$(!1)},M=(e,t)=>{t&&T?(T(!0),y("CHECKED"===k?"NONE":"CHECKED"),setTimeout((()=>{w(e)}),400)):D?w(e):($(!0),y("CHECKED"===k?"NONE":"CHECKED"),setTimeout((()=>{w(e)}),400))},P=e=>{if(D&&T){const t=N.filter((e=>e.id.includes(m.parentId??""))).length;if(!e&&u&&t===D-1)return!0;if(e&&I&&1===t)return!0}return!1},R=e=>{"CHECKED"===k&&I?M(e,P(!0)):"NONE"!==k&&"INTERMEDIATE"!==k||!u?w(e):M(e,P(!1))},S=m.children&&0!==m.children.length;return e(l,{$section:C,$animationActive:A,"data-testid":A?"animated-"+m.id:m.id,children:[e(c,{$paddedLeft:O&&!S,children:[S&&t(r,{variant:"ghost_icon",onClick:()=>{b((e=>!e))},"data-testid":"chevron-toggler-option-drawer",children:t(s,{data:K?o:a})}),e(E,{$section:C,onClick:e=>{m.disabled||(m.children&&0!==m.children.length&&b((e=>!e)),R(e))},disabled:!!m.disabled,children:[t(d,{indeterminate:"INTERMEDIATE"===k,checked:"CHECKED"===k,color:"secondary",disabled:!!m.disabled}),m.label]})]}),K&&m.children?.map((e=>t(p,{section:C+1,onToggle:g,selectedItems:N,item:e,singleSelect:f,siblings:m.children?.length,animateCheck:u,animateUncheck:I,animateParent:$,openAll:v,showIntermediateParent:H,parentHasNestedItems:!0},`OptionDrawer-${e.id}`)))]},A?`animated-StyledOptionWrapper-${m.id}`:`StyledOptionWrapper-${m.id}`)};p.displayName="OptionDrawer";export{p as OptionDrawer};
@@ -3,7 +3,7 @@ interface StyledOptionProps {
3
3
  $animationActive?: boolean;
4
4
  }
5
5
  declare const StyledOptionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledOptionProps>> & string;
6
- declare const StyledOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledOptionProps>> & string;
6
+ declare const StyledOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledOptionProps>> & string;
7
7
  declare const StyledIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<{
8
8
  title?: string;
9
9
  color?: string;
@@ -1,4 +1,4 @@
1
- import{Icon as i}from"@equinor/eds-core-react";import{colors as e}from"../../atoms/style/colors.js";import t,{keyframes as o,css as r}from"styled-components";const a=o`
1
+ import{Icon as o}from"@equinor/eds-core-react";import{colors as t}from"../../atoms/style/colors.js";import e,{keyframes as i,css as r}from"styled-components";const a=i`
2
2
  0% {
3
3
  opacity: 1;
4
4
  }
@@ -9,29 +9,42 @@ import{Icon as i}from"@equinor/eds-core-react";import{colors as e}from"../../ato
9
9
  opacity: 0;
10
10
  display: none;
11
11
  }
12
- `,n=t.div`
13
- margin-left: ${({$section:i})=>i>0?"22px":""};
12
+ `,n=e.div`
13
+ margin-left: ${({$section:o})=>o>0?"22px":""};
14
14
  opacity: 1;
15
- color: ${e.text.static_icons__default.rgba};
16
- animation: ${({$animationActive:i})=>i?r`
15
+ color: ${t.text.static_icons__default.rgba};
16
+ animation: ${({$animationActive:o})=>o?r`
17
17
  ${a} 400ms ease-in
18
18
  `:"none"};
19
- `,s=t.div`
19
+ `,s=e.button`
20
20
  position: relative;
21
21
  display: flex;
22
22
  flex: 1;
23
23
  align-items: center;
24
24
  cursor: pointer;
25
25
  transition: background-color 0.1s ease-in;
26
- &:hover {
27
- background-color: ${e.interactive.primary__hover_alt.rgba};
26
+ font-family: 'Equinor', sans-serif;
27
+ font-size: 1rem;
28
+ color: ${t.text.static_icons__default.rgba};
29
+ &:hover:not(:disabled) {
30
+ background-color: ${t.interactive.primary__hover_alt.rgba};
31
+ }
32
+ &:disabled {
33
+ cursor: not-allowed;
34
+ color: ${t.interactive.disabled__text.rgba};
35
+ > button {
36
+ cursor: not-allowed;
37
+ }
38
+ }
39
+ > span::before {
40
+ display: none;
28
41
  }
29
42
 
30
43
  svg {
31
- fill: ${e.interactive.primary__resting.rgba};
44
+ fill: ${t.interactive.primary__resting.rgba};
32
45
  }
33
- `,c=t(i)``,l=t.div`
46
+ `,l=e(o)``,c=e.div`
34
47
  display: flex;
35
48
  align-items: center;
36
- ${({$paddedLeft:i})=>i&&"margin-left: 40px"};
37
- `;export{c as StyledIcon,s as StyledOption,l as StyledOptionItem,n as StyledOptionWrapper};
49
+ ${({$paddedLeft:o})=>o&&"margin-left: 40px"};
50
+ `;export{l as StyledIcon,s as StyledOption,c as StyledOptionItem,n as StyledOptionWrapper};
@@ -1,6 +1,7 @@
1
1
  export interface ValueType {
2
2
  id: string;
3
3
  label: string;
4
+ disabled?: boolean;
4
5
  children?: ValueType[];
5
6
  value: number;
6
7
  }
@@ -2,10 +2,12 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
2
2
  &:hover {
3
3
  background: ${s.interactive.primary__hover_alt.rgba};
4
4
  }
5
- &:focus {
6
- outline: 2px dashed ${s.interactive.focus.rgba};
7
- outline-offset: -4px;
8
- }
5
+ ${({$active:t})=>t?"":n`
6
+ &:focus:not(:hover) {
7
+ outline: 2px dashed ${s.interactive.focus.rgba};
8
+ outline-offset: -4px;
9
+ }
10
+ `}
9
11
  position: relative;
10
12
  display: grid;
11
13
  grid-template-columns: auto 1fr;
@@ -111,7 +113,6 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
111
113
  `}}}
112
114
  `,u=a.div`
113
115
  display: flex;
114
- flex-direction:;
115
116
  position: relative;
116
117
  &:after {
117
118
  position: absolute;
@@ -170,8 +171,7 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
170
171
  background: ${s.ui.background__medium.rgba};
171
172
  }
172
173
  `}}}
173
- data-testid="table-of-contents-container"
174
- `,b=a(r.div)`
174
+ `,$=a(r.div)`
175
175
  display: flex;
176
176
  flex-direction: column;
177
177
  ${({$shouldShowChildren:t})=>t?null:n`
@@ -187,4 +187,4 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
187
187
  }
188
188
 
189
189
  ${({$variant:t})=>"buttons"===t&&`gap:${i.x_small};`}
190
- `;export{f as BorderItemsContainer,u as BorderItemsHorizontalContainer,d as Button,b as ChildContainer,c as Link,g as TableOfContentsContainer,p as TableOfContentsItemContainer};
190
+ `;export{f as BorderItemsContainer,u as BorderItemsHorizontalContainer,d as Button,$ as ChildContainer,c as Link,g as TableOfContentsContainer,p as TableOfContentsItemContainer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/amplify-component-lib",
3
- "version": "8.18.0",
3
+ "version": "8.18.2",
4
4
  "description": "Frontend Typescript components for the Amplify team",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",