@activecollab/components 2.0.557 → 2.0.559
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/cjs/components/Autocomplete/Autocomplete.js +3 -3
- package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/Icons/collection/OpenBook.js +66 -0
- package/dist/cjs/components/Icons/collection/OpenBook.js.map +1 -0
- package/dist/cjs/components/Icons/collection/SendBlank.js +3 -1
- package/dist/cjs/components/Icons/collection/SendBlank.js.map +1 -1
- package/dist/cjs/components/Icons/collection/SendFilled.js +2 -2
- package/dist/cjs/components/Icons/collection/SendFilled.js.map +1 -1
- package/dist/cjs/components/Icons/collection/index.js +7 -0
- package/dist/cjs/components/Icons/collection/index.js.map +1 -1
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js +4 -2
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
- package/dist/cjs/components/PillButton/Styles.js +13 -3
- package/dist/cjs/components/PillButton/Styles.js.map +1 -1
- package/dist/cjs/components/PillGroup/Styles.js +3 -1
- package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
- package/dist/cjs/components/Sheet/Sheet.js +150 -41
- package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
- package/dist/cjs/components/Sheet/Styles.js +37 -15
- package/dist/cjs/components/Sheet/Styles.js.map +1 -1
- package/dist/cjs/hooks/useResizablePanel.js +5 -3
- package/dist/cjs/hooks/useResizablePanel.js.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +3 -3
- package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/Icons/collection/OpenBook.d.ts +32 -0
- package/dist/esm/components/Icons/collection/OpenBook.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/OpenBook.js +59 -0
- package/dist/esm/components/Icons/collection/OpenBook.js.map +1 -0
- package/dist/esm/components/Icons/collection/SendBlank.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/SendBlank.js +3 -1
- package/dist/esm/components/Icons/collection/SendBlank.js.map +1 -1
- package/dist/esm/components/Icons/collection/SendFilled.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/SendFilled.js +2 -2
- package/dist/esm/components/Icons/collection/SendFilled.js.map +1 -1
- package/dist/esm/components/Icons/collection/index.d.ts +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/index.js +1 -0
- package/dist/esm/components/Icons/collection/index.js.map +1 -1
- package/dist/esm/components/ObjectLayout/ObjectLayout.d.ts +2 -0
- package/dist/esm/components/ObjectLayout/ObjectLayout.d.ts.map +1 -1
- package/dist/esm/components/ObjectLayout/ObjectLayout.js +4 -2
- package/dist/esm/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/esm/components/PillButton/PillButton.d.ts +2 -2
- package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
- package/dist/esm/components/PillButton/PillButton.js.map +1 -1
- package/dist/esm/components/PillButton/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillButton/Styles.js +10 -2
- package/dist/esm/components/PillButton/Styles.js.map +1 -1
- package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/Styles.js +3 -1
- package/dist/esm/components/PillGroup/Styles.js.map +1 -1
- package/dist/esm/components/Sheet/Sheet.d.ts +11 -0
- package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Sheet.js +139 -41
- package/dist/esm/components/Sheet/Sheet.js.map +1 -1
- package/dist/esm/components/Sheet/Styles.d.ts +3 -0
- package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Styles.js +35 -13
- package/dist/esm/components/Sheet/Styles.js.map +1 -1
- package/dist/esm/hooks/useResizablePanel.d.ts +4 -1
- package/dist/esm/hooks/useResizablePanel.d.ts.map +1 -1
- package/dist/esm/hooks/useResizablePanel.js +5 -3
- package/dist/esm/hooks/useResizablePanel.js.map +1 -1
- package/dist/index.js +786 -583
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectLayout.js","names":["React","forwardRef","useCallback","useEffect","useRef","useState","classnames","CONTAINER_CSS","StyledBand","StyledColumns","StyledHeader","StyledLeft","StyledMain","StyledObjectLayout","StyledPanel","StyledPanelHandle","StyledPart","StyledPartColumns","StyledProperties","StyledRail","StyledSplit","StyledStream","StyledTopBar","clampPanelWidth","useResizablePanel","useContainerCss","useOpeningRailHeight","resetKey","railRef","isFrozen","_useState","height","setHeight","rail","current","measure","offsetHeight","ResizeObserver","undefined","observer","observe","disconnect","freeze","noChange","ObjectLayout","_ref","ref","topBar","band","properties","main","stream","panel","_ref$panelWidth","panelWidth","_ref$panelMin","panelMin","_ref$panelMax","panelMax","_ref$mainMin","mainMin","onPanelWidthChange","_ref$resizeLabel","resizeLabel","_ref$ownScroll","ownScroll","className","testId","rest","_objectWithoutPropertiesLoose","_excluded","hasPanel","hasRail","_useOpeningRailHeight","_useResizablePanel","side","width","min","max","onChange","handleProps","part","name","header","createElement","$panel","bandNode","_extends","$fill","$ownScroll","style","$padded","label","onPointerDownCapture","onKeyDownCapture","displayName"],"sources":["../../../../src/components/ObjectLayout/ObjectLayout.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n CONTAINER_CSS,\n StyledBand,\n StyledColumns,\n StyledHeader,\n StyledLeft,\n StyledMain,\n StyledObjectLayout,\n StyledPanel,\n StyledPanelHandle,\n StyledPart,\n StyledPartColumns,\n StyledProperties,\n StyledRail,\n StyledSplit,\n StyledStream,\n StyledTopBar,\n} from \"./Styles\";\nimport { clampPanelWidth, useResizablePanel } from \"../../hooks\";\nimport { useContainerCss } from \"../../utils/useContainerCss\";\n\nexport interface IObjectLayoutProps extends HTMLAttributes<HTMLDivElement> {\n /** Sticky bar at the top edge. */\n topBar?: ReactNode;\n /** Sticky band under the top bar, for the title. */\n band?: ReactNode;\n /** A block above the main content. */\n properties?: ReactNode;\n main?: ReactNode;\n /** The 300px right column. Without a rail and a panel the layout has one column. */\n rail?: ReactNode;\n /** Rail mode: content after the main column that can hold a part on the bottom edge. */\n stream?: ReactNode;\n /** Replaces the rail with a panel at the full height of the layout. */\n panel?: ReactNode;\n panelWidth?: number;\n panelMin?: number;\n panelMax?: number;\n /** The width the main part keeps beside the panel. */\n mainMin?: number;\n /** With it the panel has a resize handle. Called with a whole pixel. */\n onPanelWidthChange?: (width: number) => void;\n /** The accessible name of the resize handle. */\n resizeLabel?: string;\n /** Panel mode: the layout has the height of its parent and the main part scrolls by itself. */\n ownScroll?: boolean;\n /** Rail mode: a new value measures the opening height of the rail again. */\n resetKey?: string | number;\n \"data-testid\"?: string;\n}\n\n// The height of the rail as the object opens. It stops to follow the rail at the first action of the user.\nconst useOpeningRailHeight = (resetKey?: string | number) => {\n const railRef = useRef<HTMLDivElement>(null);\n const isFrozen = useRef(false);\n const [height, setHeight] = useState(0);\n\n useEffect(() => {\n const rail = railRef.current;\n\n isFrozen.current = false;\n\n const measure = () => {\n if (rail && !isFrozen.current) {\n setHeight(rail.offsetHeight);\n }\n };\n\n measure();\n\n if (!rail || typeof ResizeObserver === \"undefined\") {\n return undefined;\n }\n\n // eslint-disable-next-line compat/compat\n const observer = new ResizeObserver(measure);\n\n observer.observe(rail);\n\n return () => observer.disconnect();\n }, [resetKey]);\n\n const freeze = useCallback(() => {\n isFrozen.current = true;\n }, []);\n\n return { railRef, height, freeze };\n};\n\nconst noChange = () => undefined;\n\nexport const ObjectLayout = forwardRef<HTMLDivElement, IObjectLayoutProps>(\n (\n {\n topBar,\n band,\n properties,\n main,\n rail,\n stream,\n panel,\n panelWidth = 600,\n panelMin = 300,\n panelMax = 750,\n mainMin = 550,\n onPanelWidthChange,\n resizeLabel = \"Resize panel\",\n ownScroll = false,\n resetKey,\n className,\n \"data-testid\": testId,\n ...rest\n },\n ref\n ) => {\n useContainerCss(\"c-object-layout-container\", CONTAINER_CSS);\n\n const hasPanel = panel !== undefined && panel !== null;\n const hasRail = rail !== undefined && rail !== null;\n const { railRef, height, freeze } = useOpeningRailHeight(resetKey);\n const { width, handleProps } = useResizablePanel({\n side: \"right\",\n width: clampPanelWidth(panelWidth, panelMin, panelMax),\n min: panelMin,\n max: panelMax,\n onChange: onPanelWidthChange ?? noChange,\n });\n const part = (name: string) => (testId ? `${testId}-${name}` : undefined);\n\n const header = topBar ? (\n <StyledHeader\n $panel={hasPanel}\n className=\"c-object-layout__header\"\n data-testid={part(\"header\")}\n >\n <StyledTopBar data-testid={part(\"top-bar\")}>{topBar}</StyledTopBar>\n </StyledHeader>\n ) : null;\n\n const bandNode = band ? (\n <StyledBand\n className=\"c-object-layout__band\"\n data-object-layout-band=\"\"\n data-testid={part(\"band\")}\n >\n {band}\n </StyledBand>\n ) : null;\n\n if (hasPanel) {\n return (\n <StyledObjectLayout\n {...rest}\n ref={ref}\n $fill={ownScroll}\n data-object-layout=\"\"\n data-testid={testId}\n className={classnames(\n \"c-object-layout c-object-layout--panel\",\n { \"c-object-layout--own-scroll\": ownScroll },\n className\n )}\n >\n <StyledSplit\n $ownScroll={ownScroll}\n className=\"c-object-layout__split\"\n style={\n {\n \"--panel-width\": `${width}px`,\n \"--main-min\": `${mainMin}px`,\n } as CSSProperties\n }\n data-testid={part(\"split\")}\n >\n <StyledPart\n className=\"c-object-layout__part\"\n data-testid={part(\"part\")}\n >\n {header}\n {bandNode}\n <StyledPartColumns\n className=\"c-object-layout__part-columns\"\n data-testid={part(\"columns\")}\n >\n {properties ? (\n <StyledProperties data-testid={part(\"properties\")}>\n {properties}\n </StyledProperties>\n ) : null}\n <StyledMain\n $padded\n className=\"c-object-layout__main\"\n data-testid={part(\"main\")}\n >\n {main}\n </StyledMain>\n </StyledPartColumns>\n </StyledPart>\n <StyledPanel\n className=\"c-object-layout__panel\"\n data-testid={part(\"rail\")}\n >\n {onPanelWidthChange ? (\n <StyledPanelHandle\n {...handleProps}\n label={resizeLabel}\n className=\"c-object-layout__handle\"\n data-testid={part(\"resize\")}\n />\n ) : null}\n {panel}\n </StyledPanel>\n </StyledSplit>\n </StyledObjectLayout>\n );\n }\n\n return (\n <StyledObjectLayout\n {...rest}\n ref={ref}\n $fill={false}\n data-object-layout=\"\"\n data-testid={testId}\n onPointerDownCapture={freeze}\n onKeyDownCapture={freeze}\n className={classnames(\n \"c-object-layout\",\n { \"c-object-layout--single\": !hasRail },\n className\n )}\n >\n {header}\n {bandNode}\n <StyledColumns\n className=\"c-object-layout__columns\"\n data-testid={part(\"columns\")}\n >\n <StyledLeft\n className=\"c-object-layout__left\"\n style={{ \"--opening-rail-height\": `${height}px` } as CSSProperties}\n data-testid={part(\"left\")}\n >\n {properties ? (\n <StyledProperties data-testid={part(\"properties\")}>\n {properties}\n </StyledProperties>\n ) : null}\n <StyledMain\n $padded={!stream}\n className=\"c-object-layout__main\"\n data-testid={part(\"main\")}\n >\n {main}\n </StyledMain>\n <StyledStream data-testid={part(\"stream\")}>{stream}</StyledStream>\n </StyledLeft>\n {hasRail ? (\n <StyledRail\n ref={railRef}\n className=\"c-object-layout__rail\"\n data-testid={part(\"rail\")}\n >\n {rail}\n </StyledRail>\n ) : null}\n </StyledColumns>\n </StyledObjectLayout>\n );\n }\n);\n\nObjectLayout.displayName = \"ObjectLayout\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAIVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,UAAU,EACVC,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AAa4D,IAAI,CAAC,QAAQ;EAAE,GAAE9B,MAAqB,CACvD,CAAC,EACZqB,OAAO,gBACNxE,KAAA,CAAAoF,aAAA,CAACjE,UAAU;IACT2B,GAAG,EAAElB,OAAQ;IACbsC,SAAS,EAAC,uBAAuB;IACjC,eAAae,IAAI,CAAC,MAAM;EAAE,GAEzBhD,IACS,CAAC,GACX,IACS,CACG,CAAC;AAEzB,CACF,CAAC;AAEDW,YAAY,CAACmD,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectLayout.js","names":["React","forwardRef","useCallback","useEffect","useRef","useState","classnames","CONTAINER_CSS","StyledBand","StyledColumns","StyledHeader","StyledLeft","StyledMain","StyledObjectLayout","StyledPanel","StyledPanelHandle","StyledPart","StyledPartColumns","StyledProperties","StyledRail","StyledSplit","StyledStream","StyledTopBar","clampPanelWidth","useResizablePanel","useContainerCss","useOpeningRailHeight","resetKey","railRef","isFrozen","_useState","height","setHeight","rail","current","measure","offsetHeight","ResizeObserver","undefined","observer","observe","disconnect","freeze","noChange","ObjectLayout","_ref","ref","topBar","band","properties","main","stream","panel","_ref$panelWidth","panelWidth","_ref$panelMin","panelMin","_ref$panelMax","panelMax","_ref$mainMin","mainMin","onPanelWidthChange","onPanelWidthReset","_ref$resizeLabel","resizeLabel","_ref$ownScroll","ownScroll","className","testId","rest","_objectWithoutPropertiesLoose","_excluded","hasPanel","hasRail","_useOpeningRailHeight","_useResizablePanel","side","width","min","max","onChange","onReset","handleProps","part","name","header","createElement","$panel","bandNode","_extends","$fill","$ownScroll","style","$padded","label","onPointerDownCapture","onKeyDownCapture","displayName"],"sources":["../../../../src/components/ObjectLayout/ObjectLayout.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n CONTAINER_CSS,\n StyledBand,\n StyledColumns,\n StyledHeader,\n StyledLeft,\n StyledMain,\n StyledObjectLayout,\n StyledPanel,\n StyledPanelHandle,\n StyledPart,\n StyledPartColumns,\n StyledProperties,\n StyledRail,\n StyledSplit,\n StyledStream,\n StyledTopBar,\n} from \"./Styles\";\nimport { clampPanelWidth, useResizablePanel } from \"../../hooks\";\nimport { useContainerCss } from \"../../utils/useContainerCss\";\n\nexport interface IObjectLayoutProps extends HTMLAttributes<HTMLDivElement> {\n /** Sticky bar at the top edge. */\n topBar?: ReactNode;\n /** Sticky band under the top bar, for the title. */\n band?: ReactNode;\n /** A block above the main content. */\n properties?: ReactNode;\n main?: ReactNode;\n /** The 300px right column. Without a rail and a panel the layout has one column. */\n rail?: ReactNode;\n /** Rail mode: content after the main column that can hold a part on the bottom edge. */\n stream?: ReactNode;\n /** Replaces the rail with a panel at the full height of the layout. */\n panel?: ReactNode;\n panelWidth?: number;\n panelMin?: number;\n panelMax?: number;\n /** The width the main part keeps beside the panel. */\n mainMin?: number;\n /** With it the panel has a resize handle. Called with a whole pixel. */\n onPanelWidthChange?: (width: number) => void;\n /** A double click on the resize handle. */\n onPanelWidthReset?: () => void;\n /** The accessible name of the resize handle. */\n resizeLabel?: string;\n /** Panel mode: the layout has the height of its parent and the main part scrolls by itself. */\n ownScroll?: boolean;\n /** Rail mode: a new value measures the opening height of the rail again. */\n resetKey?: string | number;\n \"data-testid\"?: string;\n}\n\n// The height of the rail as the object opens. It stops to follow the rail at the first action of the user.\nconst useOpeningRailHeight = (resetKey?: string | number) => {\n const railRef = useRef<HTMLDivElement>(null);\n const isFrozen = useRef(false);\n const [height, setHeight] = useState(0);\n\n useEffect(() => {\n const rail = railRef.current;\n\n isFrozen.current = false;\n\n const measure = () => {\n if (rail && !isFrozen.current) {\n setHeight(rail.offsetHeight);\n }\n };\n\n measure();\n\n if (!rail || typeof ResizeObserver === \"undefined\") {\n return undefined;\n }\n\n // eslint-disable-next-line compat/compat\n const observer = new ResizeObserver(measure);\n\n observer.observe(rail);\n\n return () => observer.disconnect();\n }, [resetKey]);\n\n const freeze = useCallback(() => {\n isFrozen.current = true;\n }, []);\n\n return { railRef, height, freeze };\n};\n\nconst noChange = () => undefined;\n\nexport const ObjectLayout = forwardRef<HTMLDivElement, IObjectLayoutProps>(\n (\n {\n topBar,\n band,\n properties,\n main,\n rail,\n stream,\n panel,\n panelWidth = 600,\n panelMin = 300,\n panelMax = 750,\n mainMin = 550,\n onPanelWidthChange,\n onPanelWidthReset,\n resizeLabel = \"Resize panel\",\n ownScroll = false,\n resetKey,\n className,\n \"data-testid\": testId,\n ...rest\n },\n ref\n ) => {\n useContainerCss(\"c-object-layout-container\", CONTAINER_CSS);\n\n const hasPanel = panel !== undefined && panel !== null;\n const hasRail = rail !== undefined && rail !== null;\n const { railRef, height, freeze } = useOpeningRailHeight(resetKey);\n const { width, handleProps } = useResizablePanel({\n side: \"right\",\n width: clampPanelWidth(panelWidth, panelMin, panelMax),\n min: panelMin,\n max: panelMax,\n onChange: onPanelWidthChange ?? noChange,\n onReset: onPanelWidthReset,\n });\n const part = (name: string) => (testId ? `${testId}-${name}` : undefined);\n\n const header = topBar ? (\n <StyledHeader\n $panel={hasPanel}\n className=\"c-object-layout__header\"\n data-testid={part(\"header\")}\n >\n <StyledTopBar data-testid={part(\"top-bar\")}>{topBar}</StyledTopBar>\n </StyledHeader>\n ) : null;\n\n const bandNode = band ? (\n <StyledBand\n className=\"c-object-layout__band\"\n data-object-layout-band=\"\"\n data-testid={part(\"band\")}\n >\n {band}\n </StyledBand>\n ) : null;\n\n if (hasPanel) {\n return (\n <StyledObjectLayout\n {...rest}\n ref={ref}\n $fill={ownScroll}\n data-object-layout=\"\"\n data-testid={testId}\n className={classnames(\n \"c-object-layout c-object-layout--panel\",\n { \"c-object-layout--own-scroll\": ownScroll },\n className\n )}\n >\n <StyledSplit\n $ownScroll={ownScroll}\n className=\"c-object-layout__split\"\n style={\n {\n \"--panel-width\": `${width}px`,\n \"--main-min\": `${mainMin}px`,\n } as CSSProperties\n }\n data-testid={part(\"split\")}\n >\n <StyledPart\n className=\"c-object-layout__part\"\n data-testid={part(\"part\")}\n >\n {header}\n {bandNode}\n <StyledPartColumns\n className=\"c-object-layout__part-columns\"\n data-testid={part(\"columns\")}\n >\n {properties ? (\n <StyledProperties data-testid={part(\"properties\")}>\n {properties}\n </StyledProperties>\n ) : null}\n <StyledMain\n $padded\n className=\"c-object-layout__main\"\n data-testid={part(\"main\")}\n >\n {main}\n </StyledMain>\n </StyledPartColumns>\n </StyledPart>\n <StyledPanel\n className=\"c-object-layout__panel\"\n data-testid={part(\"rail\")}\n >\n {onPanelWidthChange ? (\n <StyledPanelHandle\n {...handleProps}\n label={resizeLabel}\n className=\"c-object-layout__handle\"\n data-testid={part(\"resize\")}\n />\n ) : null}\n {panel}\n </StyledPanel>\n </StyledSplit>\n </StyledObjectLayout>\n );\n }\n\n return (\n <StyledObjectLayout\n {...rest}\n ref={ref}\n $fill={false}\n data-object-layout=\"\"\n data-testid={testId}\n onPointerDownCapture={freeze}\n onKeyDownCapture={freeze}\n className={classnames(\n \"c-object-layout\",\n { \"c-object-layout--single\": !hasRail },\n className\n )}\n >\n {header}\n {bandNode}\n <StyledColumns\n className=\"c-object-layout__columns\"\n data-testid={part(\"columns\")}\n >\n <StyledLeft\n className=\"c-object-layout__left\"\n style={{ \"--opening-rail-height\": `${height}px` } as CSSProperties}\n data-testid={part(\"left\")}\n >\n {properties ? (\n <StyledProperties data-testid={part(\"properties\")}>\n {properties}\n </StyledProperties>\n ) : null}\n <StyledMain\n $padded={!stream}\n className=\"c-object-layout__main\"\n data-testid={part(\"main\")}\n >\n {main}\n </StyledMain>\n <StyledStream data-testid={part(\"stream\")}>{stream}</StyledStream>\n </StyledLeft>\n {hasRail ? (\n <StyledRail\n ref={railRef}\n className=\"c-object-layout__rail\"\n data-testid={part(\"rail\")}\n >\n {rail}\n </StyledRail>\n ) : null}\n </StyledColumns>\n </StyledObjectLayout>\n );\n }\n);\n\nObjectLayout.displayName = \"ObjectLayout\";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sF,aAAA,CAACpE,gBAAgB;IAAC,eAAaiE,IAAI,CAAC,YAAY;EAAE,GAC/ClC,UACe,CAAC,GACjB,IAAI,eACRjD,KAAA,CAAAsF,aAAA,CAAC1E,UAAU;IACTiF,OAAO,EAAE,CAAC1C,MAAO;IACjBgB,SAAS,EAAC,uBAAuB;IACjC,eAAagB,IAAI,CAAC,MAAM;EAAE,GAEzBjC,IACS,CAAC,eACblD,KAAA,CAAAsF,aAAA,CAACjE,YAAY;IAAC,eAAa8D,IAAI,CAAC,QAAQ;EAAE,GAAEhC,MAAqB,CACvD,CAAC,EACZsB,OAAO,gBACNzE,KAAA,CAAAsF,aAAA,CAACnE,UAAU;IACT2B,GAAG,EAAElB,OAAQ;IACbuC,SAAS,EAAC,uBAAuB;IACjC,eAAagB,IAAI,CAAC,MAAM;EAAE,GAEzBlD,IACS,CAAC,GACX,IACS,CACG,CAAC;AAEzB,CACF,CAAC;AAEDW,YAAY,CAACqD,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -12,8 +12,8 @@ export interface PillButtonProps extends ComponentPropsWithoutRef<"button"> {
|
|
|
12
12
|
iconOnly?: boolean;
|
|
13
13
|
/** Hide the placeholder and keep the icon, always or only on small screens. */
|
|
14
14
|
compact?: boolean | "mobile";
|
|
15
|
-
/** Height: "medium" is 26px, "small" is 24px like a small Button. */
|
|
16
|
-
size?: "small" | "medium";
|
|
15
|
+
/** Height: "medium" is 26px, "small" is 24px like a small Button, "xsmall" is 18px with 10px text like a type chip. */
|
|
16
|
+
size?: "xsmall" | "small" | "medium";
|
|
17
17
|
/** Side padding. "tight" suits a value that draws to its own edges, like avatars. */
|
|
18
18
|
inset?: "default" | "tight";
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillButton.d.ts","sourceRoot":"","sources":["../../../../src/components/PillButton/PillButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,wBAAwB,EAExB,YAAY,EACZ,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AO,MAAM,UAAU,2FAgEtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillButton.js","names":["React","Children","forwardRef","classnames","StyledPillButton","StyledPillIcon","StyledPillPlaceholder","PillButton","_ref","ref","_args$ariaLabel","icon","placeholder","_ref$tone","tone","active","_ref$iconOnly","iconOnly","_ref$compact","compact","_ref$size","size","_ref$inset","inset","_ref$type","type","className","children","args","_objectWithoutPropertiesLoose","_excluded","isEmpty","toArray","length","ariaLabel","undefined","createElement","_extends","$tone","$active","Boolean","$empty","$iconOnly","$compact","$size","$inset","displayName"],"sources":["../../../../src/components/PillButton/PillButton.tsx"],"sourcesContent":["import React, {\n Children,\n ComponentPropsWithoutRef,\n forwardRef,\n ReactElement,\n ReactNode,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n StyledPillButton,\n StyledPillIcon,\n StyledPillPlaceholder,\n} from \"./Styles\";\n\nexport interface PillButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /** Icon shown while the pill has no value. */\n icon?: ReactElement;\n /** Label shown next to the icon while the pill has no value. */\n placeholder?: ReactNode;\n /** Fill of the pill. \"ghost\" stays empty until hover, focus, open, or hover of a `c-pill-host` ancestor. */\n tone?: \"soft\" | \"alternate\" | \"ghost\" | \"outlined\";\n /** Selected or pressed state. */\n active?: boolean;\n /** A square-ish pill that holds only its icon, for example a close button. */\n iconOnly?: boolean;\n /** Hide the placeholder and keep the icon, always or only on small screens. */\n compact?: boolean | \"mobile\";\n /** Height: \"medium\" is 26px, \"small\" is 24px like a small Button. */\n size?: \"small\" | \"medium\";\n /** Side padding. \"tight\" suits a value that draws to its own edges, like avatars. */\n inset?: \"default\" | \"tight\";\n}\n\n/**\n * @component PillButton\n * @description\n * A rounded trigger for a field value, for example the assignees, the dates or the label of a task.\n * With no children it shows its icon and placeholder. With children it shows only the children.\n * It forwards its ref and click handler, so a Menu or a Select can use it as a target.\n * Put several pills in a PillGroup to make a segmented control.\n *\n * @example\n * <PillButton icon={<CalendarIcon />} placeholder=\"Dates\" />\n * <PillButton tone=\"ghost\">Sep 24. - 30.</PillButton>\n */\nexport const PillButton = forwardRef<HTMLButtonElement, PillButtonProps>(\n (\n {\n icon,\n placeholder,\n tone = \"soft\",\n active,\n iconOnly = false,\n compact = false,\n size = \"medium\",\n inset = \"default\",\n type = \"button\",\n className,\n children,\n ...args\n },\n ref\n ) => {\n const isEmpty = Children.toArray(children).length === 0;\n const ariaLabel =\n args[\"aria-label\"] ??\n (isEmpty && compact && typeof placeholder === \"string\"\n ? placeholder\n : undefined);\n\n return (\n <StyledPillButton\n ref={ref}\n type={type}\n className={classnames(\n \"c-pill-button\",\n `c-pill-button--${tone}`,\n {\n \"c-pill-button--empty\": isEmpty,\n \"c-pill-button--active\": active,\n \"c-pill-button--icon-only\": iconOnly,\n },\n className\n )}\n aria-pressed={active}\n {...args}\n aria-label={ariaLabel}\n $tone={tone}\n $active={Boolean(active)}\n $empty={isEmpty}\n $iconOnly={iconOnly}\n $compact={compact}\n $size={size}\n $inset={inset}\n >\n {isEmpty && icon ? (\n <StyledPillIcon className=\"c-pill-button__icon\">\n {icon}\n </StyledPillIcon>\n ) : null}\n {isEmpty && placeholder && !iconOnly ? (\n <StyledPillPlaceholder className=\"c-pill-button__placeholder\">\n {placeholder}\n </StyledPillPlaceholder>\n ) : null}\n {isEmpty ? null : children}\n </StyledPillButton>\n );\n }\n);\n\nPillButton.displayName = \"PillButton\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,QAAQ,EAERC,UAAU,QAGL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,gBAAgB,EAChBC,cAAc,EACdC,qBAAqB,QAChB,UAAU;AAqBjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGL,UAAU,CAClC,CAAAM,IAAA,EAeEC,GAAG,KACA;EAAA,IAAAC,eAAA;EAAA,IAdDC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;MACE,sBAAsB,EAAEiB,OAAO;MAC/B,uBAAuB,EAAEhB,MAAM;MAC/B,0BAA0B,EAAEE;IAC9B,CAAC,EACDS,SACF,CAAE;IACF,gBAAcX;EAAO,GACjBa,IAAI;IACR,cAAYM,SAAU;IACtBI,KAAK,EAAExB,IAAK;IACZyB,OAAO,EAAEC,OAAO,CAACzB,MAAM,CAAE;IACzB0B,MAAM,EAAEV,OAAQ;IAChBW,SAAS,EAAEzB,QAAS;IACpB0B,QAAQ,EAAExB,OAAQ;IAClByB,KAAK,EAAEvB,IAAK;IACZwB,MAAM,EAAEtB;EAAM,IAEbQ,OAAO,IAAIpB,IAAI,gBACdX,KAAA,CAAAoC,aAAA,CAAC/B,cAAc;IAACqB,SAAS,EAAC;EAAqB,GAC5Cf,IACa,CAAC,GACf,IAAI,EACPoB,OAAO,IAAInB,WAAW,IAAI,CAACK,QAAQ,gBAClCjB,KAAA,CAAAoC,aAAA,CAAC9B,qBAAqB;IAACoB,SAAS,EAAC;EAA4B,GAC1Dd,WACoB,CAAC,GACtB,IAAI,EACPmB,OAAO,GAAG,IAAI,GAAGJ,QACF,CAAC;AAEvB,CACF,CAAC;AAEDpB,UAAU,CAACuC,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PillButton.js","names":["React","Children","forwardRef","classnames","StyledPillButton","StyledPillIcon","StyledPillPlaceholder","PillButton","_ref","ref","_args$ariaLabel","icon","placeholder","_ref$tone","tone","active","_ref$iconOnly","iconOnly","_ref$compact","compact","_ref$size","size","_ref$inset","inset","_ref$type","type","className","children","args","_objectWithoutPropertiesLoose","_excluded","isEmpty","toArray","length","ariaLabel","undefined","createElement","_extends","$tone","$active","Boolean","$empty","$iconOnly","$compact","$size","$inset","displayName"],"sources":["../../../../src/components/PillButton/PillButton.tsx"],"sourcesContent":["import React, {\n Children,\n ComponentPropsWithoutRef,\n forwardRef,\n ReactElement,\n ReactNode,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n StyledPillButton,\n StyledPillIcon,\n StyledPillPlaceholder,\n} from \"./Styles\";\n\nexport interface PillButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /** Icon shown while the pill has no value. */\n icon?: ReactElement;\n /** Label shown next to the icon while the pill has no value. */\n placeholder?: ReactNode;\n /** Fill of the pill. \"ghost\" stays empty until hover, focus, open, or hover of a `c-pill-host` ancestor. */\n tone?: \"soft\" | \"alternate\" | \"ghost\" | \"outlined\";\n /** Selected or pressed state. */\n active?: boolean;\n /** A square-ish pill that holds only its icon, for example a close button. */\n iconOnly?: boolean;\n /** Hide the placeholder and keep the icon, always or only on small screens. */\n compact?: boolean | \"mobile\";\n /** Height: \"medium\" is 26px, \"small\" is 24px like a small Button, \"xsmall\" is 18px with 10px text like a type chip. */\n size?: \"xsmall\" | \"small\" | \"medium\";\n /** Side padding. \"tight\" suits a value that draws to its own edges, like avatars. */\n inset?: \"default\" | \"tight\";\n}\n\n/**\n * @component PillButton\n * @description\n * A rounded trigger for a field value, for example the assignees, the dates or the label of a task.\n * With no children it shows its icon and placeholder. With children it shows only the children.\n * It forwards its ref and click handler, so a Menu or a Select can use it as a target.\n * Put several pills in a PillGroup to make a segmented control.\n *\n * @example\n * <PillButton icon={<CalendarIcon />} placeholder=\"Dates\" />\n * <PillButton tone=\"ghost\">Sep 24. - 30.</PillButton>\n */\nexport const PillButton = forwardRef<HTMLButtonElement, PillButtonProps>(\n (\n {\n icon,\n placeholder,\n tone = \"soft\",\n active,\n iconOnly = false,\n compact = false,\n size = \"medium\",\n inset = \"default\",\n type = \"button\",\n className,\n children,\n ...args\n },\n ref\n ) => {\n const isEmpty = Children.toArray(children).length === 0;\n const ariaLabel =\n args[\"aria-label\"] ??\n (isEmpty && compact && typeof placeholder === \"string\"\n ? placeholder\n : undefined);\n\n return (\n <StyledPillButton\n ref={ref}\n type={type}\n className={classnames(\n \"c-pill-button\",\n `c-pill-button--${tone}`,\n {\n \"c-pill-button--empty\": isEmpty,\n \"c-pill-button--active\": active,\n \"c-pill-button--icon-only\": iconOnly,\n },\n className\n )}\n aria-pressed={active}\n {...args}\n aria-label={ariaLabel}\n $tone={tone}\n $active={Boolean(active)}\n $empty={isEmpty}\n $iconOnly={iconOnly}\n $compact={compact}\n $size={size}\n $inset={inset}\n >\n {isEmpty && icon ? (\n <StyledPillIcon className=\"c-pill-button__icon\">\n {icon}\n </StyledPillIcon>\n ) : null}\n {isEmpty && placeholder && !iconOnly ? (\n <StyledPillPlaceholder className=\"c-pill-button__placeholder\">\n {placeholder}\n </StyledPillPlaceholder>\n ) : null}\n {isEmpty ? null : children}\n </StyledPillButton>\n );\n }\n);\n\nPillButton.displayName = \"PillButton\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,QAAQ,EAERC,UAAU,QAGL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,gBAAgB,EAChBC,cAAc,EACdC,qBAAqB,QAChB,UAAU;AAqBjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGL,UAAU,CAClC,CAAAM,IAAA,EAeEC,GAAG,KACA;EAAA,IAAAC,eAAA;EAAA,IAdDC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAAC,SAAA,GAAAL,IAAA,CACXM,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,MAAM,GAAAA,SAAA;IACbE,MAAM,GAAAP,IAAA,CAANO,MAAM;IAAAC,aAAA,GAAAR,IAAA,CACNS,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IAAAE,YAAA,GAAAV,IAAA,CAChBW,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,KAAK,GAAAA,YAAA;IAAAE,SAAA,GAAAZ,IAAA,CACfa,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,QAAQ,GAAAA,SAAA;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C5Cf,IACa,CAAC,GACf,IAAI,EACPoB,OAAO,IAAInB,WAAW,IAAI,CAACK,QAAQ,gBAClCjB,KAAA,CAAAoC,aAAA,CAAC9B,qBAAqB;IAACoB,SAAS,EAAC;EAA4B,GAC1Dd,WACoB,CAAC,GACtB,IAAI,EACPmB,OAAO,GAAG,IAAI,GAAGJ,QACF,CAAC;AAEvB,CACF,CAAC;AAEDpB,UAAU,CAACuC,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PillButton/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,UAAU,qBAAqB;IAC7B,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,cAAc,qEAU1B,CAAC;AAIF,eAAO,MAAM,qBAAqB,qEAGjC,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PillButton/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,UAAU,qBAAqB;IAC7B,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,cAAc,qEAU1B,CAAC;AAIF,eAAO,MAAM,qBAAqB,qEAGjC,CAAC;AA0GF,eAAO,MAAM,gBAAgB,0FA8F5B,CAAC"}
|
|
@@ -11,7 +11,7 @@ export const StyledPillPlaceholder = styled.span.withConfig({
|
|
|
11
11
|
componentId: "sc-14yhio0-1"
|
|
12
12
|
})(["overflow:hidden;text-overflow:ellipsis;"]);
|
|
13
13
|
StyledPillPlaceholder.displayName = "StyledPillPlaceholder";
|
|
14
|
-
const activeStyle = css(["background-color:var(--pill-background-active);color:var(--color-primary);", "{color:var(--color-primary);}"], StyledPillIcon);
|
|
14
|
+
const activeStyle = css(["background-color:var(--pill-background-active);color:var(--color-primary);", "{color:var(--color-primary);}svg{fill:currentColor;}svg [stroke]:not([stroke=\"none\"]){stroke:currentColor;}"], StyledPillIcon);
|
|
15
15
|
const hoverTextStyle = css(["color:var(--color-theme-900);", "{color:var(--color-theme-900);}"], StyledPillIcon);
|
|
16
16
|
const toneStyle = tone => {
|
|
17
17
|
switch (tone) {
|
|
@@ -26,9 +26,17 @@ const toneStyle = tone => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
const compactStyle = css(["", "{display:none;}"], StyledPillPlaceholder);
|
|
29
|
+
const PILL_HEIGHTS = {
|
|
30
|
+
xsmall: "18px",
|
|
31
|
+
small: "24px",
|
|
32
|
+
medium: "26px"
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/* The size of a type chip: small caps of an object type or a state switch. */
|
|
36
|
+
const xsmallStyle = css(["gap:3px;--c-pill-padding-x:6px;font-size:calc(0.625rem * var(--text-scale,1));font-weight:600;", " svg{width:12px;height:12px;}"], StyledPillIcon);
|
|
29
37
|
export const StyledPillButton = styled.button.withConfig({
|
|
30
38
|
displayName: "Styles__StyledPillButton",
|
|
31
39
|
componentId: "sc-14yhio0-2"
|
|
32
|
-
})(["", " ", " display:inline-flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0;max-width:100%;height:", ";margin:0
|
|
40
|
+
})(["", " ", " display:inline-flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0;max-width:100%;height:", ";margin:0;--c-pill-padding-x:", ";padding:0 var(--c-pill-padding-x);border:none;border-radius:var(--ac-br-rounded);font-size:calc(0.875rem * var(--text-scale,1));font-weight:500;line-height:1;white-space:nowrap;color:", ";cursor:pointer;user-select:none;&:focus{outline:none;}&:disabled{cursor:default;opacity:50%;pointer-events:none;}", " ", " ", " ", " ", " ", " ", " &[aria-haspopup][aria-expanded=\"true\"],.c-pill-host:hover &[aria-haspopup][aria-expanded=\"true\"]{", "}"], FontStyle, BoxSizingStyle, props => PILL_HEIGHTS[props.$size], props => props.$inset === "tight" ? "6px" : "10px", props => props.$empty ? "var(--color-theme-700)" : "var(--color-theme-800)", props => toneStyle(props.$tone), props => props.$tone === "ghost" && props.$empty && css(["", ",", "{opacity:0;}.c-pill-host:hover &.c-pill-button--ghost,&:hover,&:focus-visible,&[aria-expanded=\"true\"]{", ",", "{opacity:1;}}"], StyledPillIcon, StyledPillPlaceholder, StyledPillIcon, StyledPillPlaceholder), props => props.$iconOnly && css(["width:36px;padding:0;", " svg{width:16px;height:16px;}"], StyledPillIcon), props => props.$size === "xsmall" && xsmallStyle, props => props.$compact === true && compactStyle, props => props.$compact === "mobile" && css(["@media (max-width:768px){", "}"], compactStyle), props => props.$active && css(["&,&:hover,&:focus-visible{", "}"], activeStyle), activeStyle);
|
|
33
41
|
StyledPillButton.displayName = "StyledPillButton";
|
|
34
42
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","activeStyle","hoverTextStyle","toneStyle","tone","compactStyle","StyledPillButton","button","props","$size","$inset","$empty","$tone","$iconOnly","$compact","$active"],"sources":["../../../../src/components/PillButton/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillButtonProps } from \"./PillButton\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\ninterface StyledPillButtonProps {\n $tone: NonNullable<PillButtonProps[\"tone\"]>;\n $active: boolean;\n $empty: boolean;\n $iconOnly: boolean;\n $compact: PillButtonProps[\"compact\"];\n $size: NonNullable<PillButtonProps[\"size\"]>;\n $inset: NonNullable<PillButtonProps[\"inset\"]>;\n}\n\nexport const StyledPillIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n color: var(--color-theme-600);\n\n svg {\n width: 18px;\n height: 18px;\n fill: currentColor;\n }\n`;\n\nStyledPillIcon.displayName = \"StyledPillIcon\";\n\nexport const StyledPillPlaceholder = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nStyledPillPlaceholder.displayName = \"StyledPillPlaceholder\";\n\nconst activeStyle = css`\n background-color: var(--pill-background-active);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n`;\n\nconst hoverTextStyle = css`\n color: var(--color-theme-900);\n\n ${StyledPillIcon} {\n color: var(--color-theme-900);\n }\n`;\n\nconst toneStyle = (tone: StyledPillButtonProps[\"$tone\"]) => {\n switch (tone) {\n case \"alternate\":\n return css`\n background-color: var(--color-theme-300);\n\n &:hover,\n &:focus-visible {\n background-color: var(--color-theme-400);\n ${hoverTextStyle}\n }\n `;\n case \"ghost\":\n return css`\n background-color: transparent;\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:focus-visible {\n background-color: var(--pill-background);\n }\n\n .c-pill-host:hover &.c-pill-button--ghost:hover,\n &:hover {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n case \"outlined\":\n return css`\n background-color: transparent;\n border: 1px solid var(--color-theme-700);\n\n &:hover,\n &:focus-visible {\n border-color: var(--color-primary);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n }\n `;\n default:\n return css`\n background-color: var(--pill-background);\n\n &:hover,\n &:focus-visible {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n }\n};\n\nconst compactStyle = css`\n ${StyledPillPlaceholder} {\n display: none;\n }\n`;\n\nexport const StyledPillButton = styled.button<StyledPillButtonProps>`\n ${FontStyle}\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n flex-shrink: 0;\n max-width: 100%;\n height: ${(props) =>
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","activeStyle","hoverTextStyle","toneStyle","tone","compactStyle","PILL_HEIGHTS","xsmall","small","medium","xsmallStyle","StyledPillButton","button","props","$size","$inset","$empty","$tone","$iconOnly","$compact","$active"],"sources":["../../../../src/components/PillButton/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillButtonProps } from \"./PillButton\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\ninterface StyledPillButtonProps {\n $tone: NonNullable<PillButtonProps[\"tone\"]>;\n $active: boolean;\n $empty: boolean;\n $iconOnly: boolean;\n $compact: PillButtonProps[\"compact\"];\n $size: NonNullable<PillButtonProps[\"size\"]>;\n $inset: NonNullable<PillButtonProps[\"inset\"]>;\n}\n\nexport const StyledPillIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n color: var(--color-theme-600);\n\n svg {\n width: 18px;\n height: 18px;\n fill: currentColor;\n }\n`;\n\nStyledPillIcon.displayName = \"StyledPillIcon\";\n\nexport const StyledPillPlaceholder = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nStyledPillPlaceholder.displayName = \"StyledPillPlaceholder\";\n\nconst activeStyle = css`\n background-color: var(--pill-background-active);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n\n /* An icon in the value takes the color of the text too, its outline as well. */\n svg {\n fill: currentColor;\n }\n\n svg [stroke]:not([stroke=\"none\"]) {\n stroke: currentColor;\n }\n`;\n\nconst hoverTextStyle = css`\n color: var(--color-theme-900);\n\n ${StyledPillIcon} {\n color: var(--color-theme-900);\n }\n`;\n\nconst toneStyle = (tone: StyledPillButtonProps[\"$tone\"]) => {\n switch (tone) {\n case \"alternate\":\n return css`\n background-color: var(--color-theme-300);\n\n &:hover,\n &:focus-visible {\n background-color: var(--color-theme-400);\n ${hoverTextStyle}\n }\n `;\n case \"ghost\":\n return css`\n background-color: transparent;\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:focus-visible {\n background-color: var(--pill-background);\n }\n\n .c-pill-host:hover &.c-pill-button--ghost:hover,\n &:hover {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n case \"outlined\":\n return css`\n background-color: transparent;\n border: 1px solid var(--color-theme-700);\n\n &:hover,\n &:focus-visible {\n border-color: var(--color-primary);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n }\n `;\n default:\n return css`\n background-color: var(--pill-background);\n\n &:hover,\n &:focus-visible {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n }\n};\n\nconst compactStyle = css`\n ${StyledPillPlaceholder} {\n display: none;\n }\n`;\n\nconst PILL_HEIGHTS = { xsmall: \"18px\", small: \"24px\", medium: \"26px\" };\n\n/* The size of a type chip: small caps of an object type or a state switch. */\nconst xsmallStyle = css`\n gap: 3px;\n --c-pill-padding-x: 6px;\n font-size: calc(0.625rem * var(--text-scale, 1));\n font-weight: 600;\n\n ${StyledPillIcon} svg {\n width: 12px;\n height: 12px;\n }\n`;\n\nexport const StyledPillButton = styled.button<StyledPillButtonProps>`\n ${FontStyle}\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n flex-shrink: 0;\n max-width: 100%;\n height: ${(props) => PILL_HEIGHTS[props.$size]};\n margin: 0;\n --c-pill-padding-x: ${(props) => (props.$inset === \"tight\" ? \"6px\" : \"10px\")};\n padding: 0 var(--c-pill-padding-x);\n border: none;\n border-radius: var(--ac-br-rounded);\n font-size: calc(0.875rem * var(--text-scale, 1));\n font-weight: 500;\n line-height: 1;\n white-space: nowrap;\n color: ${(props) =>\n props.$empty ? \"var(--color-theme-700)\" : \"var(--color-theme-800)\"};\n cursor: pointer;\n user-select: none;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: default;\n opacity: 50%;\n pointer-events: none;\n }\n\n ${(props) => toneStyle(props.$tone)}\n\n ${(props) =>\n props.$tone === \"ghost\" &&\n props.$empty &&\n css`\n ${StyledPillIcon}, ${StyledPillPlaceholder} {\n opacity: 0;\n }\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:hover,\n &:focus-visible,\n &[aria-expanded=\"true\"] {\n ${StyledPillIcon}, ${StyledPillPlaceholder} {\n opacity: 1;\n }\n }\n `}\n\n ${(props) =>\n props.$iconOnly &&\n css`\n width: 36px;\n padding: 0;\n\n ${StyledPillIcon} svg {\n width: 16px;\n height: 16px;\n }\n `}\n\n ${(props) => props.$size === \"xsmall\" && xsmallStyle}\n\n ${(props) => props.$compact === true && compactStyle}\n\n ${(props) =>\n props.$compact === \"mobile\" &&\n css`\n @media (max-width: 768px) {\n ${compactStyle}\n }\n `}\n\n /* An active pill keeps its look on hover and focus. */\n ${(props) =>\n props.$active &&\n css`\n &,\n &:hover,\n &:focus-visible {\n ${activeStyle}\n }\n `}\n\n /* Last, so an open trigger shows the active look in every tone. */\n &[aria-haspopup][aria-expanded=\"true\"],\n .c-pill-host:hover &[aria-haspopup][aria-expanded=\"true\"] {\n ${activeStyle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O,KAAK,CAACC,KAAK,CAAC,EAEvBD,KAAK,IAAMA,KAAK,CAACE,MAAM,KAAK,OAAO,GAAG,KAAK,GAAG,MAAO,EAQlEF,KAAK,IACbA,KAAK,CAACG,MAAM,GAAG,wBAAwB,GAAG,wBAAwB,EAcjEH,KAAK,IAAKV,SAAS,CAACU,KAAK,CAACI,KAAK,CAAC,EAEhCJ,KAAK,IACNA,KAAK,CAACI,KAAK,KAAK,OAAO,IACvBJ,KAAK,CAACG,MAAM,IACZxB,GAAG,8IACCG,cAAc,EAAKK,qBAAqB,EAQtCL,cAAc,EAAKK,qBAAqB,CAI7C,EAEAa,KAAK,IACNA,KAAK,CAACK,SAAS,IACf1B,GAAG,6DAICG,cAAc,CAIjB,EAEAkB,KAAK,IAAKA,KAAK,CAACC,KAAK,KAAK,QAAQ,IAAIJ,WAAW,EAEjDG,KAAK,IAAKA,KAAK,CAACM,QAAQ,KAAK,IAAI,IAAId,YAAY,EAEjDQ,KAAK,IACNA,KAAK,CAACM,QAAQ,KAAK,QAAQ,IAC3B3B,GAAG,qCAEGa,YAAY,CAEjB,EAGAQ,KAAK,IACNA,KAAK,CAACO,OAAO,IACb5B,GAAG,sCAIGS,WAAW,CAEhB,EAKCA,WAAW,CAEhB;AAEDU,gBAAgB,CAACb,WAAW,GAAG,kBAAkB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PillGroup/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PillGroup/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAU7C,eAAO,MAAM,eAAe;iBACb,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;SA8DvD,CAAC"}
|
|
@@ -2,9 +2,11 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
3
|
const first = "& > .c-pill-button:first-child, & > :first-child .c-pill-button";
|
|
4
4
|
const last = "& > .c-pill-button:last-child, & > :last-child .c-pill-button";
|
|
5
|
+
const firstText = "& > .c-pill-button:not(.c-pill-button--icon-only):first-child, & > :first-child .c-pill-button:not(.c-pill-button--icon-only)";
|
|
6
|
+
const lastText = "& > .c-pill-button:not(.c-pill-button--icon-only):last-child, & > :last-child .c-pill-button:not(.c-pill-button--icon-only)";
|
|
5
7
|
export const StyledPillGroup = styled.div.withConfig({
|
|
6
8
|
displayName: "Styles__StyledPillGroup",
|
|
7
9
|
componentId: "sc-1x5hpq8-0"
|
|
8
|
-
})(["", " display:inline-flex;align-items:stretch;flex-shrink:0;max-width:100%;& > *{display:inline-flex;min-width:0;}.c-pill-button{border-radius:0;}", "{border-top-left-radius:var(--ac-br-rounded);border-bottom-left-radius:var(--ac-br-rounded);}", "{border-top-right-radius:var(--ac-br-rounded);border-bottom-right-radius:var(--ac-br-rounded);}", " ", ""], BoxSizingStyle, first, last, props => props.$appearance === "soft" && css(["gap:2px;"]), props => props.$appearance === "outlined" && css(["border:1px solid var(--pill-border);border-radius:var(--ac-br-6);overflow:hidden;.c-pill-button{height:24px;background-color:transparent;}", ",", "{border-radius:0;}& > * + *{border-left:1px solid var(--pill-border);}"], first, last));
|
|
10
|
+
})(["", " display:inline-flex;align-items:stretch;flex-shrink:0;max-width:100%;& > *{display:inline-flex;min-width:0;}.c-pill-button{border-radius:0;}", "{border-top-left-radius:var(--ac-br-rounded);border-bottom-left-radius:var(--ac-br-rounded);}", "{border-top-right-radius:var(--ac-br-rounded);border-bottom-right-radius:var(--ac-br-rounded);}", "{padding-left:calc(var(--c-pill-padding-x,10px) + 4px);}", "{padding-right:calc(var(--c-pill-padding-x,10px) + 4px);}", " ", ""], BoxSizingStyle, first, last, firstText, lastText, props => props.$appearance === "soft" && css(["gap:2px;"]), props => props.$appearance === "outlined" && css(["border:1px solid var(--pill-border);border-radius:var(--ac-br-6);overflow:hidden;.c-pill-button{height:24px;background-color:transparent;}", ",", "{border-radius:0;}& > * + *{border-left:1px solid var(--pill-border);}"], first, last));
|
|
9
11
|
StyledPillGroup.displayName = "StyledPillGroup";
|
|
10
12
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","first","last","StyledPillGroup","div","withConfig","displayName","componentId","props","$appearance"],"sources":["../../../../src/components/PillGroup/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillGroupProps } from \"./PillGroup\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\n\nconst first = \"& > .c-pill-button:first-child, & > :first-child .c-pill-button\";\nconst last = \"& > .c-pill-button:last-child, & > :last-child .c-pill-button\";\n\nexport const StyledPillGroup = styled.div<{\n $appearance: NonNullable<PillGroupProps[\"appearance\"]>;\n}>`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: stretch;\n flex-shrink: 0;\n max-width: 100%;\n\n & > * {\n display: inline-flex;\n min-width: 0;\n }\n\n .c-pill-button {\n border-radius: 0;\n }\n\n ${first} {\n border-top-left-radius: var(--ac-br-rounded);\n border-bottom-left-radius: var(--ac-br-rounded);\n }\n\n ${last} {\n border-top-right-radius: var(--ac-br-rounded);\n border-bottom-right-radius: var(--ac-br-rounded);\n }\n\n ${(props) =>\n props.$appearance === \"soft\" &&\n css`\n gap: 2px;\n `}\n\n ${(props) =>\n props.$appearance === \"outlined\" &&\n css`\n border: 1px solid var(--pill-border);\n border-radius: var(--ac-br-6);\n overflow: hidden;\n\n .c-pill-button {\n height: 24px;\n background-color: transparent;\n }\n\n ${first}, ${last} {\n border-radius: 0;\n }\n\n & > * + * {\n border-left: 1px solid var(--pill-border);\n }\n `}\n`;\n\nStyledPillGroup.displayName = \"StyledPillGroup\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAElD,MAAMC,KAAK,GAAG,iEAAiE;AAC/E,MAAMC,IAAI,GAAG,+DAA+D;
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","first","last","firstText","lastText","StyledPillGroup","div","withConfig","displayName","componentId","props","$appearance"],"sources":["../../../../src/components/PillGroup/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillGroupProps } from \"./PillGroup\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\n\nconst first = \"& > .c-pill-button:first-child, & > :first-child .c-pill-button\";\nconst last = \"& > .c-pill-button:last-child, & > :last-child .c-pill-button\";\nconst firstText =\n \"& > .c-pill-button:not(.c-pill-button--icon-only):first-child, & > :first-child .c-pill-button:not(.c-pill-button--icon-only)\";\nconst lastText =\n \"& > .c-pill-button:not(.c-pill-button--icon-only):last-child, & > :last-child .c-pill-button:not(.c-pill-button--icon-only)\";\n\nexport const StyledPillGroup = styled.div<{\n $appearance: NonNullable<PillGroupProps[\"appearance\"]>;\n}>`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: stretch;\n flex-shrink: 0;\n max-width: 100%;\n\n & > * {\n display: inline-flex;\n min-width: 0;\n }\n\n .c-pill-button {\n border-radius: 0;\n }\n\n ${first} {\n border-top-left-radius: var(--ac-br-rounded);\n border-bottom-left-radius: var(--ac-br-rounded);\n }\n\n ${last} {\n border-top-right-radius: var(--ac-br-rounded);\n border-bottom-right-radius: var(--ac-br-rounded);\n }\n\n /* The round ends of the group get 4px more room inside, so the first and last labels do not crowd the curve. */\n ${firstText} {\n padding-left: calc(var(--c-pill-padding-x, 10px) + 4px);\n }\n\n ${lastText} {\n padding-right: calc(var(--c-pill-padding-x, 10px) + 4px);\n }\n\n ${(props) =>\n props.$appearance === \"soft\" &&\n css`\n gap: 2px;\n `}\n\n ${(props) =>\n props.$appearance === \"outlined\" &&\n css`\n border: 1px solid var(--pill-border);\n border-radius: var(--ac-br-6);\n overflow: hidden;\n\n .c-pill-button {\n height: 24px;\n background-color: transparent;\n }\n\n ${first}, ${last} {\n border-radius: 0;\n }\n\n & > * + * {\n border-left: 1px solid var(--pill-border);\n }\n `}\n`;\n\nStyledPillGroup.displayName = \"StyledPillGroup\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAElD,MAAMC,KAAK,GAAG,iEAAiE;AAC/E,MAAMC,IAAI,GAAG,+DAA+D;AAC5E,MAAMC,SAAS,GACb,+HAA+H;AACjI,MAAMC,QAAQ,GACZ,6HAA6H;AAE/H,OAAO,MAAMC,eAAe,GAAGP,MAAM,CAACQ,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,geAGrCT,cAAc,EAedC,KAAK,EAKLC,IAAI,EAMJC,SAAS,EAITC,QAAQ,EAIPM,KAAK,IACNA,KAAK,CAACC,WAAW,KAAK,MAAM,IAC5BZ,GAAG,cAEF,EAEAW,KAAK,IACNA,KAAK,CAACC,WAAW,KAAK,UAAU,IAChCZ,GAAG,gOAUCE,KAAK,EAAKC,IAAI,CAOjB,CACJ;AAEDG,eAAe,CAACG,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -5,10 +5,14 @@ interface ControlProps {
|
|
|
5
5
|
tooltip: string;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
className: string;
|
|
8
|
+
/** Controls that follow each other with one group share one capsule in the side column. */
|
|
9
|
+
group?: string;
|
|
8
10
|
}
|
|
9
11
|
interface ISheet {
|
|
10
12
|
onClose?: () => void;
|
|
11
13
|
controls?: ControlProps[];
|
|
14
|
+
/** Content under the controls of the side column, such as who is here. It shows only with controls. */
|
|
15
|
+
sideContent?: React.ReactNode;
|
|
12
16
|
open?: boolean;
|
|
13
17
|
animation?: "top" | "bottom" | "left" | "right";
|
|
14
18
|
position?: "center" | "left" | "right";
|
|
@@ -28,6 +32,13 @@ interface ISheet {
|
|
|
28
32
|
onBackdropClickBlocked?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
29
33
|
/** @deprecated Use dismissOnBackdropClick={false}. Still works, with a warning in development, and will be removed. */
|
|
30
34
|
disableBackgroundClick?: boolean;
|
|
35
|
+
/** With it a stretch sheet on a side has a resize handle on its free edge. Called with a whole pixel at the end of a drag and on each key press. */
|
|
36
|
+
onWidthChange?: (width: number) => void;
|
|
37
|
+
/** A double click on the resize handle. */
|
|
38
|
+
onWidthReset?: () => void;
|
|
39
|
+
resizeMin?: number;
|
|
40
|
+
resizeMax?: number;
|
|
41
|
+
resizeLabel?: string;
|
|
31
42
|
}
|
|
32
43
|
export interface SheetMethods {
|
|
33
44
|
close: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../../src/components/Sheet/Sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../../src/components/Sheet/Sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,aAAa,EACb,UAAU,EAGX,MAAM,OAAO,CAAC;AAgKf,UAAU,YAAY;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,uGAAuG;IACvG,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,C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ers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "onClose", "controls", "open", "animation", "position", "mode", "maxWidth", "surface", "disableFocusLock", "disableScrollLock", "disableBackgroundColor", "bodyStyle", "bodyClassName", "dismissOnBackdropClick", "onBackdropClickBlocked", "disableBackgroundClick"]
|
|
4
|
-
|
|
3
|
+
const _excluded = ["children", "onClose", "controls", "sideContent", "open", "animation", "position", "mode", "maxWidth", "surface", "disableFocusLock", "disableScrollLock", "disableBackgroundColor", "bodyStyle", "bodyClassName", "dismissOnBackdropClick", "onBackdropClickBlocked", "disableBackgroundClick", "onWidthChange", "onWidthReset", "resizeMin", "resizeMax", "resizeLabel"],
|
|
4
|
+
_excluded2 = ["active"];
|
|
5
|
+
import React, { useCallback, useEffect, useLayoutEffect, forwardRef, useState, useImperativeHandle, useRef } from "react";
|
|
5
6
|
import classnames from "classnames";
|
|
6
|
-
import { StyledAnimatedSpan, StyledCssTransition, StyledHeader, StyledIconsWrapperSmall, StyledListSeparator, StyledSheetIcons, StyledSheetWrapper, SHEET_ENTER_MS, SHEET_EXIT_MS, StyledSheetSurface, StyledSheetWrapperPaper } from "./Styles";
|
|
7
|
+
import { StyledAnimatedSpan, StyledCssTransition, StyledHeader, StyledIconsWrapperSmall, StyledListSeparator, StyledSheetControlGroup, StyledSheetIcons, StyledSheetSideContent, StyledSheetWrapper, SHEET_ENTER_MS, SHEET_EXIT_MS, StyledSheetSurface, StyledSheetWrapperPaper, StyledSheetResizeHandle } from "./Styles";
|
|
7
8
|
import { PortalContainerProvider, usePortalContainer } from "../../helpers";
|
|
9
|
+
import { useResizablePanel } from "../../hooks";
|
|
8
10
|
import { usePropWarning } from "../Dialog/usePropWarning";
|
|
9
11
|
import { IconButton } from "../IconButton";
|
|
10
12
|
import { Overlay } from "../Overlay";
|
|
@@ -13,28 +15,31 @@ import { Fade } from "../Transitions";
|
|
|
13
15
|
import { Window } from "../Window";
|
|
14
16
|
import { useHostAboveOpenModal } from "./useHostAboveOpenModal";
|
|
15
17
|
const INSET_VAR = "--c-sheet-inset-right";
|
|
18
|
+
const WIDTH_VAR = "--c-sheet-width";
|
|
16
19
|
const INSET_DURATION_VAR = "--c-sheet-inset-duration";
|
|
17
20
|
// The controls column stands 48px left of the sheet. With less room it is not there.
|
|
18
21
|
const CONTROLS_ROOM = 64;
|
|
22
|
+
const writeInset = wrapper => {
|
|
23
|
+
const root = document.documentElement;
|
|
24
|
+
const _wrapper$getBoundingC = wrapper.getBoundingClientRect(),
|
|
25
|
+
left = _wrapper$getBoundingC.left;
|
|
26
|
+
if (left >= CONTROLS_ROOM) {
|
|
27
|
+
root.style.setProperty(INSET_VAR, root.clientWidth - left + "px");
|
|
28
|
+
} else {
|
|
29
|
+
root.style.removeProperty(INSET_VAR);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
19
32
|
|
|
20
33
|
// A right sheet tells the page, on the root, how far from the right edge it starts, so a floating part of the page
|
|
21
34
|
// can move out of its way with the same timing.
|
|
22
|
-
const useSheetInset = (wrapperRef, isOn) => {
|
|
35
|
+
const useSheetInset = (wrapperRef, isOn, isResizing, resizedWidth) => {
|
|
23
36
|
useEffect(() => {
|
|
24
37
|
const wrapper = wrapperRef.current;
|
|
25
38
|
if (!isOn || !wrapper) {
|
|
26
39
|
return undefined;
|
|
27
40
|
}
|
|
28
41
|
const root = document.documentElement;
|
|
29
|
-
const update = () =>
|
|
30
|
-
const _wrapper$getBoundingC = wrapper.getBoundingClientRect(),
|
|
31
|
-
left = _wrapper$getBoundingC.left;
|
|
32
|
-
if (left >= CONTROLS_ROOM) {
|
|
33
|
-
root.style.setProperty(INSET_VAR, root.clientWidth - left + "px");
|
|
34
|
-
} else {
|
|
35
|
-
root.style.removeProperty(INSET_VAR);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
42
|
+
const update = () => writeInset(wrapper);
|
|
38
43
|
const observer = typeof ResizeObserver === "undefined" ? undefined :
|
|
39
44
|
// eslint-disable-next-line compat/compat
|
|
40
45
|
new ResizeObserver(update);
|
|
@@ -69,12 +74,65 @@ const useSheetInset = (wrapperRef, isOn) => {
|
|
|
69
74
|
root.style.removeProperty(INSET_VAR);
|
|
70
75
|
};
|
|
71
76
|
}, [wrapperRef, isOn]);
|
|
77
|
+
|
|
78
|
+
// Before the first frame of the drag, so the parts never animate a move of the edge.
|
|
79
|
+
useLayoutEffect(() => {
|
|
80
|
+
if (!isOn || !isResizing) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const root = document.documentElement;
|
|
84
|
+
root.style.setProperty(INSET_DURATION_VAR, "0ms");
|
|
85
|
+
root.style.setProperty("cursor", "col-resize");
|
|
86
|
+
return () => {
|
|
87
|
+
root.style.setProperty(INSET_DURATION_VAR, SHEET_ENTER_MS + "ms");
|
|
88
|
+
root.style.removeProperty("cursor");
|
|
89
|
+
};
|
|
90
|
+
}, [isOn, isResizing]);
|
|
91
|
+
|
|
92
|
+
// A resize observer reports a frame late, so a drag writes the inset in the commit of its width.
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
if (isOn && isResizing && wrapperRef.current) {
|
|
95
|
+
writeInset(wrapperRef.current);
|
|
96
|
+
}
|
|
97
|
+
}, [wrapperRef, isOn, isResizing, resizedWidth]);
|
|
72
98
|
};
|
|
99
|
+
const useWrapperWidth = (wrapperRef, isOn) => {
|
|
100
|
+
const _useState = useState(0),
|
|
101
|
+
width = _useState[0],
|
|
102
|
+
setWidth = _useState[1];
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const wrapper = wrapperRef.current;
|
|
105
|
+
if (!isOn || !wrapper) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
const measure = () => setWidth(wrapper.getBoundingClientRect().width);
|
|
109
|
+
const observer = typeof ResizeObserver === "undefined" ? undefined :
|
|
110
|
+
// eslint-disable-next-line compat/compat
|
|
111
|
+
new ResizeObserver(measure);
|
|
112
|
+
measure();
|
|
113
|
+
observer == null || observer.observe(wrapper);
|
|
114
|
+
return () => observer == null ? void 0 : observer.disconnect();
|
|
115
|
+
}, [wrapperRef, isOn]);
|
|
116
|
+
return width;
|
|
117
|
+
};
|
|
118
|
+
const noResize = () => undefined;
|
|
119
|
+
// The side column as a list of single controls and runs of controls of one group.
|
|
120
|
+
const groupControls = controls => controls.reduce((runs, control) => {
|
|
121
|
+
var _last$;
|
|
122
|
+
const last = runs[runs.length - 1];
|
|
123
|
+
if (control.group && (last == null || (_last$ = last[0]) == null ? void 0 : _last$.group) === control.group) {
|
|
124
|
+
last.push(control);
|
|
125
|
+
} else {
|
|
126
|
+
runs.push([control]);
|
|
127
|
+
}
|
|
128
|
+
return runs;
|
|
129
|
+
}, []);
|
|
73
130
|
export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
74
131
|
let children = _ref.children,
|
|
75
132
|
onClose = _ref.onClose,
|
|
76
133
|
_ref$controls = _ref.controls,
|
|
77
134
|
controls = _ref$controls === void 0 ? [] : _ref$controls,
|
|
135
|
+
sideContent = _ref.sideContent,
|
|
78
136
|
_ref$open = _ref.open,
|
|
79
137
|
defaultOpen = _ref$open === void 0 ? false : _ref$open,
|
|
80
138
|
_ref$animation = _ref.animation,
|
|
@@ -97,18 +155,26 @@ export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
97
155
|
dismissOnBackdropClick = _ref.dismissOnBackdropClick,
|
|
98
156
|
onBackdropClickBlocked = _ref.onBackdropClickBlocked,
|
|
99
157
|
disableBackgroundClick = _ref.disableBackgroundClick,
|
|
158
|
+
onWidthChange = _ref.onWidthChange,
|
|
159
|
+
onWidthReset = _ref.onWidthReset,
|
|
160
|
+
_ref$resizeMin = _ref.resizeMin,
|
|
161
|
+
resizeMin = _ref$resizeMin === void 0 ? 600 : _ref$resizeMin,
|
|
162
|
+
_ref$resizeMax = _ref.resizeMax,
|
|
163
|
+
resizeMax = _ref$resizeMax === void 0 ? 1800 : _ref$resizeMax,
|
|
164
|
+
_ref$resizeLabel = _ref.resizeLabel,
|
|
165
|
+
resizeLabel = _ref$resizeLabel === void 0 ? "Resize sheet" : _ref$resizeLabel,
|
|
100
166
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
101
|
-
const
|
|
102
|
-
open =
|
|
103
|
-
setOpen =
|
|
104
|
-
const
|
|
105
|
-
exited =
|
|
106
|
-
setExited =
|
|
167
|
+
const _useState2 = useState(defaultOpen),
|
|
168
|
+
open = _useState2[0],
|
|
169
|
+
setOpen = _useState2[1];
|
|
170
|
+
const _useState3 = useState(true),
|
|
171
|
+
exited = _useState3[0],
|
|
172
|
+
setExited = _useState3[1];
|
|
107
173
|
// Clicks pass through the overlay until it has faded in, and again from the first moment it fades out. Over a
|
|
108
174
|
// native dialog it takes them all the time, since a click through it would hit the dialog's backdrop.
|
|
109
|
-
const
|
|
110
|
-
overlayEntered =
|
|
111
|
-
setOverlayEntered =
|
|
175
|
+
const _useState4 = useState(false),
|
|
176
|
+
overlayEntered = _useState4[0],
|
|
177
|
+
setOverlayEntered = _useState4[1];
|
|
112
178
|
const wrapperRef = useRef(null);
|
|
113
179
|
useEffect(() => {
|
|
114
180
|
setOpen(defaultOpen);
|
|
@@ -152,9 +218,24 @@ export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
152
218
|
const _useHostAboveOpenModa = useHostAboveOpenModal(open || !exited, portalContainer === undefined),
|
|
153
219
|
modalHost = _useHostAboveOpenModa.host,
|
|
154
220
|
modalHostPending = _useHostAboveOpenModa.pending;
|
|
221
|
+
const isResizable = Boolean(onWidthChange) && mode === "stretch" && position !== "center";
|
|
222
|
+
const measuredWidth = useWrapperWidth(wrapperRef, isResizable && open && !modalHostPending);
|
|
223
|
+
const _useResizablePanel = useResizablePanel({
|
|
224
|
+
side: position === "left" ? "left" : "right",
|
|
225
|
+
width: measuredWidth,
|
|
226
|
+
min: resizeMin,
|
|
227
|
+
max: resizeMax,
|
|
228
|
+
onChange: onWidthChange != null ? onWidthChange : noResize,
|
|
229
|
+
onReset: onWidthReset
|
|
230
|
+
}),
|
|
231
|
+
resizedWidth = _useResizablePanel.width,
|
|
232
|
+
isResizing = _useResizablePanel.isResizing,
|
|
233
|
+
handleProps = _useResizablePanel.handleProps;
|
|
234
|
+
const isHandleActive = handleProps.active,
|
|
235
|
+
resizeHandleProps = _objectWithoutPropertiesLoose(handleProps, _excluded2);
|
|
155
236
|
|
|
156
237
|
// A pending sheet renders no wrapper yet, so the inset starts once it does.
|
|
157
|
-
useSheetInset(wrapperRef, open && position === "right" && !modalHostPending);
|
|
238
|
+
useSheetInset(wrapperRef, open && position === "right" && !modalHostPending, isResizing, resizedWidth);
|
|
158
239
|
if (!open && exited || modalHostPending) {
|
|
159
240
|
return null;
|
|
160
241
|
}
|
|
@@ -180,7 +261,11 @@ export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
180
261
|
})), /*#__PURE__*/React.createElement(StyledSheetWrapper, {
|
|
181
262
|
ref: wrapperRef,
|
|
182
263
|
className: classnames("c-sheet__wrapper", bodyClassName),
|
|
183
|
-
style: bodyStyle,
|
|
264
|
+
style: isResizing ? _extends({}, bodyStyle, {
|
|
265
|
+
maxWidth: resizedWidth + "px",
|
|
266
|
+
transition: "none",
|
|
267
|
+
[WIDTH_VAR]: resizedWidth + "px"
|
|
268
|
+
}) : bodyStyle,
|
|
184
269
|
$position: position,
|
|
185
270
|
$mode: mode,
|
|
186
271
|
$maxWidth: maxWidth
|
|
@@ -192,22 +277,30 @@ export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
192
277
|
$direction: animation,
|
|
193
278
|
onEnter: handleEnter,
|
|
194
279
|
onExited: handleExited
|
|
195
|
-
}, /*#__PURE__*/React.createElement(StyledSheetSurface, null, controls.length > 0 && /*#__PURE__*/React.createElement(StyledSheetIcons, null, controls.map((
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
280
|
+
}, /*#__PURE__*/React.createElement(StyledSheetSurface, null, controls.length > 0 && /*#__PURE__*/React.createElement(StyledSheetIcons, null, groupControls(controls).map((run, runIndex) => {
|
|
281
|
+
const items = run.map((_ref2, index) => {
|
|
282
|
+
let IconComponent = _ref2.icon,
|
|
283
|
+
tooltip = _ref2.tooltip,
|
|
284
|
+
onClick = _ref2.onClick,
|
|
285
|
+
disabled = _ref2.disabled,
|
|
286
|
+
className = _ref2.className;
|
|
287
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
288
|
+
title: tooltip,
|
|
289
|
+
disable: !tooltip || disabled,
|
|
290
|
+
key: "c-sheet-control-" + runIndex + "-" + index
|
|
291
|
+
}, /*#__PURE__*/React.createElement(StyledAnimatedSpan, {
|
|
292
|
+
onClick: onClick,
|
|
293
|
+
$disabled: disabled,
|
|
294
|
+
className: className
|
|
295
|
+
}, IconComponent));
|
|
296
|
+
});
|
|
297
|
+
return run[0].group ? /*#__PURE__*/React.createElement(StyledSheetControlGroup, {
|
|
298
|
+
key: "c-sheet-group-" + runIndex,
|
|
299
|
+
className: classnames("c-sheet__control-group", run[0].className)
|
|
300
|
+
}, items) : items;
|
|
301
|
+
}), sideContent ? /*#__PURE__*/React.createElement(StyledSheetSideContent, {
|
|
302
|
+
className: "c-sheet__side-content"
|
|
303
|
+
}, sideContent) : null), /*#__PURE__*/React.createElement(StyledSheetWrapperPaper, {
|
|
211
304
|
paperClass: "c-sheet__wrapper__paper",
|
|
212
305
|
$surface: surface
|
|
213
306
|
}, controls.length > 0 && /*#__PURE__*/React.createElement(StyledHeader, null, /*#__PURE__*/React.createElement(StyledIconsWrapperSmall, null, controls.map((_ref3, index) => {
|
|
@@ -226,7 +319,12 @@ export const Sheet = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
226
319
|
className: className,
|
|
227
320
|
variant: "text gray"
|
|
228
321
|
}, IconComponent));
|
|
229
|
-
})), /*#__PURE__*/React.createElement(StyledListSeparator, null)), children)
|
|
322
|
+
})), /*#__PURE__*/React.createElement(StyledListSeparator, null)), children), isResizable ? /*#__PURE__*/React.createElement(StyledSheetResizeHandle, _extends({}, resizeHandleProps, {
|
|
323
|
+
active: isHandleActive,
|
|
324
|
+
label: resizeLabel,
|
|
325
|
+
edge: position === "left" ? "right" : "left",
|
|
326
|
+
className: "c-sheet__resize c-sheet__resize--" + (position === "left" ? "right" : "left")
|
|
327
|
+
})) : null))));
|
|
230
328
|
|
|
231
329
|
// The provider is always there, so the Window keeps its place in the tree when the sheet gets a host.
|
|
232
330
|
return /*#__PURE__*/React.createElement(PortalContainerProvider, {
|