@fluentui-copilot/react-prompt-starter 0.10.6 → 0.10.8
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.json +81 -1
- package/CHANGELOG.md +27 -2
- package/dist/index.d.ts +58 -3
- package/lib/components/PromptStarter/PromptStarter.js +4 -1
- package/lib/components/PromptStarter/PromptStarter.js.map +1 -1
- package/lib/components/PromptStarter/PromptStarter.types.js +2 -0
- package/lib/components/PromptStarter/PromptStarter.types.js.map +1 -1
- package/lib/components/PromptStarter/renderPromptStarter.js +4 -1
- package/lib/components/PromptStarter/renderPromptStarter.js.map +1 -1
- package/lib/components/PromptStarter/usePromptStarter.js +3 -0
- package/lib/components/PromptStarter/usePromptStarter.js.map +1 -1
- package/lib/components/PromptStarter/usePromptStarterStyles.styles.js +4 -0
- package/lib/components/PromptStarter/usePromptStarterStyles.styles.js.map +1 -1
- package/lib/components/PromptStarter/usePromptStarterStyles.styles.raw.js +4 -1
- package/lib/components/PromptStarter/usePromptStarterStyles.styles.raw.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarter/PromptStarter.types.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarter/renderPromptStarter.js +1 -0
- package/lib/components/PromptStarterV2/PromptStarter/renderPromptStarter.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarter.js +8 -1
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarter.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.js +112 -23
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.raw.js +62 -12
- package/lib/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.raw.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarterList/PromptStarterList.types.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarterList/renderPromptStarterList.js +1 -0
- package/lib/components/PromptStarterV2/PromptStarterList/renderPromptStarterList.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterList.js +33 -10
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterList.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.js +30 -4
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.js.map +1 -1
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.raw.js +16 -4
- package/lib/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.raw.js.map +1 -1
- package/lib/contexts/PromptStarterListContext.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/PromptStarter.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/PromptStarter.types.js +2 -0
- package/lib-commonjs/components/PromptStarter/PromptStarter.types.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/renderPromptStarter.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/usePromptStarter.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/usePromptStarterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PromptStarter/usePromptStarterStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/PromptStarter.types.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/renderPromptStarter.js +1 -0
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/renderPromptStarter.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarter.js +8 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarter.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.js +170 -28
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.raw.js +62 -12
- package/lib-commonjs/components/PromptStarterV2/PromptStarter/usePromptStarterStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/PromptStarterList.types.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/renderPromptStarterList.js +1 -0
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/renderPromptStarterList.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterList.js +33 -10
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterList.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.js +41 -4
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.raw.js +16 -4
- package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterListStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/contexts/PromptStarterListContext.js.map +1 -1
- package/package.json +12 -12
|
@@ -14,16 +14,32 @@ const _reactcomponents = require("@fluentui/react-components");
|
|
|
14
14
|
const _reactprovider = require("@fluentui-copilot/react-provider");
|
|
15
15
|
const _reacticons = require("@fluentui/react-icons");
|
|
16
16
|
const _promptStarterMotion = require("../PromptStarter/promptStarterMotion");
|
|
17
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
17
18
|
const usePromptStarterList_unstable = (props, ref)=>{
|
|
18
|
-
const { arrowNavigationOptions, expandButtonLabel = 'Show more', collapseButtonLabel = 'Show less' } = props;
|
|
19
|
+
const { arrowNavigationOptions, expandButtonLabel = 'Show more', collapseButtonLabel = 'Show less', onExpandedChange, animateOnMount = true, visibleRows = 1 } = props;
|
|
19
20
|
const designVersion = (0, _reactprovider.useDesignVersion)(props.designVersion);
|
|
20
21
|
var _arrowNavigationOptions_axis, _arrowNavigationOptions_memorizeCurrent;
|
|
21
22
|
const focusAttrs = (0, _reactcomponents.useArrowNavigationGroup)({
|
|
22
23
|
...arrowNavigationOptions,
|
|
23
|
-
axis: (_arrowNavigationOptions_axis = arrowNavigationOptions === null || arrowNavigationOptions === void 0 ? void 0 : arrowNavigationOptions.axis) !== null && _arrowNavigationOptions_axis !== void 0 ? _arrowNavigationOptions_axis : '
|
|
24
|
+
axis: (_arrowNavigationOptions_axis = arrowNavigationOptions === null || arrowNavigationOptions === void 0 ? void 0 : arrowNavigationOptions.axis) !== null && _arrowNavigationOptions_axis !== void 0 ? _arrowNavigationOptions_axis : 'both',
|
|
24
25
|
memorizeCurrent: (_arrowNavigationOptions_memorizeCurrent = arrowNavigationOptions === null || arrowNavigationOptions === void 0 ? void 0 : arrowNavigationOptions.memorizeCurrent) !== null && _arrowNavigationOptions_memorizeCurrent !== void 0 ? _arrowNavigationOptions_memorizeCurrent : true
|
|
25
26
|
});
|
|
26
|
-
const [isExpanded, setIsExpanded] =
|
|
27
|
+
const [isExpanded, setIsExpanded] = (0, _reactutilities.useControllableState)({
|
|
28
|
+
state: props.isExpanded,
|
|
29
|
+
defaultState: props.defaultExpanded,
|
|
30
|
+
initialState: false
|
|
31
|
+
});
|
|
32
|
+
const toggleExpanded = _react.useCallback((event)=>{
|
|
33
|
+
setIsExpanded((prevExpanded)=>{
|
|
34
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(event, {
|
|
35
|
+
isExpanded: !prevExpanded
|
|
36
|
+
});
|
|
37
|
+
return !prevExpanded;
|
|
38
|
+
});
|
|
39
|
+
}, [
|
|
40
|
+
setIsExpanded,
|
|
41
|
+
onExpandedChange
|
|
42
|
+
]);
|
|
27
43
|
const [numberOfColumns, setNumberOfColumns] = _react.useState(3);
|
|
28
44
|
const gridWrapperRef = _react.useRef(null);
|
|
29
45
|
const { targetDocument } = (0, _reactcomponents.useFluent)();
|
|
@@ -45,11 +61,12 @@ const usePromptStarterList_unstable = (props, ref)=>{
|
|
|
45
61
|
]);
|
|
46
62
|
const state = {
|
|
47
63
|
numberOfColumns: numberOfColumns,
|
|
48
|
-
isExpanded,
|
|
64
|
+
isExpanded: isExpanded,
|
|
49
65
|
designVersion,
|
|
50
66
|
components: {
|
|
51
67
|
root: 'div',
|
|
52
68
|
gridWrapper: 'div',
|
|
69
|
+
actions: 'span',
|
|
53
70
|
expandButton: _reactcomponents.Button
|
|
54
71
|
},
|
|
55
72
|
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
|
|
@@ -65,6 +82,9 @@ const usePromptStarterList_unstable = (props, ref)=>{
|
|
|
65
82
|
},
|
|
66
83
|
elementType: 'div'
|
|
67
84
|
}),
|
|
85
|
+
actions: _reactcomponents.slot.optional(props.actions, {
|
|
86
|
+
elementType: 'span'
|
|
87
|
+
}),
|
|
68
88
|
expandButton: _reactcomponents.slot.optional(props.expandButton, {
|
|
69
89
|
defaultProps: {
|
|
70
90
|
appearance: 'subtle',
|
|
@@ -92,12 +112,11 @@ const usePromptStarterList_unstable = (props, ref)=>{
|
|
|
92
112
|
if (!/*#__PURE__*/ _react.isValidElement(child) || child.type === _react.Fragment) {
|
|
93
113
|
throw new Error('You should only use PromptStarter components as the children of PromptStarterList.');
|
|
94
114
|
}
|
|
95
|
-
// In the collapsed state, if there is one column, we show three children.
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
const visibility = numberOfColumns === 1 && index < 3 || index < numberOfColumns || isExpanded;
|
|
115
|
+
// In the collapsed state, if there is one column, we show three children. If there are two or three columns,
|
|
116
|
+
// we show two or three (or four or six, if there are two visible rows). All children are shown in the isExpanded state.
|
|
117
|
+
const visibility = numberOfColumns === 1 && index < 3 || index < numberOfColumns * visibleRows || isExpanded;
|
|
99
118
|
return /*#__PURE__*/ _react.createElement(_promptStarterMotion.PromptStarterMotion, {
|
|
100
|
-
appear:
|
|
119
|
+
appear: animateOnMount,
|
|
101
120
|
key: index,
|
|
102
121
|
index: index,
|
|
103
122
|
visible: visibility,
|
|
@@ -109,8 +128,12 @@ const usePromptStarterList_unstable = (props, ref)=>{
|
|
|
109
128
|
isExpanded
|
|
110
129
|
]);
|
|
111
130
|
state.root.children = childrenWithMotion;
|
|
131
|
+
const numChildren = childrenArray.length;
|
|
132
|
+
if (numberOfColumns === 1 && numChildren <= 3 || numChildren <= numberOfColumns * visibleRows) {
|
|
133
|
+
state.expandButton = undefined;
|
|
134
|
+
}
|
|
112
135
|
if (state.expandButton) {
|
|
113
|
-
state.expandButton.onClick = (0, _reactcomponents.mergeCallbacks)(state.expandButton.onClick,
|
|
136
|
+
state.expandButton.onClick = (0, _reactcomponents.mergeCallbacks)(state.expandButton.onClick, toggleExpanded);
|
|
114
137
|
}
|
|
115
138
|
return state;
|
|
116
139
|
};
|
package/lib-commonjs/components/PromptStarterV2/PromptStarterList/usePromptStarterList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePromptStarterList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n slot,\n Button,\n useArrowNavigationGroup,\n mergeCallbacks,\n useFluent,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { PromptStarterListProps, PromptStarterListState } from './PromptStarterList.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\nimport { ChevronDown12Regular } from '@fluentui/react-icons';\nimport { PromptStarterMotion } from '../PromptStarter/promptStarterMotion';\n\n/**\n * Create the state required to render PromptStarterList.\n *\n * The returned state can be modified with hooks such as usePromptStarterListStyles_unstable,\n * before being passed to renderPromptStarterList_unstable.\n *\n * @param props - props from this instance of PromptStarterList\n * @param ref - reference to root HTMLElement of PromptStarterList\n */\nexport const usePromptStarterList_unstable = (\n props: PromptStarterListProps,\n ref: React.Ref<HTMLDivElement>,\n): PromptStarterListState => {\n const { arrowNavigationOptions, expandButtonLabel = 'Show more', collapseButtonLabel = 'Show less' } = props;\n const designVersion = useDesignVersion(props.designVersion);\n const focusAttrs = useArrowNavigationGroup({\n ...arrowNavigationOptions,\n axis: arrowNavigationOptions?.axis ?? 'grid-linear',\n memorizeCurrent: arrowNavigationOptions?.memorizeCurrent ?? true,\n });\n\n const [isExpanded, setIsExpanded] = React.useState(false);\n const [numberOfColumns, setNumberOfColumns] = React.useState<number>(3);\n\n const gridWrapperRef = React.useRef<HTMLDivElement>(null);\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n React.useEffect(() => {\n if (!win || !gridWrapperRef.current) return;\n\n const promptStarterGrid = gridWrapperRef.current;\n\n const updateNumberOfColumns = () => {\n const numColumns = win.getComputedStyle(promptStarterGrid).gridTemplateColumns.split(' ').length;\n setNumberOfColumns(numColumns);\n };\n\n const ro = new win.ResizeObserver(updateNumberOfColumns);\n ro.observe(promptStarterGrid);\n\n return () => {\n ro.unobserve(promptStarterGrid);\n };\n }, [win]);\n\n const state: PromptStarterListState = {\n numberOfColumns: numberOfColumns,\n isExpanded,\n designVersion,\n components: {\n root: 'div',\n gridWrapper: 'div',\n expandButton: Button,\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n gridWrapper: slot.always(props.gridWrapper, {\n defaultProps: {\n role: 'list',\n ...focusAttrs,\n },\n elementType: 'div',\n }),\n expandButton: slot.optional(props.expandButton, {\n defaultProps: {\n appearance: 'subtle',\n size: 'small',\n shape: 'rounded',\n icon: <ChevronDown12Regular />,\n iconPosition: 'after',\n 'aria-expanded': isExpanded,\n children: isExpanded ? collapseButtonLabel : expandButtonLabel,\n },\n renderByDefault: true,\n elementType: Button,\n }),\n };\n\n state.gridWrapper.ref = useMergedRefs(gridWrapperRef, state.gridWrapper.ref);\n\n // Get the array of children.\n const childrenArray = React.useMemo<(React.ReactChild | React.ReactFragment | React.ReactPortal)[]>(() => {\n return React.Children.toArray(state.root.children);\n }, [state.root.children]);\n\n // Add motion to the children.\n const childrenWithMotion = React.useMemo(\n () =>\n childrenArray.map((child, index) => {\n // Throw error if the child is not a valid React element or is a Fragment.\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error('You should only use PromptStarter components as the children of PromptStarterList.');\n }\n\n // In the collapsed state, if there is one column, we show three children.\n // If there are two or three columns, we show two or three. All children\n // are shown in the expanded state.\n const visibility = (numberOfColumns === 1 && index < 3) || index < numberOfColumns || isExpanded;\n\n return (\n <PromptStarterMotion appear key={index} index={index} visible={visibility} numberOfColumns={numberOfColumns}>\n {child}\n </PromptStarterMotion>\n );\n }),\n [childrenArray, numberOfColumns, isExpanded],\n );\n\n state.root.children = childrenWithMotion;\n\n if (state.expandButton) {\n state.expandButton.onClick = mergeCallbacks(\n state.expandButton.onClick as React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>,\n () => setIsExpanded(!isExpanded),\n );\n }\n\n return state;\n};\n"],"names":["usePromptStarterList_unstable","props","ref","arrowNavigationOptions","expandButtonLabel","collapseButtonLabel","designVersion","useDesignVersion","focusAttrs","useArrowNavigationGroup","axis","memorizeCurrent","isExpanded","setIsExpanded","React","useState","numberOfColumns","setNumberOfColumns","gridWrapperRef","useRef","targetDocument","useFluent","win","defaultView","useEffect","current","promptStarterGrid","updateNumberOfColumns","numColumns","getComputedStyle","gridTemplateColumns","split","length","ro","ResizeObserver","observe","unobserve","state","components","root","gridWrapper","expandButton","Button","slot","always","getIntrinsicElementProps","elementType","defaultProps","role","optional","appearance","size","shape","icon","createElement","ChevronDown12Regular","iconPosition","children","renderByDefault","useMergedRefs","childrenArray","useMemo","Children","toArray","childrenWithMotion","map","child","index","isValidElement","type","Fragment","Error","visibility","PromptStarterMotion","appear","key","visible","onClick","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAwBaA;;;eAAAA;;;;iEAxBU;iCAShB;+BAE0B;4BACI;qCACD;AAW7B,M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AAE;gBACjE,MAAM,IAAIC,MAAM;YAClB;YAEA,0EAA0E;YAC1E,wEAAwE;YACxE,mCAAmC;YACnC,MAAMC,aAAaxD,oBAAqB,KAAKmD,QAAQ,KAAMA,QAAQnD,mBAAmBJ;YAEtF,OAAA,WAAA,GACEE,OAAAwC,aAAA,CAACmB,wCAAAA,EAAAA;gBAAoBC,QAAAA;gBAAOC,KAAKR;gBAAOA,OAAOA;gBAAOS,SAASJ;gBAAYxD,iBAAiBA;eACzFkD;QAGP,IACF;QAACN;QAAe5C;QAAiBJ;KAAW;IAG9CyB,MAAME,IAAI,CAACkB,QAAQ,GAAGO;IAEtB,IAAI3B,MAAMI,YAAY,EAAE;QACtBJ,MAAMI,YAAY,CAACoC,OAAO,GAAGC,IAAAA,+BAAAA,EAC3BzC,MAAMI,YAAY,CAACoC,OAAO,EAC1B,IAAMhE,cAAc,CAACD;IAEzB;IAEA,OAAOyB;AACT"}
|
|
1
|
+
{"version":3,"sources":["usePromptStarterList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n slot,\n Button,\n useArrowNavigationGroup,\n mergeCallbacks,\n useFluent,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport type { PromptStarterListProps, PromptStarterListState } from './PromptStarterList.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\nimport { ChevronDown12Regular } from '@fluentui/react-icons';\nimport { PromptStarterMotion } from '../PromptStarter/promptStarterMotion';\nimport { useControllableState } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render PromptStarterList.\n *\n * The returned state can be modified with hooks such as usePromptStarterListStyles_unstable,\n * before being passed to renderPromptStarterList_unstable.\n *\n * @param props - props from this instance of PromptStarterList\n * @param ref - reference to root HTMLElement of PromptStarterList\n */\nexport const usePromptStarterList_unstable = (\n props: PromptStarterListProps,\n ref: React.Ref<HTMLDivElement>,\n): PromptStarterListState => {\n const {\n arrowNavigationOptions,\n expandButtonLabel = 'Show more',\n collapseButtonLabel = 'Show less',\n onExpandedChange,\n animateOnMount = true,\n visibleRows = 1,\n } = props;\n const designVersion = useDesignVersion(props.designVersion);\n const focusAttrs = useArrowNavigationGroup({\n ...arrowNavigationOptions,\n axis: arrowNavigationOptions?.axis ?? 'both',\n memorizeCurrent: arrowNavigationOptions?.memorizeCurrent ?? true,\n });\n\n const [isExpanded, setIsExpanded] = useControllableState({\n state: props.isExpanded,\n defaultState: props.defaultExpanded,\n initialState: false,\n });\n const toggleExpanded = React.useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n setIsExpanded(prevExpanded => {\n onExpandedChange?.(event, { isExpanded: !prevExpanded });\n return !prevExpanded;\n });\n },\n [setIsExpanded, onExpandedChange],\n );\n const [numberOfColumns, setNumberOfColumns] = React.useState<number>(3);\n\n const gridWrapperRef = React.useRef<HTMLDivElement>(null);\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n React.useEffect(() => {\n if (!win || !gridWrapperRef.current) return;\n\n const promptStarterGrid = gridWrapperRef.current;\n\n const updateNumberOfColumns = () => {\n const numColumns = win.getComputedStyle(promptStarterGrid).gridTemplateColumns.split(' ').length;\n setNumberOfColumns(numColumns);\n };\n\n const ro = new win.ResizeObserver(updateNumberOfColumns);\n ro.observe(promptStarterGrid);\n\n return () => {\n ro.unobserve(promptStarterGrid);\n };\n }, [win]);\n\n const state: PromptStarterListState = {\n numberOfColumns: numberOfColumns,\n isExpanded: isExpanded,\n designVersion,\n components: {\n root: 'div',\n gridWrapper: 'div',\n actions: 'span',\n expandButton: Button,\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n gridWrapper: slot.always(props.gridWrapper, {\n defaultProps: {\n role: 'list',\n ...focusAttrs,\n },\n elementType: 'div',\n }),\n actions: slot.optional(props.actions, {\n elementType: 'span',\n }),\n expandButton: slot.optional(props.expandButton, {\n defaultProps: {\n appearance: 'subtle',\n size: 'small',\n shape: 'rounded',\n icon: <ChevronDown12Regular />,\n iconPosition: 'after',\n 'aria-expanded': isExpanded,\n children: isExpanded ? collapseButtonLabel : expandButtonLabel,\n },\n renderByDefault: true,\n elementType: Button,\n }),\n };\n\n state.gridWrapper.ref = useMergedRefs(gridWrapperRef, state.gridWrapper.ref);\n\n // Get the array of children.\n const childrenArray = React.useMemo<\n (React.ReactElement<any> | number | string | Iterable<React.ReactNode> | React.ReactPortal)[]\n >(() => {\n return React.Children.toArray(state.root.children);\n }, [state.root.children]);\n\n // Add motion to the children.\n const childrenWithMotion = React.useMemo(\n () =>\n childrenArray.map((child, index) => {\n // Throw error if the child is not a valid React element or is a Fragment.\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error('You should only use PromptStarter components as the children of PromptStarterList.');\n }\n\n // In the collapsed state, if there is one column, we show three children. If there are two or three columns,\n // we show two or three (or four or six, if there are two visible rows). All children are shown in the isExpanded state.\n const visibility = (numberOfColumns === 1 && index < 3) || index < numberOfColumns * visibleRows || isExpanded;\n\n return (\n <PromptStarterMotion\n appear={animateOnMount}\n key={index}\n index={index}\n visible={visibility}\n numberOfColumns={numberOfColumns}\n >\n {child}\n </PromptStarterMotion>\n );\n }),\n [childrenArray, numberOfColumns, isExpanded],\n );\n\n state.root.children = childrenWithMotion;\n\n const numChildren = childrenArray.length;\n if ((numberOfColumns === 1 && numChildren <= 3) || numChildren <= numberOfColumns * visibleRows) {\n state.expandButton = undefined;\n }\n\n if (state.expandButton) {\n state.expandButton.onClick = mergeCallbacks(\n state.expandButton.onClick as React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>,\n toggleExpanded,\n );\n }\n\n return state;\n};\n"],"names":["usePromptStarterList_unstable","props","ref","arrowNavigationOptions","expandButtonLabel","collapseButtonLabel","onExpandedChange","animateOnMount","visibleRows","designVersion","useDesignVersion","focusAttrs","useArrowNavigationGroup","axis","memorizeCurrent","isExpanded","setIsExpanded","useControllableState","state","defaultState","defaultExpanded","initialState","toggleExpanded","React","useCallback","event","prevExpanded","numberOfColumns","setNumberOfColumns","useState","gridWrapperRef","useRef","targetDocument","useFluent","win","defaultView","useEffect","current","promptStarterGrid","updateNumberOfColumns","numColumns","getComputedStyle","gridTemplateColumns","split","length","ro","ResizeObserver","observe","unobserve","components","root","gridWrapper","actions","expandButton","Button","slot","always","getIntrinsicElementProps","elementType","defaultProps","role","optional","appearance","size","shape","icon","createElement","ChevronDown12Regular","iconPosition","children","renderByDefault","useMergedRefs","childrenArray","useMemo","Children","toArray","childrenWithMotion","map","child","index","isValidElement","type","Fragment","Error","visibility","PromptStarterMotion","appear","key","visible","numChildren","undefined","onClick","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAyBaA;;;eAAAA;;;;iEAzBU;iCAShB;+BAE0B;4BACI;qCACD;gCACC;AAW9B,MAAMA,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EACJC,sBAAsB,EACtBC,oBAAoB,WAAW,EAC/BC,sBAAsB,WAAW,EACjCC,gBAAgB,EAChBC,iBAAiB,IAAI,EACrBC,cAAc,CAAC,EAChB,GAAGP;IACJ,MAAMQ,gBAAgBC,IAAAA,+BAAAA,EAAiBT,MAAMQ,aAAa;QAGlDN,8BACWA;IAHnB,MAAMQ,aAAaC,IAAAA,wCAAAA,EAAwB;QACzC,GAAGT,sBAAsB;QACzBU,MAAMV,CAAAA,+BAAAA,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBU,IAAI,AAAJA,MAAI,QAA5BV,iCAAAA,KAAAA,IAAAA,+BAAgC;QACtCW,iBAAiBX,CAAAA,0CAAAA,2BAAAA,QAAAA,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAwBW,eAAe,AAAfA,MAAe,QAAvCX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MA,QAAQpD,kBAAkBnB,eAAeO;YAEpG,OAAA,WAAA,GACEQ,OAAA2C,aAAA,CAACmB,wCAAAA,EAAAA;gBACCC,QAAQ/E;gBACRgF,KAAKR;gBACLA,OAAOA;gBACPS,SAASJ;gBACTzD,iBAAiBA;eAEhBmD;QAGP,IACF;QAACN;QAAe7C;QAAiBZ;KAAW;IAG9CG,MAAMgC,IAAI,CAACmB,QAAQ,GAAGO;IAEtB,MAAMa,cAAcjB,cAAc5B,MAAM;IACxC,IAAIjB,oBAAqB,KAAK8D,eAAe,KAAMA,eAAe9D,kBAAkBnB,aAAa;QAC/FU,MAAMmC,YAAY,GAAGqC;IACvB;IAEA,IAAIxE,MAAMmC,YAAY,EAAE;QACtBnC,MAAMmC,YAAY,CAACsC,OAAO,GAAGC,IAAAA,+BAAAA,EAC3B1E,MAAMmC,YAAY,CAACsC,OAAO,EAC1BrE;IAEJ;IAEA,OAAOJ;AACT"}
|
|
@@ -20,15 +20,21 @@ const _reactcomponents = require("@fluentui/react-components");
|
|
|
20
20
|
const promptStarterListClassNames = {
|
|
21
21
|
root: 'fai-PromptStarterList',
|
|
22
22
|
gridWrapper: 'fai-PromptStarterList__gridWrapper',
|
|
23
|
+
actions: 'fai-PromptStarterList__actions',
|
|
23
24
|
expandButton: 'fai-PromptStarterList__expandButton'
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* Styles for the root slot
|
|
27
|
-
*/ const useRootClassName = (0, _reactcomponents.__resetStyles)("
|
|
28
|
-
".
|
|
28
|
+
*/ const useRootClassName = (0, _reactcomponents.__resetStyles)("r1svwxtk", null, [
|
|
29
|
+
".r1svwxtk{display:grid;grid-template-columns:1fr max-content max-content;grid-template-rows:max-content max-content;grid-template-areas:\"grid grid grid\" \". actions expandButton\";max-width:772px;row-gap:var(--spacingVerticalXL);column-gap:var(--spacingHorizontalSNudge);}"
|
|
29
30
|
]);
|
|
30
31
|
const useStyles = (0, _reactcomponents.__styles)({
|
|
31
32
|
gridWrapper: {
|
|
33
|
+
Bw0ie65: 0,
|
|
34
|
+
Br312pm: 0,
|
|
35
|
+
nk6f5a: 0,
|
|
36
|
+
Ijaq50: 0,
|
|
37
|
+
Bq1tomu: "fl4njfv",
|
|
32
38
|
mc9l5x: "f13qh94s",
|
|
33
39
|
i8kkvl: 0,
|
|
34
40
|
Belr9w4: 0,
|
|
@@ -37,8 +43,19 @@ const useStyles = (0, _reactcomponents.__styles)({
|
|
|
37
43
|
Budl1dq: "fvo7o13",
|
|
38
44
|
Bxotwcr: "f1nkeedh"
|
|
39
45
|
},
|
|
46
|
+
actions: {
|
|
47
|
+
Bw0ie65: 0,
|
|
48
|
+
Br312pm: 0,
|
|
49
|
+
nk6f5a: 0,
|
|
50
|
+
Ijaq50: 0,
|
|
51
|
+
Bq1tomu: "fceb517"
|
|
52
|
+
},
|
|
40
53
|
expandButton: {
|
|
41
|
-
|
|
54
|
+
Bw0ie65: 0,
|
|
55
|
+
Br312pm: 0,
|
|
56
|
+
nk6f5a: 0,
|
|
57
|
+
Ijaq50: 0,
|
|
58
|
+
Bq1tomu: "f1najgz0",
|
|
42
59
|
wrk2wx: "f11k2d1d",
|
|
43
60
|
dutsh0: "f1iwh30k",
|
|
44
61
|
B4u5nao: "fn63aq9",
|
|
@@ -53,6 +70,12 @@ const useStyles = (0, _reactcomponents.__styles)({
|
|
|
53
70
|
}
|
|
54
71
|
}, {
|
|
55
72
|
d: [
|
|
73
|
+
[
|
|
74
|
+
".fl4njfv{grid-area:grid;}",
|
|
75
|
+
{
|
|
76
|
+
p: -1
|
|
77
|
+
}
|
|
78
|
+
],
|
|
56
79
|
".f13qh94s{display:grid;}",
|
|
57
80
|
[
|
|
58
81
|
".f1p93rwu{gap:var(--spacingHorizontalL);}",
|
|
@@ -63,7 +86,18 @@ const useStyles = (0, _reactcomponents.__styles)({
|
|
|
63
86
|
".f4wu0r3{grid-auto-columns:max-content;}",
|
|
64
87
|
".fvo7o13{grid-template-columns:repeat(auto-fit, minmax(214px, 1fr));}",
|
|
65
88
|
".f1nkeedh{grid-auto-flow:unset;}",
|
|
66
|
-
|
|
89
|
+
[
|
|
90
|
+
".fceb517{grid-area:actions;}",
|
|
91
|
+
{
|
|
92
|
+
p: -1
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
".f1najgz0{grid-area:expandButton;}",
|
|
97
|
+
{
|
|
98
|
+
p: -1
|
|
99
|
+
}
|
|
100
|
+
],
|
|
67
101
|
".f11k2d1d .fui-Button__icon{font-size:12px;}",
|
|
68
102
|
".f1iwh30k .fui-Button__icon{height:12px;}",
|
|
69
103
|
".fn63aq9 .fui-Button__icon{width:12px;}",
|
|
@@ -82,6 +116,9 @@ const usePromptStarterListStyles_unstable = (state)=>{
|
|
|
82
116
|
const styles = useStyles();
|
|
83
117
|
state.root.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.root, rootClassName, state.root.className);
|
|
84
118
|
state.gridWrapper.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.gridWrapper, styles.gridWrapper, state.gridWrapper.className);
|
|
119
|
+
if (state.actions) {
|
|
120
|
+
state.actions.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.actions, styles.actions, state.actions.className);
|
|
121
|
+
}
|
|
85
122
|
if (state.expandButton) {
|
|
86
123
|
state.expandButton.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.expandButton, styles.expandButton, isExpanded && styles.expandButtonExpanded, state.expandButton.className);
|
|
87
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePromptStarterListStyles.styles.ts"],"sourcesContent":["import { buttonClassNames, makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport type { PromptStarterListSlots, PromptStarterListState } from './PromptStarterList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\n\nexport const promptStarterListClassNames: SlotClassNames<PromptStarterListSlots> = {\n root: 'fai-PromptStarterList',\n gridWrapper: 'fai-PromptStarterList__gridWrapper',\n expandButton: 'fai-PromptStarterList__expandButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: '
|
|
1
|
+
{"version":3,"sources":["usePromptStarterListStyles.styles.ts"],"sourcesContent":["import { buttonClassNames, makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport type { PromptStarterListSlots, PromptStarterListState } from './PromptStarterList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\n\nexport const promptStarterListClassNames: SlotClassNames<PromptStarterListSlots> = {\n root: 'fai-PromptStarterList',\n gridWrapper: 'fai-PromptStarterList__gridWrapper',\n actions: 'fai-PromptStarterList__actions',\n expandButton: 'fai-PromptStarterList__expandButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: '1fr max-content max-content',\n gridTemplateRows: 'max-content max-content',\n gridTemplateAreas: `\"grid grid grid\"\n \". actions expandButton\"`,\n maxWidth: '772px',\n rowGap: tokens.spacingVerticalXL,\n columnGap: tokens.spacingHorizontalSNudge,\n});\n\nconst useStyles = makeStyles({\n gridWrapper: {\n gridArea: 'grid',\n display: 'grid',\n gap: tokens.spacingHorizontalL,\n gridAutoColumns: 'max-content',\n\n gridTemplateColumns: `repeat(auto-fit, minmax(214px, 1fr))`,\n gridAutoFlow: 'unset',\n },\n\n actions: {\n gridArea: 'actions',\n },\n\n expandButton: {\n gridArea: 'expandButton',\n [`& .${buttonClassNames.icon}`]: {\n fontSize: '12px',\n height: '12px',\n width: '12px',\n },\n ':hover': {\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n ':hover:active': {\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n },\n\n expandButtonExpanded: {\n [`& > .${buttonClassNames.icon}`]: {\n transform: 'rotate(180deg)',\n },\n },\n});\n\n/**\n * Apply styling to the PromptStarterList slots based on the state\n */\nexport const usePromptStarterListStyles_unstable = (state: PromptStarterListState): PromptStarterListState => {\n 'use no memo';\n\n const { isExpanded } = state;\n\n const rootClassName = useRootClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(promptStarterListClassNames.root, rootClassName, state.root.className);\n state.gridWrapper.className = mergeClasses(\n promptStarterListClassNames.gridWrapper,\n styles.gridWrapper,\n state.gridWrapper.className,\n );\n if (state.actions) {\n state.actions.className = mergeClasses(\n promptStarterListClassNames.actions,\n styles.actions,\n state.actions.className,\n );\n }\n if (state.expandButton) {\n state.expandButton.className = mergeClasses(\n promptStarterListClassNames.expandButton,\n styles.expandButton,\n isExpanded && styles.expandButtonExpanded,\n state.expandButton.className,\n );\n }\n\n return state;\n};\n"],"names":["promptStarterListClassNames","gridWrapper","root","actions","expandButton","display","__resetStyles","gridTemplateColumns","gridTemplateRows","gridTemplateAreas","maxWidth","rowGap","tokens","columnGap","mc9l5x","i8kkvl","useStyles","gridArea","gridAutoColumns","gridAutoFlow","Bw0ie65","Ijaq50","buttonClassNames","fontSize","height","width","expandButtonExpanded","p","usePromptStarterListStyles_unstable","state","isExpanded","rootClassName","useRootClassName","styles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,2BAAAA;eAAAA;;IAyELC,mCACJD;eADIC;;;iCA9E4D;AAK7D,MAAMD,8BAAsE;UACjFE;iBACAD;aACAE;kBACAC;AACF;AAEA;;CAEC,SAECC,mBAASC,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MACTC,YAAAA,IAAAA,yBAAqB,EAAA;iBACrBC;QACAC,SAAAA;;QAEAC,QAAAA;QACAC,QAAQC;QACRC,SAAAA;QACFC,QAAA;QAEAC,QAAMC;QACJf,SAAAA;gBACEgB;gBACAZ;iBACKO;iBACLM;;aAGAC;QACFC,SAAA;QAEAjB,SAAS;gBACPc;QACFI,QAAA;QAEAjB,SAAAA;;kBAESkB;iBACLC;iBACAC;gBACAC;gBACF;iBACA;gBACE;;iBAEA;iBACF;gBACA;;0BAEWb;iBACT;YAAA;YAAA;SAAA;;;OAIJc;QAAAA;YAAAA;YAAsB;oBACpB;;;;QACa;YAAA;YAAA;oBACb;;SACF;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBACFC,GAAA,CAAA;YAEA;SAAA;QAAA;YAAA;YAAA;;YAEC;SACD;QAAA;QAAaC;QAAuCC;QAAAA;QAAAA;KAAAA;OAClD;QAAA;QAAA;KAAA;;AAOAA,MAAM5B,sCACJD,CAAAA;;UAUF,EACA8B,UAAU1B;UAOV2B,gBAAAC;UAEAC,SAAOJ;IACPA,MAAA3B,IAAA,CAAAgC,SAAA,GAAAC,IAAAA,6BAAA,EAAAnC,4BAAAE,IAAA,EAAA6B,eAAAF,MAAA3B,IAAA,CAAAgC,SAAA"}
|
|
@@ -21,26 +21,35 @@ const _tokens = require("@fluentui-copilot/tokens");
|
|
|
21
21
|
const promptStarterListClassNames = {
|
|
22
22
|
root: 'fai-PromptStarterList',
|
|
23
23
|
gridWrapper: 'fai-PromptStarterList__gridWrapper',
|
|
24
|
+
actions: 'fai-PromptStarterList__actions',
|
|
24
25
|
expandButton: 'fai-PromptStarterList__expandButton'
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* Styles for the root slot
|
|
28
29
|
*/ const useRootClassName = (0, _reactcomponents.makeResetStyles)({
|
|
29
|
-
display: '
|
|
30
|
-
|
|
30
|
+
display: 'grid',
|
|
31
|
+
gridTemplateColumns: '1fr max-content max-content',
|
|
32
|
+
gridTemplateRows: 'max-content max-content',
|
|
33
|
+
gridTemplateAreas: `"grid grid grid"
|
|
34
|
+
". actions expandButton"`,
|
|
31
35
|
maxWidth: '772px',
|
|
32
|
-
|
|
36
|
+
rowGap: _tokens.tokens.spacingVerticalXL,
|
|
37
|
+
columnGap: _tokens.tokens.spacingHorizontalSNudge
|
|
33
38
|
});
|
|
34
39
|
const useStyles = (0, _reactcomponents.makeStyles)({
|
|
35
40
|
gridWrapper: {
|
|
41
|
+
gridArea: 'grid',
|
|
36
42
|
display: 'grid',
|
|
37
43
|
gap: _tokens.tokens.spacingHorizontalL,
|
|
38
44
|
gridAutoColumns: 'max-content',
|
|
39
45
|
gridTemplateColumns: `repeat(auto-fit, minmax(214px, 1fr))`,
|
|
40
46
|
gridAutoFlow: 'unset'
|
|
41
47
|
},
|
|
48
|
+
actions: {
|
|
49
|
+
gridArea: 'actions'
|
|
50
|
+
},
|
|
42
51
|
expandButton: {
|
|
43
|
-
|
|
52
|
+
gridArea: 'expandButton',
|
|
44
53
|
[`& .${_reactcomponents.buttonClassNames.icon}`]: {
|
|
45
54
|
fontSize: '12px',
|
|
46
55
|
height: '12px',
|
|
@@ -70,6 +79,9 @@ const usePromptStarterListStyles_unstable = (state)=>{
|
|
|
70
79
|
const styles = useStyles();
|
|
71
80
|
state.root.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.root, rootClassName, state.root.className);
|
|
72
81
|
state.gridWrapper.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.gridWrapper, styles.gridWrapper, state.gridWrapper.className);
|
|
82
|
+
if (state.actions) {
|
|
83
|
+
state.actions.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.actions, styles.actions, state.actions.className);
|
|
84
|
+
}
|
|
73
85
|
if (state.expandButton) {
|
|
74
86
|
state.expandButton.className = (0, _reactcomponents.mergeClasses)(promptStarterListClassNames.expandButton, styles.expandButton, isExpanded && styles.expandButtonExpanded, state.expandButton.className);
|
|
75
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePromptStarterListStyles.styles.ts"],"sourcesContent":["import { buttonClassNames, makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport type { PromptStarterListSlots, PromptStarterListState } from './PromptStarterList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\n\nexport const promptStarterListClassNames: SlotClassNames<PromptStarterListSlots> = {\n root: 'fai-PromptStarterList',\n gridWrapper: 'fai-PromptStarterList__gridWrapper',\n expandButton: 'fai-PromptStarterList__expandButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: '
|
|
1
|
+
{"version":3,"sources":["usePromptStarterListStyles.styles.ts"],"sourcesContent":["import { buttonClassNames, makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport type { PromptStarterListSlots, PromptStarterListState } from './PromptStarterList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\n\nexport const promptStarterListClassNames: SlotClassNames<PromptStarterListSlots> = {\n root: 'fai-PromptStarterList',\n gridWrapper: 'fai-PromptStarterList__gridWrapper',\n actions: 'fai-PromptStarterList__actions',\n expandButton: 'fai-PromptStarterList__expandButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: '1fr max-content max-content',\n gridTemplateRows: 'max-content max-content',\n gridTemplateAreas: `\"grid grid grid\"\n \". actions expandButton\"`,\n maxWidth: '772px',\n rowGap: tokens.spacingVerticalXL,\n columnGap: tokens.spacingHorizontalSNudge,\n});\n\nconst useStyles = makeStyles({\n gridWrapper: {\n gridArea: 'grid',\n display: 'grid',\n gap: tokens.spacingHorizontalL,\n gridAutoColumns: 'max-content',\n\n gridTemplateColumns: `repeat(auto-fit, minmax(214px, 1fr))`,\n gridAutoFlow: 'unset',\n },\n\n actions: {\n gridArea: 'actions',\n },\n\n expandButton: {\n gridArea: 'expandButton',\n [`& .${buttonClassNames.icon}`]: {\n fontSize: '12px',\n height: '12px',\n width: '12px',\n },\n ':hover': {\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n ':hover:active': {\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n },\n\n expandButtonExpanded: {\n [`& > .${buttonClassNames.icon}`]: {\n transform: 'rotate(180deg)',\n },\n },\n});\n\n/**\n * Apply styling to the PromptStarterList slots based on the state\n */\nexport const usePromptStarterListStyles_unstable = (state: PromptStarterListState): PromptStarterListState => {\n 'use no memo';\n\n const { isExpanded } = state;\n\n const rootClassName = useRootClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(promptStarterListClassNames.root, rootClassName, state.root.className);\n state.gridWrapper.className = mergeClasses(\n promptStarterListClassNames.gridWrapper,\n styles.gridWrapper,\n state.gridWrapper.className,\n );\n if (state.actions) {\n state.actions.className = mergeClasses(\n promptStarterListClassNames.actions,\n styles.actions,\n state.actions.className,\n );\n }\n if (state.expandButton) {\n state.expandButton.className = mergeClasses(\n promptStarterListClassNames.expandButton,\n styles.expandButton,\n isExpanded && styles.expandButtonExpanded,\n state.expandButton.className,\n );\n }\n\n return state;\n};\n"],"names":["promptStarterListClassNames","usePromptStarterListStyles_unstable","root","gridWrapper","actions","expandButton","useRootClassName","makeResetStyles","display","gridTemplateColumns","gridTemplateRows","gridTemplateAreas","maxWidth","rowGap","tokens","spacingVerticalXL","columnGap","spacingHorizontalSNudge","useStyles","makeStyles","gridArea","gap","spacingHorizontalL","gridAutoColumns","gridAutoFlow","buttonClassNames","icon","fontSize","height","width","color","colorNeutralForeground2Hover","colorNeutralForeground2Pressed","expandButtonExpanded","transform","state","isExpanded","rootClassName","styles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,2BAAAA;eAAAA;;IAiEAC,mCAAAA;eAAAA;;;iCAtE+D;w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MAAMjC,IAAI,CAACqC,SAAS,GAAGC,IAAAA,6BAAAA,EAAaxC,4BAA4BE,IAAI,EAAEmC,eAAeF,MAAMjC,IAAI,CAACqC,SAAS;IACzGJ,MAAMhC,WAAW,CAACoC,SAAS,GAAGC,IAAAA,6BAAAA,EAC5BxC,4BAA4BG,WAAW,EACvCmC,OAAOnC,WAAW,EAClBgC,MAAMhC,WAAW,CAACoC,SAAS;IAE7B,IAAIJ,MAAM/B,OAAO,EAAE;QACjB+B,MAAM/B,OAAO,CAACmC,SAAS,GAAGC,IAAAA,6BAAAA,EACxBxC,4BAA4BI,OAAO,EACnCkC,OAAOlC,OAAO,EACd+B,MAAM/B,OAAO,CAACmC,SAAS;IAE3B;IACA,IAAIJ,MAAM9B,YAAY,EAAE;QACtB8B,MAAM9B,YAAY,CAACkC,SAAS,GAAGC,IAAAA,6BAAAA,EAC7BxC,4BAA4BK,YAAY,EACxCiC,OAAOjC,YAAY,EACnB+B,cAAcE,OAAOL,oBAAoB,EACzCE,MAAM9B,YAAY,CAACkC,SAAS;IAEhC;IAEA,OAAOJ;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PromptStarterListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport type { PromptStarterListContextValue } from '../PromptStarterList';\n\nexport const PromptStarterListContext = createContext<PromptStarterListContextValue | undefined>(undefined);\n\nconst promptStarterListContextDefaultValue: PromptStarterListContextValue = {\n numberOfColumns: 3,\n};\n\nexport const usePromptStarterListContext = <T>(selector: ContextSelector<PromptStarterListContextValue, T>) =>\n useContextSelector(PromptStarterListContext, (ctx = promptStarterListContextDefaultValue) => selector(ctx));\nexport const PromptStarterListProvider = PromptStarterListContext.Provider;\n"],"names":["PromptStarterListContext","PromptStarterListProvider","usePromptStarterListContext","createContext","undefined","promptStarterListContextDefaultValue","numberOfColumns","selector","useContextSelector","ctx","Provider"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAQAC,yBAAAA;eAAAA;;IAFAC,2BAAAA;eAAAA;;;sCAVqC;AAI3C,MAAMF,2BAA2BG,IAAAA,mCAAAA,EAAyDC;AAEjG,MAAMC,uCAAsE;IAC1EC,iBAAiB;AACnB;AAEO,MAAMJ,8BAA8B,CAAIK,WAC7CC,IAAAA,wCAAAA,EAAmBR,0BAA0B,CAACS,MAAMJ,oCAAoC,GAAKE,SAASE;AACjG,MAAMR,4BAA4BD,yBAAyBU,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["PromptStarterListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport type { PromptStarterListContextValue } from '../PromptStarterList';\n\nexport const PromptStarterListContext = createContext<PromptStarterListContextValue | undefined>(undefined);\n\nconst promptStarterListContextDefaultValue: PromptStarterListContextValue = {\n numberOfColumns: 3,\n};\n\nexport const usePromptStarterListContext = <T>(selector: ContextSelector<PromptStarterListContextValue, T>): T =>\n useContextSelector(PromptStarterListContext, (ctx = promptStarterListContextDefaultValue) => selector(ctx));\nexport const PromptStarterListProvider = PromptStarterListContext.Provider;\n"],"names":["PromptStarterListContext","PromptStarterListProvider","usePromptStarterListContext","createContext","undefined","promptStarterListContextDefaultValue","numberOfColumns","selector","useContextSelector","ctx","Provider"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAQAC,yBAAAA;eAAAA;;IAFAC,2BAAAA;eAAAA;;;sCAVqC;AAI3C,MAAMF,2BAA2BG,IAAAA,mCAAAA,EAAyDC;AAEjG,MAAMC,uCAAsE;IAC1EC,iBAAiB;AACnB;AAEO,MAAMJ,8BAA8B,CAAIK,WAC7CC,IAAAA,wCAAAA,EAAmBR,0BAA0B,CAACS,MAAMJ,oCAAoC,GAAKE,SAASE;AACjG,MAAMR,4BAA4BD,yBAAyBU,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-prompt-starter",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.8",
|
|
4
4
|
"description": "A Fluent AI package",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/react-provider": "^0.12.
|
|
16
|
-
"@fluentui-copilot/tokens": "^0.3.
|
|
15
|
+
"@fluentui-copilot/react-provider": "^0.12.6",
|
|
16
|
+
"@fluentui-copilot/tokens": "^0.3.15",
|
|
17
17
|
"@swc/helpers": "^0.5.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@fluentui/react-components": ">=9.
|
|
21
|
-
"@fluentui/react-context-selector": ">=9.2.
|
|
20
|
+
"@fluentui/react-components": ">=9.70.0 <10.0.0",
|
|
21
|
+
"@fluentui/react-context-selector": ">=9.2.7 <10.0.0",
|
|
22
22
|
"@fluentui/react-icons": ">=2.0.303 <3.0.0",
|
|
23
|
-
"@fluentui/react-jsx-runtime": ">=9.
|
|
24
|
-
"@fluentui/react-shared-contexts": ">=9.
|
|
25
|
-
"@fluentui/react-utilities": ">=9.
|
|
26
|
-
"@types/react": ">=16.14.0 <
|
|
27
|
-
"@types/react-dom": ">=16.9.8 <
|
|
28
|
-
"react": ">=16.14.0 <
|
|
29
|
-
"react-dom": ">=16.14.0 <
|
|
23
|
+
"@fluentui/react-jsx-runtime": ">=9.2.0 <10.0.0",
|
|
24
|
+
"@fluentui/react-shared-contexts": ">=9.25.1 <10.0.0",
|
|
25
|
+
"@fluentui/react-utilities": ">=9.24.1 <10.0.0",
|
|
26
|
+
"@types/react": ">=16.14.0 <20.0.0",
|
|
27
|
+
"@types/react-dom": ">=16.9.8 <20.0.0",
|
|
28
|
+
"react": ">=16.14.0 <20.0.0",
|
|
29
|
+
"react-dom": ">=16.14.0 <20.0.0"
|
|
30
30
|
},
|
|
31
31
|
"beachball": {
|
|
32
32
|
"disallowedChangeTypes": [
|