@equinor/amplify-component-lib 9.15.3 → 9.16.0-beta.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/useFaqsInApplication.js +1 -1
- package/dist/atoms/hooks/usePrefetchRichTextImages.js +1 -1
- package/dist/atoms/hooks/useRichTextImage.js +1 -1
- package/dist/atoms/hooks/useSelect.d.ts +3 -3
- package/dist/atoms/hooks/useSelect.js +1 -1
- package/dist/atoms/index.d.ts +0 -1
- package/dist/atoms/index.js +1 -1
- package/dist/atoms/utils/auth_environment.js +1 -1
- package/dist/atoms/utils/date.d.ts +1 -1
- package/dist/atoms/utils/date.js +1 -1
- package/dist/atoms/utils/map.js +1 -1
- package/dist/atoms/utils/size.js +1 -1
- package/dist/atoms/utils/url.js +1 -1
- package/dist/deprecated/IconToggleButton.js +1 -1
- package/dist/deprecated/OldStepper/OldStepLine.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1 -1
- package/dist/molecules/ApplicationIcon/ApplicationIconBase.js +1 -1
- package/dist/molecules/Badge/Badge.styles.js +1 -1
- package/dist/molecules/Button/Button.js +1 -1
- package/dist/molecules/Chip/Chip.d.ts +2 -2
- package/dist/molecules/Chip/Chip.styles.js +1 -1
- package/dist/molecules/ContentMenu/ContentMenu.js +1 -1
- package/dist/molecules/DatePicker/DatePicker.d.ts +3 -3
- package/dist/molecules/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/molecules/Dialog/Dialog.d.ts +2 -2
- package/dist/molecules/EquinorLogo/EquinorLogo.d.ts +2 -2
- package/dist/molecules/FileProgress/CompactFileProgress.js +1 -1
- package/dist/molecules/FileProgress/FileProgress.utils.js +1 -1
- package/dist/molecules/FileProgress/RegularFileProgress.js +1 -1
- package/dist/molecules/IconCell/IconCell.d.ts +54 -0
- package/dist/molecules/IconCell/IconCell.js +1 -0
- package/dist/molecules/IconCell/IconCell.styles.js +108 -0
- package/dist/molecules/IconCell/IconCell.types.d.ts +33 -0
- package/dist/molecules/IconCell/IconCell.types.js +1 -0
- package/dist/molecules/IconCell/IconCell.utils.js +8 -0
- package/dist/molecules/InfoElement/CopyText.js +1 -1
- package/dist/molecules/ListItem/ListItem.d.ts +2 -2
- package/dist/molecules/OptionDrawer/OptionDrawer.utils.js +1 -1
- package/dist/molecules/OptionalTooltip/OptionalTooltip.d.ts +4 -4
- package/dist/molecules/ProfileAvatar/ProfileAvatar.d.ts +2 -2
- package/dist/molecules/ProfileAvatar/ProfileAvatar.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/AddImageButton.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/MenuBar.d.ts +6 -6
- package/dist/molecules/RichTextEditor/MenuBar/Table/TableColumn.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/Table/TableMerge.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/Table/TableRow.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/Table/ToggleTable.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/TextColor.js +1 -1
- package/dist/molecules/RichTextEditor/custom-extensions/ExtendedImage.js +1 -1
- package/dist/molecules/RichTextEditor/index.d.ts +6 -6
- package/dist/molecules/Search/Search.d.ts +2 -2
- package/dist/molecules/Select/AddTagItem.js +1 -1
- package/dist/molecules/Select/Select.styles.d.ts +4 -4
- package/dist/molecules/Select/SelectMenuItem.js +1 -1
- package/dist/molecules/SelectionControls/Checkbox/Checkbox.d.ts +2 -2
- package/dist/molecules/SelectionControls/Radio/Radio.d.ts +2 -2
- package/dist/molecules/SelectionControls/Switch/Switch.d.ts +2 -2
- package/dist/molecules/Skeleton/SkeletonBase/SkeletonBase.d.ts +2 -2
- package/dist/molecules/Stepper/Step/Step.js +1 -1
- package/dist/molecules/Stepper/Stepper.js +1 -1
- package/dist/molecules/Tabs/Tabs.types.d.ts +1 -1
- package/dist/molecules/Waves/Waves.js +1 -1
- package/dist/molecules/index.d.ts +3 -3
- package/dist/molecules/index.js +1 -1
- package/dist/organisms/Faq/Category/Category.js +2 -2
- package/dist/organisms/Faq/Category/Question.js +1 -1
- package/dist/organisms/Faq/Faq.js +1 -1
- package/dist/organisms/Faq/Header.js +2 -2
- package/dist/organisms/FieldSelector/FieldSelector.js +1 -1
- package/dist/organisms/Filter/ButtonWithMenu.js +1 -1
- package/dist/organisms/Filter/Filter.d.ts +2 -2
- package/dist/organisms/Filter/QuickFilter.d.ts +2 -2
- package/dist/organisms/Filter/SortMenu.d.ts +2 -2
- package/dist/organisms/ReleaseNote/ReleaseNote.d.ts +3 -3
- package/dist/organisms/ReleaseNote/ReleaseNote.js +1 -1
- package/dist/organisms/ReleaseNote/ReleaseNote.utils.js +1 -1
- package/dist/organisms/SideBar/MenuItem/BasicMenuItem.js +1 -1
- package/dist/organisms/SideBar/MenuItem/CollapsableMenuItem.js +1 -1
- package/dist/organisms/SideBar/MenuItem/MenuItem.styles.js +1 -1
- package/dist/organisms/SideBar/MenuItem/MenuItem.utils.js +1 -1
- package/dist/organisms/SideBar/SideBar.d.ts +2 -2
- package/dist/organisms/Status/Action.d.ts +2 -2
- package/dist/organisms/Status/Description.d.ts +2 -2
- package/dist/organisms/Status/MissingAccesses.d.ts +2 -2
- package/dist/organisms/Status/Title.d.ts +2 -2
- package/dist/organisms/Status/collections/BadRequest.js +2 -2
- package/dist/organisms/Status/collections/GenericError.js +1 -1
- package/dist/organisms/Status/collections/MissingAccessToApp.js +1 -1
- package/dist/organisms/Status/collections/MissingPermissions.js +1 -1
- package/dist/organisms/Status/collections/PageNotFound.js +2 -2
- package/dist/organisms/Status/collections/ServerError.js +2 -2
- package/dist/organisms/TableOfContents/TableOfContents.styles.js +1 -1
- package/dist/organisms/Template/Template.d.ts +3 -3
- package/dist/organisms/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/organisms/ToggleGroup/ToggleGroupOption.d.ts +2 -2
- package/dist/organisms/TopBar/Account/ImpersonateButton.js +1 -1
- package/dist/organisms/TopBar/Account/ImpersonateMenu/Actions.js +1 -1
- package/dist/organisms/TopBar/Account/ImpersonateMenu/CreateOrEditUser/CreateOrEditUser.js +1 -1
- package/dist/organisms/TopBar/Account/ImpersonateMenu/DeleteUser/DeleteUser.js +1 -1
- package/dist/organisms/TopBar/Account/ImpersonateMenu/ImpersonateMenu.js +1 -1
- package/dist/organisms/TopBar/Actions.d.ts +2 -2
- package/dist/organisms/TopBar/FieldMenu/FieldMenu.d.ts +2 -2
- package/dist/organisms/TopBar/Notifications/NotificationProvider.d.ts +2 -2
- package/dist/organisms/TopBar/Resources/Feedback/Feedback.utils.js +2 -2
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/FeedbackForm.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/ImageFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/UploadFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/Url.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponsePage.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponseStatus.js +1 -1
- package/dist/organisms/TopBar/Resources/ReleaseNotesDialog/Header/Header.js +1 -1
- package/dist/organisms/TopBar/Resources/ReleaseNotesDialog/ReleaseNotesDialog.js +1 -1
- package/dist/organisms/TopBar/TopBar.styles.js +1 -1
- package/dist/organisms/TopBar/Tutorials/TutorialItem.js +1 -1
- package/dist/providers/AuthProvider/AuthProviderInner.js +1 -1
- package/dist/providers/ReleaseNotesProvider.js +1 -1
- package/dist/providers/SideBarProvider.js +1 -1
- package/dist/providers/StepperProvider.js +1 -1
- package/dist/providers/TableOfContentsProvider.js +1 -1
- package/dist/providers/ThemeProvider/ThemeProvider.js +1 -1
- package/dist/providers/TutorialHighlightingProvider/TutorialHighlightingProviderInner.js +1 -1
- package/package.json +5 -9
- package/dist/atoms/hooks/useSearchParameter.d.ts +0 -12
- package/dist/atoms/hooks/useSearchParameter.js +0 -1
- package/dist/molecules/Sieve/Filter.d.ts +0 -10
- package/dist/molecules/Sieve/Filter.js +0 -1
- package/dist/molecules/Sieve/Sieve.d.ts +0 -7
- package/dist/molecules/Sieve/Sieve.js +0 -1
- package/dist/molecules/Sieve/Sieve.styles.js +0 -43
- package/dist/molecules/Sieve/Sieve.types.d.ts +0 -28
- package/dist/molecules/Sieve/Sort.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useOnScreenMultiple as e}from"../atoms/hooks/useOnScreenMultiple.js";import{getValues as t}from"./TableOfContentsProvider.utils.js";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import{useLocation as u,useNavigate as d}from"react-router";const f=n(void 0);function p(){let e=i(f);if(e===void 0)throw Error(`'useTableOfContents' must be used within provider`);return e}const m=({items:n,children:i,hashNavigation:p})=>{let m=d(),{hash:h}=u(),[g,_]=c(n[0]?.value),[v,y]=c([]),
|
|
1
|
+
import{useOnScreenMultiple as e}from"../atoms/hooks/useOnScreenMultiple.js";import{getValues as t}from"./TableOfContentsProvider.utils.js";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import{useLocation as u,useNavigate as d}from"@tanstack/react-router";const f=n(void 0);function p(){let e=i(f);if(e===void 0)throw Error(`'useTableOfContents' must be used within provider`);return e}const m=({items:n,children:i,hashNavigation:p})=>{let m=d(),{hash:h}=u(),[g,_]=c(n[0]?.value),[v,y]=c([]),b=s(!1),x=o(()=>n.flatMap(e=>t([],e)),[n]);a(()=>{y(x.map(e=>document.getElementById(e)))},[x]),a(()=>{h.length||(b.current=!0)},[h]);let S=r(e=>e.value===g?!0:e.children&&g?t([],e).includes(g):!1,[g]),C=e(v),w=s(-1),T=r((e,t)=>{let n=x.findIndex(t=>t===e);if(p){_(x[n]),m({to:`.`,hash:`#${x[n]}`,hashScrollIntoView:!1,replace:!0});return}let r=v[n];if(r){let e=t?.behavior??`smooth`;r.scrollIntoView({block:`start`,behavior:e}),w.current=n;let i=1/0,a=0,o=()=>{let e=r?.getBoundingClientRect().top;if(e===i){if(a+=1,a>1){_(x[n]),w.current=-1;return}}else a=0,i=e;requestAnimationFrame(o)};requestAnimationFrame(o)}},[v,p,m,x]);return a(()=>{if(h&&!b.current){b.current=!0;let e=decodeURIComponent(h.replace(`#`,``));if(!e.length||!x.includes(e))return;_(e),m({to:`.`,hash:`#${e}`,hashScrollIntoView:{block:`start`,behavior:`instant`},replace:!0})}},[h,m,x]),a(()=>{if(C.length===0||C.length!==x.length||w.current!==-1||!b.current)return;let e=-1;for(let t=C.length-1;t>=0;t--)C[t]&&(e=t);e===-1||x.at(e)===void 0||(_(x[e]),p&&m({to:`.`,hash:`#${x[e]}`,hashScrollIntoView:!1,replace:!0}))},[T,p,m,x,C]),l(f.Provider,{value:{items:n,selected:g,setSelected:T,isActive:S},children:i})};export{m as TableOfContentsProvider,p as useTableOfContents};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLocalStorage as e}from"../../atoms/hooks/useLocalStorage.js";import{THEME_LOCALSTORAGE_KEY as t}from"./ThemeProvider.constants.js";import{Theme as n}from"../../atoms/enums/Theme.js";import{createContext as r,useContext as i,useEffect as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=r(void 0);function c(){let e=i(s);if(e===void 0)throw Error(`ThemeProvider must be used within Provider`);return e}const l=({children:r})=>{let[i,c]=e(t,n.LIGHT);a(()=>{document.documentElement.setAttribute(`data-theme`,i)},[i])
|
|
1
|
+
import{useLocalStorage as e}from"../../atoms/hooks/useLocalStorage.js";import{THEME_LOCALSTORAGE_KEY as t}from"./ThemeProvider.constants.js";import{Theme as n}from"../../atoms/enums/Theme.js";import{createContext as r,useContext as i,useEffect as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=r(void 0);function c(){let e=i(s);if(e===void 0)throw Error(`ThemeProvider must be used within Provider`);return e}const l=({children:r})=>{let[i,c]=e(t,n.LIGHT);return a(()=>{document.documentElement.setAttribute(`data-theme`,i)},[i]),o(s.Provider,{value:{theme:i,setTheme:e=>{c(e)}},children:r})};export{l as ThemeProvider,s as ThemeProviderContext,c as useThemeProvider};
|
|
@@ -21,4 +21,4 @@ import{spacings as e}from"../../atoms/style/spacings.js";import{getHighlightElem
|
|
|
21
21
|
height: 100vh;
|
|
22
22
|
background: none;
|
|
23
23
|
pointer-events: none;
|
|
24
|
-
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{
|
|
24
|
+
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{y||(async()=>{if(g&&_!==void 0){if(!g.steps[_].highlightElement)return w([]);let e=await t(g.id,_,x);return w(e?[e]:[])}let e=await Promise.all(v.map(e=>{if(e.steps.at(0)?.highlightElement)return t(e.id,0,x)}));return w(e.filter(e=>e!==void 0))})()},[_,g,y,v,x]);let T=g?[g]:v.filter(e=>e.steps[0].highlightElement&&C.some(e=>e.id)||!e.steps[0].highlightElement);return T.length>0?u(c,{children:[e,l(h,{children:T.map(e=>{let t=C.find(t=>t.id===e.id);return l(i,{isHighlighting:C.length>0,contentRef:s,...e,...t},e.id)})}),u(m,{children:[u(`mask`,{id:`tutorials-rectangles`,children:[l(`rect`,{width:`100%`,height:`100%`,fill:`white`}),l(d.g,{style:{translateY:b},children:C.map(e=>l(d.path,{"data-testid":`tutorial-mask-${e.id}`,initial:{opacity:0,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},animate:{opacity:1,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},fill:`black`},e.id))})]}),l(d.rect,{width:`100%`,height:`100%`,fill:`rgba(111, 111, 111, 0.35)`,mask:`url(#tutorials-rectangles)`,...r})]})]}):l(c,{children:e})};export{g as TutorialHighlightingProviderInner};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/amplify-component-lib",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.16.0-beta.1",
|
|
4
4
|
"description": "Frontend Typescript components for the Amplify team",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@equinor/eds-icons": "^0.22.0",
|
|
55
|
-
"@equinor/subsurface-app-management": "
|
|
55
|
+
"@equinor/subsurface-app-management": "4.4.3-beta.0",
|
|
56
56
|
"@eslint/js": "^9.22.0",
|
|
57
57
|
"@faker-js/faker": "^9.6.0",
|
|
58
58
|
"@storybook/addon-designs": "^10.0.2",
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
"@types/random-seed": "^0.3.5",
|
|
73
73
|
"@types/react": "^19.0.10",
|
|
74
74
|
"@types/react-dom": "^19.0.4",
|
|
75
|
-
"@types/react-router-dom": "^5.3.3",
|
|
76
75
|
"@types/styled-components": "^5.1.34",
|
|
77
76
|
"@types/uuid": "^10.0.0",
|
|
78
77
|
"@types/wicg-file-system-access": "^2023.10.5",
|
|
@@ -93,12 +92,10 @@
|
|
|
93
92
|
"prettier": "^3.5.3",
|
|
94
93
|
"react": "^19.0.0",
|
|
95
94
|
"react-dom": "^19.0.0",
|
|
96
|
-
"react-router": "^6.28.0",
|
|
97
|
-
"react-router-dom": "^6.28.0",
|
|
98
95
|
"resize-observer-polyfill": "^1.5.1",
|
|
99
96
|
"resolve-tspaths": "^0.8.23",
|
|
100
97
|
"storybook": "^9.1.1",
|
|
101
|
-
"tsdown": "^0.14.
|
|
98
|
+
"tsdown": "^0.14.2",
|
|
102
99
|
"typescript": "^5.8.2",
|
|
103
100
|
"typescript-eslint": "^8.26.1",
|
|
104
101
|
"uuid": "^11.1.0",
|
|
@@ -113,12 +110,11 @@
|
|
|
113
110
|
},
|
|
114
111
|
"peerDependencies": {
|
|
115
112
|
"@equinor/eds-icons": "*",
|
|
116
|
-
"@equinor/subsurface-app-management": "
|
|
113
|
+
"@equinor/subsurface-app-management": "4.4.3-beta.0",
|
|
117
114
|
"@tanstack/react-query": "*",
|
|
115
|
+
"@tanstack/react-router": "*",
|
|
118
116
|
"react": "^19.0.0",
|
|
119
117
|
"react-dom": "^19.0.0",
|
|
120
|
-
"react-router": "^6.28.0",
|
|
121
|
-
"react-router-dom": "^6.28.0",
|
|
122
118
|
"@equinor/eds-core-react": "0.44.0",
|
|
123
119
|
"@equinor/eds-data-grid-react": "^0.7.5",
|
|
124
120
|
"@tiptap/core": "^3.1.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/atoms/hooks/useSearchParameter.d.ts
|
|
2
|
-
declare function useSearchParameter<T>({
|
|
3
|
-
key,
|
|
4
|
-
initialValue,
|
|
5
|
-
parser
|
|
6
|
-
}: {
|
|
7
|
-
key: string;
|
|
8
|
-
initialValue?: T;
|
|
9
|
-
parser?: (value: string) => T;
|
|
10
|
-
}): readonly [T | undefined, (action: ((value: T | undefined) => T) | T) => void];
|
|
11
|
-
//#endregion
|
|
12
|
-
export { useSearchParameter };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useRef as e}from"react";import{useSearchParams as t}from"react-router-dom";function n({key:n,initialValue:r,parser:i}){let[a,o]=t(),s=e(!1),c=a.get(n)??void 0,l=i&&c?i(c):c,u=!s.current&&l===void 0?r:l,d=e=>{if(s.current||=!0,e instanceof Function){let t=e(u);d(t)}else{let t=new URLSearchParams(a),r=typeof e==`string`?e:JSON.stringify(e);r===void 0||r===``||r===`null`||r===`[]`||r===`{}`?t.delete(n):t.set(n,r),o(t)}};return[u,d]}export{n as useSearchParameter};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{useOutsideClick as t}from"../../node_modules/@equinor/eds-utils/dist/esm/hooks/useOutsideClick.js";import{Chip as n,MenuItem as r}from"./Sieve.styles.js";import{useRef as i,useState as a}from"react";import{Icon as o,Menu as s}from"@equinor/eds-core-react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{arrow_drop_right as d,checkbox as f,checkbox_outline as p,filter_list as m}from"@equinor/eds-icons";const{colors:h}=e,g=({options:e,filterValues:g,setFilterValues:_})=>{let v=i(null),[y,b]=a(null),x=i(null),S=i(null),[C,w]=a(-1),[T,E]=a(!1);t(v.current,e=>{y===null&&T&&x.current&&!x.current.contains(e.target)?E(!1):T&&y!==null&&x.current&&!x.current.contains(e.target)&&S.current&&!S.current.contains(e.target)&&(E(!1),w(-1),b(null))});let D=()=>{E(!T),w(-1),b(null)},O=(e,t)=>{C===t?(w(-1),b(null)):(w(t),b(e.currentTarget))},k=(e,t)=>{let n={...g};if(e in n&&n[e].some(e=>e.value===t.value)){let r=n[e].findIndex(e=>e.value===t.value);n[e].splice(r,1),n[e].length===0&&delete n[e]}else n[e]?n[e].push(t):n[e]=[t];Object.keys(n).flatMap(e=>n?.[e]).length===0&&(n=void 0),_(n)};return e.length===0?null:u(c,{children:[u(n,{ref:v,onClick:D,children:[`Filter by `,l(o,{data:m})]}),T&&l(s,{open:!0,ref:x,anchorEl:v.current,placement:`bottom-start`,children:l(s.Section,{title:`Filter by`,children:e.map((e,t)=>u(r,{active:C===t,onClick:e=>O(e,t),children:[e.label,l(o,{data:d,color:h.text.static_icons__tertiary.rgba})]},`filter-menu-item-${e.label}`))})}),C!==-1&&l(s,{open:!0,anchorEl:y,ref:S,placement:`right-start`,children:l(s.Section,{title:e[C].label,children:e[C]?.options.map(t=>u(r,{onClick:()=>k(e[C].label,t),children:[t.label,l(o,{data:g?.[e[C].label]?.some(e=>e.value===t.value)?f:p,color:h.interactive.primary__resting.rgba})]},`filter-option-${t.label}`))})})]})};export{g as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Container as e,FilterChip as t,Search as n,Wrapper as r}from"./Sieve.styles.js";import i from"./Filter.js";import a from"./Sort.js";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{debounce as f}from"lodash";import{useSearchParams as p}from"react-router-dom";const m=({searchPlaceholder:m,sortOptions:h,filterOptions:g,sieveValue:_,onUpdate:v,showChips:y=!0,minSearchWidth:b=`24rem`,syncWithSearchParams:x=!1,isLoadingOptions:S=!1,debounceSearchValue:C=!1,onIsTyping:w})=>{let[T,E]=l(_.searchValue??``),D=c(!1),[O,k]=p(),A=c(!1);s(()=>{if(!A.current&&x&&!S){let e=O.get(`search`)??void 0,t=g?.map(e=>e.label)??[],n={};for(let e of t){let t=g?.find(t=>t.label===e)?.options,r=JSON.parse(O.get(e.toLowerCase())??`[]`);t!==void 0&&(n[e]=t.filter(e=>r.includes(e.label)))}v({searchValue:e,filterValues:n,sortValue:_.sortValue}),A.current=!0}},[g,A,S,v,O,_.sortValue,x]);let j=c(`{}`);s(()=>{if(x&&A.current&&!S&&JSON.stringify(_)!==j.current){_.searchValue===void 0?O.delete(`search`):O.set(`search`,_.searchValue);let e=g?.map(e=>e.label)??[],t=_.filterValues;for(let n of e)t?.[n]&&t[n].length>0?O.set(n.toLowerCase(),JSON.stringify(t[n].map(e=>e.label))):O.delete(n.toLowerCase());j.current=JSON.stringify(_),k(O),v(_)}},[g,A,S,v,O,k,_,x]);let M=o((e,t)=>{let n={..._,[e]:t};v(n)},[v,_]),N=o(f((e,t)=>{M(e,t),w?.(!1),D.current=!1},800),[M,w]),P=(e,t)=>{let n={..._.filterValues},r=n[e].findIndex(e=>e.value===t.value);n[e].splice(r,1),n[e].length===0&&delete n[e],Object.keys(n).flatMap(e=>n?.[e]).length===0&&(n=void 0),M(`filterValues`,n)},F=()=>{M(`filterValues`,void 0)},I=e=>{C?(E(e.target.value),e.target.value===``?(N.cancel(),M(`searchValue`,void 0),w?.(!1),D.current=!1):(N(`searchValue`,e.target.value),D.current||=(w?.(!0),!0))):M(`searchValue`,e.target.value===``?void 0:e.target.value)};return d(r,{className:`sieve-container`,children:[d(e,{children:[u(n,{style:{minWidth:b},placeholder:m,value:C?T:_.searchValue??``,onChange:I}),h!==void 0&&u(a,{options:h,selectedOption:_.sortValue,setSelectedOption:e=>M(`sortValue`,e)}),g!==void 0&&u(i,{options:g,filterValues:_.filterValues,setFilterValues:e=>M(`filterValues`,e)})]}),y&&d(e,{children:[Object.keys(_.filterValues??{}).map(e=>_.filterValues?.[e].map(n=>u(t,{onDelete:()=>P(e,n),children:n?.label},`filter-chip-${n?.value}`))),_.filterValues&&Object.keys(_.filterValues).flatMap(e=>_.filterValues?.[e]).length>1&&u(t,{onDelete:F,children:`Remove all`})]})]})};export{m as Sieve};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import{colors as e}from"../../atoms/style/colors.js";import{spacings as t}from"../../atoms/style/spacings.js";import{Chip as n,Menu as r,Search as i}from"@equinor/eds-core-react";import a from"styled-components";const o=a.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: ${t.medium};
|
|
5
|
-
`,s=a.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
gap: ${t.medium};
|
|
8
|
-
align-items: center;
|
|
9
|
-
`,c=a(n)`
|
|
10
|
-
color: ${e.text.static_icons__default.rgba};
|
|
11
|
-
background: ${e.ui.background__light.rgba};
|
|
12
|
-
border: 1px solid ${e.ui.background__medium.rgba};
|
|
13
|
-
line-height: normal;
|
|
14
|
-
transition: background 0.15s ease-in;
|
|
15
|
-
|
|
16
|
-
svg {
|
|
17
|
-
z-index: auto;
|
|
18
|
-
fill: ${e.text.static_icons__default.rgba};
|
|
19
|
-
}
|
|
20
|
-
`,l=a(i)`
|
|
21
|
-
> div {
|
|
22
|
-
box-shadow: none;
|
|
23
|
-
outline: none !important;
|
|
24
|
-
background: ${e.ui.background__default.rgba};
|
|
25
|
-
> input {
|
|
26
|
-
color: ${e.text.static_icons__default.rgba};
|
|
27
|
-
box-shadow: inset 0 -1px 0 0 ${e.text.static_icons__tertiary.rgba};
|
|
28
|
-
&:hover {
|
|
29
|
-
box-shadow: inset 0 -2px 0 0 ${e.text.static_icons__tertiary.rgba};
|
|
30
|
-
}
|
|
31
|
-
&:focus {
|
|
32
|
-
box-shadow: inset 0 -2px 0 0 ${e.interactive.primary__resting.rgba};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`,u=a(r.Item)`
|
|
37
|
-
outline: none !important;
|
|
38
|
-
> div {
|
|
39
|
-
grid-template-columns: 1fr auto;
|
|
40
|
-
}
|
|
41
|
-
`,d=a(n)`
|
|
42
|
-
background: none;
|
|
43
|
-
`;export{d as Chip,s as Container,c as FilterChip,u as MenuItem,l as Search,o as Wrapper};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { SieveFilterGroup } from "./Filter.js";
|
|
2
|
-
|
|
3
|
-
//#region src/molecules/Sieve/Sieve.types.d.ts
|
|
4
|
-
interface SieveOption {
|
|
5
|
-
label: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
type FilterValues = Record<string, SieveOption[]>;
|
|
9
|
-
interface SieveValue {
|
|
10
|
-
searchValue: string | undefined;
|
|
11
|
-
sortValue: SieveOption | undefined;
|
|
12
|
-
filterValues: FilterValues | undefined;
|
|
13
|
-
}
|
|
14
|
-
interface SieveProps {
|
|
15
|
-
searchPlaceholder: string;
|
|
16
|
-
sortOptions?: SieveOption[];
|
|
17
|
-
filterOptions?: SieveFilterGroup[];
|
|
18
|
-
sieveValue: SieveValue;
|
|
19
|
-
onUpdate: (value: SieveValue) => void;
|
|
20
|
-
showChips?: boolean;
|
|
21
|
-
minSearchWidth?: string;
|
|
22
|
-
syncWithSearchParams?: boolean;
|
|
23
|
-
isLoadingOptions?: boolean;
|
|
24
|
-
debounceSearchValue?: boolean;
|
|
25
|
-
onIsTyping?: (value: boolean) => void;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { type FilterValues, type SieveOption, type SieveProps, type SieveValue };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{colors as e}from"../../atoms/style/colors.js";import{Chip as t,MenuItem as n}from"./Sieve.styles.js";import{useRef as r,useState as i}from"react";import{Icon as a,Menu as o}from"@equinor/eds-core-react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{radio_button_selected as u,radio_button_unselected as d,sort as f}from"@equinor/eds-icons";const p=({options:p,selectedOption:m,setSelectedOption:h})=>{let g=r(null),[_,v]=i(!1),y=()=>{v(!_)},b=()=>{v(!1)},x=e=>{h(e)};return p.length===0?null:l(s,{children:[l(t,{ref:g,onClick:y,children:[`Sort by `,c(a,{data:f})]}),_&&c(o,{open:!0,anchorEl:g.current,onClose:b,placement:`bottom-start`,children:c(o.Section,{title:`Sort by`,children:p.map(t=>l(n,{onClick:()=>x(t),children:[t.label,c(a,{data:m?.value===t.value?u:d,color:e.interactive.primary__resting.rgba})]},`sort-item-${t.value}`))})})]})};export{p as default};
|