@instructure/ui-truncate-list 8.27.1-snapshot-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +30 -0
- package/es/TruncateList/TruncateListLocator.js +43 -0
- package/es/TruncateList/index.js +272 -0
- package/es/TruncateList/props.js +36 -0
- package/es/TruncateList/styles.js +75 -0
- package/es/index.js +24 -0
- package/lib/TruncateList/TruncateListLocator.js +54 -0
- package/lib/TruncateList/index.js +265 -0
- package/lib/TruncateList/props.js +47 -0
- package/lib/TruncateList/styles.js +83 -0
- package/lib/index.js +13 -0
- package/lib/package.json +1 -0
- package/package.json +52 -0
- package/src/TruncateList/README.md +201 -0
- package/src/TruncateList/TruncateListLocator.ts +37 -0
- package/src/TruncateList/index.tsx +311 -0
- package/src/TruncateList/props.ts +124 -0
- package/src/TruncateList/styles.ts +81 -0
- package/src/index.ts +26 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/TruncateList/TruncateListLocator.d.ts +582 -0
- package/types/TruncateList/TruncateListLocator.d.ts.map +1 -0
- package/types/TruncateList/index.d.ts +62 -0
- package/types/TruncateList/index.d.ts.map +1 -0
- package/types/TruncateList/props.d.ts +58 -0
- package/types/TruncateList/props.d.ts.map +1 -0
- package/types/TruncateList/styles.d.ts +14 -0
- package/types/TruncateList/styles.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TruncateListLocator.d.ts","sourceRoot":"","sources":["../../src/TruncateList/TruncateListLocator.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAK5D,eAAO,MAAM,mBAAmB;;oCACF,GAAG,EAAE;uCAGF,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHR,GAAG,EAAE;uCAGF,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHR,GAAG,EAAE;uCAGF,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHR,GAAG,EAAE;uCAGF,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHR,GAAG,EAAE;uCAGF,GAAG,EAAE;;0KAGpC,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { jsx } from '@instructure/emotion';
|
|
4
|
+
import type { TruncateListProps, TruncateListState } from './props';
|
|
5
|
+
/**
|
|
6
|
+
---
|
|
7
|
+
category: components/utilities
|
|
8
|
+
---
|
|
9
|
+
@tsProps
|
|
10
|
+
**/
|
|
11
|
+
declare class TruncateList extends Component<TruncateListProps, TruncateListState> {
|
|
12
|
+
static readonly componentId = "TruncateList";
|
|
13
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
visibleItemsCount?: number | undefined;
|
|
16
|
+
renderHiddenItemMenu?: ((hiddenChildren: (string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal)[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
17
|
+
onUpdate?: (({ visibleItemsCount }: {
|
|
18
|
+
visibleItemsCount: number;
|
|
19
|
+
}) => void) | undefined;
|
|
20
|
+
itemSpacing?: string | undefined;
|
|
21
|
+
fixMenuTriggerWidth?: string | undefined;
|
|
22
|
+
debounce?: number | undefined;
|
|
23
|
+
elementRef?: ((element: HTMLUListElement | null) => void) | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
static allowedProps: readonly (keyof {
|
|
26
|
+
children?: import("react").ReactNode;
|
|
27
|
+
visibleItemsCount?: number | undefined;
|
|
28
|
+
renderHiddenItemMenu?: ((hiddenChildren: (string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal)[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
29
|
+
onUpdate?: (({ visibleItemsCount }: {
|
|
30
|
+
visibleItemsCount: number;
|
|
31
|
+
}) => void) | undefined;
|
|
32
|
+
itemSpacing?: string | undefined;
|
|
33
|
+
fixMenuTriggerWidth?: string | undefined;
|
|
34
|
+
debounce?: number | undefined;
|
|
35
|
+
elementRef?: ((element: HTMLUListElement | null) => void) | undefined;
|
|
36
|
+
})[];
|
|
37
|
+
static defaultProps: {
|
|
38
|
+
itemSpacing: string;
|
|
39
|
+
debounce: number;
|
|
40
|
+
};
|
|
41
|
+
ref: HTMLUListElement | null;
|
|
42
|
+
private _menuTriggerRef;
|
|
43
|
+
private _debouncedHandleResize?;
|
|
44
|
+
private _resizeListener?;
|
|
45
|
+
handleRef: (el: HTMLUListElement | null) => void;
|
|
46
|
+
constructor(props: TruncateListProps);
|
|
47
|
+
componentDidMount(): void;
|
|
48
|
+
componentDidUpdate(prevProps: TruncateListProps, prevState: TruncateListState): void;
|
|
49
|
+
componentWillUnmount(): void;
|
|
50
|
+
get childrenArray(): (string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal)[];
|
|
51
|
+
get visibleChildren(): (string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal)[];
|
|
52
|
+
get hiddenChildren(): (string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal)[];
|
|
53
|
+
calcMenuTriggerWidth(): number;
|
|
54
|
+
measureItems: () => {
|
|
55
|
+
visibleItemsCount: number;
|
|
56
|
+
};
|
|
57
|
+
handleResize: () => void;
|
|
58
|
+
render(): jsx.JSX.Element;
|
|
59
|
+
}
|
|
60
|
+
export { TruncateList };
|
|
61
|
+
export default TruncateList;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TruncateList/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAY,SAAS,EAAE,MAAM,OAAO,CAAA;AAS3C,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEnE;;;;;GAKG;AACH,cAEM,YAAa,SAAQ,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IACxE,MAAM,CAAC,QAAQ,CAAC,WAAW,kBAAiB;IAE5C,MAAM,CAAC,SAAS;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;MAGlB;IAED,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAO;IAEnC,OAAO,CAAC,eAAe,CAA6B;IAEpD,OAAO,CAAC,sBAAsB,CAAC,CAAW;IAC1C,OAAO,CAAC,eAAe,CAAC,CAAgB;IAExC,SAAS,OAAQ,gBAAgB,GAAG,IAAI,UAQvC;gBAEW,KAAK,EAAE,iBAAiB;IASpC,iBAAiB;IAoCjB,kBAAkB,CAChB,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,iBAAiB;IA6B9B,oBAAoB;IAUpB,IAAI,aAAa,+KAEhB;IAED,IAAI,eAAe,+KAelB;IAED,IAAI,cAAc,+KASjB;IAED,oBAAoB;IAqBpB,YAAY;;MAwCX;IAED,YAAY,aASX;IAED,MAAM;CAuCP;AAED,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
3
|
+
import type { OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
4
|
+
declare type TruncateListOwnProps = {
|
|
5
|
+
/**
|
|
6
|
+
* List of items in the truncated list
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the number of navigation items that are visible.
|
|
11
|
+
* If not set, the list is not truncated.
|
|
12
|
+
*/
|
|
13
|
+
visibleItemsCount?: number;
|
|
14
|
+
/**
|
|
15
|
+
* When there are list items hidden, an optional element
|
|
16
|
+
* (dropdown menu, link, etc.) can be provided to display them
|
|
17
|
+
* (renders at the end of the list).
|
|
18
|
+
*/
|
|
19
|
+
renderHiddenItemMenu?: (hiddenChildren: Exclude<React.ReactNode, boolean | null | undefined>[]) => React.ReactElement;
|
|
20
|
+
/**
|
|
21
|
+
* Called whenever the navigation items are updated or the size of
|
|
22
|
+
* the navigation changes. Passes in the `visibleItemsCount` as
|
|
23
|
+
* a parameter.
|
|
24
|
+
*/
|
|
25
|
+
onUpdate?: ({ visibleItemsCount }: {
|
|
26
|
+
visibleItemsCount: number;
|
|
27
|
+
}) => void;
|
|
28
|
+
/**
|
|
29
|
+
* The spacing between list items (in 'rem', 'em' or 'px')
|
|
30
|
+
*/
|
|
31
|
+
itemSpacing?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Fix width of the Menu trigger (in 'rem', 'em' or 'px')
|
|
34
|
+
*/
|
|
35
|
+
fixMenuTriggerWidth?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The rate (in ms) the component responds to container resizing or
|
|
38
|
+
* an update to one of its child items
|
|
39
|
+
*/
|
|
40
|
+
debounce?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Provides a reference to the underlying ul element
|
|
43
|
+
*/
|
|
44
|
+
elementRef?: (element: HTMLUListElement | null) => void;
|
|
45
|
+
};
|
|
46
|
+
declare type PropKeys = keyof TruncateListOwnProps;
|
|
47
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
48
|
+
declare type TruncateListProps = TruncateListOwnProps & WithStyleProps<null, TruncateListStyle> & OtherHTMLAttributes<TruncateListOwnProps>;
|
|
49
|
+
declare type TruncateListStyle = ComponentStyle<'truncateList' | 'listItem' | 'menuTrigger'>;
|
|
50
|
+
declare type TruncateListState = {
|
|
51
|
+
isMeasuring: boolean;
|
|
52
|
+
menuTriggerWidth?: number;
|
|
53
|
+
};
|
|
54
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
55
|
+
declare const allowedProps: AllowedPropKeys;
|
|
56
|
+
export type { TruncateListProps, TruncateListStyle, TruncateListState };
|
|
57
|
+
export { propTypes, allowedProps };
|
|
58
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/TruncateList/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,C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AE,cAAc,CAAC,QAAQ,CASvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eASnB,CAAA;AAED,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TruncateListProps, TruncateListStyle } from './props';
|
|
2
|
+
/**
|
|
3
|
+
* ---
|
|
4
|
+
* private: true
|
|
5
|
+
* ---
|
|
6
|
+
* Generates the style object from the theme and provided additional information
|
|
7
|
+
* @param {Object} componentTheme The theme variable object.
|
|
8
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
9
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
10
|
+
* @return {Object} The final style object, which will be used in the component
|
|
11
|
+
*/
|
|
12
|
+
declare const generateStyle: (_componentTheme: null, props: TruncateListProps) => TruncateListStyle;
|
|
13
|
+
export default generateStyle;
|
|
14
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/TruncateList/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEnE;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa,oBACA,IAAI,SACd,iBAAiB,KACvB,iBAuCF,CAAA;AAED,eAAe,aAAa,CAAA"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA"}
|