@sanity/ui 3.0.0-static.0 → 3.0.0-static.1
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/_chunks-cjs/buildCommand.js +1387 -681
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/css.d.mts +131 -12
- package/dist/css.d.ts +131 -12
- package/dist/css.esm.js +1450 -791
- package/dist/css.esm.js.map +1 -1
- package/dist/css.js +1449 -790
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +1450 -791
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +84 -76
- package/dist/index.d.ts +84 -76
- package/dist/index.esm.js +2734 -3146
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2733 -3145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2734 -3146
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1590 -1158
- package/dist/theme.esm.js +1565 -452
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1599 -484
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1565 -452
- package/dist/theme.mjs.map +1 -1
- package/package.json +22 -22
- package/src/core/__workshop__/constants.ts +14 -5
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/_compat/index.ts +2 -0
- package/src/core/{styles → _compat/styles}/box/boxStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/helpers.ts +1 -1
- package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
- package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/dialog/dialog.tsx +1 -5
- package/src/core/components/hotkeys/hotkeys.tsx +1 -1
- package/src/core/components/menu/menu.tsx +8 -10
- package/src/core/components/menu/menuDivider.tsx +16 -0
- package/src/core/components/menu/menuGroup.tsx +2 -8
- package/src/core/components/menu/menuItem.tsx +1 -1
- package/src/core/components/skeleton/skeleton.tsx +14 -20
- package/src/core/components/skeleton/textSkeleton.tsx +72 -48
- package/src/core/components/tab/tab.tsx +0 -1
- package/src/core/components/tab/tabList.tsx +4 -21
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/toast.tsx +27 -14
- package/src/core/components/toast/toastProvider.tsx +4 -13
- package/src/core/components/tree/tree.tsx +1 -2
- package/src/core/components/tree/treeGroup.tsx +4 -1
- package/src/core/components/tree/treeItem.tsx +11 -15
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/index.ts +0 -1
- package/src/core/lib/styled/members.ts +2 -2
- package/src/core/primitives/avatar/avatar.tsx +0 -21
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/avatar/styles.ts +2 -2
- package/src/core/primitives/box/box.tsx +4 -1
- package/src/core/primitives/button/__workshop__/props.tsx +2 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/styles.ts +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +2 -2
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +7 -10
- package/src/core/primitives/code/code.tsx +2 -4
- package/src/core/primitives/container/styles.ts +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -13
- package/src/core/primitives/grid/grid.tsx +5 -19
- package/src/core/primitives/heading/heading.tsx +8 -25
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +3 -12
- package/src/core/primitives/inline/styles.ts +1 -1
- package/src/core/primitives/label/label.tsx +4 -9
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverCard.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +2 -2
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +3 -3
- package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/stack/styles.ts +1 -1
- package/src/core/primitives/switch/styles.ts +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -1
- package/src/core/primitives/text/text.tsx +1 -4
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +3 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +3 -2
- package/src/core/primitives/textInput/textInput.tsx +16 -83
- package/src/core/primitives/tooltip/tooltipCard.tsx +5 -5
- package/src/core/primitives/types.ts +1 -0
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +2 -4
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/types/box.ts +22 -16
- package/src/core/types/grid.ts +17 -12
- package/src/core/types/text.ts +7 -4
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/compile/{comileRules.ts → compileRules.ts} +2 -5
- package/src/css/compile/compileSystem.ts +1 -1
- package/src/css/compile/compileTheme.ts +4 -1
- package/src/css/components/breadcrumbs/rules.ts +18 -0
- package/src/css/components/menu/index.ts +1 -0
- package/src/css/components/menu/menu.ts +5 -0
- package/src/css/components/menu/rules.ts +10 -0
- package/src/css/components/skeleton/index.ts +2 -0
- package/src/css/components/skeleton/rules.ts +106 -0
- package/src/css/components/skeleton/skeleton.ts +31 -0
- package/src/css/components/skeleton/types.ts +24 -0
- package/src/css/components/toast/rules.ts +68 -0
- package/src/css/components/tree/rules.ts +115 -0
- package/src/css/index.ts +4 -0
- package/src/css/primitives/box/box.ts +5 -1
- package/src/css/primitives/box/types.ts +7 -8
- package/src/css/primitives/card/rules.ts +161 -13
- package/src/css/primitives/checkbox/__styles.ts +115 -113
- package/src/css/primitives/selectable/__style.ts +117 -115
- package/src/css/primitives/spinner/rules.ts +5 -7
- package/src/css/primitives/spinner/spinner.ts +4 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +159 -64
- package/src/css/primitives/textInput/textInput.ts +11 -3
- package/src/css/primitives/textInput/types.ts +8 -0
- package/src/css/rules.ts +16 -38
- package/src/css/styles/font/font.ts +7 -2
- package/src/css/styles/font/rules.ts +23 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/rules.ts +6 -6
- package/src/css/styles/grid/grid.ts +13 -0
- package/src/css/styles/grid/index.ts +2 -0
- package/src/css/styles/grid/rules.ts +112 -1
- package/src/css/styles/grid/types.ts +29 -0
- package/src/css/styles/margin/rules.ts +58 -54
- package/src/css/styles/outline/rules.ts +7 -0
- package/src/css/styles/overflow/index.ts +2 -0
- package/src/css/styles/overflow/overflow.ts +11 -0
- package/src/css/styles/overflow/types.ts +11 -0
- package/src/css/styles/padding/rules.ts +50 -48
- package/src/css/types.ts +36 -1
- package/src/css/varNames.ts +1 -1
- package/src/css/vars.ts +86 -0
- package/dist/_chunks-cjs/getTheme_v2.js +0 -316
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -317
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -317
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
- package/src/core/components/menu/menuDivider.ts +0 -13
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/toast/styles.ts +0 -61
- package/src/core/components/tree/style.ts +0 -104
- package/src/core/primitives/card/styles.ts +0 -146
- /package/src/core/{styles → _compat/styles}/border/borderStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/types.ts +0 -0
- /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {FontCodeSize, FontHeadingSize, FontLabelSize, FontTextSize} from '@sanity/ui/theme'
|
|
2
|
+
import {RadiusStyleProps} from '../../styles/radius'
|
|
3
|
+
import {ResponsiveProp} from '../../types'
|
|
4
|
+
|
|
5
|
+
/** @beta */
|
|
6
|
+
export interface SkeletonStyleProps extends RadiusStyleProps {
|
|
7
|
+
// visible?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CodeSkeletonStyleProps {
|
|
11
|
+
size?: ResponsiveProp<FontCodeSize>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface HeadingSkeletonStyleProps {
|
|
15
|
+
size?: ResponsiveProp<FontHeadingSize>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LabelSkeletonStyleProps {
|
|
19
|
+
size?: ResponsiveProp<FontLabelSize>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TextSkeletonStyleProps {
|
|
23
|
+
size?: ResponsiveProp<FontTextSize>
|
|
24
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// import {ThemeColorStateToneKey, getTheme_v2} from '../../../theme'
|
|
2
|
+
// import {POPOVER_MOTION_CONTENT_OPACITY_PROPERTY} from '../../constants'
|
|
3
|
+
// import {styled, keyframes, css} from '../../lib/styled'
|
|
4
|
+
// import {Flex} from '../../primitives'
|
|
5
|
+
// import {ThemeProps} from '../../styles'
|
|
6
|
+
|
|
7
|
+
// const loadingAnimation = keyframes`
|
|
8
|
+
// 0% {
|
|
9
|
+
// width: 0;
|
|
10
|
+
// }
|
|
11
|
+
// 100% {
|
|
12
|
+
// width: 100%;
|
|
13
|
+
// }
|
|
14
|
+
// `
|
|
15
|
+
|
|
16
|
+
// const LOADING_BAR_HEIGHT = 2
|
|
17
|
+
|
|
18
|
+
// export function rootStyles(
|
|
19
|
+
// props: {$duration?: number; tone: ThemeColorStateToneKey} & ThemeProps,
|
|
20
|
+
// ): ReturnType<typeof css> {
|
|
21
|
+
// const {color} = getTheme_v2(props.theme)
|
|
22
|
+
|
|
23
|
+
// const loadingBarColor = color.button.default[props.tone].enabled.bg
|
|
24
|
+
|
|
25
|
+
// if (!props.$duration)
|
|
26
|
+
// return css`
|
|
27
|
+
// pointer-events: all;
|
|
28
|
+
// & > * {
|
|
29
|
+
// opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
30
|
+
// will-change: opacity;
|
|
31
|
+
// }
|
|
32
|
+
// `
|
|
33
|
+
|
|
34
|
+
// return css`
|
|
35
|
+
// pointer-events: all;
|
|
36
|
+
// width: 100%;
|
|
37
|
+
// position: relative;
|
|
38
|
+
// overflow: hidden;
|
|
39
|
+
// overflow: clip;
|
|
40
|
+
// padding-bottom: ${LOADING_BAR_HEIGHT}px;
|
|
41
|
+
// &::before {
|
|
42
|
+
// content: '';
|
|
43
|
+
// position: absolute;
|
|
44
|
+
// bottom: 0px;
|
|
45
|
+
// height: ${LOADING_BAR_HEIGHT}px;
|
|
46
|
+
// background: ${loadingBarColor};
|
|
47
|
+
// animation-name: ${loadingAnimation};
|
|
48
|
+
// animation-duration: ${props.$duration}ms;
|
|
49
|
+
// animation-fill-mode: both;
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
// & > * {
|
|
53
|
+
// opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
54
|
+
// will-change: opacity;
|
|
55
|
+
// }
|
|
56
|
+
// `
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
export {}
|
|
60
|
+
|
|
61
|
+
// const ToastContainer = styled.div`
|
|
62
|
+
// box-sizing: border-box;
|
|
63
|
+
// position: absolute;
|
|
64
|
+
// right: 0;
|
|
65
|
+
// bottom: 0;
|
|
66
|
+
// max-width: 420px;
|
|
67
|
+
// width: 100%;
|
|
68
|
+
// `
|
|
@@ -50,3 +50,118 @@ export const treeRules: Rules = {
|
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
// const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle))
|
|
55
|
+
|
|
56
|
+
// const TreeItemBox = styled(Box).attrs({forwardedAs: 'a'})<TreeItemBoxStyleProps>(treeItemBoxStyle)
|
|
57
|
+
|
|
58
|
+
// const ToggleArrowText = styled(Text)`
|
|
59
|
+
// & > svg {
|
|
60
|
+
// transition: transform 100ms;
|
|
61
|
+
// }
|
|
62
|
+
// `
|
|
63
|
+
|
|
64
|
+
// import {getTheme_v2} from '@sanity/ui/theme'
|
|
65
|
+
// import {css} from '../../lib/styled'
|
|
66
|
+
// import {rem, ThemeProps} from '../../styles'
|
|
67
|
+
// import {_cardColorStyle} from '../../styles/card'
|
|
68
|
+
|
|
69
|
+
// export function treeItemRootStyle(): ReturnType<typeof css> {
|
|
70
|
+
// return css`
|
|
71
|
+
// &[role='none'] > [role='treeitem'] {
|
|
72
|
+
// outline: none;
|
|
73
|
+
// cursor: default;
|
|
74
|
+
// border-radius: 3px;
|
|
75
|
+
|
|
76
|
+
// background-color: var(--card-bg-color);
|
|
77
|
+
// color: var(--treeitem-fg-color);
|
|
78
|
+
|
|
79
|
+
// &:focus {
|
|
80
|
+
// position: relative;
|
|
81
|
+
// }
|
|
82
|
+
// }
|
|
83
|
+
|
|
84
|
+
// &[role='treeitem'] {
|
|
85
|
+
// outline: none;
|
|
86
|
+
|
|
87
|
+
// & > div {
|
|
88
|
+
// cursor: default;
|
|
89
|
+
// border-radius: 3px;
|
|
90
|
+
|
|
91
|
+
// background-color: var(--card-bg-color);
|
|
92
|
+
// color: var(--treeitem-fg-color);
|
|
93
|
+
// }
|
|
94
|
+
|
|
95
|
+
// &:focus > div {
|
|
96
|
+
// position: relative;
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
// `
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
// export function treeItemRootColorStyle(props: ThemeProps): ReturnType<typeof css> {
|
|
103
|
+
// const $tone = 'default'
|
|
104
|
+
// const {color} = getTheme_v2(props.theme)
|
|
105
|
+
// const tone = color.selectable[$tone]
|
|
106
|
+
|
|
107
|
+
// return css`
|
|
108
|
+
// &[role='none'] {
|
|
109
|
+
// & > [role='treeitem'] {
|
|
110
|
+
// ${_cardColorStyle(color, tone.enabled)}
|
|
111
|
+
// }
|
|
112
|
+
|
|
113
|
+
// &[data-selected] > [role='treeitem'] {
|
|
114
|
+
// ${_cardColorStyle(color, tone.pressed)}
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// @media (hover: hover) {
|
|
118
|
+
// &:not([data-selected]) > [role='treeitem']:not(:focus):hover {
|
|
119
|
+
// ${_cardColorStyle(color, tone.hovered)}
|
|
120
|
+
// }
|
|
121
|
+
|
|
122
|
+
// & > [role='treeitem']:focus {
|
|
123
|
+
// ${_cardColorStyle(color, tone.selected)}
|
|
124
|
+
// }
|
|
125
|
+
// }
|
|
126
|
+
// }
|
|
127
|
+
|
|
128
|
+
// &[role='treeitem'] {
|
|
129
|
+
// & > [data-ui='TreeItem__box'] {
|
|
130
|
+
// ${_cardColorStyle(color, tone.enabled)}
|
|
131
|
+
// }
|
|
132
|
+
|
|
133
|
+
// &[data-selected] > [data-ui='TreeItem__box'] {
|
|
134
|
+
// ${_cardColorStyle(color, tone.pressed)}
|
|
135
|
+
// }
|
|
136
|
+
|
|
137
|
+
// @media (hover: hover) {
|
|
138
|
+
// &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {
|
|
139
|
+
// ${_cardColorStyle(color, tone.hovered)}
|
|
140
|
+
// }
|
|
141
|
+
|
|
142
|
+
// &:focus > [data-ui='TreeItem__box'] {
|
|
143
|
+
// ${_cardColorStyle(color, tone.selected)}
|
|
144
|
+
// }
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
// `
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// export interface TreeItemBoxStyleProps {
|
|
151
|
+
// $level: number
|
|
152
|
+
// }
|
|
153
|
+
|
|
154
|
+
// export function treeItemBoxStyle(
|
|
155
|
+
// props: TreeItemBoxStyleProps & ThemeProps,
|
|
156
|
+
// ): ReturnType<typeof css> {
|
|
157
|
+
// const {$level} = props
|
|
158
|
+
// const {space} = getTheme_v2(props.theme)
|
|
159
|
+
|
|
160
|
+
// return css`
|
|
161
|
+
// padding-left: ${rem(space[2] * $level)};
|
|
162
|
+
|
|
163
|
+
// &[data-as='a'] {
|
|
164
|
+
// text-decoration: none;
|
|
165
|
+
// }
|
|
166
|
+
// `
|
|
167
|
+
// }
|
package/src/css/index.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './composeClassNames'
|
|
|
5
5
|
|
|
6
6
|
export * from './components/breadcrumbs'
|
|
7
7
|
export * from './components/dialog'
|
|
8
|
+
export * from './components/menu'
|
|
9
|
+
export * from './components/skeleton'
|
|
8
10
|
export * from './components/tree'
|
|
9
11
|
|
|
10
12
|
export * from './primitives/avatar'
|
|
@@ -35,9 +37,11 @@ export * from './styles/gap/types'
|
|
|
35
37
|
export * from './styles/flex/types'
|
|
36
38
|
export * from './styles/flexItem/types'
|
|
37
39
|
export * from './styles/font/types'
|
|
40
|
+
export * from './styles/grid/types'
|
|
38
41
|
export * from './styles/gridItem/types'
|
|
39
42
|
export * from './styles/margin/types'
|
|
40
43
|
export * from './styles/maxWidth/types'
|
|
44
|
+
export * from './styles/overflow/types'
|
|
41
45
|
export * from './styles/padding/types'
|
|
42
46
|
export * from './styles/pointerEvents/types'
|
|
43
47
|
export * from './styles/position/types'
|
|
@@ -3,9 +3,11 @@ import {composeClassNames} from '../../composeClassNames'
|
|
|
3
3
|
import {flex} from '../../styles/flex'
|
|
4
4
|
import {flexItem} from '../../styles/flexItem'
|
|
5
5
|
import {gap} from '../../styles/gap'
|
|
6
|
+
import {grid} from '../../styles/grid'
|
|
6
7
|
import {gridItem} from '../../styles/gridItem'
|
|
7
8
|
import {margin} from '../../styles/margin'
|
|
8
9
|
import {maxWidth} from '../../styles/maxWidth'
|
|
10
|
+
import {overflow} from '../../styles/overflow'
|
|
9
11
|
import {padding} from '../../styles/padding'
|
|
10
12
|
import {pointerEvents} from '../../styles/pointerEvents'
|
|
11
13
|
import {position} from '../../styles/position'
|
|
@@ -18,14 +20,16 @@ export function box(props: BoxStyleProps): string {
|
|
|
18
20
|
'box',
|
|
19
21
|
_resp(undefined, props.display),
|
|
20
22
|
_resp(`h`, props.height),
|
|
21
|
-
_resp(`overflow`, props.overflow),
|
|
22
23
|
_resp(`box`, props.sizing),
|
|
23
24
|
flex(props),
|
|
24
25
|
flexItem(props),
|
|
26
|
+
grid(props),
|
|
25
27
|
gridItem(props),
|
|
26
28
|
gap(props),
|
|
27
29
|
margin(props),
|
|
28
30
|
maxWidth(props),
|
|
31
|
+
props.outline && `outline-${props.outline}`,
|
|
32
|
+
overflow(props),
|
|
29
33
|
padding(props),
|
|
30
34
|
pointerEvents(props),
|
|
31
35
|
position(props),
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import {GridStyleProps} from '@sanity/ui/css'
|
|
1
2
|
import {FlexStyleProps} from '../../styles/flex'
|
|
2
3
|
import {FlexItemStyleProps} from '../../styles/flexItem'
|
|
3
4
|
import {GapStyleProps} from '../../styles/gap'
|
|
4
5
|
import {GridItemStyleProps} from '../../styles/gridItem'
|
|
5
6
|
import {MarginStyleProps} from '../../styles/margin'
|
|
6
7
|
import {MaxWidthStyleProps} from '../../styles/maxWidth'
|
|
8
|
+
import {OverflowStyleProps} from '../../styles/overflow'
|
|
7
9
|
import {PaddingStyleProps} from '../../styles/padding'
|
|
8
10
|
import {PointerEventsStyleProps} from '../../styles/pointerEvents'
|
|
9
11
|
import {PositionStyleProps} from '../../styles/position'
|
|
@@ -18,32 +20,29 @@ export type BoxSizing = 'content' | 'border'
|
|
|
18
20
|
/**
|
|
19
21
|
* @public
|
|
20
22
|
*/
|
|
21
|
-
export type
|
|
23
|
+
export type Display = 'none' | 'block' | 'grid' | 'flex' | 'inline-block'
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* @public
|
|
25
27
|
*/
|
|
26
28
|
export type BoxHeight = 'stretch' | 'fill'
|
|
27
29
|
|
|
28
|
-
/**
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export type BoxOverflow = 'visible' | 'hidden' | 'auto'
|
|
32
|
-
|
|
33
30
|
/** @public */
|
|
34
31
|
export interface BoxStyleProps
|
|
35
32
|
extends FlexStyleProps,
|
|
36
33
|
FlexItemStyleProps,
|
|
37
34
|
GapStyleProps,
|
|
35
|
+
GridStyleProps,
|
|
38
36
|
GridItemStyleProps,
|
|
39
37
|
MarginStyleProps,
|
|
40
38
|
MaxWidthStyleProps,
|
|
39
|
+
OverflowStyleProps,
|
|
41
40
|
PaddingStyleProps,
|
|
42
41
|
PointerEventsStyleProps,
|
|
43
42
|
PositionStyleProps,
|
|
44
43
|
WidthStyleProps {
|
|
45
|
-
display?: ResponsiveProp<
|
|
44
|
+
display?: ResponsiveProp<Display>
|
|
46
45
|
height?: ResponsiveProp<BoxHeight>
|
|
47
|
-
|
|
46
|
+
outline?: 'none'
|
|
48
47
|
sizing?: ResponsiveProp<BoxSizing>
|
|
49
48
|
}
|
|
@@ -55,21 +55,19 @@ export const cardRules: Rules = {
|
|
|
55
55
|
'--card-skeleton-from-color': 'var(--color-skeleton-from)',
|
|
56
56
|
'--card-skeleton-to-color': 'var(--color-skeleton-to)',
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'--card-bg-image': checkered
|
|
64
|
-
? `repeating-conic-gradient(${color.bg} 0% 25%, ${color.muted.bg} 0% 50%)`
|
|
65
|
-
: undefined,
|
|
66
|
-
|
|
67
|
-
'--card-bg2-color': color.muted.bg,
|
|
68
|
-
'--card-link-color': color.link.fg,
|
|
69
|
-
'--card-hairline-soft-color': color.border,
|
|
70
|
-
'--card-hairline-hard-color': color.border, */
|
|
58
|
+
'--card-bg2-color': `var(--color-muted-bg)`,
|
|
59
|
+
'--card-link-color': `var(--color-link-fg)`,
|
|
60
|
+
'--card-hairline-soft-color': `var(--color-border)`,
|
|
61
|
+
'--card-hairline-hard-color': `var(--color-border)`,
|
|
71
62
|
|
|
72
63
|
'@nest': {
|
|
64
|
+
'&[data-checkered]': {
|
|
65
|
+
'--card-bg-image': `repeating-conic-gradient(var(--color-bg) 0% 25%, var(--color-muted-bg) 0% 50%)`,
|
|
66
|
+
'backgroundSize': `var(--space-3) var(--space-3)`,
|
|
67
|
+
'backgroundPosition': '50% 50%',
|
|
68
|
+
'backgroundImage': 'var(--card-bg-image)',
|
|
69
|
+
},
|
|
70
|
+
|
|
73
71
|
'&[data-as="button"]': {
|
|
74
72
|
WebkitFontSmoothing: 'inherit',
|
|
75
73
|
appearance: 'none',
|
|
@@ -91,3 +89,153 @@ export const cardRules: Rules = {
|
|
|
91
89
|
},
|
|
92
90
|
},
|
|
93
91
|
}
|
|
92
|
+
|
|
93
|
+
// import {getTheme_v2} from '@sanity/ui/theme'
|
|
94
|
+
// import {css} from '../../lib/styled'
|
|
95
|
+
// // import {ThemeProps} from '../../styles'
|
|
96
|
+
// // import {_cardColorStyle} from '../../styles/card'
|
|
97
|
+
// // import {focusRingStyle} from '../../styles/focusRing'
|
|
98
|
+
// import {CardStyleProps} from './types'
|
|
99
|
+
// import {ThemeProps} from '../../_compat'
|
|
100
|
+
// import {_cardColorStyle} from '../../_compat/styles/card'
|
|
101
|
+
// import {focusRingStyle} from '../../_compat/styles/focusRing'
|
|
102
|
+
|
|
103
|
+
// export function cardStyle(
|
|
104
|
+
// props: CardStyleProps & ThemeProps,
|
|
105
|
+
// ): Array<ReturnType<typeof css> | (() => ReturnType<typeof css>)> {
|
|
106
|
+
// return [cardBaseStyle(props), cardColorStyle(props)]
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
// export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
110
|
+
// const {$checkered} = props
|
|
111
|
+
// const {space} = getTheme_v2(props.theme)
|
|
112
|
+
|
|
113
|
+
// return css`
|
|
114
|
+
// ${$checkered &&
|
|
115
|
+
// css`
|
|
116
|
+
// background-size: ${space[3]}px ${space[3]}px;
|
|
117
|
+
// background-position: 50% 50%;
|
|
118
|
+
// background-image: var(--card-bg-image);
|
|
119
|
+
// `}
|
|
120
|
+
|
|
121
|
+
// &[data-as='button'] {
|
|
122
|
+
// -webkit-font-smoothing: inherit;
|
|
123
|
+
// appearance: none;
|
|
124
|
+
// outline: none;
|
|
125
|
+
// font: inherit;
|
|
126
|
+
// text-align: inherit;
|
|
127
|
+
// border: 0;
|
|
128
|
+
// width: -moz-available;
|
|
129
|
+
// width: -webkit-fill-available;
|
|
130
|
+
// width: stretch;
|
|
131
|
+
// }
|
|
132
|
+
|
|
133
|
+
// /* &:is(a) */
|
|
134
|
+
// &[data-as='a'] {
|
|
135
|
+
// outline: none;
|
|
136
|
+
// text-decoration: none;
|
|
137
|
+
// }
|
|
138
|
+
|
|
139
|
+
// /* &:is(pre) */
|
|
140
|
+
// &[data-as='pre'] {
|
|
141
|
+
// font: inherit;
|
|
142
|
+
// }
|
|
143
|
+
// `
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
147
|
+
// const {$checkered, $focusRing, $muted} = props
|
|
148
|
+
// const {card, color, style} = getTheme_v2(props.theme)
|
|
149
|
+
// const border = {width: card.border.width, color: 'var(--card-border-color)'}
|
|
150
|
+
|
|
151
|
+
// return css`
|
|
152
|
+
// color-scheme: ${color._dark ? 'dark' : 'light'};
|
|
153
|
+
|
|
154
|
+
// ${_cardColorStyle(color, color, $checkered)}
|
|
155
|
+
|
|
156
|
+
// background-color: ${$muted ? 'var(--card-muted-bg-color)' : 'var(--card-bg-color)'};
|
|
157
|
+
// color: var(--card-fg-color);
|
|
158
|
+
|
|
159
|
+
// /* &:is(button) */
|
|
160
|
+
// &[data-as='button'] {
|
|
161
|
+
// --card-focus-ring-box-shadow: none;
|
|
162
|
+
|
|
163
|
+
// cursor: default;
|
|
164
|
+
// box-shadow: var(--card-focus-ring-box-shadow);
|
|
165
|
+
|
|
166
|
+
// &:disabled {
|
|
167
|
+
// ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
168
|
+
// }
|
|
169
|
+
|
|
170
|
+
// &:not(:disabled) {
|
|
171
|
+
// &[data-pressed] {
|
|
172
|
+
// ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
173
|
+
// }
|
|
174
|
+
|
|
175
|
+
// &[data-selected] {
|
|
176
|
+
// ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
177
|
+
// }
|
|
178
|
+
|
|
179
|
+
// @media (hover: hover) {
|
|
180
|
+
// &:not([data-pressed]):not([data-selected]) {
|
|
181
|
+
// &[data-hovered],
|
|
182
|
+
// &:hover {
|
|
183
|
+
// ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
184
|
+
// }
|
|
185
|
+
|
|
186
|
+
// &:active {
|
|
187
|
+
// ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
188
|
+
// }
|
|
189
|
+
// }
|
|
190
|
+
// }
|
|
191
|
+
|
|
192
|
+
// &:focus-visible {
|
|
193
|
+
// --card-focus-ring-box-shadow: ${$focusRing
|
|
194
|
+
// ? focusRingStyle({base: color, border, focusRing: card.focusRing})
|
|
195
|
+
// : undefined};
|
|
196
|
+
// }
|
|
197
|
+
// }
|
|
198
|
+
// }
|
|
199
|
+
|
|
200
|
+
// /* &:is(a) */
|
|
201
|
+
// &[data-as='a'] {
|
|
202
|
+
// cursor: pointer;
|
|
203
|
+
// box-shadow: var(--card-focus-ring-box-shadow);
|
|
204
|
+
|
|
205
|
+
// &[data-disabled] {
|
|
206
|
+
// ${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
207
|
+
// }
|
|
208
|
+
|
|
209
|
+
// &:not([data-disabled]) {
|
|
210
|
+
// &[data-pressed] {
|
|
211
|
+
// ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
212
|
+
// }
|
|
213
|
+
|
|
214
|
+
// &[data-selected] {
|
|
215
|
+
// ${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
216
|
+
// }
|
|
217
|
+
|
|
218
|
+
// @media (hover: hover) {
|
|
219
|
+
// &:not([data-pressed]):not([data-selected]) {
|
|
220
|
+
// &[data-hovered],
|
|
221
|
+
// &:hover {
|
|
222
|
+
// ${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
223
|
+
// }
|
|
224
|
+
|
|
225
|
+
// &:active {
|
|
226
|
+
// ${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
|
+
// }
|
|
230
|
+
|
|
231
|
+
// &:focus-visible {
|
|
232
|
+
// --card-focus-ring-box-shadow: ${$focusRing
|
|
233
|
+
// ? focusRingStyle({base: color, border, focusRing: card.focusRing})
|
|
234
|
+
// : undefined};
|
|
235
|
+
// }
|
|
236
|
+
// }
|
|
237
|
+
// }
|
|
238
|
+
|
|
239
|
+
// ${style?.card?.root}
|
|
240
|
+
// `
|
|
241
|
+
// }
|