Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
17a0c00
feat(parser): new style parser
tenphi May 26, 2025
e5d4739
feat(parser): new style parser * 2
tenphi May 26, 2025
c154597
feat(parser): new style parser * 3
tenphi May 26, 2025
ded64db
feat(parser): new style parser * 4
tenphi May 26, 2025
b93f994
feat(parser): new style parser * 5
tenphi May 27, 2025
d74a1f5
feat(parser): new style parser * 6
tenphi May 27, 2025
7022d19
fix(Slider): wrong style declaration
tenphi May 27, 2025
e926da1
fix(Slider): wrong styles
tenphi May 27, 2025
35576fe
fix(Slider): wrong ref
tenphi May 27, 2025
5e4291b
feat(parser): new style parser * 7
tenphi May 27, 2025
000e53f
feat(parser): new style parser * 8
tenphi May 27, 2025
f6faeaa
feat(parser): new style parser * 9
tenphi May 27, 2025
a8ea8dd
chore: update config
tenphi May 28, 2025
64d0ba3
chore: update config * 2
tenphi May 28, 2025
759ace5
chore: add test for parser
tenphi Jun 3, 2025
e8b6788
Update src/tasty/styles/border.ts
tenphi Jun 4, 2025
02c7fed
chore: styles util clean up
tenphi Jun 6, 2025
3cd9fd8
fix(border.style): type
tenphi Jun 6, 2025
346792e
fix(scrollnar.style): none keyword
tenphi Jun 6, 2025
5f8ef40
Merge remote-tracking branch 'origin' into new-style-parser
tenphi Jun 6, 2025
ae4079a
fix(Tooltip): drop-shadow declaration
tenphi Jun 6, 2025
5dfb93c
Merge remote-tracking branch 'origin' into new-style-parser
tenphi Aug 5, 2025
639e3b5
fix: new var syntax
tenphi Aug 5, 2025
cd64a07
chore: fix cursor rules
tenphi Aug 5, 2025
e0bf8f2
chore: update size-limit
tenphi Aug 5, 2025
91c7e62
chore: update node, pnpm, add changelog
tenphi Aug 5, 2025
e2b67aa
chore: update github actions to support new node and pnpm versions
tenphi Aug 5, 2025
1444831
chore: update deps
tenphi Aug 5, 2025
186f483
chore: update ci test command
tenphi Aug 5, 2025
a9ce99e
chore: add vercel config
tenphi Aug 5, 2025
d4dc30d
chore: update vercel config
tenphi Aug 5, 2025
8c8f1f5
chore: update vercel config
tenphi Aug 5, 2025
f882118
fix(ComboBox): remove modAttr helper
tenphi Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-ants-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": minor
---

A brand new style parser that supports all kinds of css syntax and nested custom tasty syntax.
8 changes: 8 additions & 0 deletions .cursor/rules/parser.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
description: If the task requires information about how styles are parsed in `tasty`.
globs:
alwaysApply: false
---
The specification of the style parser is described in [parser.md](mdc:src/parser/parser.md)
This part of the styles handling only covers the parsing of string values. Though, boolean and number styles can be converted to string.
Style-2-state mapping and responsive values are handled separately in [styles.ts](mdc:src/tasty/utils/styles.ts) and [responsive.ts](mdc:src/tasty/utils/responsive.ts)
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand Down Expand Up @@ -59,16 +59,16 @@ jobs:
NODE_OPTIONS: --max-old-space-size=4096
CHROMATIC_RETRIES: 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Download storybook cache
with:
path: |
Expand All @@ -77,7 +77,7 @@ jobs:
restore-keys: |
${{ runner.os }}-storybook

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
name: Canary package in NPM
url: https://www.npmjs.com/package/@cube-dev/ui-kit/v/${{ steps.publish.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand Down Expand Up @@ -79,21 +79,21 @@ jobs:
name: 'Tests & lint'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Download eslint cache
with:
path: |
**/.eslintcache
key: ${{ runner.os }}-eslint

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand All @@ -105,7 +105,7 @@ jobs:
run: pnpm lint

- name: Run the tests
run: pnpm test -- --no-cache
run: pnpm test:no-cache

