Skip to content

Commit c29bee5

Browse files
authored
feat(Root): cursor strategy support (#873)
1 parent 7574a2c commit c29bee5

File tree

18 files changed

+32
-22
lines changed

18 files changed

+32
-22
lines changed

.changeset/unlucky-tables-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": minor
3+
---
4+
5+
Allow to set cursorStrategy to `web` or `native` in Root component.

src/components/HiddenInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const HiddenInput = tasty({
1919
height: '100%',
2020
cursor: {
2121
'': 'default',
22-
button: 'pointer',
22+
button: '$pointer',
2323
disabled: 'not-allowed',
2424
},
2525
},

src/components/Root.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { PortalProvider } from './portal';
2424

2525
const RootElement = tasty({
2626
id: 'cube-ui-kit-root',
27-
// className: 'root',
2827
});
2928

3029
const DEFAULT_STYLES = {
@@ -49,6 +48,7 @@ export interface CubeRootProps extends BaseProps {
4948
monospaceFont?: string;
5049
applyLegacyTokens?: boolean;
5150
tracking?: TrackingProps;
51+
cursorStrategy?: 'web' | 'native';
5252
}
5353

5454
const IS_DVH_SUPPORTED =
@@ -70,6 +70,7 @@ export function Root(allProps: CubeRootProps) {
7070
monospaceFont,
7171
applyLegacyTokens,
7272
tracking,
73+
cursorStrategy = 'web',
7374
style,
7475
...props
7576
} = allProps;
@@ -138,6 +139,7 @@ export function Root(allProps: CubeRootProps) {
138139
'--cube-dynamic-viewport-height': height
139140
? height + 'px'
140141
: '100dvh',
142+
'--pointer': cursorStrategy === 'web' ? 'pointer' : 'default',
141143
...style,
142144
}}
143145
>

src/components/actions/Action/Action.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ActionElement = tasty({
3939
padding: 0,
4040
outline: 0,
4141
transition: 'theme',
42-
cursor: 'pointer',
42+
cursor: '$pointer',
4343
textDecoration: 'none',
4444
fill: '#clear',
4545
},

src/components/actions/Button/Button.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ export const DEFAULT_BUTTON_STYLES = {
100100
margin: 0,
101101
boxSizing: 'border-box',
102102
cursor: {
103-
'': 'pointer',
104-
disabled: 'default',
103+
'': 'default',
104+
':is(a)': 'pointer',
105+
':is(button)': '$pointer',
106+
disabled: 'not-allowed',
105107
},
106108
gap: {
107109
'': '.75x',

src/components/actions/ItemAction/ItemAction.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const ItemActionElement = tasty({
7777
reset: 'button',
7878
outline: 0,
7979
outlineOffset: 1,
80-
cursor: { '': 'pointer', disabled: 'default' },
80+
cursor: { '': '$pointer', disabled: 'default' },
8181
padding: {
8282
'': '0 $inline-padding',
8383
'with-icon': 0,

src/components/content/CopyPasteBlock/CopyPasteBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const CopyPasteBlockElement = tasty(Card, {
6060
':focus': '2px dashed #purple-text',
6161
error: 'dashed #danger',
6262
},
63-
cursor: 'pointer',
63+
cursor: '$pointer',
6464
preset: {
6565
'': 't3',
6666
'[data-size="large"]': 't2',

src/components/content/Item/Item.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ const ItemElement = tasty({
280280
outlineOffset: 1,
281281
cursor: {
282282
'': 'default',
283-
':is(button) | :is(a)': 'pointer',
283+
':is(a)': 'pointer',
284+
':is(button) | listboxitem | menuitem': '$pointer',
284285
disabled: 'not-allowed',
285286
},
286287

src/components/fields/Checkbox/Checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const CheckboxWrapperElement = tasty({
6464
gap: '1x',
6565
flow: 'row',
6666
preset: 'default',
67-
cursor: 'pointer',
67+
cursor: '$pointer',
6868
width: 'max max-content',
6969
color: '#dark-02',
7070
},

src/components/fields/FileInput/FileInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const FileInputElement = tasty(Action, {
4343
},
4444
border: true,
4545
radius: true,
46-
cursor: 'pointer',
46+
cursor: '$pointer',
4747
overflow: 'hidden',
4848
whiteSpace: 'nowrap',
4949

@@ -91,7 +91,7 @@ const FileInputElement = tasty(Action, {
9191
left: 0,
9292
radius: '$content-radius',
9393
opacity: 0.01,
94-
cursor: 'pointer',
94+
cursor: '$pointer',
9595
zIndex: 10,
9696
},
9797
},

0 commit comments

Comments
 (0)