@activecollab/components 2.0.569 → 2.0.571
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 +1 -1
- package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/Autocomplete/Styles.js +1 -1
- package/dist/cjs/components/Autocomplete/Styles.js.map +1 -1
- package/dist/cjs/components/Chip/ChipGroupStyles.js +1 -1
- package/dist/cjs/components/Chip/ChipGroupStyles.js.map +1 -1
- package/dist/cjs/components/Chip/Styles.js +2 -2
- package/dist/cjs/components/Chip/Styles.js.map +1 -1
- package/dist/cjs/components/Dialog/Styles.js +1 -1
- package/dist/cjs/components/Dialog/Styles.js.map +1 -1
- package/dist/cjs/components/GlobalStyle.js +1 -1
- package/dist/cjs/components/GlobalStyle.js.map +1 -1
- package/dist/cjs/components/Icons/collection/ArrowUpCircle.js +61 -0
- package/dist/cjs/components/Icons/collection/ArrowUpCircle.js.map +1 -0
- package/dist/cjs/components/Icons/collection/Storage.js +61 -0
- package/dist/cjs/components/Icons/collection/Storage.js.map +1 -0
- package/dist/cjs/components/Icons/collection/index.js +14 -0
- package/dist/cjs/components/Icons/collection/index.js.map +1 -1
- package/dist/cjs/components/IdentityMark/Styles.js +7 -0
- package/dist/cjs/components/IdentityMark/Styles.js.map +1 -1
- package/dist/cjs/components/ListSection/Styles.js +1 -1
- package/dist/cjs/components/ListSection/Styles.js.map +1 -1
- package/dist/cjs/components/Menu/Menu.js +3 -0
- package/dist/cjs/components/Menu/Menu.js.map +1 -1
- package/dist/cjs/components/NoteCard/NoteCard.js +23 -18
- package/dist/cjs/components/NoteCard/NoteCard.js.map +1 -1
- package/dist/cjs/components/NoteCard/Styles.js +62 -49
- package/dist/cjs/components/NoteCard/Styles.js.map +1 -1
- package/dist/cjs/components/NotebookCard/NotebookCard.js +45 -0
- package/dist/cjs/components/NotebookCard/NotebookCard.js.map +1 -0
- package/dist/cjs/components/NotebookCard/Styles.js +49 -0
- package/dist/cjs/components/NotebookCard/Styles.js.map +1 -0
- package/dist/cjs/components/NotebookCard/index.js +17 -0
- package/dist/cjs/components/NotebookCard/index.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/Styles.js +2 -2
- package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -1
- package/dist/cjs/components/PillButton/PillButton.js +5 -2
- package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
- package/dist/cjs/components/PillButton/Styles.js +8 -2
- package/dist/cjs/components/PillButton/Styles.js.map +1 -1
- package/dist/cjs/components/PillGroup/PillGroup.js.map +1 -1
- package/dist/cjs/components/PillGroup/Styles.js +4 -1
- package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
- package/dist/cjs/components/Popper/Popper.js +18 -1
- package/dist/cjs/components/Popper/Popper.js.map +1 -1
- package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js +11 -8
- package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
- package/dist/cjs/components/PresenceCapsule/Styles.js +7 -8
- package/dist/cjs/components/PresenceCapsule/Styles.js.map +1 -1
- package/dist/cjs/components/PropertyList/PropertyListPopover.js +3 -0
- package/dist/cjs/components/PropertyList/PropertyListPopover.js.map +1 -1
- package/dist/cjs/components/PropertyList/Styles.js +1 -1
- package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +4 -2
- package/dist/cjs/components/Select/Select.js.map +1 -1
- package/dist/cjs/components/Sheet/Sheet.js +5 -2
- package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
- package/dist/cjs/components/Sheet/Styles.js +19 -14
- package/dist/cjs/components/Sheet/Styles.js.map +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.js +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.js.map +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.test.js +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.test.js.map +1 -1
- package/dist/cjs/components/ToastMessage/Styles.js +6 -6
- package/dist/cjs/components/ToastMessage/Styles.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +5 -0
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/Styles.js +62 -22
- package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +149 -153
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/index.js +0 -11
- package/dist/cjs/components/ViewSwitcher/index.js.map +1 -1
- package/dist/cjs/components/index.js +12 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/presentation/invoicing/invoiceObjectList.js +2 -4
- package/dist/cjs/presentation/invoicing/invoiceObjectList.js.map +1 -1
- package/dist/cjs/presentation/shared/ActivityFeed.js +3 -5
- package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/cjs/presentation/shared/PageViewSwitcher.js +5 -10
- package/dist/cjs/presentation/shared/PageViewSwitcher.js.map +1 -1
- package/dist/cjs/presentation/shared/TaskListSettingsDialog.js +3 -2
- package/dist/cjs/presentation/shared/TaskListSettingsDialog.js.map +1 -1
- package/dist/cjs/presentation/shared/headers.js +4 -8
- package/dist/cjs/presentation/shared/headers.js.map +1 -1
- package/dist/cjs/presentation/shared/systemSettingsDialog.js +13 -8
- package/dist/cjs/presentation/shared/systemSettingsDialog.js.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/Autocomplete/Styles.js +1 -1
- package/dist/esm/components/Autocomplete/Styles.js.map +1 -1
- package/dist/esm/components/Chip/ChipGroupStyles.js +2 -2
- package/dist/esm/components/Chip/ChipGroupStyles.js.map +1 -1
- package/dist/esm/components/Chip/Styles.d.ts +5 -0
- package/dist/esm/components/Chip/Styles.d.ts.map +1 -1
- package/dist/esm/components/Chip/Styles.js +1 -1
- package/dist/esm/components/Chip/Styles.js.map +1 -1
- package/dist/esm/components/Dialog/Styles.js +1 -1
- package/dist/esm/components/Dialog/Styles.js.map +1 -1
- package/dist/esm/components/GlobalStyle.d.ts.map +1 -1
- package/dist/esm/components/GlobalStyle.js +1 -1
- package/dist/esm/components/GlobalStyle.js.map +1 -1
- package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts +32 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.js +54 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.js.map +1 -0
- package/dist/esm/components/Icons/collection/Storage.d.ts +32 -0
- package/dist/esm/components/Icons/collection/Storage.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/Storage.js +54 -0
- package/dist/esm/components/Icons/collection/Storage.js.map +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts +2 -0
- package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/index.js +2 -0
- package/dist/esm/components/Icons/collection/index.js.map +1 -1
- package/dist/esm/components/IdentityMark/Styles.d.ts +1 -1
- package/dist/esm/components/IdentityMark/Styles.d.ts.map +1 -1
- package/dist/esm/components/IdentityMark/Styles.js +7 -0
- package/dist/esm/components/IdentityMark/Styles.js.map +1 -1
- package/dist/esm/components/ListSection/Styles.js +1 -1
- package/dist/esm/components/ListSection/Styles.js.map +1 -1
- package/dist/esm/components/Menu/Menu.d.ts +2 -0
- package/dist/esm/components/Menu/Menu.d.ts.map +1 -1
- package/dist/esm/components/Menu/Menu.js +3 -0
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/NoteCard/NoteCard.d.ts +13 -7
- package/dist/esm/components/NoteCard/NoteCard.d.ts.map +1 -1
- package/dist/esm/components/NoteCard/NoteCard.js +24 -19
- package/dist/esm/components/NoteCard/NoteCard.js.map +1 -1
- package/dist/esm/components/NoteCard/Styles.d.ts +7 -6
- package/dist/esm/components/NoteCard/Styles.d.ts.map +1 -1
- package/dist/esm/components/NoteCard/Styles.js +59 -48
- package/dist/esm/components/NoteCard/Styles.js.map +1 -1
- package/dist/esm/components/NotebookCard/NotebookCard.d.ts +21 -0
- package/dist/esm/components/NotebookCard/NotebookCard.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/NotebookCard.js +35 -0
- package/dist/esm/components/NotebookCard/NotebookCard.js.map +1 -0
- package/dist/esm/components/NotebookCard/Styles.d.ts +11 -0
- package/dist/esm/components/NotebookCard/Styles.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/Styles.js +42 -0
- package/dist/esm/components/NotebookCard/Styles.js.map +1 -0
- package/dist/esm/components/NotebookCard/index.d.ts +2 -0
- package/dist/esm/components/NotebookCard/index.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/index.js +2 -0
- package/dist/esm/components/NotebookCard/index.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/Styles.js +2 -2
- package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -1
- package/dist/esm/components/PillButton/PillButton.d.ts +5 -3
- package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
- package/dist/esm/components/PillButton/PillButton.js +5 -2
- 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 +5 -1
- package/dist/esm/components/PillButton/Styles.js.map +1 -1
- package/dist/esm/components/PillGroup/PillGroup.d.ts +2 -2
- package/dist/esm/components/PillGroup/PillGroup.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/PillGroup.js.map +1 -1
- package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/Styles.js +2 -1
- package/dist/esm/components/PillGroup/Styles.js.map +1 -1
- package/dist/esm/components/Popper/Popper.d.ts +2 -0
- package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/components/Popper/Popper.js +16 -1
- package/dist/esm/components/Popper/Popper.js.map +1 -1
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts +2 -2
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts.map +1 -1
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.js +11 -8
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
- package/dist/esm/components/PresenceCapsule/Styles.d.ts +1 -3
- package/dist/esm/components/PresenceCapsule/Styles.d.ts.map +1 -1
- package/dist/esm/components/PresenceCapsule/Styles.js +6 -5
- package/dist/esm/components/PresenceCapsule/Styles.js.map +1 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.d.ts +3 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.js +3 -0
- package/dist/esm/components/PropertyList/PropertyListPopover.js.map +1 -1
- package/dist/esm/components/PropertyList/Styles.js +1 -1
- package/dist/esm/components/PropertyList/Styles.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +2 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +4 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Sheet/Sheet.d.ts +2 -0
- package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Sheet.js +6 -3
- package/dist/esm/components/Sheet/Sheet.js.map +1 -1
- package/dist/esm/components/Sheet/Styles.d.ts +1 -0
- package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Styles.js +17 -12
- package/dist/esm/components/Sheet/Styles.js.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.d.ts +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.d.ts.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.js +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.js.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.test.js +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.test.js.map +1 -1
- package/dist/esm/components/ToastMessage/Styles.d.ts.map +1 -1
- package/dist/esm/components/ToastMessage/Styles.js +3 -3
- package/dist/esm/components/ToastMessage/Styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +5 -0
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.d.ts +13 -3
- package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.js +60 -20
- package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +13 -13
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +138 -147
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts +0 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.js +0 -1
- package/dist/esm/components/ViewSwitcher/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/presentation/invoicing/invoiceObjectList.d.ts.map +1 -1
- package/dist/esm/presentation/invoicing/invoiceObjectList.js +2 -4
- package/dist/esm/presentation/invoicing/invoiceObjectList.js.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.d.ts.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js +3 -5
- package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/esm/presentation/shared/PageViewSwitcher.d.ts.map +1 -1
- package/dist/esm/presentation/shared/PageViewSwitcher.js +5 -10
- package/dist/esm/presentation/shared/PageViewSwitcher.js.map +1 -1
- package/dist/esm/presentation/shared/TaskListSettingsDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/TaskListSettingsDialog.js +3 -2
- package/dist/esm/presentation/shared/TaskListSettingsDialog.js.map +1 -1
- package/dist/esm/presentation/shared/headers.d.ts.map +1 -1
- package/dist/esm/presentation/shared/headers.js +4 -8
- package/dist/esm/presentation/shared/headers.js.map +1 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.d.ts +22 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.js +12 -7
- package/dist/esm/presentation/shared/systemSettingsDialog.js.map +1 -1
- package/dist/index.js +1229 -1052
- 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
- package/dist/cjs/components/ViewSwitcher/ViewIllustration.js +0 -127
- package/dist/cjs/components/ViewSwitcher/ViewIllustration.js.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewIllustration.d.ts +0 -20
- package/dist/esm/components/ViewSwitcher/ViewIllustration.d.ts.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewIllustration.js +0 -91
- package/dist/esm/components/ViewSwitcher/ViewIllustration.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","FontStyle","NOTEBOOK_CARD_MAX_TABS","StyledNotebookCard","a","withConfig","displayName","componentId","StyledNotebookCardBook","div","StyledNotebookCardTabs","StyledNotebookCardTab","StyledNotebookCardBack","StyledNotebookCardCover","StyledNotebookCardName","StyledNotebookCardCount","StyledNotebookCardOptions"],"sources":["../../../../src/components/NotebookCard/Styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { FontStyle } from \"../FontStyle\";\n\nexport const NOTEBOOK_CARD_MAX_TABS = 6;\n\nexport const StyledNotebookCard = styled.a`\n ${FontStyle}\n --notebook-card-cover-top: #44474e;\n --notebook-card-cover-bottom: #3f4249;\n --notebook-card-cover-edge: rgba(255, 255, 255, 0.008);\n --notebook-card-cover-shadow: rgba(0, 0, 0, 0.055);\n --notebook-card-spine: rgba(0, 0, 0, 0.045);\n --notebook-card-back: #26282d;\n --notebook-card-shadow: rgba(0, 0, 0, 0.032);\n --notebook-card-shadow-near: rgba(0, 0, 0, 0.045);\n --notebook-card-tab-edge: rgba(255, 255, 255, 0.016);\n --notebook-card-tab-shadow: rgba(0, 0, 0, 0.05);\n --notebook-card-name: #eef0f3;\n --notebook-card-count: #b8bdc7;\n\n @supports (color: light-dark(red, red)) {\n --notebook-card-cover-top: light-dark(#f5f0dd, #44474e);\n --notebook-card-cover-bottom: light-dark(#f3edd9, #3f4249);\n --notebook-card-cover-edge: light-dark(\n rgba(255, 255, 255, 0.6),\n rgba(255, 255, 255, 0.008)\n );\n --notebook-card-cover-shadow: light-dark(\n rgba(0, 0, 0, 0.06),\n rgba(0, 0, 0, 0.055)\n );\n --notebook-card-spine: light-dark(\n rgba(0, 0, 0, 0.03),\n rgba(0, 0, 0, 0.045)\n );\n --notebook-card-back: light-dark(#cfc6a8, #26282d);\n --notebook-card-shadow: light-dark(\n rgba(0, 0, 0, 0.05),\n rgba(0, 0, 0, 0.032)\n );\n --notebook-card-shadow-near: light-dark(\n rgba(0, 0, 0, 0.07),\n rgba(0, 0, 0, 0.045)\n );\n --notebook-card-tab-edge: light-dark(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.016)\n );\n --notebook-card-tab-shadow: light-dark(\n rgba(0, 0, 0, 0.09),\n rgba(0, 0, 0, 0.05)\n );\n --notebook-card-name: light-dark(#3a3830, #eef0f3);\n --notebook-card-count: light-dark(#6b675a, #b8bdc7);\n }\n\n display: block;\n width: 208px;\n height: 234px;\n text-decoration: none;\n`;\n\n/* The link stays in place on hover, so a pointer at the bottom edge does not lose it. */\nexport const StyledNotebookCardBook = styled.div`\n position: relative;\n display: flex;\n box-sizing: border-box;\n height: 100%;\n flex-direction: column;\n gap: 2px;\n padding: 24px 30px 0 18px;\n transition: translate 150ms cubic-bezier(0.4, 0, 0.2, 1);\n\n ${StyledNotebookCard}:hover & {\n translate: 0 -2px;\n }\n`;\n\nexport const StyledNotebookCardTabs = styled.div`\n position: absolute;\n top: 8px;\n left: 176px;\n display: flex;\n width: 32px;\n flex-direction: column;\n gap: 6px;\n`;\n\nexport const StyledNotebookCardTab = styled.div`\n height: 31px;\n border-radius: 0 4px 4px 0;\n box-shadow: 0 1px 1.5px var(--notebook-card-tab-shadow),\n inset 0 1px 0 var(--notebook-card-tab-edge);\n\n background-color: var(--page-paper-main);\n\n @supports (color: light-dark(red, red)) {\n background-color: light-dark(#e3d9b8, #b4a578);\n }\n`;\n\nexport const StyledNotebookCardBack = styled.div`\n position: absolute;\n top: 0.3px;\n left: 0.2px;\n width: 194px;\n height: 231px;\n border-radius: 4px;\n background-color: var(--notebook-card-back);\n box-shadow: 0 5px 12px var(--notebook-card-shadow),\n 0 1px 2px var(--notebook-card-shadow-near);\n`;\n\nexport const StyledNotebookCardCover = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 194px;\n height: 231px;\n border-radius: 5px 3px 3px 5px;\n background: linear-gradient(to right, var(--notebook-card-spine), transparent)\n left / 12px 100% no-repeat,\n linear-gradient(\n 191.86deg,\n var(--notebook-card-cover-top) 6.84%,\n var(--notebook-card-cover-bottom) 93.16%\n );\n box-shadow: 2px 0 3px var(--notebook-card-cover-shadow),\n inset 0 1px 0 var(--notebook-card-cover-edge);\n`;\n\nexport const StyledNotebookCardName = styled.div`\n position: relative;\n display: -webkit-box;\n flex-shrink: 0;\n overflow: hidden;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 4;\n overflow-wrap: break-word;\n font-size: calc(16px * var(--text-scale, 1));\n font-weight: 600;\n line-height: 20px;\n color: var(--notebook-card-name);\n\n ${StyledNotebookCard}:hover & {\n text-decoration-line: underline;\n }\n`;\n\nexport const StyledNotebookCardCount = styled.div`\n position: relative;\n flex-shrink: 0;\n overflow: hidden;\n font-size: calc(12px * var(--text-scale, 1));\n line-height: 16px;\n color: var(--notebook-card-count);\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const StyledNotebookCardOptions = styled.div`\n /* The cover keeps one look per scheme, whatever the theme tokens are. */\n --color-theme-300: #33363f;\n --color-theme-700: #b0b0b5;\n --color-theme-800: #dfdfe5;\n --color-theme-900: #ffffff;\n\n @supports (color: light-dark(red, red)) {\n --color-theme-300: light-dark(rgba(0, 0, 0, 0.08), #33363f);\n --color-theme-700: light-dark(#4a4a50, #b0b0b5);\n --color-theme-800: light-dark(#3a3a40, #dfdfe5);\n --color-theme-900: light-dark(#2b2b32, #ffffff);\n }\n\n position: absolute;\n right: 20px;\n bottom: 9px;\n display: flex;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,sBAAsB,GAAG,CAAC;AAEvC,OAAO,MAAMC,kBAAkB,GAAGH,MAAM,CAACI,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,m3CACtCN,SAAS,CAsDZ;;AAED;AACA,OAAO,MAAMO,sBAAsB,GAAGR,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qNAU5CJ,kBAAkB,CAGrB;AAED,OAAO,MAAMO,sBAAsB,GAAGV,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mGAQ/C;AAED,OAAO,MAAMI,qBAAqB,GAAGX,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6QAW9C;AAED,OAAO,MAAMK,sBAAsB,GAAGZ,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kOAU/C;AAED,OAAO,MAAMM,uBAAuB,GAAGb,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qZAgBhD;AAED,OAAO,MAAMO,sBAAsB,GAAGd,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gTAa5CJ,kBAAkB,CAGrB;AAED,OAAO,MAAMY,uBAAuB,GAAGf,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+LAShD;AAED,OAAO,MAAMS,yBAAyB,GAAGhB,MAAM,CAACS,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6YAkBlD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotebookCard/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/NotebookCard/index.ts"],"sourcesContent":["export * from \"./NotebookCard\";\n"],"mappings":"AAAA,cAAc,gBAAgB","ignoreList":[]}
|
|
@@ -5,11 +5,11 @@ const MAX_HEIGHT = "95vh";
|
|
|
5
5
|
export const StyledObjectFormModalClose = styled.button.withConfig({
|
|
6
6
|
displayName: "Styles__StyledObjectFormModalClose",
|
|
7
7
|
componentId: "sc-vysvjm-0"
|
|
8
|
-
})(["position:absolute;top:-1px;left:calc(100% + 8px);display:flex;align-items:center;justify-content:center;width:48px;height:48px;padding:0;cursor:pointer;background-color:var(--form-modal-surface,var(--color-theme-200));border:1px solid var(--form-modal-border,var(--border-raised));box-shadow:var(--form-modal-shadow,var(--shadow-primary));border-radius:24px;&:hover{filter:brightness(1.1);}svg{width:24px;height:24px;fill:var(--color-theme-700);}"]);
|
|
8
|
+
})(["position:absolute;top:-1px;left:calc(100% + 8px);display:flex;align-items:center;justify-content:center;width:48px;height:48px;padding:0;cursor:pointer;background-color:var(--form-modal-surface,var(--color-theme-200));border:1px solid var(--form-modal-border,var(--border-raised));box-shadow:var(--form-modal-shadow,var(--shadow-primary-simplified));border-radius:24px;&:hover{filter:brightness(1.1);}svg{width:24px;height:24px;fill:var(--color-theme-700);}"]);
|
|
9
9
|
StyledObjectFormModalClose.displayName = "StyledObjectFormModalClose";
|
|
10
10
|
export const StyledObjectFormModal = styled.div.withConfig({
|
|
11
11
|
displayName: "Styles__StyledObjectFormModal",
|
|
12
12
|
componentId: "sc-vysvjm-1"
|
|
13
|
-
})(["flex:0 0 auto;pointer-events:auto;position:relative;width:100%;max-width:", "px;max-height:", ";padding:20px;overflow-y:auto;overscroll-behavior:contain;background-color:var(--form-modal-surface,var(--color-theme-200));color:var(--color-theme-900);border:1px solid var(--form-modal-border,var(--border-raised));box-shadow:var(--form-modal-shadow,var(--shadow-primary));border-radius:24px;&[data-resizing]{overflow:hidden;}", " ", " ", " ", ""], props => props.$maxWidth, MAX_HEIGHT, props => props.$fill && css(["display:flex;flex-direction:column;> :not(.c-object-form-modal-close){min-height:0;}"]), props => props.$closeButton && css(["&,&[data-resizing]{overflow:visible;}&[data-resizing] > :not(.c-object-form-modal-close){overflow:hidden;}"]), FontStyle, BoxSizingStyle);
|
|
13
|
+
})(["flex:0 0 auto;pointer-events:auto;position:relative;width:100%;max-width:", "px;max-height:", ";padding:20px;overflow-y:auto;overscroll-behavior:contain;background-color:var(--form-modal-surface,var(--color-theme-200));color:var(--color-theme-900);border:1px solid var(--form-modal-border,var(--border-raised));box-shadow:var(--form-modal-shadow,var(--shadow-primary-simplified));border-radius:24px;&[data-resizing]{overflow:hidden;}", " ", " ", " ", ""], props => props.$maxWidth, MAX_HEIGHT, props => props.$fill && css(["display:flex;flex-direction:column;> :not(.c-object-form-modal-close){min-height:0;}"]), props => props.$closeButton && css(["&,&[data-resizing]{overflow:visible;}&[data-resizing] > :not(.c-object-form-modal-close){overflow:hidden;}"]), FontStyle, BoxSizingStyle);
|
|
14
14
|
StyledObjectFormModal.displayName = "StyledObjectFormModal";
|
|
15
15
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","MAX_HEIGHT","StyledObjectFormModalClose","button","withConfig","displayName","componentId","StyledObjectFormModal","div","props","$maxWidth","$fill","$closeButton"],"sources":["../../../../src/components/ObjectFormModal/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\nconst MAX_HEIGHT = \"95vh\";\n\nexport const StyledObjectFormModalClose = styled.button`\n position: absolute;\n top: -1px;\n left: calc(100% + 8px);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n padding: 0;\n cursor: pointer;\n background-color: var(--form-modal-surface, var(--color-theme-200));\n border: 1px solid var(--form-modal-border, var(--border-raised));\n box-shadow: var(--form-modal-shadow, var(--shadow-primary));\n border-radius: 24px;\n\n &:hover {\n filter: brightness(1.1);\n }\n\n svg {\n width: 24px;\n height: 24px;\n fill: var(--color-theme-700);\n }\n`;\n\nStyledObjectFormModalClose.displayName = \"StyledObjectFormModalClose\";\n\nexport const StyledObjectFormModal = styled.div<{\n $maxWidth: number;\n $fill: boolean;\n $closeButton: boolean;\n}>`\n flex: 0 0 auto;\n pointer-events: auto;\n position: relative;\n width: 100%;\n max-width: ${(props) => props.$maxWidth}px;\n max-height: ${MAX_HEIGHT};\n padding: 20px;\n overflow-y: auto;\n overscroll-behavior: contain;\n background-color: var(--form-modal-surface, var(--color-theme-200));\n color: var(--color-theme-900);\n border: 1px solid var(--form-modal-border, var(--border-raised));\n box-shadow: var(--form-modal-shadow, var(--shadow-primary));\n border-radius: 24px;\n\n &[data-resizing] {\n overflow: hidden;\n }\n\n ${(props) =>\n props.$fill &&\n css`\n display: flex;\n flex-direction: column;\n\n > :not(.c-object-form-modal-close) {\n min-height: 0;\n }\n `}\n\n /* The close button stands beside the surface, so the content clips in place of the surface. */\n ${(props) =>\n props.$closeButton &&\n css`\n &,\n &[data-resizing] {\n overflow: visible;\n }\n\n &[data-resizing] > :not(.c-object-form-modal-close) {\n overflow: hidden;\n }\n `}\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\n\nStyledObjectFormModal.displayName = \"StyledObjectFormModal\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAG,MAAM;AAEzB,OAAO,MAAMC,0BAA0B,GAAGL,MAAM,CAACM,MAAM,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","MAX_HEIGHT","StyledObjectFormModalClose","button","withConfig","displayName","componentId","StyledObjectFormModal","div","props","$maxWidth","$fill","$closeButton"],"sources":["../../../../src/components/ObjectFormModal/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\nconst MAX_HEIGHT = \"95vh\";\n\nexport const StyledObjectFormModalClose = styled.button`\n position: absolute;\n top: -1px;\n left: calc(100% + 8px);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n padding: 0;\n cursor: pointer;\n background-color: var(--form-modal-surface, var(--color-theme-200));\n border: 1px solid var(--form-modal-border, var(--border-raised));\n box-shadow: var(--form-modal-shadow, var(--shadow-primary-simplified));\n border-radius: 24px;\n\n &:hover {\n filter: brightness(1.1);\n }\n\n svg {\n width: 24px;\n height: 24px;\n fill: var(--color-theme-700);\n }\n`;\n\nStyledObjectFormModalClose.displayName = \"StyledObjectFormModalClose\";\n\nexport const StyledObjectFormModal = styled.div<{\n $maxWidth: number;\n $fill: boolean;\n $closeButton: boolean;\n}>`\n flex: 0 0 auto;\n pointer-events: auto;\n position: relative;\n width: 100%;\n max-width: ${(props) => props.$maxWidth}px;\n max-height: ${MAX_HEIGHT};\n padding: 20px;\n overflow-y: auto;\n overscroll-behavior: contain;\n background-color: var(--form-modal-surface, var(--color-theme-200));\n color: var(--color-theme-900);\n border: 1px solid var(--form-modal-border, var(--border-raised));\n box-shadow: var(--form-modal-shadow, var(--shadow-primary-simplified));\n border-radius: 24px;\n\n &[data-resizing] {\n overflow: hidden;\n }\n\n ${(props) =>\n props.$fill &&\n css`\n display: flex;\n flex-direction: column;\n\n > :not(.c-object-form-modal-close) {\n min-height: 0;\n }\n `}\n\n /* The close button stands beside the surface, so the content clips in place of the surface. */\n ${(props) =>\n props.$closeButton &&\n css`\n &,\n &[data-resizing] {\n overflow: visible;\n }\n\n &[data-resizing] > :not(.c-object-form-modal-close) {\n overflow: hidden;\n }\n `}\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\n\nStyledObjectFormModal.displayName = \"StyledObjectFormModal\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAG,MAAM;AAEzB,OAAO,MAAMC,0BAA0B,GAAGL,MAAM,CAACM,MAAM,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,idAyBtD;AAEDJ,0BAA0B,CAACG,WAAW,GAAG,4BAA4B;AAErE,OAAO,MAAME,qBAAqB,GAAGV,MAAM,CAACW,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6cAS/BG,KAAK,IAAKA,KAAK,CAACC,SAAS,EACzBT,UAAU,EAcrBQ,KAAK,IACNA,KAAK,CAACE,KAAK,IACXb,GAAG,0FAOF,EAGAW,KAAK,IACNA,KAAK,CAACG,YAAY,IAClBd,GAAG,gHASF,EAEDE,SAAS,EACTD,cAAc,CACjB;AAEDQ,qBAAqB,CAACF,WAAW,GAAG,uBAAuB","ignoreList":[]}
|
|
@@ -2,18 +2,20 @@ import React, { ComponentPropsWithoutRef, ReactElement, ReactNode } from "react"
|
|
|
2
2
|
export interface PillButtonProps extends ComponentPropsWithoutRef<"button"> {
|
|
3
3
|
/** Icon shown while the pill has no value. */
|
|
4
4
|
icon?: ReactElement;
|
|
5
|
+
/** Icon after the placeholder, for example a caret on a pill that opens a menu. */
|
|
6
|
+
endIcon?: ReactElement;
|
|
5
7
|
/** Label shown next to the icon while the pill has no value. */
|
|
6
8
|
placeholder?: ReactNode;
|
|
7
9
|
/** Fill of the pill. "ghost" stays empty until hover, focus, open, or hover of a `c-pill-host` ancestor. "alert" and "warning" look soft and get their own active look, for example an active flag. "accent" has a soft fill and the text of the primary color, for an action that must stand out. */
|
|
8
|
-
tone?: "soft" | "alternate" | "ghost" | "outlined" | "alert" | "warning" | "accent";
|
|
10
|
+
tone?: "soft" | "alternate" | "ghost" | "outlined" | "alert" | "warning" | "accent" | "raised";
|
|
9
11
|
/** Selected or pressed state. */
|
|
10
12
|
active?: boolean;
|
|
11
13
|
/** A square-ish pill that holds only its icon, for example a close button. */
|
|
12
14
|
iconOnly?: boolean;
|
|
13
15
|
/** Hide the placeholder and keep the icon, always or only on small screens. */
|
|
14
16
|
compact?: boolean | "mobile";
|
|
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
|
+
/** Height: "medium" is 26px, "small" is 24px like a small Button, "dense" is 24px with 12px text and icon, "xsmall" is 18px with 10px text like a type chip. */
|
|
18
|
+
size?: "xsmall" | "small" | "dense" | "medium";
|
|
17
19
|
/** Side padding. "tight" suits a value that draws to its own edges, like avatars. */
|
|
18
20
|
inset?: "default" | "tight";
|
|
19
21
|
/** Dims a disabled pill. Set false to keep the full look of a read-only indicator, still with no hover. */
|
|
@@ -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,SAAS,EACV,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,eAAgB,SAAQ,wBAAwB,CAAC,QAAQ,CAAC;IACzE,8CAA8C;IAC9C,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,gEAAgE;IAChE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sSAAsS;IACtS,IAAI,CAAC,EACD,MAAM,GACN,WAAW,GACX,OAAO,GACP,UAAU,GACV,OAAO,GACP,SAAS,GACT,QAAQ,CAAC;IACb,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7B,
|
|
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,SAAS,EACV,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,eAAgB,SAAQ,wBAAwB,CAAC,QAAQ,CAAC;IACzE,8CAA8C;IAC9C,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,mFAAmF;IACnF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sSAAsS;IACtS,IAAI,CAAC,EACD,MAAM,GACN,WAAW,GACX,OAAO,GACP,UAAU,GACV,OAAO,GACP,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;IACb,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7B,gKAAgK;IAChK,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC/C,qFAAqF;IACrF,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,2GAA2G;IAC3G,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,2FAwEtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["icon", "placeholder", "tone", "active", "iconOnly", "compact", "size", "inset", "dimDisabled", "type", "className", "children"];
|
|
3
|
+
const _excluded = ["icon", "endIcon", "placeholder", "tone", "active", "iconOnly", "compact", "size", "inset", "dimDisabled", "type", "className", "children"];
|
|
4
4
|
import React, { Children, forwardRef } from "react";
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import { StyledPillButton, StyledPillIcon, StyledPillPlaceholder } from "./Styles";
|
|
@@ -19,6 +19,7 @@ import { StyledPillButton, StyledPillIcon, StyledPillPlaceholder } from "./Style
|
|
|
19
19
|
export const PillButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
20
20
|
var _args$ariaLabel;
|
|
21
21
|
let icon = _ref.icon,
|
|
22
|
+
endIcon = _ref.endIcon,
|
|
22
23
|
placeholder = _ref.placeholder,
|
|
23
24
|
_ref$tone = _ref.tone,
|
|
24
25
|
tone = _ref$tone === void 0 ? "soft" : _ref$tone,
|
|
@@ -63,7 +64,9 @@ export const PillButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
63
64
|
className: "c-pill-button__icon"
|
|
64
65
|
}, icon) : null, isEmpty && placeholder && !iconOnly ? /*#__PURE__*/React.createElement(StyledPillPlaceholder, {
|
|
65
66
|
className: "c-pill-button__placeholder"
|
|
66
|
-
}, placeholder) : null, isEmpty ?
|
|
67
|
+
}, placeholder) : null, isEmpty && endIcon && !iconOnly ? /*#__PURE__*/React.createElement(StyledPillIcon, {
|
|
68
|
+
className: "c-pill-button__end-icon"
|
|
69
|
+
}, endIcon) : null, isEmpty ? null : children);
|
|
67
70
|
});
|
|
68
71
|
PillButton.displayName = "PillButton";
|
|
69
72
|
//# sourceMappingURL=PillButton.js.map
|
|
@@ -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$dimDisabled","dimDisabled","_ref$type","type","className","children","args","_objectWithoutPropertiesLoose","_excluded","isEmpty","toArray","length","ariaLabel","undefined","createElement","_extends","$tone","$active","Boolean","$empty","$iconOnly","$compact","$size","$inset","$dimDisabled","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. \"alert\" and \"warning\" look soft and get their own active look, for example an active flag. \"accent\" has a soft fill and the text of the primary color, for an action that must stand out. */\n tone?:\n | \"soft\"\n | \"alternate\"\n | \"ghost\"\n | \"outlined\"\n | \"alert\"\n | \"warning\"\n | \"accent\";\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 /** Dims a disabled pill. Set false to keep the full look of a read-only indicator, still with no hover. */\n dimDisabled?: boolean;\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 dimDisabled = true,\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 $dimDisabled={dimDisabled}\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;
|
|
1
|
+
{"version":3,"file":"PillButton.js","names":["React","Children","forwardRef","classnames","StyledPillButton","StyledPillIcon","StyledPillPlaceholder","PillButton","_ref","ref","_args$ariaLabel","icon","endIcon","placeholder","_ref$tone","tone","active","_ref$iconOnly","iconOnly","_ref$compact","compact","_ref$size","size","_ref$inset","inset","_ref$dimDisabled","dimDisabled","_ref$type","type","className","children","args","_objectWithoutPropertiesLoose","_excluded","isEmpty","toArray","length","ariaLabel","undefined","createElement","_extends","$tone","$active","Boolean","$empty","$iconOnly","$compact","$size","$inset","$dimDisabled","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 /** Icon after the placeholder, for example a caret on a pill that opens a menu. */\n endIcon?: 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. \"alert\" and \"warning\" look soft and get their own active look, for example an active flag. \"accent\" has a soft fill and the text of the primary color, for an action that must stand out. */\n tone?:\n | \"soft\"\n | \"alternate\"\n | \"ghost\"\n | \"outlined\"\n | \"alert\"\n | \"warning\"\n | \"accent\"\n | \"raised\";\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, \"dense\" is 24px with 12px text and icon, \"xsmall\" is 18px with 10px text like a type chip. */\n size?: \"xsmall\" | \"small\" | \"dense\" | \"medium\";\n /** Side padding. \"tight\" suits a value that draws to its own edges, like avatars. */\n inset?: \"default\" | \"tight\";\n /** Dims a disabled pill. Set false to keep the full look of a read-only indicator, still with no hover. */\n dimDisabled?: boolean;\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 endIcon,\n placeholder,\n tone = \"soft\",\n active,\n iconOnly = false,\n compact = false,\n size = \"medium\",\n inset = \"default\",\n dimDisabled = true,\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 $dimDisabled={dimDisabled}\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 && endIcon && !iconOnly ? (\n <StyledPillIcon className=\"c-pill-button__end-icon\">\n {endIcon}\n </StyledPillIcon>\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;AAiCjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGL,UAAU,CAClC,CAAAM,IAAA,EAiBEC,GAAG,KACA;EAAA,IAAAC,eAAA;EAAA,IAhBDC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IAAAC,SAAA,GAAAN,IAAA,CACXO,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,MAAM,GAAAA,SAAA;IACbE,MAAM,GAAAR,IAAA,CAANQ,MAAM;IAAAC,aAAA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cb;EAAO,GACjBe,IAAI;IACR,cAAYM,SAAU;IACtBI,KAAK,EAAE1B,IAAK;IACZ2B,OAAO,EAAEC,OAAO,CAAC3B,MAAM,CAAE;IACzB4B,MAAM,EAAEV,OAAQ;IAChBW,SAAS,EAAE3B,QAAS;IACpB4B,QAAQ,EAAE1B,OAAQ;IAClB2B,KAAK,EAAEzB,IAAK;IACZ0B,MAAM,EAAExB,KAAM;IACdyB,YAAY,EAAEvB;EAAY,IAEzBQ,OAAO,IAAIvB,IAAI,gBACdX,KAAA,CAAAuC,aAAA,CAAClC,cAAc;IAACwB,SAAS,EAAC;EAAqB,GAC5ClB,IACa,CAAC,GACf,IAAI,EACPuB,OAAO,IAAIrB,WAAW,IAAI,CAACK,QAAQ,gBAClClB,KAAA,CAAAuC,aAAA,CAACjC,qBAAqB;IAACuB,SAAS,EAAC;EAA4B,GAC1DhB,WACoB,CAAC,GACtB,IAAI,EACPqB,OAAO,IAAItB,OAAO,IAAI,CAACM,QAAQ,gBAC9BlB,KAAA,CAAAuC,aAAA,CAAClC,cAAc;IAACwB,SAAS,EAAC;EAAyB,GAChDjB,OACa,CAAC,GACf,IAAI,EACPsB,OAAO,GAAG,IAAI,GAAGJ,QACF,CAAC;AAEvB,CACF,CAAC;AAEDvB,UAAU,CAAC2C,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;IAC9C,YAAY,EAAE,OAAO,CAAC;CACvB;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;IAC9C,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,qEAU1B,CAAC;AAIF,eAAO,MAAM,qBAAqB,qEAGjC,CAAC;AAqMF,eAAO,MAAM,gBAAgB,0FAgG5B,CAAC"}
|
|
@@ -24,6 +24,8 @@ const toneStyle = tone => {
|
|
|
24
24
|
return css(["background-color:var(--color-theme-300);&:hover,&:focus-visible{background-color:var(--color-theme-400);", "}"], hoverTextStyle);
|
|
25
25
|
case "accent":
|
|
26
26
|
return css(["background-color:color-mix( in srgb,var(--color-primary) 15%,transparent );color:var(--color-primary);", "{color:var(--color-primary);}&:hover,&:focus-visible{background-color:color-mix( in srgb,var(--color-primary) 25%,transparent );color:var(--color-primary);}"], StyledPillIcon);
|
|
27
|
+
case "raised":
|
|
28
|
+
return css(["&&{gap:6px;font-weight:600;}border:1px solid var(--color-theme-400);background-color:var(--color-theme-200);box-shadow:inset 0 1px 0 rgba(255,255,255,0.07);color:var(--color-theme-900);", "{color:inherit;}@supports (color:light-dark(red,red)){border-color:light-dark(var(--color-theme-400),#494e59);background-color:transparent;background-image:linear-gradient( light-dark(#ffffff,#3a3f49),light-dark(#f3f4f6,#31353e) );color:light-dark(var(--color-theme-900),#eceef1);&:hover{background-image:linear-gradient( light-dark(#f8f9fa,#444a55),light-dark(#eceef1,#3a3f49) );}}&:focus-visible{outline:2px solid var(--color-primary);outline-offset:1px;}&[aria-expanded=\"true\"]{background-image:none;}"], StyledPillIcon);
|
|
27
29
|
case "ghost":
|
|
28
30
|
return css(["background-color:transparent;.c-pill-host:hover &.c-pill-button--ghost,&:focus-visible{background-color:var(--pill-background);}.c-pill-host:hover &.c-pill-button--ghost:hover,&:hover{background-color:var(--pill-background-hover);", "}"], hoverTextStyle);
|
|
29
31
|
case "outlined":
|
|
@@ -36,14 +38,16 @@ const compactStyle = css(["", "{display:none;}"], StyledPillPlaceholder);
|
|
|
36
38
|
const PILL_HEIGHTS = {
|
|
37
39
|
xsmall: "18px",
|
|
38
40
|
small: "24px",
|
|
41
|
+
dense: "24px",
|
|
39
42
|
medium: "26px"
|
|
40
43
|
};
|
|
44
|
+
const denseStyle = css(["gap:4px;--c-pill-padding-x:11px;font-size:calc(0.75rem * var(--text-scale,1));", " svg{width:12px;height:12px;}"], StyledPillIcon);
|
|
41
45
|
|
|
42
46
|
/* The size of a type chip: small caps of an object type or a state switch. */
|
|
43
47
|
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);
|
|
44
48
|
export const StyledPillButton = styled.button.withConfig({
|
|
45
49
|
displayName: "Styles__StyledPillButton",
|
|
46
50
|
componentId: "sc-14yhio0-2"
|
|
47
|
-
})(["", " ", " 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:", ";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 => props.$dimDisabled ? "50%" : "100%", 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:
|
|
51
|
+
})(["", " ", " 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:", ";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 => props.$dimDisabled ? "50%" : "100%", 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:", ";padding:0;", " svg{width:16px;height:16px;}"], props.$tone === "raised" ? "28px" : "36px", StyledPillIcon), props => props.$size === "xsmall" && xsmallStyle, props => props.$size === "dense" && denseStyle, props => props.$compact === true && compactStyle, props => props.$compact === "mobile" && css(["@media (max-width:768px){", "}"], compactStyle), props => props.$active && css(["&,&:hover,&:focus-visible{", "}"], activeStyle(props.$tone)), props => activeStyle(props.$tone));
|
|
48
52
|
StyledPillButton.displayName = "StyledPillButton";
|
|
49
53
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","ACTIVE_COLORS","alert","warning","activeColors","tone","activeStyle","hoverTextStyle","toneStyle","compactStyle","PILL_HEIGHTS","xsmall","small","medium","xsmallStyle","StyledPillButton","button","props","$size","$inset","$empty","$dimDisabled","$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 $dimDisabled: boolean;\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 ACTIVE_COLORS = {\n alert: [\"var(--alert-surface-subtle)\", \"var(--red-alert)\"],\n warning: [\"var(--note-bg)\", \"var(--warning-text)\"],\n};\n\nconst activeColors = (tone: StyledPillButtonProps[\"$tone\"]) =>\n tone === \"alert\" || tone === \"warning\"\n ? ACTIVE_COLORS[tone]\n : [\"var(--pill-background-active)\", \"var(--color-primary)\"];\n\nconst activeStyle = (tone: StyledPillButtonProps[\"$tone\"]) => css`\n background-color: ${activeColors(tone)[0]};\n color: ${activeColors(tone)[1]};\n\n ${StyledPillIcon} {\n color: ${activeColors(tone)[1]};\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 \"accent\":\n return css`\n background-color: color-mix(\n in srgb,\n var(--color-primary) 15%,\n transparent\n );\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n\n &:hover,\n &:focus-visible {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 25%,\n transparent\n );\n color: var(--color-primary);\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: ${(props) => (props.$dimDisabled ? \"50%\" : \"100%\")};\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(props.$tone)}\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 ${(props) => activeStyle(props.$tone)}\n }\n`;\n\nStyledPillButton.displayName = \"StyledPillButton\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAaxC,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qHAUxC;AAEDJ,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAE7C,OAAO,MAAME,qBAAqB,GAAGT,MAAM,CAACK,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAG/C;AAEDC,qBAAqB,CAACF,WAAW,GAAG,uBAAuB;AAE3D,MAAMG,aAAa,GAAG;EACpBC,KAAK,EAAE,CAAC,6BAA6B,EAAE,kBAAkB,CAAC;EAC1DC,OAAO,EAAE,CAAC,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AAM,KAAK,OAAO,GAAG,KAAK,GAAG,MAAO,EAQlEF,KAAK,IACbA,KAAK,CAACG,MAAM,GAAG,wBAAwB,GAAG,wBAAwB,EAUtDH,KAAK,IAAMA,KAAK,CAACI,YAAY,GAAG,KAAK,GAAG,MAAO,EAI1DJ,KAAK,IAAKT,SAAS,CAACS,KAAK,CAACK,KAAK,CAAC,EAEhCL,KAAK,IACNA,KAAK,CAACK,KAAK,KAAK,OAAO,IACvBL,KAAK,CAACG,MAAM,IACZ5B,GAAG,8IACCG,cAAc,EAAKK,qBAAqB,EAQtCL,cAAc,EAAKK,qBAAqB,CAI7C,EAEAiB,KAAK,IACNA,KAAK,CAACM,SAAS,IACf/B,GAAG,6DAICG,cAAc,CAIjB,EAEAsB,KAAK,IAAKA,KAAK,CAACC,KAAK,KAAK,QAAQ,IAAIJ,WAAW,EAEjDG,KAAK,IAAKA,KAAK,CAACO,QAAQ,KAAK,IAAI,IAAIf,YAAY,EAEjDQ,KAAK,IACNA,KAAK,CAACO,QAAQ,KAAK,QAAQ,IAC3BhC,GAAG,qCAEGiB,YAAY,CAEjB,EAGAQ,KAAK,IACNA,KAAK,CAACQ,OAAO,IACbjC,GAAG,sCAIGc,WAAW,CAACW,KAAK,CAACK,KAAK,CAAC,CAE7B,EAKEL,KAAK,IAAKX,WAAW,CAACW,KAAK,CAACK,KAAK,CAAC,CAExC;AAEDP,gBAAgB,CAACjB,WAAW,GAAG,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","ACTIVE_COLORS","alert","warning","activeColors","tone","activeStyle","hoverTextStyle","toneStyle","compactStyle","PILL_HEIGHTS","xsmall","small","dense","medium","denseStyle","xsmallStyle","StyledPillButton","button","props","$size","$inset","$empty","$dimDisabled","$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 $dimDisabled: boolean;\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 ACTIVE_COLORS = {\n alert: [\"var(--alert-surface-subtle)\", \"var(--red-alert)\"],\n warning: [\"var(--note-bg)\", \"var(--warning-text)\"],\n};\n\nconst activeColors = (tone: StyledPillButtonProps[\"$tone\"]) =>\n tone === \"alert\" || tone === \"warning\"\n ? ACTIVE_COLORS[tone]\n : [\"var(--pill-background-active)\", \"var(--color-primary)\"];\n\nconst activeStyle = (tone: StyledPillButtonProps[\"$tone\"]) => css`\n background-color: ${activeColors(tone)[0]};\n color: ${activeColors(tone)[1]};\n\n ${StyledPillIcon} {\n color: ${activeColors(tone)[1]};\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 \"accent\":\n return css`\n background-color: color-mix(\n in srgb,\n var(--color-primary) 15%,\n transparent\n );\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n\n &:hover,\n &:focus-visible {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 25%,\n transparent\n );\n color: var(--color-primary);\n }\n `;\n case \"raised\":\n return css`\n && {\n gap: 6px;\n font-weight: 600;\n }\n\n border: 1px solid var(--color-theme-400);\n background-color: var(--color-theme-200);\n box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);\n color: var(--color-theme-900);\n\n ${StyledPillIcon} {\n color: inherit;\n }\n\n @supports (color: light-dark(red, red)) {\n border-color: light-dark(var(--color-theme-400), #494e59);\n background-color: transparent;\n background-image: linear-gradient(\n light-dark(#ffffff, #3a3f49),\n light-dark(#f3f4f6, #31353e)\n );\n color: light-dark(var(--color-theme-900), #eceef1);\n\n &:hover {\n background-image: linear-gradient(\n light-dark(#f8f9fa, #444a55),\n light-dark(#eceef1, #3a3f49)\n );\n }\n }\n\n &:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n }\n\n &[aria-expanded=\"true\"] {\n background-image: none;\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 = {\n xsmall: \"18px\",\n small: \"24px\",\n dense: \"24px\",\n medium: \"26px\",\n};\n\nconst denseStyle = css`\n gap: 4px;\n --c-pill-padding-x: 11px;\n font-size: calc(0.75rem * var(--text-scale, 1));\n\n ${StyledPillIcon} svg {\n width: 12px;\n height: 12px;\n }\n`;\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: ${(props) => (props.$dimDisabled ? \"50%\" : \"100%\")};\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: ${props.$tone === \"raised\" ? \"28px\" : \"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.$size === \"dense\" && denseStyle}\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(props.$tone)}\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 ${(props) => activeStyle(props.$tone)}\n }\n`;\n\nStyledPillButton.displayName = \"StyledPillButton\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAaxC,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qHAUxC;AAEDJ,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAE7C,OAAO,MAAME,qBAAqB,GAAGT,MAAM,CAACK,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAG/C;AAEDC,qBAAqB,CAACF,WAAW,GAAG,uBAAuB;AAE3D,MAAMG,aAAa,GAAG;EACpBC,KAAK,EAAE,CAAC,6BAA6B,EAAE,kBAAkB,CAAC;EAC1DC,OAAO,EAAE,CAAC,gBAAgB,EAAE,qBAAqB;AACnD,CAAC;AAED,MAAMC,YAAY,GAAIC,IAAoC,IACxDA,IAAI,KAAK,OAAO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AC,EAEvBD,KAAK,IAAMA,KAAK,CAACE,MAAM,KAAK,OAAO,GAAG,KAAK,GAAG,MAAO,EAQlEF,KAAK,IACbA,KAAK,CAACG,MAAM,GAAG,wBAAwB,GAAG,wBAAwB,EAUtDH,KAAK,IAAMA,KAAK,CAACI,YAAY,GAAG,KAAK,GAAG,MAAO,EAI1DJ,KAAK,IAAKX,SAAS,CAACW,KAAK,CAACK,KAAK,CAAC,EAEhCL,KAAK,IACNA,KAAK,CAACK,KAAK,KAAK,OAAO,IACvBL,KAAK,CAACG,MAAM,IACZ9B,GAAG,8IACCG,cAAc,EAAKK,qBAAqB,EAQtCL,cAAc,EAAKK,qBAAqB,CAI7C,EAEAmB,KAAK,IACNA,KAAK,CAACM,SAAS,IACfjC,GAAG,6DACQ2B,KAAK,CAACK,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,EAGjD7B,cAAc,CAIjB,EAEAwB,KAAK,IAAKA,KAAK,CAACC,KAAK,KAAK,QAAQ,IAAIJ,WAAW,EAEjDG,KAAK,IAAKA,KAAK,CAACC,KAAK,KAAK,OAAO,IAAIL,UAAU,EAE/CI,KAAK,IAAKA,KAAK,CAACO,QAAQ,KAAK,IAAI,IAAIjB,YAAY,EAEjDU,KAAK,IACNA,KAAK,CAACO,QAAQ,KAAK,QAAQ,IAC3BlC,GAAG,qCAEGiB,YAAY,CAEjB,EAGAU,KAAK,IACNA,KAAK,CAACQ,OAAO,IACbnC,GAAG,sCAIGc,WAAW,CAACa,KAAK,CAACK,KAAK,CAAC,CAE7B,EAKEL,KAAK,IAAKb,WAAW,CAACa,KAAK,CAACK,KAAK,CAAC,CAExC;AAEDP,gBAAgB,CAACnB,WAAW,GAAG,kBAAkB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ComponentPropsWithoutRef } from "react";
|
|
2
2
|
export interface PillGroupProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
-
/** "soft" joins filled pills with small gaps. "outlined" puts them in one frame with dividers. */
|
|
4
|
-
appearance?: "soft" | "outlined";
|
|
3
|
+
/** "soft" joins filled pills with small gaps. "outlined" puts them in one frame with dividers. "raised" sticks raised pills together. */
|
|
4
|
+
appearance?: "soft" | "outlined" | "raised";
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* @component PillGroup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/PillGroup/PillGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,wBAAwB,EAAc,MAAM,OAAO,CAAC;AAMpE,MAAM,WAAW,cAAe,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACrE,
|
|
1
|
+
{"version":3,"file":"PillGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/PillGroup/PillGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,wBAAwB,EAAc,MAAM,OAAO,CAAC;AAMpE,MAAM,WAAW,cAAe,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACrE,yIAAyI;IACzI,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC7C;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,uFAgBrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillGroup.js","names":["React","forwardRef","classnames","StyledPillGroup","PillGroup","_ref","ref","_ref$appearance","appearance","className","children","args","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","role","$appearance","displayName"],"sources":["../../../../src/components/PillGroup/PillGroup.tsx"],"sourcesContent":["import React, { ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledPillGroup } from \"./Styles\";\n\nexport interface PillGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n /** \"soft\" joins filled pills with small gaps. \"outlined\" puts them in one frame with dividers. */\n appearance?: \"soft\" | \"outlined\";\n}\n\n/**\n * @component PillGroup\n * @description\n * Joins PillButton children into one segmented control. The outer pills keep their round ends.\n * A child may wrap its pill, for example in a Tooltip or a picker, the group still finds it.\n *\n * @example\n * <PillGroup aria-label=\"Task fields\">\n * <PillButton icon={<PersonPlusIcon />} placeholder=\"Assignee\" />\n * <PillButton icon={<CalendarIcon />} placeholder=\"Dates\" />\n * </PillGroup>\n */\nexport const PillGroup = forwardRef<HTMLDivElement, PillGroupProps>(\n ({ appearance = \"soft\", className, children, ...args }, ref) => (\n <StyledPillGroup\n ref={ref}\n role=\"group\"\n className={classnames(\n \"c-pill-group\",\n `c-pill-group--${appearance}`,\n className\n )}\n $appearance={appearance}\n {...args}\n >\n {children}\n </StyledPillGroup>\n )\n);\n\nPillGroup.displayName = \"PillGroup\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAA8BC,UAAU,QAAQ,OAAO;AAEnE,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,eAAe,QAAQ,UAAU;AAO1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,gBAAGH,UAAU,CACjC,CAAAI,IAAA,EAAwDC,GAAG;EAAA,IAAAC,eAAA,GAAAF,IAAA,CAAxDG,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,MAAM,GAAAA,eAAA;IAAEE,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAKC,IAAI,GAAAC,6BAAA,CAAAP,IAAA,EAAAQ,SAAA;EAAA,oBAClDb,KAAA,CAAAc,aAAA,CAACX,eAAe,EAAAY,QAAA;IACdT,GAAG,EAAEA,GAAI;IACTU,IAAI,EAAC,OAAO;IACZP,SAAS,EAAEP,UAAU,CACnB,cAAc,qBACGM,UAAU,EAC3BC,SACF,CAAE;IACFQ,WAAW,EAAET;EAAW,GACpBG,IAAI,GAEPD,QACc,CAAC;AAAA,CAEtB,CAAC;AAEDN,SAAS,CAACc,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PillGroup.js","names":["React","forwardRef","classnames","StyledPillGroup","PillGroup","_ref","ref","_ref$appearance","appearance","className","children","args","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","role","$appearance","displayName"],"sources":["../../../../src/components/PillGroup/PillGroup.tsx"],"sourcesContent":["import React, { ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledPillGroup } from \"./Styles\";\n\nexport interface PillGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n /** \"soft\" joins filled pills with small gaps. \"outlined\" puts them in one frame with dividers. \"raised\" sticks raised pills together. */\n appearance?: \"soft\" | \"outlined\" | \"raised\";\n}\n\n/**\n * @component PillGroup\n * @description\n * Joins PillButton children into one segmented control. The outer pills keep their round ends.\n * A child may wrap its pill, for example in a Tooltip or a picker, the group still finds it.\n *\n * @example\n * <PillGroup aria-label=\"Task fields\">\n * <PillButton icon={<PersonPlusIcon />} placeholder=\"Assignee\" />\n * <PillButton icon={<CalendarIcon />} placeholder=\"Dates\" />\n * </PillGroup>\n */\nexport const PillGroup = forwardRef<HTMLDivElement, PillGroupProps>(\n ({ appearance = \"soft\", className, children, ...args }, ref) => (\n <StyledPillGroup\n ref={ref}\n role=\"group\"\n className={classnames(\n \"c-pill-group\",\n `c-pill-group--${appearance}`,\n className\n )}\n $appearance={appearance}\n {...args}\n >\n {children}\n </StyledPillGroup>\n )\n);\n\nPillGroup.displayName = \"PillGroup\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAA8BC,UAAU,QAAQ,OAAO;AAEnE,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,eAAe,QAAQ,UAAU;AAO1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,gBAAGH,UAAU,CACjC,CAAAI,IAAA,EAAwDC,GAAG;EAAA,IAAAC,eAAA,GAAAF,IAAA,CAAxDG,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,MAAM,GAAAA,eAAA;IAAEE,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAKC,IAAI,GAAAC,6BAAA,CAAAP,IAAA,EAAAQ,SAAA;EAAA,oBAClDb,KAAA,CAAAc,aAAA,CAACX,eAAe,EAAAY,QAAA;IACdT,GAAG,EAAEA,GAAI;IACTU,IAAI,EAAC,OAAO;IACZP,SAAS,EAAEP,UAAU,CACnB,cAAc,qBACGM,UAAU,EAC3BC,SACF,CAAE;IACFQ,WAAW,EAAET;EAAW,GACpBG,IAAI,GAEPD,QACc,CAAC;AAAA,CAEtB,CAAC;AAEDN,SAAS,CAACc,WAAW,GAAG,WAAW","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;AAY7C,eAAO,MAAM,eAAe;iBACb,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;SA0FvD,CAAC"}
|
|
@@ -3,10 +3,11 @@ 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
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 lastIconOnly = "& > .c-pill-button--icon-only:last-child, & > :last-child .c-pill-button--icon-only";
|
|
6
7
|
const lastText = "& > .c-pill-button:not(.c-pill-button--icon-only):last-child, & > :last-child .c-pill-button:not(.c-pill-button--icon-only)";
|
|
7
8
|
export const StyledPillGroup = styled.div.withConfig({
|
|
8
9
|
displayName: "Styles__StyledPillGroup",
|
|
9
10
|
componentId: "sc-1x5hpq8-0"
|
|
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;}.c-pill-button:not(.c-pill-button--accent){background-color:transparent;}", ",", "{border-radius:0;}& > * + *{border-left:1px solid var(--pill-border);}"], first, last));
|
|
11
|
+
})(["", " 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 === "raised" && css(["border-radius:var(--ac-br-rounded);box-shadow:0 1px 1px rgba(0,0,0,0.22);", "{width:auto;padding-left:7px;padding-right:calc(var(--c-pill-padding-x,10px) + 4px);}& > * + *{margin-left:-1px;}.c-pill-button:hover,.c-pill-button:focus-visible{position:relative;z-index:1;}"], lastIconOnly), props => props.$appearance === "outlined" && css(["border:1px solid var(--pill-border);border-radius:var(--ac-br-6);overflow:hidden;.c-pill-button{height:24px;}.c-pill-button:not(.c-pill-button--accent){background-color:transparent;}", ",", "{border-radius:0;}& > * + *{border-left:1px solid var(--pill-border);}"], first, last));
|
|
11
12
|
StyledPillGroup.displayName = "StyledPillGroup";
|
|
12
13
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
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 }\n\n .c-pill-button:not(.c-pill-button--accent) {\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,
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","first","last","firstText","lastIconOnly","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 lastIconOnly =\n \"& > .c-pill-button--icon-only:last-child, & > :last-child .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 === \"raised\" &&\n css`\n border-radius: var(--ac-br-rounded);\n box-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);\n\n /* An icon at the round end gets the same room as the first label. */\n ${lastIconOnly} {\n width: auto;\n padding-left: 7px;\n padding-right: calc(var(--c-pill-padding-x, 10px) + 4px);\n }\n\n /* The neighbors share one border. */\n & > * + * {\n margin-left: -1px;\n }\n\n .c-pill-button:hover,\n .c-pill-button:focus-visible {\n position: relative;\n z-index: 1;\n }\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 }\n\n .c-pill-button:not(.c-pill-button--accent) {\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,YAAY,GAChB,qFAAqF;AACvF,MAAMC,QAAQ,GACZ,6HAA6H;AAE/H,OAAO,MAAMC,eAAe,GAAGR,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qeAGrCV,cAAc,EAedC,KAAK,EAKLC,IAAI,EAMJC,SAAS,EAITE,QAAQ,EAIPM,KAAK,IACNA,KAAK,CAACC,WAAW,KAAK,MAAM,IAC5Bb,GAAG,cAEF,EAEAY,KAAK,IACNA,KAAK,CAACC,WAAW,KAAK,QAAQ,IAC9Bb,GAAG,oRAKCK,YAAY,CAgBf,EAEAO,KAAK,IACNA,KAAK,CAACC,WAAW,KAAK,UAAU,IAChCb,GAAG,4QAaCE,KAAK,EAAKC,IAAI,CAOjB,CACJ;AAEDI,eAAe,CAACG,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -28,6 +28,8 @@ interface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
|
28
28
|
strategy?: PositioningStrategy;
|
|
29
29
|
/** After Write callback */
|
|
30
30
|
afterWrite?: (...args: any[]) => void;
|
|
31
|
+
/** Follow the anchor when it changes size while the popper is open. Off by default. */
|
|
32
|
+
followAnchor?: boolean;
|
|
31
33
|
/** Extra Popper.js modifiers, merged with the built-in ones */
|
|
32
34
|
modifiers?: PopperModifier[];
|
|
33
35
|
/** Component children */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../src/components/Popper/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,aAAa,EACb,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ACzB,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,MAAM,oFA+KlB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "anchorEl", "open", "style", "transition", "placement", "strategy", "afterWrite", "modifiers"];
|
|
3
|
+
const _excluded = ["children", "anchorEl", "open", "style", "transition", "placement", "strategy", "afterWrite", "followAnchor", "modifiers"];
|
|
4
4
|
import React, { forwardRef, useCallback, useRef, useEffect, useState } from "react";
|
|
5
5
|
import { createPopper } from "@popperjs/core";
|
|
6
6
|
import { StyledPopper } from "./Styles";
|
|
@@ -18,6 +18,8 @@ export const Popper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
18
|
_ref$strategy = _ref.strategy,
|
|
19
19
|
strategy = _ref$strategy === void 0 ? "absolute" : _ref$strategy,
|
|
20
20
|
afterWrite = _ref.afterWrite,
|
|
21
|
+
_ref$followAnchor = _ref.followAnchor,
|
|
22
|
+
followAnchor = _ref$followAnchor === void 0 ? false : _ref$followAnchor,
|
|
21
23
|
extraModifiers = _ref.modifiers,
|
|
22
24
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
25
|
const _useState = useState(true),
|
|
@@ -106,6 +108,19 @@ export const Popper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
106
108
|
handleClose();
|
|
107
109
|
}
|
|
108
110
|
}, [open, transition]);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!followAnchor || !open || !anchorEl || typeof ResizeObserver === "undefined") {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line compat/compat -- guarded above
|
|
117
|
+
const observer = new ResizeObserver(() => {
|
|
118
|
+
var _popperRef$current;
|
|
119
|
+
(_popperRef$current = popperRef.current) == null || _popperRef$current.update();
|
|
120
|
+
});
|
|
121
|
+
observer.observe(anchorEl);
|
|
122
|
+
return () => observer.disconnect();
|
|
123
|
+
}, [anchorEl, followAnchor, open]);
|
|
109
124
|
useEffect(() => {
|
|
110
125
|
if (popperRef.current) {
|
|
111
126
|
popperRef.current.update();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.js","names":["React","forwardRef","useCallback","useRef","useEffect","useState","createPopper","StyledPopper","useForkRef","Popper","_ref","ref","children","anchorEl","_ref$open","open","style","_ref$transition","transition","_ref$placement","placement","initialPlacement","_ref$strategy","strategy","afterWrite","extraModifiers","modifiers","rest","_objectWithoutPropertiesLoose","_excluded","_useState","exited","setExited","_useState2","setPlacement","ownRef","popperRef","handleInnerRef","handlePopperUpdate","data","handleOpen","current","destroy","name","enabled","phase","fn","referenceElement","currentElement","isHidden","computedStyle","getComputedStyle","display","visibility","parentElement","_ownRef$current","setAttribute","_ownRef$current2","removeAttribute","push","onFirstUpdate","handleClose","handleRef","node","handleEnter","handleExited","update","childProps","transitionProps","in","onEnter","onExited","createElement","_extends","displayName"],"sources":["../../../../src/components/Popper/Popper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useRef,\n useEffect,\n useState,\n CSSProperties,\n ReactNode,\n HTMLAttributes,\n} from \"react\";\n\nimport {\n createPopper,\n Instance,\n Modifier,\n Options as PopperOptions,\n PositioningStrategy,\n State,\n} from \"@popperjs/core\";\n\nimport { Placement } from \".\";\nimport { StyledPopper } from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\ntype CustomModifier = Modifier<string, PopperOptions>;\nexport type PopperModifier = Partial<\n Modifier<string, { [key: string]: unknown }>\n>;\n\ninterface TransitionProps {\n in: boolean;\n onEnter: () => void;\n onExited: () => void;\n}\ninterface IChildProps {\n placement: Placement;\n transitionProps: Partial<TransitionProps>;\n}\n\ninterface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Anchor Element. */\n anchorEl?: Element | null;\n /** Open */\n open?: boolean;\n /** Inline style */\n style?: CSSProperties;\n /** Child with transition */\n transition?: boolean;\n /** Placement */\n placement?: Placement;\n /** Strategy */\n strategy?: PositioningStrategy;\n /** After Write callback */\n afterWrite?: (...args) => void;\n /** Extra Popper.js modifiers, merged with the built-in ones */\n modifiers?: PopperModifier[];\n\n /** Component children */\n children?: ReactNode | React.FC<Partial<IChildProps>>;\n}\n\nexport const Popper = forwardRef<HTMLDivElement, PopperProps>(\n (\n {\n children,\n anchorEl,\n open = false,\n style,\n transition = false,\n placement: initialPlacement = \"bottom\",\n strategy = \"absolute\",\n afterWrite,\n modifiers: extraModifiers,\n ...rest\n },\n ref\n ) => {\n const [exited, setExited] = useState(true);\n const [placement, setPlacement] = useState(initialPlacement);\n const ownRef = useRef<HTMLDivElement | null>(null);\n const popperRef = useRef<Instance>();\n\n const handleInnerRef = useForkRef(ownRef, ref);\n\n const handlePopperUpdate = (data: Partial<State>): void => {\n setPlacement(data.placement || \"bottom\");\n };\n\n const handleOpen = useCallback(() => {\n if (!ownRef.current || !anchorEl || !open) {\n return;\n }\n\n if (popperRef.current) {\n popperRef.current.destroy();\n }\n\n const modifiers: (CustomModifier | PopperModifier)[] = [\n ...(extraModifiers || []),\n {\n name: \"hide\",\n enabled: true,\n phase: \"main\",\n fn: () => {\n const referenceElement = anchorEl as HTMLElement;\n\n let currentElement: HTMLElement | null = referenceElement;\n let isHidden = false;\n while (currentElement) {\n const computedStyle = getComputedStyle(currentElement);\n if (\n computedStyle.display === \"none\" ||\n computedStyle.visibility === \"hidden\"\n ) {\n isHidden = true;\n break;\n }\n currentElement = currentElement.parentElement;\n }\n\n if (isHidden) {\n ownRef.current?.setAttribute(\"data-popper-reference-hidden\", \"\");\n } else {\n ownRef.current?.removeAttribute(\"data-popper-reference-hidden\");\n }\n },\n },\n ];\n\n if (typeof afterWrite === \"function\") {\n modifiers.push({\n phase: \"afterWrite\",\n enabled: true,\n name: \"popper-after-write\",\n fn: afterWrite,\n });\n }\n\n popperRef.current = createPopper(anchorEl, ownRef.current, {\n placement,\n onFirstUpdate: handlePopperUpdate,\n strategy,\n modifiers,\n });\n }, [afterWrite, anchorEl, extraModifiers, open, placement, strategy]);\n\n const handleClose = (): void => {\n if (!popperRef.current) {\n return;\n }\n\n popperRef.current.destroy();\n };\n\n const handleRef = useCallback(\n (node: HTMLDivElement) => {\n handleInnerRef(node);\n handleOpen();\n },\n [handleOpen, handleInnerRef]\n );\n\n const handleEnter = (): void => {\n setExited(false);\n };\n\n const handleExited = (): void => {\n setExited(true);\n handleClose();\n };\n\n useEffect(() => {\n return (): void => {\n handleClose();\n };\n }, []);\n\n useEffect(() => {\n if (!open && !transition) {\n handleClose();\n }\n }, [open, transition]);\n\n useEffect(() => {\n if (popperRef.current) {\n popperRef.current.update();\n }\n });\n\n if (!open && (!transition || exited)) {\n return null;\n }\n\n const childProps: Partial<IChildProps> = { placement };\n\n if (transition) {\n childProps.transitionProps = {\n in: open,\n onEnter: handleEnter,\n onExited: handleExited,\n };\n }\n\n return (\n <StyledPopper\n ref={handleRef}\n {...rest}\n style={{\n ...style,\n }}\n >\n {typeof children === \"function\" ? children(childProps) : children}\n </StyledPopper>\n );\n }\n);\n\nPopper.displayName = \"Popper\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,SAAS,EACTC,QAAQ,QAIH,OAAO;AAEd,SACEC,YAAY,QAMP,gBAAgB;AAGvB,SAASC,YAAY,QAAQ,UAAU;AACvC,OAAOC,UAAU,MAAM,wBAAwB;AAsC/C,OAAO,MAAMC,MAAM,gBAAGR,UAAU,CAC9B,CAAAS,IAAA,EAaEC,GAAG,KACA;EAAA,IAZDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QA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IACdiD,UAAU,CAACC,eAAe,GAAG;MAC3BC,EAAE,EAAEtD,IAAI;MACRuD,OAAO,EAAEN,WAAW;MACpBO,QAAQ,EAAEN;IACZ,CAAC;EACH;EAEA,oBACEjE,KAAA,CAAAwE,aAAA,CAACjE,YAAY,EAAAkE,QAAA;IACX9D,GAAG,EAAEmD;EAAU,GACXnC,IAAI;IACRX,KAAK,EAAAyD,QAAA,KACAzD,KAAK;EACR,IAED,OAAOJ,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACuD,UAAU,CAAC,GAAGvD,QAC7C,CAAC;AAEnB,CACF,CAAC;AAEDH,MAAM,CAACiE,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Popper.js","names":["React","forwardRef","useCallback","useRef","useEffect","useState","createPopper","StyledPopper","useForkRef","Popper","_ref","ref","children","anchorEl","_ref$open","open","style","_ref$transition","transition","_ref$placement","placement","initialPlacement","_ref$strategy","strategy","afterWrite","_ref$followAnchor","followAnchor","extraModifiers","modifiers","rest","_objectWithoutPropertiesLoose","_excluded","_useState","exited","setExited","_useState2","setPlacement","ownRef","popperRef","handleInnerRef","handlePopperUpdate","data","handleOpen","current","destroy","name","enabled","phase","fn","referenceElement","currentElement","isHidden","computedStyle","getComputedStyle","display","visibility","parentElement","_ownRef$current","setAttribute","_ownRef$current2","removeAttribute","push","onFirstUpdate","handleClose","handleRef","node","handleEnter","handleExited","ResizeObserver","undefined","observer","_popperRef$current","update","observe","disconnect","childProps","transitionProps","in","onEnter","onExited","createElement","_extends","displayName"],"sources":["../../../../src/components/Popper/Popper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useRef,\n useEffect,\n useState,\n CSSProperties,\n ReactNode,\n HTMLAttributes,\n} from \"react\";\n\nimport {\n createPopper,\n Instance,\n Modifier,\n Options as PopperOptions,\n PositioningStrategy,\n State,\n} from \"@popperjs/core\";\n\nimport { Placement } from \".\";\nimport { StyledPopper } from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\ntype CustomModifier = Modifier<string, PopperOptions>;\nexport type PopperModifier = Partial<\n Modifier<string, { [key: string]: unknown }>\n>;\n\ninterface TransitionProps {\n in: boolean;\n onEnter: () => void;\n onExited: () => void;\n}\ninterface IChildProps {\n placement: Placement;\n transitionProps: Partial<TransitionProps>;\n}\n\ninterface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Anchor Element. */\n anchorEl?: Element | null;\n /** Open */\n open?: boolean;\n /** Inline style */\n style?: CSSProperties;\n /** Child with transition */\n transition?: boolean;\n /** Placement */\n placement?: Placement;\n /** Strategy */\n strategy?: PositioningStrategy;\n /** After Write callback */\n afterWrite?: (...args) => void;\n /** Follow the anchor when it changes size while the popper is open. Off by default. */\n followAnchor?: boolean;\n /** Extra Popper.js modifiers, merged with the built-in ones */\n modifiers?: PopperModifier[];\n\n /** Component children */\n children?: ReactNode | React.FC<Partial<IChildProps>>;\n}\n\nexport const Popper = forwardRef<HTMLDivElement, PopperProps>(\n (\n {\n children,\n anchorEl,\n open = false,\n style,\n transition = false,\n placement: initialPlacement = \"bottom\",\n strategy = \"absolute\",\n afterWrite,\n followAnchor = false,\n modifiers: extraModifiers,\n ...rest\n },\n ref\n ) => {\n const [exited, setExited] = useState(true);\n const [placement, setPlacement] = useState(initialPlacement);\n const ownRef = useRef<HTMLDivElement | null>(null);\n const popperRef = useRef<Instance>();\n\n const handleInnerRef = useForkRef(ownRef, ref);\n\n const handlePopperUpdate = (data: Partial<State>): void => {\n setPlacement(data.placement || \"bottom\");\n };\n\n const handleOpen = useCallback(() => {\n if (!ownRef.current || !anchorEl || !open) {\n return;\n }\n\n if (popperRef.current) {\n popperRef.current.destroy();\n }\n\n const modifiers: (CustomModifier | PopperModifier)[] = [\n ...(extraModifiers || []),\n {\n name: \"hide\",\n enabled: true,\n phase: \"main\",\n fn: () => {\n const referenceElement = anchorEl as HTMLElement;\n\n let currentElement: HTMLElement | null = referenceElement;\n let isHidden = false;\n while (currentElement) {\n const computedStyle = getComputedStyle(currentElement);\n if (\n computedStyle.display === \"none\" ||\n computedStyle.visibility === \"hidden\"\n ) {\n isHidden = true;\n break;\n }\n currentElement = currentElement.parentElement;\n }\n\n if (isHidden) {\n ownRef.current?.setAttribute(\"data-popper-reference-hidden\", \"\");\n } else {\n ownRef.current?.removeAttribute(\"data-popper-reference-hidden\");\n }\n },\n },\n ];\n\n if (typeof afterWrite === \"function\") {\n modifiers.push({\n phase: \"afterWrite\",\n enabled: true,\n name: \"popper-after-write\",\n fn: afterWrite,\n });\n }\n\n popperRef.current = createPopper(anchorEl, ownRef.current, {\n placement,\n onFirstUpdate: handlePopperUpdate,\n strategy,\n modifiers,\n });\n }, [afterWrite, anchorEl, extraModifiers, open, placement, strategy]);\n\n const handleClose = (): void => {\n if (!popperRef.current) {\n return;\n }\n\n popperRef.current.destroy();\n };\n\n const handleRef = useCallback(\n (node: HTMLDivElement) => {\n handleInnerRef(node);\n handleOpen();\n },\n [handleOpen, handleInnerRef]\n );\n\n const handleEnter = (): void => {\n setExited(false);\n };\n\n const handleExited = (): void => {\n setExited(true);\n handleClose();\n };\n\n useEffect(() => {\n return (): void => {\n handleClose();\n };\n }, []);\n\n useEffect(() => {\n if (!open && !transition) {\n handleClose();\n }\n }, [open, transition]);\n\n useEffect(() => {\n if (\n !followAnchor ||\n !open ||\n !anchorEl ||\n typeof ResizeObserver === \"undefined\"\n ) {\n return undefined;\n }\n\n // eslint-disable-next-line compat/compat -- guarded above\n const observer = new ResizeObserver(() => {\n popperRef.current?.update();\n });\n\n observer.observe(anchorEl);\n\n return () => observer.disconnect();\n }, [anchorEl, followAnchor, open]);\n\n useEffect(() => {\n if (popperRef.current) {\n popperRef.current.update();\n }\n });\n\n if (!open && (!transition || exited)) {\n return null;\n }\n\n const childProps: Partial<IChildProps> = { placement };\n\n if (transition) {\n childProps.transitionProps = {\n in: open,\n onEnter: handleEnter,\n onExited: handleExited,\n };\n }\n\n return (\n <StyledPopper\n ref={handleRef}\n {...rest}\n style={{\n ...style,\n }}\n >\n {typeof children === \"function\" ? children(childProps) : children}\n </StyledPopper>\n );\n }\n);\n\nPopper.displayName = \"Popper\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,SAAS,EACTC,QAAQ,QAIH,OAAO;AAEd,SACEC,YAAY,QAMP,gBAAgB;AAGvB,SAASC,YAAY,QAAQ,UAAU;AACvC,OAAOC,UAAU,MAAM,wBAAwB;AAwC/C,OAAO,MAAMC,MAAM,gBAAGR,UAAU,CAC9B,CAAAS,IAAA,EAcEC,GAAG,KACA;EAAA,IAbDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,SAAA,GAAAJ,IAAA,CACRK,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;IACZE,KAAK,GAAAN,IAAA,CAALM,KAAK;IAAAC,eAAA,GAAAP,IAAA,CACLQ,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,KAAK,GAAAA,eAAA;IAAAE,cAAA,GAAAT,IAAA,CAClBU,SAAS;IAAEC,gBAAgB,GAAAF,cAAA,cAAG,QAAQ,GAAAA,cAAA;IAAAG,aAAA,GAAAZ,IAAA,CACtCa,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,UAAU,GAAAA,aAAA;IACrBE,UAAU,GAAAd,IAAA,CAAVc,UAAU;IAAAC,iBAAA,GAAAf,IAAA,CACVgB,YAAY;IAAZA,YAAY,GAAAD,iBAAA,cAAG,KAAK,GAAAA,iBAAA;IACTE,cAAc,GAAAjB,IAAA,CAAzBkB,SAAS;IACNC,IAAI,GAAAC,6BAAA,CAAApB,IAAA,EAAAqB,SAAA;EAIT,MAAAC,SAAA,GAA4B3B,QAAQ,CAAC,IAAI,CAAC;IAAnC4B,MAAM,GAAAD,SAAA;IAAEE,SAAS,GAAAF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,KAAA,CAAAgF,aAAA,CAACzE,YAAY,EAAA0E,QAAA;IACXtE,GAAG,EAAEqD;EAAU,GACXnC,IAAI;IACRb,KAAK,EAAAiE,QAAA,KACAjE,KAAK;EACR,IAED,OAAOJ,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAAC+D,UAAU,CAAC,GAAG/D,QAC7C,CAAC;AAEnB,CACF,CAAC;AAEDH,MAAM,CAACyE,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@ export interface IPresenceFace {
|
|
|
4
4
|
id: string | number;
|
|
5
5
|
/** The name of the user, for the tooltip and the accessible name. */
|
|
6
6
|
name: string;
|
|
7
|
-
/** The URL of the avatar image,
|
|
7
|
+
/** The URL of the avatar image, 56px for the 28px face. */
|
|
8
8
|
avatarUrl?: string;
|
|
9
9
|
/** Replaces the avatar image, for example a round avatar with initials. */
|
|
10
10
|
avatar?: ReactNode;
|
|
11
|
-
/** The user writes a comment. Shows the typing mark
|
|
11
|
+
/** The user writes a comment. Shows the typing mark. */
|
|
12
12
|
typing?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export interface IPresenceCapsuleLabels {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresenceCapsule.d.ts","sourceRoot":"","sources":["../../../../src/components/PresenceCapsule/PresenceCapsule.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,cAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAoB/E,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"PresenceCapsule.d.ts","sourceRoot":"","sources":["../../../../src/components/PresenceCap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vatar, StyledPresenceCapsule, StyledPresenceDot, StyledP
|
|
|
7
7
|
import { Avatar } from "../Avatar";
|
|
8
8
|
import { ArrowDownSmallIcon } from "../Icons";
|
|
9
9
|
import { Tooltip } from "../Tooltip";
|
|
10
|
-
const AVATAR_SIZE =
|
|
10
|
+
const AVATAR_SIZE = 28;
|
|
11
11
|
const DEFAULT_LABELS = {
|
|
12
|
-
group: "Here
|
|
12
|
+
group: "Here Now",
|
|
13
13
|
typing: name => name + " is typing...",
|
|
14
14
|
showMore: count => "Show " + count + " more",
|
|
15
15
|
showFewer: "Show fewer"
|
|
@@ -55,9 +55,14 @@ export const PresenceCapsule = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
55
55
|
ref: ref,
|
|
56
56
|
"data-testid": testId,
|
|
57
57
|
className: classnames("c-presence-capsule", className)
|
|
58
|
-
}), /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
59
|
+
title: text.group,
|
|
60
|
+
placement: "left"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(StyledPresenceDot, {
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
className: "c-presence-capsule__dot",
|
|
64
|
+
"data-testid": partTestId("dot")
|
|
65
|
+
})), /*#__PURE__*/React.createElement(StyledPresenceFaces, null, visible.map(face => {
|
|
61
66
|
var _face$avatar, _face$avatarUrl;
|
|
62
67
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
63
68
|
key: face.id,
|
|
@@ -73,9 +78,7 @@ export const PresenceCapsule = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
73
78
|
"aria-hidden": "true",
|
|
74
79
|
className: "c-presence-capsule__typing",
|
|
75
80
|
"data-testid": partTestId("typing")
|
|
76
|
-
}, /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null)) : null, /*#__PURE__*/React.createElement(StyledPresenceAvatar, {
|
|
77
|
-
$typing: Boolean(face.typing)
|
|
78
|
-
}, (_face$avatar = face.avatar) != null ? _face$avatar : /*#__PURE__*/React.createElement(Avatar, {
|
|
81
|
+
}, /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null)) : null, /*#__PURE__*/React.createElement(StyledPresenceAvatar, null, (_face$avatar = face.avatar) != null ? _face$avatar : /*#__PURE__*/React.createElement(Avatar, {
|
|
79
82
|
alt: face.name,
|
|
80
83
|
url: (_face$avatarUrl = face.avatarUrl) != null ? _face$avatarUrl : "",
|
|
81
84
|
size: AVATAR_SIZE
|