deploy-chromatic:
name: 'Prepare Storybook for review & tests'
Expand All @@ -117,16 +117,16 @@ jobs:
CHROMATIC_RETRIES: 5
LOG_LEVEL: 'error'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Download storybook cache
with:
path: |
Expand All @@ -135,7 +135,7 @@ jobs:
restore-keys: |
${{ runner.os }}-storybook

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
REPORT_FOLDER: './size-limit-report'
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
version: 10.14.0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.1
20.19.2
6 changes: 3 additions & 3 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ module.exports = [
}),
);
},
limit: '281kB',
limit: '282kB',
},
{
name: 'Tree shaking (just a Button)',
path: './dist/es/index.js',
webpack: true,
import: '{ Button }',
limit: '23 kB',
limit: '24 kB',
},
{
name: 'Tree shaking (just an Icon)',
path: './dist/es/index.js',
webpack: true,
import: '{ AiIcon }',
limit: '12 kB',
limit: '13 kB',
},
];
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"module": "dist/es/index.js",
"types": "dist/types/index.d.ts",
"sideEffects": false,
"packageManager": "pnpm@9.12.2",
"packageManager": "pnpm@10.14.0",
"exports": {
".": {
"import": "./dist/es/index.js",
Expand All @@ -28,6 +28,7 @@
"build:esm": "tsc -p tsconfig.es.json",
"watch": "pnpm build:esm --watch",
"test": "jest",
"test:no-cache": "jest --no-cache",
"test-cover": "jest --coverage",
"test-watch": "jest --watch",
"prettier": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
Expand Down Expand Up @@ -102,6 +103,7 @@
},
"devDependencies": {
"@actions/core": "^1.11.1",
"@eslint/js": "^9.25.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@changesets/changelog-github": "^0.4.4",
Expand Down Expand Up @@ -182,7 +184,7 @@
],
"license": "MIT",
"engines": {
"node": ">=18.19.1",
"pnpm": "^9.0.0"
"node": ">=20.19.2",
"pnpm": "^10.0.0"
}
}
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions src/components/fields/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
import { generateRandomId } from '../../../utils/random';
import {
mergeProps,
modAttrs,
useCombinedRefs,
useLayoutEffect,
} from '../../../utils/react';
Expand Down Expand Up @@ -430,7 +429,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
<ComboBoxWrapperElement
ref={wrapperRef}
qa={qa || 'ComboBox'}
{...modAttrs(mods)}
mods={mods}
styles={wrapperStyles}
style={{
zIndex: isFocused ? 1 : 'initial',
Expand All @@ -446,7 +445,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
{...allInputProps}
autoComplete={autoComplete}
styles={inputStyles}
{...modAttrs(mods)}
mods={mods}
data-size={size}
/>
<div data-element="Suffix">
Expand All @@ -463,14 +462,14 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
data-menu-trigger
qa="ComboBoxTrigger"
{...mergeProps(buttonProps, triggerFocusProps, triggerHoverProps)}
{...modAttrs({
ref={triggerRef}
mods={{
pressed: isTriggerPressed,
focused: isTriggerFocused,
hovered: isTriggerHovered,
disabled: isDisabled,
loading: isLoading,
})}
ref={triggerRef}
}}
data-size={size}
isDisabled={isDisabled}
styles={triggerStyles}
Expand Down
6 changes: 6 additions & 0 deletions src/components/fields/Slider/RangeSlider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ WithoutValue.args = {
label: 'Slider',
showValueLabel: false,
};

export const Vertical = Template.bind({});
Vertical.args = {
label: 'Slider',
orientation: 'vertical',
};
25 changes: 18 additions & 7 deletions src/components/fields/Slider/RangeSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { forwardRef } from 'react';
import { forwardRef, useRef } from 'react';

import { Gradation } from './Gradation';
import { SliderBase, SliderBaseChildArguments } from './SliderBase';
import { SliderThumb } from './SliderThumb';
import { SliderTrack } from './SliderTrack';

import type { DOMRef } from '@react-types/shared';
import type { FocusableRef } from '@react-types/shared';
import type { RangeValue } from '../../../shared';
import type { CubeSliderBaseProps } from './types';

Expand All @@ -19,29 +19,40 @@ const INTL_MESSAGES = {
maximum: 'Maximum',
};

function RangeSlider(props: CubeRangeSliderProps, ref: DOMRef<HTMLDivElement>) {
function RangeSlider(
props: CubeRangeSliderProps,
ref: FocusableRef<HTMLDivElement>,
) {
let { isDisabled, styles, gradation, ...otherProps } = props;

// Create separate refs for each thumb to enable proper focus management
const minThumbInputRef = useRef<HTMLInputElement>(null);
const maxThumbInputRef = useRef<HTMLInputElement>(null);

return (
<SliderBase {...(otherProps as CubeSliderBaseProps<number[]>)}>
<SliderBase ref={ref} {...(otherProps as CubeSliderBaseProps<number[]>)}>
{({ trackRef, inputRef, state }: SliderBaseChildArguments) => {
return (
<>
<Gradation state={state} ranges={[0, 1]} values={gradation} />
<SliderTrack state={state} isDisabled={isDisabled} />
<SliderTrack
state={state}
isDisabled={isDisabled}
orientation={props.orientation}
/>
<SliderThumb
index={0}
aria-label={INTL_MESSAGES['minimum']}
state={state}
inputRef={inputRef}
inputRef={minThumbInputRef}
trackRef={trackRef}
isDisabled={isDisabled}
/>
<SliderThumb
index={1}
aria-label={INTL_MESSAGES['maximum']}
state={state}
inputRef={inputRef}
inputRef={maxThumbInputRef}
trackRef={trackRef}
isDisabled={isDisabled}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/components/fields/Slider/SliderTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export function SliderTrack(props: SliderTrackProps) {
'--slider-range-start': `${selectedTrack[0] * 100}%`,
'--slider-range-end': `${selectedTrack[1] * 100}%`,
}
: {}
: {
'--slider-value': `${selectedTrack[0] * 100}%`,
}
}
/>
);
Expand Down
Loading
Loading