@equinor/amplify-component-lib 8.7.5 → 8.8.1
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/dist/atoms/hooks/useSelect.d.ts +1 -2
- package/dist/atoms/hooks/useSelect.js +1 -1
- package/dist/atoms/style/colors.d.ts +1 -0
- package/dist/atoms/style/colors.js +1 -1
- package/dist/molecules/Select/AddTagItem.d.ts +0 -1
- package/dist/molecules/Select/AddTagItem.js +1 -1
- package/dist/molecules/Select/ComboBox/ComboBox.d.ts +9 -0
- package/dist/molecules/Select/GroupedSelectMenu.js +1 -1
- package/dist/molecules/Select/ListSelectMenu.d.ts +1 -1
- package/dist/molecules/Select/ListSelectMenu.js +1 -1
- package/dist/molecules/Select/Select.js +1 -1
- package/dist/molecules/Select/Select.styles.js +38 -40
- package/dist/molecules/Select/Select.types.d.ts +2 -3
- package/dist/molecules/Select/SelectMenuItem.js +1 -1
- package/dist/molecules/Select/SingleSelect/SingleSelect.d.ts +8 -0
- package/dist/molecules/TextField/TextField.js +8 -5
- package/dist/organisms/TableOfContents/TableOfContents.constants.js +1 -1
- package/dist/organisms/TableOfContents/TableOfContents.js +1 -1
- package/dist/organisms/TableOfContents/TableOfContents.styles.d.ts +5 -0
- package/dist/organisms/TableOfContents/TableOfContents.styles.js +30 -5
- package/dist/organisms/TableOfContents/TableOfContents.types.d.ts +1 -1
- package/dist/organisms/Template/Template.js +8 -7
- package/dist/organisms/TopBar/Account/ImpersonateMenu/CreateNewUser/CreateNewUser.js +1 -1
- package/package.json +2 -2
|
@@ -12,8 +12,7 @@ declare const useSelect: <T extends SelectOptionRequired>(props: SelectComponent
|
|
|
12
12
|
handleToggleOpen: () => void;
|
|
13
13
|
handleOnClose: () => void;
|
|
14
14
|
handleOnOpen: () => void;
|
|
15
|
-
handleOnRemoveItem: (item: T) => void;
|
|
16
|
-
handleOnMouseEnterItem: (index: number) => void;
|
|
15
|
+
handleOnRemoveItem: (item: SelectOption<T>) => void;
|
|
17
16
|
search: string;
|
|
18
17
|
searchRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
19
18
|
itemRefs: import("react").MutableRefObject<(HTMLButtonElement | null)[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e,useRef as n,useMemo as r,useEffect as t}from"react";const
|
|
1
|
+
import{useState as e,useRef as n,useMemo as r,useEffect as t}from"react";import{flattenOptions as l}from"../../molecules/Select/Select.utils.js";const a=a=>{const{loading:u,disabled:c,sortValues:o,onSearchChange:d,onOpenCallback:s}=a,[i,v]=e(!1),[h,m]=e(""),p=n(null),f=n([]),g=n(-1),[y,k]=e(void 0),S=n(!1),I=n(0),A=r((()=>{let e,n=[];return"values"in a?n=a.values:a.value&&(n=[a.value]),o?(e=a.groups?a.groups.flatMap((e=>e.items)):a.items.flatMap((e=>[{...e},...e.children||[]])),n.sort(((n,r)=>e.findIndex((e=>e.value===n.value))-e.findIndex((e=>e.value===r.value))))):n}),[a,o]);t((()=>{void 0!==s&&s(i)}),[s,i]),t((()=>{S.current&&I.current!==A.length&&(I.current=A.length,S.current=!1,p.current?.focus())}),[A.length]);const O=()=>{i||c||u||(p.current?.focus(),v(!0))},w=()=>{v(!1),m(""),g.current=0},C=e=>{!("values"in a)||u||c||a.onSelect(a.values.filter((n=>n.value!==e.value)),e)};return{handleOnAddItem:()=>{"onAddItem"in a&&a.onAddItem&&(a.onAddItem(h),m(""))},handleOnItemSelect:e=>{"value"in a?a.onSelect(e):a.onSelect(((e,n)=>{const r=structuredClone(e);return r.some((e=>e.value===n.value))?r.filter((e=>e.value!==n.value)):"values"in a&&void 0!==a.syncParentChildSelection&&!a.syncParentChildSelection?[n,...r]:[n,...r.filter((e=>(!(void 0===n.children||n.children.length>0)||!l([n]).some((n=>n.value===e.value)))&&(void 0===e.children||0===e.children.length||l([e]).every((e=>e.value!==n.value)))))]})(a.values,e),e),""!==h&&m(""),S.current=!0},handleOnItemKeyDown:e=>{"ArrowDown"===e.key&&g.current<f.current.length-1?(g.current+=1,f.current.at(g.current)?.focus()):"ArrowUp"===e.key&&g.current>0?(g.current-=1,f.current.at(g.current)?.focus()):"ArrowUp"===e.key&&0===g.current&&(g.current=-1,p.current?.focus())},handleOnSearchKeyDown:e=>{"Enter"===e.key&&""!==h&&"onAddItem"in a&&a.onAddItem?(a.onAddItem(h),m("")):"Space"===e.key||"Enter"===e.key?O():"Escape"===e.key?(p.current?.blur(),w()):"ArrowDown"!==e.key&&"ArrowUp"!==e.key||!f.current.at(0)?"Backspace"===e.key&&void 0===y&&"values"in a&&""===h?k(A?.at(-1)):"Backspace"===e.key&&y&&(C(y),k(void 0)):(f.current[0]?.focus(),g.current=0)},handleOnClear:()=>{"value"in a?a.onSelect(void 0):a.onSelect([])},handleOnSearchChange:e=>{" "===e.target.value||u||c||(m(e.target.value),d?.(e.target.value),i||v(!0))},handleToggleOpen:()=>{c||u||(i?w():O())},handleOnClose:w,handleOnOpen:O,handleOnRemoveItem:C,search:h,searchRef:p,itemRefs:f,selectedValues:A,open:i,tryingToRemoveItem:y}};export{a as useSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tokens as a}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";const{colors:r}=a,i={...r,dataviz:{darkblue:{default:"var(--amplify_dataviz_darkblue_default, rgba(0, 71, 153, 1))",darker:"var(--amplify_dataviz_darkblue_darker, rgba(4, 48, 98, 1))",lighter:"var(--amplify_dataviz_darkblue_lighter, rgba(191, 220, 252, 1))"},lightblue:{default:"var(--amplify_dataviz_lightblue_default, rgba(133, 208, 250, 1))",darker:"var(--amplify_dataviz_lightblue_darker, rgba(35, 170, 246, 1))",lighter:"var(--amplify_dataviz_lightblue_lighter, rgba(211, 238, 253, 1))"},lightgreen:{default:"var(--amplify_dataviz_lightgreen_default, rgba(10, 194, 154, 1))",darker:"var(--amplify_dataviz_lightgreen_darker, rgba(8, 145, 115, 1))",lighter:"var(--amplify_dataviz_lightgreen_lighter, rgba(220, 241, 236, 1))"},darkgreen:{default:"var(--amplify_dataviz_darkgreen_default, rgba(0, 102, 76, 1))",darker:"var(--amplify_dataviz_darkgreen_darker, rgba(0, 61, 46, 1))",lighter:"var(--amplify_dataviz_darkgreen_lighter, rgba(200, 237, 227, 1))"},darkpink:{default:"var(--amplify_dataviz_darkpink_default, rgba(169, 30, 88, 1))",darker:"var(--amplify_dataviz_darkpink_darker, rgba(135, 18, 67, 1))",lighter:"var(--amplify_dataviz_darkpink_lighter, rgba(252, 212, 229, 1))"},lightpink:{default:"var(--amplify_dataviz_lightpink_default, rgba(255, 128, 138, 1))",darker:"var(--amplify_dataviz_lightpink_darker, rgba(225, 81, 93, 1))",lighter:"var(--amplify_dataviz_lightpink_lighter, rgba(255, 219, 222, 1))"},darkyellow:{default:"var(--amplify_dataviz_darkyellow_default, rgba(160, 112, 28, 1))",darker:"var(--amplify_dataviz_darkyellow_darker, rgba(121, 85, 21, 1))",lighter:"var(--amplify_dataviz_darkyellow_lighter, rgba(244, 226, 195, 1))"},lightyellow:{default:"var(--amplify_dataviz_lightyellow_default, rgba(253, 203, 53, 1))",darker:"var(--amplify_dataviz_lightyellow_darker, rgba(227, 171, 2, 1))",lighter:"var(--amplify_dataviz_lightyellow_lighter, rgba(255, 240, 194, 1))"},darkpurple:{default:"var(--amplify_dataviz_darkpurple_default, rgba(147, 20, 219, 1))",darker:"var(--amplify_dataviz_darkpurple_darker, rgba(97, 1, 152, 1))",lighter:"var(--amplify_dataviz_darkpurple_lighter, rgba(232, 209, 246, 1))"},lightpurple:{default:"var(--amplify_dataviz_lightpurple_default, rgba(186, 153, 255, 1))",darker:"var(--amplify_dataviz_lightpurple_darker, rgba(155, 89, 242, 1))",lighter:"var(--amplify_dataviz_lightpurple_lighter, rgba(234, 224, 255, 1))"},darkgray:{default:"var(--amplify_dataviz_darkgray_default, rgba(122, 122, 122,1))",darker:"var(--amplify-dataviz_darkgray_darker, rgba(86, 86, 86,1))",lighter:"var(--amplify-dataviz_darkgray_lighter, rgba(173, 173, 173, 1))"},lightgray:{default:"var(--amplify_dataviz_lightgray_default, rgba(144, 155, 162, 1))",darker:"var(--amplify_dataviz_lightgray_darker, rgba(91, 102, 108, 1))",lighter:"var(--amplify_dataviz_lightgray_lighter, rgba(194, 200, 204, 1))"}}},
|
|
1
|
+
import{tokens as a}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";const{colors:r}=a,i={...r,dataviz:{darkblue:{default:"var(--amplify_dataviz_darkblue_default, rgba(0, 71, 153, 1))",darker:"var(--amplify_dataviz_darkblue_darker, rgba(4, 48, 98, 1))",lighter:"var(--amplify_dataviz_darkblue_lighter, rgba(191, 220, 252, 1))"},lightblue:{default:"var(--amplify_dataviz_lightblue_default, rgba(133, 208, 250, 1))",darker:"var(--amplify_dataviz_lightblue_darker, rgba(35, 170, 246, 1))",lighter:"var(--amplify_dataviz_lightblue_lighter, rgba(211, 238, 253, 1))"},lightgreen:{default:"var(--amplify_dataviz_lightgreen_default, rgba(10, 194, 154, 1))",darker:"var(--amplify_dataviz_lightgreen_darker, rgba(8, 145, 115, 1))",lighter:"var(--amplify_dataviz_lightgreen_lighter, rgba(220, 241, 236, 1))"},darkgreen:{default:"var(--amplify_dataviz_darkgreen_default, rgba(0, 102, 76, 1))",darker:"var(--amplify_dataviz_darkgreen_darker, rgba(0, 61, 46, 1))",lighter:"var(--amplify_dataviz_darkgreen_lighter, rgba(200, 237, 227, 1))"},darkpink:{default:"var(--amplify_dataviz_darkpink_default, rgba(169, 30, 88, 1))",darker:"var(--amplify_dataviz_darkpink_darker, rgba(135, 18, 67, 1))",lighter:"var(--amplify_dataviz_darkpink_lighter, rgba(252, 212, 229, 1))"},lightpink:{default:"var(--amplify_dataviz_lightpink_default, rgba(255, 128, 138, 1))",darker:"var(--amplify_dataviz_lightpink_darker, rgba(225, 81, 93, 1))",lighter:"var(--amplify_dataviz_lightpink_lighter, rgba(255, 219, 222, 1))"},darkyellow:{default:"var(--amplify_dataviz_darkyellow_default, rgba(160, 112, 28, 1))",darker:"var(--amplify_dataviz_darkyellow_darker, rgba(121, 85, 21, 1))",lighter:"var(--amplify_dataviz_darkyellow_lighter, rgba(244, 226, 195, 1))"},lightyellow:{default:"var(--amplify_dataviz_lightyellow_default, rgba(253, 203, 53, 1))",darker:"var(--amplify_dataviz_lightyellow_darker, rgba(227, 171, 2, 1))",lighter:"var(--amplify_dataviz_lightyellow_lighter, rgba(255, 240, 194, 1))"},darkpurple:{default:"var(--amplify_dataviz_darkpurple_default, rgba(147, 20, 219, 1))",darker:"var(--amplify_dataviz_darkpurple_darker, rgba(97, 1, 152, 1))",lighter:"var(--amplify_dataviz_darkpurple_lighter, rgba(232, 209, 246, 1))"},lightpurple:{default:"var(--amplify_dataviz_lightpurple_default, rgba(186, 153, 255, 1))",darker:"var(--amplify_dataviz_lightpurple_darker, rgba(155, 89, 242, 1))",lighter:"var(--amplify_dataviz_lightpurple_lighter, rgba(234, 224, 255, 1))"},darkgray:{default:"var(--amplify_dataviz_darkgray_default, rgba(122, 122, 122,1))",darker:"var(--amplify-dataviz_darkgray_darker, rgba(86, 86, 86,1))",lighter:"var(--amplify-dataviz_darkgray_lighter, rgba(173, 173, 173, 1))"},lightgray:{default:"var(--amplify_dataviz_lightgray_default, rgba(144, 155, 162, 1))",darker:"var(--amplify_dataviz_lightgray_darker, rgba(91, 102, 108, 1))",lighter:"var(--amplify_dataviz_lightgray_lighter, rgba(194, 200, 204, 1))"}}},e={warning:i.interactive.warning__resting.rgba,error:i.interactive.danger__resting.rgba,success:i.interactive.success__resting.rgba,dirty:i.infographic.substitute__blue_ocean.rgba},l={warning:i.interactive.warning__hover.rgba,error:i.interactive.danger__hover.rgba,success:i.interactive.success__hover.rgba,dirty:i.infographic.substitute__blue_ocean.rgba};export{e as VARIANT_COLORS,l as VARIANT_HELPER_COLORS,i as colors};
|
|
@@ -2,7 +2,6 @@ import { FC } from 'react';
|
|
|
2
2
|
import { MultiSelectMenuItemProps, SelectOptionRequired } from './Select.types';
|
|
3
3
|
interface AddTagItemProps {
|
|
4
4
|
itemRefs: MultiSelectMenuItemProps<SelectOptionRequired>['itemRefs'];
|
|
5
|
-
onMouseEnterItem: MultiSelectMenuItemProps<SelectOptionRequired>['onMouseEnterItem'];
|
|
6
5
|
onItemKeyDown: MultiSelectMenuItemProps<SelectOptionRequired>['onItemKeyDown'];
|
|
7
6
|
onAddItem: () => void;
|
|
8
7
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Icon as o}from"@equinor/eds-core-react";import{add_box as t}from"@equinor/eds-icons";import{colors as n}from"../../atoms/style/colors.js";import{MenuItemWrapper as i,StyledMenuItem as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Icon as o}from"@equinor/eds-core-react";import{add_box as t}from"@equinor/eds-icons";import{colors as n}from"../../atoms/style/colors.js";import{MenuItemWrapper as i,StyledMenuItem as m}from"./Select.styles.js";const s=({itemRefs:s,onItemKeyDown:c,index:a,onAddItem:d,children:l})=>e(i,{children:r(m,{index:a,ref:e=>{s.current[a]=e},onClick:d,onKeyDownCapture:e=>{e.preventDefault(),"Enter"===e.key?d():c(e)},children:[e(o,{data:t,color:n.interactive.primary__resting.rgba}),r("span",{children:['Add "',l,'" as new tag']})]})});export{s as AddTagItem};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { CommonSelectProps, GroupedSelectProps, ListSelectProps, MultiSelectCommon, SelectOptionRequired } from '../Select.types';
|
|
2
2
|
export type ComboBoxProps<T extends SelectOptionRequired> = CommonSelectProps & MultiSelectCommon<T> & (GroupedSelectProps<T> | ListSelectProps<T>);
|
|
3
|
+
/**
|
|
4
|
+
* @param clearable - If users should be able to clear the input, defaults to true
|
|
5
|
+
* @param loading - Show loader, defaults to false
|
|
6
|
+
* @param lightBackground - If the input should have white background, defaults to false
|
|
7
|
+
* @param sortValues - Sort the provided values, defaults to true
|
|
8
|
+
* @param inDialog - Fixes weird issue that EDS menus has when it's used in dialogs, defaults to false
|
|
9
|
+
* @param showHelperIcon - Show helper variant icon, defaults to true
|
|
10
|
+
* @param syncParentChildSelection - Syncs parents/child selections, default is true
|
|
11
|
+
*/
|
|
3
12
|
export declare function ComboBox<T extends SelectOptionRequired>(props: ComboBoxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{Menu as i}from"@equinor/eds-core-react";import{NoItemsFoundText as m}from"./Select.styles.js";import{getCumulativeArrayFromNumberedArray as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{Menu as i}from"@equinor/eds-core-react";import{NoItemsFoundText as m}from"./Select.styles.js";import{getCumulativeArrayFromNumberedArray as l}from"./Select.utils.js";import{SelectMenuItem as n}from"./SelectMenuItem.js";const r=r=>{const{onItemSelect:o,onItemKeyDown:s,itemRefs:c,groups:a,search:f}=r,u=t((()=>{if(""===f)return a;const e=new RegExp(f,"i");return a.map((t=>({title:t.title,items:t.items.filter((t=>t.label.match(e)))}))).filter((e=>e.items.length>0))}),[a,f]),p=t((()=>{const e=u.map((e=>e.items.length));return l(e)}),[u]);return 0===u.length?e(m,{children:"No items found"}):"values"in r?u.map(((t,m)=>e(i.Section,{index:m,title:t.title,children:t.items.map(((i,l)=>e(n,{index:l+p[m],childOffset:0,item:i,multiselect:!0,itemRefs:c,onItemKeyDown:s,onItemSelect:o,values:r.values},`${t.title}-${m}-item-${i.value}`)))},`${t.title}-${m}`))):u.map(((t,m)=>e(i.Section,{index:m,title:t.title,children:t.items.map(((i,l)=>e(n,{index:l+p[m],childOffset:0,item:i,itemRefs:c,onItemKeyDown:s,onItemSelect:o},`${t.title}-${m}-item-${i.value}`)))},`${t.title}-${m}`)))};export{r as GroupedSelectMenu};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ListSelectProps, MultiSelectCommon, SelectMenuProps, SelectOptionRequired, SingleSelectCommon } from './Select.types';
|
|
2
|
-
export declare const ListSelectMenu: <T extends SelectOptionRequired>(props: ListSelectProps<T> & SelectMenuProps<T> & (Omit<MultiSelectCommon<T>, "onAddItem"> | SingleSelectCommon<T>)) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
|
|
2
|
+
export declare const ListSelectMenu: <T extends SelectOptionRequired>(props: ListSelectProps<T> & SelectMenuProps<T> & (Omit<MultiSelectCommon<T>, "onAddItem" | "syncParentChildSelection"> | SingleSelectCommon<T>)) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as m}from"react";import{Menu as
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as m}from"react";import{Menu as i}from"@equinor/eds-core-react";import{AddTagItem as o}from"./AddTagItem.js";import{NoItemsFoundText as r,NoTagFoundText as l}from"./Select.styles.js";import{flattenOptions as s,getChildOffset as d}from"./Select.utils.js";import{SelectMenuItem as a}from"./SelectMenuItem.js";const c=c=>{const{search:u,items:f,onItemSelect:h,itemRefs:p,onItemKeyDown:I}=c,x=m((()=>{if(""===u)return f;const e=new RegExp(u,"i");return s(f).map((({value:e,label:t})=>({value:e,label:t}))).filter((t=>t.label.match(e)))}),[f,u]);if(0===x.length&&!c.onAddItem)return e(r,{children:"No items found"});const g=x.some((e=>e.children&&e.children.length>0));if("values"in c){const m=x.map(((e,t)=>({childOffset:d(x,t),index:t,item:e,itemRefs:p,onItemKeyDown:I,onItemSelect:h,itemValue:e.value,values:c.values,parentHasNestedItems:g})));return"onAddItem"in c&&c.onAddItem&&""!==u?t(n,{children:[e(i.Section,{title:"Add tag",index:0,children:e(o,{index:0,itemRefs:p,onItemKeyDown:I,onAddItem:c.onAddItem,children:u})}),e(i.Section,{title:"Tag search results",index:1,children:m.length>0?m.map(((t,n)=>e(a,{multiselect:!0,...t,index:n+1},`menu-item-${n}-${t.itemValue}`))):t(l,{children:['No tag for "',u,'" found.']})})]}):m.map(((t,n)=>e(a,{multiselect:!0,...t},`menu-item-${n}-${t.itemValue}`)))}return x.map(((t,n)=>e(a,{childOffset:d(x,n),index:n,item:t,itemRefs:p,onItemKeyDown:I,onItemSelect:h,parentHasNestedItems:g},`menu-item-${n}-${t.value}`)))};export{c as ListSelectMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRef as n,useMemo as o}from"react";import{Label as r,CircularProgress as l,Icon as a}from"@equinor/eds-core-react";import{thumbs_up as i,warning_filled as c,error_filled as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRef as n,useMemo as o}from"react";import{Label as r,CircularProgress as l,Icon as a}from"@equinor/eds-core-react";import{thumbs_up as i,warning_filled as c,error_filled as d,arrow_drop_up as s,arrow_drop_down as m,clear as h}from"@equinor/eds-icons";import{tokens as u}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{useSelect as p}from"../../atoms/hooks/useSelect.js";import{GroupedSelectMenu as g}from"./GroupedSelectMenu.js";import{ListSelectMenu as b}from"./ListSelectMenu.js";import{ValueText as f,StyledChip as v,Wrapper as x,Container as y,Section as I,PlaceholderText as O,ClearButton as k,HelperWrapper as C,StyledMenu as S}from"./Select.styles.js";import{useOutsideClick as w}from"../../node_modules/@equinor/eds-utils/dist/esm/hooks/useOutsideClick.js";const{colors:$}=u,j=u=>{const{clearable:j=!0,loading:D=!1,disabled:R=!1,lightBackground:B=!1,underlineHighlight:K=!1,sortValues:_=!0,placeholder:q="Select...",label:T,helperText:z,showHelperIcon:A=!0,meta:H,id:V=`amplify-combobox-${T}`,variant:W,inDialog:F=!1}=u,{handleOnAddItem:M,handleOnClear:E,handleOnItemKeyDown:G,handleOnItemSelect:L,handleOnSearchChange:N,handleOnSearchKeyDown:J,handleToggleOpen:P,itemRefs:Q,search:U,selectedValues:X,handleOnClose:Y,handleOnOpen:Z,handleOnRemoveItem:ee,open:te,searchRef:ne,tryingToRemoveItem:oe}=p({...u,clearable:j,loading:D,disabled:R,lightBackground:B,underlineHighlight:K,sortValues:_,placeholder:q}),re=n(null),le=n(null),ae=o((()=>!!T||!!H),[T,H]),ie=o((()=>!!z),[z]),ce=o((()=>{if(A)switch(W){case"error":return d;case"warning":return c;case"success":return i}}),[A,W]);w(le.current,(e=>{F&&te&&e.target&&re.current&&le.current&&!re.current.contains(e.target)&&!le.current?.contains(e.target)&&Y()}));const de=o((()=>"value"in u&&u.value?e(f,{children:u.value.label}):X.map((t=>e(v,{"data-testid":"amplify-combobox-chip",className:"amplify-combo-box-chip",onDelete:()=>ee(t),$tryingToRemove:oe?.value===t.value,$lightBackground:B,children:t.label},t.value)))),[X,oe,B,u,ee]);return t("div",{children:[ae&&e(r,{label:T,meta:H,htmlFor:V}),t(x,{children:[t(y,{"data-testid":"combobox-container",ref:re,onClick:Z,"aria-expanded":te,$variant:W,$lightBackground:B,children:[t(I,{children:[""===U&&0===X.length&&e(O,{children:q}),(""===U||"values"in u&&X.length>0)&&de,e("input",{id:V,disabled:R||D,ref:ne,type:"search",role:"combobox",value:U,autoComplete:"off",onChange:N,onKeyDownCapture:J})]}),D?e(l,{size:16}):e(a,{onClick:P,data:te?s:m,color:$.interactive.primary__resting.rgba}),j&&X.length>0&&!D&&e(k,{id:"clear",variant:"ghost_icon",onClick:E,"data-testid":"clearBtn",children:e(a,{data:h,size:18})})]}),ie&&t(C,{$variant:W,children:[ce&&e(a,{data:ce,size:16}),e(r,{label:z,htmlFor:V})]})]}),te&&e(S,{ref:le,open:!0,id:"combobox-menu",anchorEl:re.current,onClose:Y,placement:"bottom",style:{width:`${re.current?.clientWidth}px`,maxWidth:`${re.current?.clientWidth}px`},children:u.groups?e(g,{...u,search:U,itemRefs:Q,onItemSelect:L,onItemKeyDown:G}):e(b,{...u,search:U,itemRefs:Q,onAddItem:"values"in u&&u.onAddItem?M:void 0,onItemSelect:L,onItemKeyDown:G})})]})};export{j as Select};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";export{Button}from"@equinor/eds-core-react";import{
|
|
1
|
+
import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";export{Button}from"@equinor/eds-core-react";import{VARIANT_HELPER_COLORS as a,colors as i,VARIANT_COLORS as o}from"../../atoms/style/colors.js";import{spacings as n}from"../../atoms/style/spacings.js";import{Chip as s}from"../Chip/Chip.js";import l,{css as d}from"styled-components";const c=l.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
gap: ${
|
|
5
|
-
`,
|
|
4
|
+
gap: ${n.small};
|
|
5
|
+
`,p=l.span`
|
|
6
6
|
display: flex;
|
|
7
|
-
gap: ${
|
|
7
|
+
gap: ${n.small};
|
|
8
8
|
align-items: center;
|
|
9
|
-
margin-left: ${
|
|
10
|
-
width: calc(100% - ${
|
|
9
|
+
margin-left: ${n.small};
|
|
10
|
+
width: calc(100% - ${n.small});
|
|
11
11
|
> label {
|
|
12
12
|
margin: 0;
|
|
13
13
|
}
|
|
14
|
-
${({$variant:t})=>t?
|
|
14
|
+
${({$variant:t})=>t?d`
|
|
15
|
+
> label {
|
|
16
|
+
color: ${a[t]};
|
|
17
|
+
}
|
|
15
18
|
> svg {
|
|
16
19
|
flex-shrink: 0;
|
|
17
20
|
fill: ${a[t]};
|
|
18
21
|
}
|
|
19
22
|
`:""}
|
|
20
|
-
`,
|
|
23
|
+
`,g=l.div`
|
|
21
24
|
position: relative;
|
|
22
25
|
display: grid;
|
|
23
26
|
grid-template-columns: 1fr auto;
|
|
@@ -27,17 +30,17 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
27
30
|
cursor: pointer;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
${({$variant:t})=>t?"dirty"===t?
|
|
31
|
-
box-shadow: inset 0 -2px 0 0 ${
|
|
33
|
+
${({$variant:t})=>t?"dirty"===t?d`
|
|
34
|
+
box-shadow: inset 0 -2px 0 0 ${o[t]};
|
|
32
35
|
&:hover {
|
|
33
|
-
box-shadow: inset 0 -2px 0 0 ${
|
|
36
|
+
box-shadow: inset 0 -2px 0 0 ${o[t]};
|
|
34
37
|
}
|
|
35
|
-
`:
|
|
36
|
-
outline: 1px solid ${
|
|
38
|
+
`:d`
|
|
39
|
+
outline: 1px solid ${o[t]};
|
|
37
40
|
&:hover {
|
|
38
|
-
box-shadow: inset 0 -1px 0 0 ${
|
|
41
|
+
box-shadow: inset 0 -1px 0 0 ${o[t]};
|
|
39
42
|
}
|
|
40
|
-
`:
|
|
43
|
+
`:d`
|
|
41
44
|
box-shadow: inset 0 -1px 0 0 ${i.text.static_icons__tertiary.rgba};
|
|
42
45
|
&:hover {
|
|
43
46
|
box-shadow: inset 0 -2px 0 0 ${i.text.static_icons__tertiary.rgba};
|
|
@@ -85,11 +88,11 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
85
88
|
width: calc(100% - 24px);
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
`,
|
|
91
|
+
`,b=l.section`
|
|
89
92
|
position: relative;
|
|
90
93
|
display: flex;
|
|
91
94
|
flex-wrap: wrap;
|
|
92
|
-
gap: ${
|
|
95
|
+
gap: ${n.x_small};
|
|
93
96
|
min-height: 24px;
|
|
94
97
|
input[type='search'] {
|
|
95
98
|
background: transparent;
|
|
@@ -127,7 +130,7 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
`,
|
|
133
|
+
`,h=l(t)`
|
|
131
134
|
position: absolute;
|
|
132
135
|
top: 50%;
|
|
133
136
|
transform: translate(0, -50%);
|
|
@@ -142,9 +145,9 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
142
145
|
height: 24px;
|
|
143
146
|
left: 0;
|
|
144
147
|
}
|
|
145
|
-
`,u=s
|
|
148
|
+
`,u=l(s)`
|
|
146
149
|
background: ${({$tryingToRemove:t,$lightBackground:e})=>t?i.interactive.primary__hover_alt.rgba:e?i.ui.background__light.rgba:i.ui.background__default.rgba} !important;
|
|
147
|
-
`,
|
|
150
|
+
`,x=l(e.Item)`
|
|
148
151
|
flex-grow: 1;
|
|
149
152
|
border-radius: 2px;
|
|
150
153
|
${({$paddedLeft:t})=>t&&"margin-left: 36px"};
|
|
@@ -156,37 +159,32 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
&:hover {
|
|
159
|
-
background: none;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
&:focus {
|
|
163
|
-
outline: none;
|
|
164
162
|
background: ${i.interactive.primary__hover_alt.rgba};
|
|
165
163
|
}
|
|
166
164
|
|
|
167
165
|
&:focus-visible {
|
|
168
|
-
|
|
166
|
+
outline: 2px dashed ${i.interactive.primary__resting.rgba};
|
|
169
167
|
}
|
|
170
|
-
`,
|
|
171
|
-
height: calc(100% + ${
|
|
168
|
+
`,m=l.hr`
|
|
169
|
+
height: calc(100% + ${n.medium} * 2);
|
|
172
170
|
justify-self: center;
|
|
173
|
-
width: ${
|
|
174
|
-
`,
|
|
171
|
+
width: ${n.x_large};
|
|
172
|
+
`,_=l(r)`
|
|
175
173
|
position: absolute;
|
|
176
174
|
color: ${i.text.static_icons__tertiary.rgba};
|
|
177
175
|
top: calc(50%);
|
|
178
176
|
transform: translate(0, -50%);
|
|
179
|
-
`,
|
|
177
|
+
`,f=l(_)`
|
|
180
178
|
white-space: nowrap;
|
|
181
179
|
overflow: hidden;
|
|
182
180
|
text-overflow: ellipsis;
|
|
183
181
|
color: ${i.text.static_icons__default.rgba};
|
|
184
182
|
max-width: 100%;
|
|
185
|
-
|
|
186
|
-
margin: ${
|
|
187
|
-
`,v=
|
|
188
|
-
margin-left: ${
|
|
189
|
-
|
|
183
|
+
`,$=l(r)`
|
|
184
|
+
margin: ${n.medium};
|
|
185
|
+
`,v=l(r)`
|
|
186
|
+
margin-left: ${n.medium};
|
|
187
|
+
`,w=l(e)`
|
|
190
188
|
max-height: 20rem;
|
|
191
189
|
max-width: inherit;
|
|
192
190
|
overflow-y: auto;
|
|
@@ -194,11 +192,11 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
194
192
|
width: inherit;
|
|
195
193
|
max-width: inherit;
|
|
196
194
|
}
|
|
197
|
-
`,
|
|
195
|
+
`,y=l.div`
|
|
198
196
|
display: flex;
|
|
199
197
|
align-items: center;
|
|
200
|
-
padding: 0 ${
|
|
201
|
-
`,
|
|
198
|
+
padding: 0 ${n.small};
|
|
199
|
+
`,k=l(t)`
|
|
202
200
|
width: 36px;
|
|
203
201
|
height: 36px;
|
|
204
|
-
`;export{
|
|
202
|
+
`;export{h as ClearButton,g as Container,p as HelperWrapper,m as MenuItemSpacer,y as MenuItemWrapper,v as NoItemsFoundText,$ as NoTagFoundText,_ as PlaceholderText,b as Section,k as SmallButton,u as StyledChip,w as StyledMenu,x as StyledMenuItem,f as ValueText,c as Wrapper};
|
|
@@ -14,7 +14,7 @@ export interface SingleSelectCommon<T extends SelectOptionRequired> {
|
|
|
14
14
|
export interface MultiSelectCommon<T extends SelectOptionRequired> {
|
|
15
15
|
values: SelectOption<T>[];
|
|
16
16
|
onSelect: (values: SelectOption<T>[], selectedValue?: SelectOption<T>) => void;
|
|
17
|
-
|
|
17
|
+
syncParentChildSelection?: boolean;
|
|
18
18
|
onAddItem?: (item: string) => void;
|
|
19
19
|
}
|
|
20
20
|
export interface GroupedSelectProps<T extends SelectOptionRequired> {
|
|
@@ -34,8 +34,6 @@ export interface SelectMenuProps<T extends SelectOptionRequired> {
|
|
|
34
34
|
itemRefs: MutableRefObject<(HTMLButtonElement | null)[]>;
|
|
35
35
|
onItemKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
|
|
36
36
|
onItemSelect: (item: SelectOption<T>) => void;
|
|
37
|
-
onMouseEnterItem: (index: number) => void;
|
|
38
|
-
selectableParent?: boolean;
|
|
39
37
|
}
|
|
40
38
|
interface SelectMenuItemProps<T extends SelectOptionRequired> {
|
|
41
39
|
item: SelectOption<T>;
|
|
@@ -60,6 +58,7 @@ export interface CommonSelectProps {
|
|
|
60
58
|
variant?: Variants;
|
|
61
59
|
label?: string;
|
|
62
60
|
helperText?: string;
|
|
61
|
+
showHelperIcon?: boolean;
|
|
63
62
|
placeholder?: string;
|
|
64
63
|
sortValues?: boolean;
|
|
65
64
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as n}from"react/jsx-runtime";import{useState as t,useRef as
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as n}from"react/jsx-runtime";import{useState as t,useRef as i,useMemo as c}from"react";import{Icon as o}from"@equinor/eds-core-react";import{checkbox_outline as l,checkbox as a,checkbox_indeterminate as u,chevron_down as s,chevron_right as d}from"@equinor/eds-icons";import{tokens as m}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{MenuItemSpacer as p,MenuItemWrapper as h,SmallButton as f,StyledMenuItem as v}from"./Select.styles.js";import{getChildOffset as y,flattenOptions as w}from"./Select.utils.js";const{colors:g}=m,k=m=>{const{index:b,childOffset:x,depth:C=0,item:A,multiselect:D,itemRefs:$,onItemKeyDown:_,onItemSelect:I,parentHasNestedItems:K=!1}=m,[j,O]=t(!1),S=i(-1),q=i([]),R=("values"in m?m.values.map((({value:e})=>e)):[]).includes(A.value),H=c((()=>{if(!D||!A.children||0===A.children.length)return l;if(R)return a;if([A,...A.children].some((e=>m.values.find((r=>r.value===e.value)))))return u;const e=m.values.map((({value:e})=>e)),r=w([A])?.map((({value:e})=>e));return r.some((r=>e.includes(r)))?u:l}),[A,D,m,R]),L=c((()=>new Array(C).fill(0).map(((r,n)=>e(p,{},`spacer-${r+n}`)))),[C]),M=()=>{I(A)},N=e=>{e.stopPropagation(),O((e=>!e))},U=e=>{"ArrowDown"===e.key?S.current+=1:"ArrowUp"===e.key&&(S.current-=1),S.current<=-1?($.current[b]?.focus(),S.current=-1):S.current+x===q.current.length?(S.current=-1,_(e),O(!1)):S.current>=0&&S.current<q.current.length-x&&q.current[S.current+x]?.focus()},P=e=>{!j&&"ArrowDown"===e.key||"ArrowUp"===e.key?_(e):"ArrowRight"===e.key||"ArrowLeft"===e.key?O((e=>!e)):j&&"ArrowDown"===e.key&&-1===S.current&&(S.current=0,q.current[S.current+x]?.focus())};return A.children&&A.children.length>0&&D?r(n,{children:[r(h,{children:[L,e(f,{variant:"ghost_icon",onClick:N,"data-testid":"toggle-button",children:e(o,{color:g.interactive.primary__resting.rgba,data:j?s:d})}),r(v,{$depth:C,ref:e=>{$.current[b]=e},index:b,closeMenuOnClick:!1,onKeyDownCapture:P,onClick:M,children:[e(o,{color:g.interactive.primary__resting.rgba,data:H}),e("span",{children:A.label})]})]}),j&&A.children.map(((r,n)=>e(k,{index:x+n,childOffset:x+y(A.children,n),depth:C+1,multiselect:!0,item:r,itemRefs:q,values:m.values,onItemKeyDown:U,onItemSelect:I,parentHasNestedItems:!0},`child-${n}-${r.value}-${A.value}`)))]}):D?r(h,{children:[L,r(v,{$depth:C,$paddedLeft:K,ref:e=>{$.current[b]=e},index:b,tabIndex:C,closeMenuOnClick:!1,onKeyDownCapture:_,onClick:M,children:[e(o,{color:g.interactive.primary__resting.rgba,data:R?a:l}),e("span",{children:A.label})]})]}):e(h,{children:e(v,{$depth:C,ref:e=>{$.current[b]=e},index:b,onKeyDownCapture:_,onClick:M,children:e("span",{children:A.label})})})};export{k as SelectMenuItem};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { CommonSelectProps, GroupedSelectProps, ListSelectProps, SelectOptionRequired, SingleSelectCommon } from '../Select.types';
|
|
2
2
|
export type SingleSelectProps<T extends SelectOptionRequired> = CommonSelectProps & SingleSelectCommon<T> & (GroupedSelectProps<T> | ListSelectProps<T>);
|
|
3
|
+
/**
|
|
4
|
+
* @param clearable - If users should be able to clear the input, defaults to true
|
|
5
|
+
* @param loading - Show loader, defaults to false
|
|
6
|
+
* @param lightBackground - If the input should have white background, defaults to false
|
|
7
|
+
* @param sortValues - Sort the provided values, defaults to true
|
|
8
|
+
* @param inDialog - Fixes weird issue that EDS menus has when it's used in dialogs, defaults to false
|
|
9
|
+
* @param showHelperIcon - Show helper variant icon, defaults to true
|
|
10
|
+
*/
|
|
3
11
|
export declare function SingleSelect<T extends SelectOptionRequired>(props: SingleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{TextField as i}from"@equinor/eds-core-react";import{colors as e,VARIANT_COLORS as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{TextField as i}from"@equinor/eds-core-react";import{colors as e,VARIANT_COLORS as o}from"../../atoms/style/colors.js";import r,{css as a}from"styled-components";const n=r.div`
|
|
2
2
|
input,
|
|
3
3
|
textarea {
|
|
4
4
|
color: ${e.text.static_icons__default.rgba};
|
|
5
|
+
&::placeholder {
|
|
6
|
+
opacity: 1;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
div:focus-within {
|
|
7
10
|
outline: none !important;
|
|
@@ -30,13 +33,13 @@ import{jsx as t}from"react/jsx-runtime";import{TextField as i}from"@equinor/eds-
|
|
|
30
33
|
${"dirty"===t&&a`
|
|
31
34
|
input,
|
|
32
35
|
textarea {
|
|
33
|
-
box-shadow: inset 0 -2px 0 0 ${
|
|
36
|
+
box-shadow: inset 0 -2px 0 0 ${o[t]};
|
|
34
37
|
}
|
|
35
38
|
`}
|
|
36
39
|
|
|
37
40
|
input:hover,
|
|
38
41
|
textarea:hover {
|
|
39
|
-
box-shadow: inset 0 -${"dirty"===t?2:1}px 0 0 ${
|
|
42
|
+
box-shadow: inset 0 -${"dirty"===t?2:1}px 0 0 ${o[t]};
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
div:focus-within {
|
|
@@ -44,8 +47,8 @@ import{jsx as t}from"react/jsx-runtime";import{TextField as i}from"@equinor/eds-
|
|
|
44
47
|
|
|
45
48
|
input,
|
|
46
49
|
textarea {
|
|
47
|
-
box-shadow: inset 0 -2px 0 0 ${
|
|
50
|
+
box-shadow: inset 0 -2px 0 0 ${o[t]};
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
`}
|
|
51
|
-
`,s=e=>{const
|
|
54
|
+
`,s=e=>{const o={...e,variant:"dirty"!==e.variant?e.variant:void 0};return t(n,{$variant:e.variant,$disabled:e.disabled,children:t(i,{...o})})};export{s as TextField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../atoms/style/colors.js";import{spacings as o}from"../../atoms/style/spacings.js";const
|
|
1
|
+
import"../../atoms/style/colors.js";import{spacings as o}from"../../atoms/style/spacings.js";const r={buttons:"39px",border:"34px",borderHorizontal:"34px"},t={buttons:o.x_small,border:"0",borderHorizontal:"0"};export{t as GAP,r as HEIGHT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{TableOfContentsContainer as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{TableOfContentsContainer as n,BorderItemsContainer as r,BorderItemsHorizontalContainer as a}from"./TableOfContents.styles.js";import{TableOfContentsItem as o}from"./TableOfContentsItem.js";import{useTableOfContents as i}from"../../providers/TableOfContentsProvider.js";import{getValues as l}from"../../providers/TableOfContentsProvider.utils.js";const s=({variant:s="buttons",onlyShowSelectedChildren:d=!0,isLink:c=!1})=>{const{items:m,selected:u}=i(),v=t((()=>{for(const[e,t]of m.entries()){const n=l([],t);if(t.value===u||u&&n.includes(u))return e}return-1}),[m,u]);return e(n,"border"===s?{className:"page-menu",$variant:s,layoutRoot:!0,"data-testid":"table-of-contents-container",children:m.map(((t,n)=>e(r,{"data-testid":`border-items-container-${t.value}`,$index:n,$activeIndex:v,"aria-selected":v===n,children:e(o,{variant:s,...t,onlyShowSelectedChildren:d,isLink:c})},t.value)))}:"borderHorizontal"===s?{className:"page-menu",$variant:s,layoutRoot:!0,"data-testid":"table-of-contents-container",children:m.map(((t,n)=>e(a,{$index:n,$activeIndex:v,"aria-selected":v===n,children:e(o,{variant:s,...t,onlyShowSelectedChildren:d,isLink:c})},t.value)))}:{className:"page-menu",$variant:s,layoutRoot:!0,children:m.map((t=>e(o,{variant:s,...t,onlyShowSelectedChildren:d,isLink:c},t.value)))})};export{s as TableOfContents};
|
|
@@ -10,6 +10,11 @@ interface LinkProps extends ButtonProps {
|
|
|
10
10
|
export declare const Link: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, "ref"> & {
|
|
11
11
|
ref?: ((instance: HTMLAnchorElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
|
|
12
12
|
}, LinkProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, keyof import("react").Component<any, {}, any>>;
|
|
13
|
+
interface BorderItemsHorizontalContainerProps {
|
|
14
|
+
$activeIndex: number;
|
|
15
|
+
$index: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const BorderItemsHorizontalContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, BorderItemsHorizontalContainerProps>> & string;
|
|
13
18
|
interface BorderItemsContainerProps {
|
|
14
19
|
$activeIndex: number;
|
|
15
20
|
$index: number;
|
|
@@ -110,6 +110,20 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
110
110
|
}
|
|
111
111
|
`}}}
|
|
112
112
|
`,u=a.div`
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction:;
|
|
115
|
+
position: relative;
|
|
116
|
+
&:after {
|
|
117
|
+
position: absolute;
|
|
118
|
+
left: 0;
|
|
119
|
+
bottom: ${({$activeIndex:t,$index:e})=>100*(t-e)+"%"};
|
|
120
|
+
content: '';
|
|
121
|
+
width: 100%;
|
|
122
|
+
height: 2px;
|
|
123
|
+
background: ${s.interactive.primary__resting.rgba};
|
|
124
|
+
z-index: 100;
|
|
125
|
+
}
|
|
126
|
+
`,f=a.div`
|
|
113
127
|
display: flex;
|
|
114
128
|
flex-direction: column;
|
|
115
129
|
position: relative;
|
|
@@ -123,7 +137,7 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
123
137
|
background: ${s.interactive.primary__resting.rgba};
|
|
124
138
|
z-index: 100;
|
|
125
139
|
}
|
|
126
|
-
`,
|
|
140
|
+
`,p=a(r.div)`
|
|
127
141
|
display: flex;
|
|
128
142
|
flex-direction: column;
|
|
129
143
|
position: relative;
|
|
@@ -131,9 +145,9 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
131
145
|
min-height: ${o[t]};
|
|
132
146
|
${"buttons"===t&&`gap: ${i.x_small};`}
|
|
133
147
|
`}
|
|
134
|
-
`,
|
|
148
|
+
`,g=a(r.div)`
|
|
135
149
|
display: flex;
|
|
136
|
-
flex-direction: column;
|
|
150
|
+
flex-direction: ${({$variant:t})=>"borderHorizontal"===t?"row":"column"};
|
|
137
151
|
height: fit-content;
|
|
138
152
|
overflow: hidden;
|
|
139
153
|
${({$variant:t})=>{switch(t){case"buttons":return`gap: ${i.small};`;case"border":return n`
|
|
@@ -145,8 +159,19 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
145
159
|
height: 100%;
|
|
146
160
|
background: ${s.ui.background__medium.rgba};
|
|
147
161
|
}
|
|
162
|
+
`;case"borderHorizontal":return n`
|
|
163
|
+
&:after {
|
|
164
|
+
position: absolute;
|
|
165
|
+
left: 0;
|
|
166
|
+
bottom: 0;
|
|
167
|
+
content: '';
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: 2px;
|
|
170
|
+
background: ${s.ui.background__medium.rgba};
|
|
171
|
+
}
|
|
148
172
|
`}}}
|
|
149
|
-
|
|
173
|
+
data-testid="table-of-contents-container"
|
|
174
|
+
`,b=a(r.div)`
|
|
150
175
|
display: flex;
|
|
151
176
|
flex-direction: column;
|
|
152
177
|
${({$shouldShowChildren:t})=>t?null:n`
|
|
@@ -162,4 +187,4 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
162
187
|
}
|
|
163
188
|
|
|
164
189
|
${({$variant:t})=>"buttons"===t&&`gap:${i.x_small};`}
|
|
165
|
-
`;export{
|
|
190
|
+
`;export{f as BorderItemsContainer,u as BorderItemsHorizontalContainer,d as Button,b as ChildContainer,c as Link,g as TableOfContentsContainer,p as TableOfContentsItemContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TableOfContentsVariants = 'buttons' | 'border';
|
|
1
|
+
export type TableOfContentsVariants = 'buttons' | 'border' | 'borderHorizontal';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{tokens as o}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import"../../atoms/style/colors.js";import{spacings as i}from"../../atoms/style/spacings.js";import{darkTokens as
|
|
1
|
+
import{tokens as o}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import"../../atoms/style/colors.js";import{spacings as i}from"../../atoms/style/spacings.js";import{darkTokens as t}from"../../atoms/style/darkTokens.js";import{lightTokens as e}from"../../atoms/style/lightTokens.js";import{spacingTokens as n}from"../../atoms/style/spacingTokens.js";import s,{createGlobalStyle as a}from"styled-components";const{colors:r}=o,d=s.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
min-height: 100vh;
|
|
@@ -12,18 +12,19 @@ import{tokens as o}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
|
|
|
12
12
|
min-height: calc(100vh - 64px);
|
|
13
13
|
max-height: calc(100vh - 64px);
|
|
14
14
|
overflow: auto;
|
|
15
|
-
/* 231px and 64px is width of Sidebar when open/closed
|
|
16
|
-
min-width: calc(
|
|
17
|
-
100% - ${o=>o.$open?"232px":"65px"} -
|
|
18
|
-
${i.xxx_large} * 2
|
|
19
|
-
);
|
|
15
|
+
/* 231px and 64px is width of Sidebar when open/closed */
|
|
16
|
+
min-width: calc(100% - ${o=>o.$open?"231px":"64px"});
|
|
20
17
|
&:not(:has(.select-field)) {
|
|
21
18
|
padding: 0 ${i.xxx_large};
|
|
22
19
|
}
|
|
23
20
|
`,c=a`
|
|
24
|
-
${e}
|
|
25
21
|
${t}
|
|
22
|
+
${e}
|
|
26
23
|
${n}
|
|
24
|
+
|
|
25
|
+
* {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
29
|
button {
|
|
29
30
|
border: none;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as r,useMemo as t}from"react";import{Button as i,Icon as s,Typography as l,DotProgress as m}from"@equinor/eds-core-react";import{arrow_back as a}from"@equinor/eds-icons";import{useAllAppRoles as n}from"../hooks/useAllAppRoles.js";import{useCreateImpersonation as p}from"../hooks/useCreateImpersonation.js";import{Container as c,Header as u,Section as d}from"./CreateNewUser.styles.js";import{environment as j}from"../../../../../atoms/utils/auth_environment.js";import"../../../../../molecules/AnimatedCheckmark/AnimatedCheckmark.styles.js";import"../../../../../molecules/ApplicationIcon/ApplicationIcon.js";import"../../../../../molecules/Badge/Badge.styles.js";import"../../../../../molecules/Banner/Banner.styles.js";import"../../../../../molecules/Chip/Chip.js";import"../../../../../molecules/ContentMenu/ContentMenu.js";import"../../../../../molecules/Dialog/Dialog.styles.js";import"../../../../../molecules/EquinorLogo/EquinorLogo.js";import"../../../../../atoms/style/colors.js";import"../../../../../molecules/FileProgress/CompactFileProgress.styles.js";import"../../../../../molecules/RichTextEditor/custom-extensions/AmplifyKit.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuBar.js";import"@tiptap/react";import"../../../../../molecules/RichTextEditor/RichTextEditor.styles.js";import"../../../../../molecules/RichTextEditor/RichTextEditor.types.js";import"../../../../../node_modules/lodash/lodash.js";import"@equinor/subsurface-app-management";import"@microsoft/signalr";import"@tanstack/react-query";import"../../../../../atoms/enums/Environment.js";import"../../../Notifications/NotificationProvider.js";import"../../../../../providers/AuthProvider/AuthProvider.js";import"../../../../../providers/ReleaseNotesProvider.js";import"../../../../../providers/SideBarProvider.js";import"../../../../../providers/SnackbarProvider/SnackbarProvider.js";import"../../../../../providers/TableOfContentsProvider.js";import"../../../../../providers/ThemeProvider/ThemeProvider.js";import"../../../../../providers/TutorialStepsProvider.js";import"../../../../../atoms/enums/Errors.js";import"../../../../../atoms/enums/Theme.js";import"../../../../ErrorPage/illustrations/GlitchAnimation.js";import"../../../../ErrorPage/illustrations/QuestioningAnimation.js";import"proj4";import"html2canvas";import"../../../../../molecules/FileProgress/RegularFileProgress.styles.js";import"../../../../../molecules/FileUploadArea/FileUploadArea.js";import"../../../../../molecules/FullPageSpinner/FullPageSpinner.js";import"../../../../../molecules/InfoElement/InfoElement.js";import"../../../../../molecules/OptionalTooltip/OptionalTooltip.js";import"../../../../../molecules/ProfileAvatar/ProfileAvatar.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuBar.styles.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuButton.js";import"../../../../../molecules/Search/Search.js";import"react-router-dom";import"../../../../../molecules/Sieve/Sieve.styles.js";import"../../../../../molecules/SingleFilterMenu/SingleFilterMenu.js";import"../../../../../molecules/Skeleton/SkeletonBase/SkeletonBase.js";import"../../../../../molecules/Stepper/Stepper.js";import"../../../../../molecules/OptionDrawer/OptionDrawer.js";import"../../../../../molecules/Select/Select.styles.js";import"../../../../../molecules/ListItem/ListItem.js";import"../../../../../molecules/SelectionControls/Checkbox/Checkbox.js";import"../../../../../molecules/SelectionControls/Radio/Radio.js";import
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as r,useMemo as t}from"react";import{Button as i,Icon as s,Typography as l,DotProgress as m}from"@equinor/eds-core-react";import{arrow_back as a}from"@equinor/eds-icons";import{useAllAppRoles as n}from"../hooks/useAllAppRoles.js";import{useCreateImpersonation as p}from"../hooks/useCreateImpersonation.js";import{Container as c,Header as u,Section as d}from"./CreateNewUser.styles.js";import{environment as j}from"../../../../../atoms/utils/auth_environment.js";import"../../../../../molecules/AnimatedCheckmark/AnimatedCheckmark.styles.js";import"../../../../../molecules/ApplicationIcon/ApplicationIcon.js";import"../../../../../molecules/Badge/Badge.styles.js";import"../../../../../molecules/Banner/Banner.styles.js";import"../../../../../molecules/Chip/Chip.js";import"../../../../../molecules/ContentMenu/ContentMenu.js";import"../../../../../molecules/Dialog/Dialog.styles.js";import"../../../../../molecules/EquinorLogo/EquinorLogo.js";import"../../../../../atoms/style/colors.js";import"../../../../../molecules/FileProgress/CompactFileProgress.styles.js";import"../../../../../molecules/RichTextEditor/custom-extensions/AmplifyKit.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuBar.js";import"@tiptap/react";import"../../../../../molecules/RichTextEditor/RichTextEditor.styles.js";import"../../../../../molecules/RichTextEditor/RichTextEditor.types.js";import"../../../../../node_modules/lodash/lodash.js";import"@equinor/subsurface-app-management";import"@microsoft/signalr";import"@tanstack/react-query";import"../../../../../atoms/enums/Environment.js";import"../../../Notifications/NotificationProvider.js";import"../../../../../providers/AuthProvider/AuthProvider.js";import"../../../../../providers/ReleaseNotesProvider.js";import"../../../../../providers/SideBarProvider.js";import"../../../../../providers/SnackbarProvider/SnackbarProvider.js";import"../../../../../providers/TableOfContentsProvider.js";import"../../../../../providers/ThemeProvider/ThemeProvider.js";import"../../../../../providers/TutorialStepsProvider.js";import"../../../../../atoms/enums/Errors.js";import"../../../../../atoms/enums/Theme.js";import"../../../../ErrorPage/illustrations/GlitchAnimation.js";import"../../../../ErrorPage/illustrations/QuestioningAnimation.js";import"proj4";import"html2canvas";import"../../../../../molecules/FileProgress/RegularFileProgress.styles.js";import"../../../../../molecules/FileUploadArea/FileUploadArea.js";import"../../../../../molecules/FullPageSpinner/FullPageSpinner.js";import"../../../../../molecules/InfoElement/InfoElement.js";import"../../../../../molecules/OptionalTooltip/OptionalTooltip.js";import"../../../../../molecules/ProfileAvatar/ProfileAvatar.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuBar.styles.js";import"../../../../../molecules/RichTextEditor/MenuBar/MenuButton.js";import"../../../../../molecules/Search/Search.js";import"react-router-dom";import"../../../../../molecules/Sieve/Sieve.styles.js";import"../../../../../molecules/SingleFilterMenu/SingleFilterMenu.js";import"../../../../../molecules/Skeleton/SkeletonBase/SkeletonBase.js";import"../../../../../molecules/Stepper/Stepper.js";import"../../../../../molecules/OptionDrawer/OptionDrawer.js";import{ComboBox as h}from"../../../../../molecules/Select/ComboBox/ComboBox.js";import"../../../../../molecules/Select/Select.styles.js";import"../../../../../molecules/ListItem/ListItem.js";import"../../../../../molecules/SelectionControls/Checkbox/Checkbox.js";import"../../../../../molecules/SelectionControls/Radio/Radio.js";import"../../../../../molecules/SelectionControls/Switch/Switch.js";import{TextField as v}from"../../../../../molecules/TextField/TextField.js";const g=({onBack:g,onClose:C})=>{const[S,f]=r([]),[P,A]=r(""),[k,y]=r(""),{data:E,isLoading:T}=n(),x=t((()=>E?.map((e=>({value:e.value,label:e.value})))??[]),[E]),{mutateAsync:B,isPending:R}=p(),b=t((()=>""===P||""===k||0===S.length),[P,k,S.length]);return e(c,{children:[e(u,{children:[o(i,{variant:"ghost_icon",onClick:g,children:o(s,{data:a})}),o(l,{variant:"h6",children:"Create new user"})]}),e(d,{children:[o(v,{id:"first-name",label:"First name",placeholder:"Add first name...",value:P,onChange:e=>{A(e.target.value)}}),o(v,{id:"last-name",label:"Last name",placeholder:"Add last name...",value:k,onChange:e=>{y(e.target.value)}})]}),e(d,{children:[o(l,{variant:"label",group:"navigation",children:"Roles"}),T&&o(m,{color:"primary"}),o(h,{placeholder:"Select roles...",values:S,onSelect:e=>{f(e)},items:x})]}),e(d,{children:[o(i,{variant:"outlined",onClick:g,children:"Cancel"}),o(i,R?{children:o(m,{})}:{onClick:async()=>{await B({firstName:P,lastName:k,roles:S.map((e=>e.value)).sort(),uniqueName:`${P}.${k}`.toLowerCase(),appName:j.getAppName(import.meta.env.VITE_NAME),activeUsers:[]}),C()},disabled:b,children:"Create and impersonate"})]})]})};export{g as CreateNewUser};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/amplify-component-lib",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.1",
|
|
4
4
|
"description": "Frontend Typescript components for the Amplify team",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"eslint-plugin-storybook": "^0.8.0",
|
|
142
142
|
"jest-environment-jsdom": "^29.7.0",
|
|
143
143
|
"jest-styled-components": "^7.2.0",
|
|
144
|
-
"msw": "^2.
|
|
144
|
+
"msw": "^2.4.9",
|
|
145
145
|
"msw-storybook-addon": "^2.0.3",
|
|
146
146
|
"ora": "^8.1.0",
|
|
147
147
|
"prettier": "^3.3.3",
|