@equinor/fusion-react-context-selector 0.1.7 → 0.2.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/README.md CHANGED
@@ -5,18 +5,12 @@
5
5
 
6
6
  [Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/data-contextselector)
7
7
 
8
- [Fusion Web Component](https://github.com/equinor/fusion-web-components/tree/main/packages/searchable-dropdown)
8
+ Extending [fusion-react-searchable-dropdown](https://equinor.github.io/fusion-react-components/?path=/docs/data-searchable-dropdown)
9
+
10
+ Built on Web-Component [Fusion Web Component](https://github.com/equinor/fusion-web-components/tree/main/packages/searchable-dropdown)
9
11
 
10
12
  ### Installation
11
13
 
12
14
  ```sh
13
15
  npm install @equinor/fusion-react-context-selector
14
16
  ```
15
-
16
- ### Methods
17
-
18
- | Name | Description
19
- | -------- | -------------
20
- | `onSelect() => ContextResult` | Returns `ContextResult` of selected items in event details.
21
-
22
- <!--prettier-ignore-end-->
@@ -0,0 +1,4 @@
1
+ import { ContextProviderProps } from './types';
2
+ export declare const ContextProvider: ({ children, ...props }: React.PropsWithChildren<ContextProviderProps>) => JSX.Element;
3
+ export default ContextProvider;
4
+ //# sourceMappingURL=ContextProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../src/ContextProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,2BAA4B,MAAM,iBAAiB,CAAC,oBAAoB,CAAC,KAAG,WAGvG,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* eslint-disable react/no-multi-comp */
3
+ import { DropdownProvider, useDropdownProviderRef } from '@equinor/fusion-react-searchable-dropdown';
4
+ export const ContextProvider = ({ children, ...props }) => {
5
+ const providerRef = useDropdownProviderRef(props.resolver);
6
+ return _jsx(DropdownProvider, { ref: providerRef, children: children });
7
+ };
8
+ export default ContextProvider;
9
+ //# sourceMappingURL=ContextProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextProvider.js","sourceRoot":"","sources":["../src/ContextProvider.tsx"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAIrG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiD,EAAe,EAAE;IACpH,MAAM,WAAW,GAAG,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3D,OAAO,KAAC,gBAAgB,IAAC,GAAG,EAAE,WAAW,YAAG,QAAQ,GAAoB,CAAC;AAC3E,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,12 +1,4 @@
1
- import { DropdownProps, SearchableDropdownResolver, SearchableDropdownResult, SearchableDropdownResultItem, SearchableDropdownSelectEvent } from '@equinor/fusion-react-searchable-dropdown';
2
- type ElementResolver = {
3
- resolver?: SearchableDropdownResolver;
4
- };
5
- export type ContextResult = SearchableDropdownResult;
6
- export type ContextResultItem = SearchableDropdownResultItem;
7
- export type ContextResolver = SearchableDropdownResolver;
8
- export type ContextSelectEvent = SearchableDropdownSelectEvent;
9
- export type ContextSelectorProps = DropdownProps & ElementResolver;
1
+ import { ContextSelectorProps } from './types';
10
2
  export declare const ContextSelector: ({ children, ...props }: React.PropsWithChildren<ContextSelectorProps>) => JSX.Element;
11
3
  export default ContextSelector;
12
4
  //# sourceMappingURL=ContextSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContextSelector.d.ts","sourceRoot":"","sources":["../src/ContextSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,2CAA2C,CAAC;AAEnD,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC;AACrD,MAAM,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,0BAA0B,CAAC;AACzD,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAC/D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,eAAe,CAAC;AAEnE,eAAO,MAAM,eAAe,2BAA4B,MAAM,iBAAiB,CAAC,oBAAoB,CAAC,KAAG,WAOvG,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ContextSelector.d.ts","sourceRoot":"","sources":["../src/ContextSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,2BAA4B,MAAM,iBAAiB,CAAC,oBAAoB,CAAC,KAAG,WAEvG,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable react/no-multi-comp */
3
- import { DropdownProvider, Dropdown, useDropdownProviderRef, } from '@equinor/fusion-react-searchable-dropdown';
3
+ import { Dropdown } from '@equinor/fusion-react-searchable-dropdown';
4
4
  export const ContextSelector = ({ children, ...props }) => {
5
- const providerRef = useDropdownProviderRef(props.resolver);
6
- return (_jsx(DropdownProvider, { ref: providerRef, children: _jsx(Dropdown, { ...props, children: children }) }));
5
+ return _jsx(Dropdown, { ...props, children: children });
7
6
  };
8
7
  export default ContextSelector;
9
8
  //# sourceMappingURL=ContextSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContextSelector.js","sourceRoot":"","sources":["../src/ContextSelector.tsx"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,sBAAsB,GAMvB,MAAM,2CAA2C,CAAC;AAYnD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiD,EAAe,EAAE;IACpH,MAAM,WAAW,GAAG,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3D,OAAO,CACL,KAAC,gBAAgB,IAAC,GAAG,EAAE,WAAW,YAChC,KAAC,QAAQ,OAAK,KAAK,YAAG,QAAQ,GAAY,GACzB,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ContextSelector.js","sourceRoot":"","sources":["../src/ContextSelector.tsx"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAGrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiD,EAAe,EAAE;IACpH,OAAO,KAAC,QAAQ,OAAK,KAAK,YAAG,QAAQ,GAAY,CAAC;AACpD,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './ContextProvider';
1
2
  export * from './ContextSelector';
3
+ export * from './types';
2
4
  export { ContextSelector as default } from './ContextSelector';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './ContextProvider';
1
2
  export * from './ContextSelector';
3
+ export * from './types';
2
4
  export { ContextSelector as default } from './ContextSelector';
3
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { DropdownProps, SearchableDropdownResultItem, SearchableDropdownSelectEvent } from '@equinor/fusion-react-searchable-dropdown';
2
+ export type ContextResultItem = Pick<SearchableDropdownResultItem, 'children' | 'graphic' | 'id' | 'isDisabled' | 'isError' | 'isSelected' | 'meta' | 'subTitle' | 'title' | 'type'>;
3
+ export type ContextResult = Array<ContextResultItem>;
4
+ export type ContextSelectEvent = SearchableDropdownSelectEvent;
5
+ export type ContextSelectorProps = DropdownProps;
6
+ export interface ContextResolver {
7
+ searchQuery: (queryString: string) => Promise<ContextResult> | ContextResult;
8
+ initialResult?: ContextResult;
9
+ closeHandler?: (e: MouseEvent) => void;
10
+ }
11
+ export type ContextProviderProps = {
12
+ resolver?: ContextResolver;
13
+ };
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,4BAA4B,EAC5B,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CACjH,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAC/D,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;IAC7E,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-react-context-selector",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "React component for context selector",
5
5
  "keywords": [
6
6
  "contextselector",
@@ -37,8 +37,8 @@
37
37
  "url": "https://github.com/equinor/fusion-react-components/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@equinor/fusion-react-searchable-dropdown": "^0.1.7",
40
+ "@equinor/fusion-react-searchable-dropdown": "^0.2.0",
41
41
  "@equinor/fusion-react-utils": "^2.0.4"
42
42
  },
43
- "gitHead": "947555607eec060ffea5282a87429565e9f34ed2"
43
+ "gitHead": "a976401d0c5be9bc37c1b8f0fb2248e829de99ab"
44
44
  }