Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/scan-adoption-script' into scan-…
Browse files Browse the repository at this point in the history
…adoption-script
  • Loading branch information
andresin87 committed May 23, 2024
2 parents d506fe8 + 6b72512 commit c9a8e34
Show file tree
Hide file tree
Showing 65 changed files with 1,352 additions and 320 deletions.
1,134 changes: 973 additions & 161 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "13.4.0",
"@testing-library/user-event": "14.5.2",
"@types/react": "18.2.74",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
Expand Down Expand Up @@ -99,7 +99,7 @@
"eslint-plugin-simple-import-sort": "10.0.0",
"eslint-plugin-standard": "5.0.0",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-tailwindcss": "3.15.1",
"eslint-plugin-tailwindcss": "3.15.2",
"eslint-plugin-testing-library": "5.11.1",
"husky": "8.0.3",
"jsdom": "21.1.1",
Expand All @@ -109,7 +109,7 @@
"postcss": "8.4.38",
"prettier": "3.2.5",
"prettier-plugin-tailwindcss": "0.5.14",
"react": "18.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-live": "3.2.0",
"remark-gfm": "^4.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/components/alert-dialog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.18](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/alert-dialog

## [1.0.17](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-14)

**Note:** Version bump only for package @spark-ui/alert-dialog
Expand Down
4 changes: 2 additions & 2 deletions packages/components/alert-dialog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spark-ui/alert-dialog",
"version": "1.0.17",
"version": "1.0.18",
"description": "A modal dialog that interrupts the user with important content and expects a response.",
"publishConfig": {
"access": "public"
Expand All @@ -24,7 +24,7 @@
},
"dependencies": {
"@radix-ui/primitive": "1.0.1",
"@spark-ui/dialog": "^1.12.1",
"@spark-ui/dialog": "^1.12.2",
"@spark-ui/use-merge-refs": "^0.4.1",
"class-variance-authority": "0.7.0"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/components/checkbox/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.2.7](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/checkbox

## [2.2.6](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/checkbox

## [2.2.5](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-14)

**Note:** Version bump only for package @spark-ui/checkbox
Expand Down
6 changes: 3 additions & 3 deletions packages/components/checkbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spark-ui/checkbox",
"version": "2.2.5",
"version": "2.2.7",
"description": "A control that allows the user to toggle between checked and not checked.",
"publishConfig": {
"access": "public"
Expand All @@ -24,9 +24,9 @@
},
"dependencies": {
"@radix-ui/react-checkbox": "1.0.4",
"@spark-ui/form-field": "^1.5.3",
"@spark-ui/form-field": "^1.5.5",
"@spark-ui/icon": "^2.1.3",
"@spark-ui/icons": "^1.21.8",
"@spark-ui/icons": "^1.21.9",
"@spark-ui/internal-utils": "^2.3.0",
"@spark-ui/label": "^1.7.1",
"@spark-ui/use-merge-refs": "^0.4.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/components/chip/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.2.14](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/chip

## [1.2.13](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-14)

**Note:** Version bump only for package @spark-ui/chip
Expand Down
4 changes: 2 additions & 2 deletions packages/components/chip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spark-ui/chip",
"version": "1.2.13",
"version": "1.2.14",
"description": "To help people enter information, make selections, filter content, or trigger actions.",
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -44,7 +44,7 @@
"license": "MIT",
"dependencies": {
"@spark-ui/icon": "^2.1.3",
"@spark-ui/icons": "^1.21.8",
"@spark-ui/icons": "^1.21.9",
"@spark-ui/internal-utils": "^2.3.0",
"@spark-ui/slot": "^1.7.1",
"emulate-tab": "^1.2.1"
Expand Down
30 changes: 30 additions & 0 deletions packages/components/combobox/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.1](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-22)

**Note:** Version bump only for package @spark-ui/combobox

# [1.0.0](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-17)

### Bug Fixes

- **combobox:** combobox stable release ([0f3ecc6](https://github.com/adevinta/spark/commit/0f3ecc6e5c8f7ae8f788197f2ff090dce658d779))

## [0.12.13](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

### Bug Fixes

- **combobox:** placeholder only appears when there is no value on combobox ([9a8215f](https://github.com/adevinta/spark/commit/9a8215f5b5c26c1190a3acf2347e2446dab61fa5))

## [0.12.12](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/combobox

## [0.12.11](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/combobox

## [0.12.10](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

### Bug Fixes

- **combobox:** apply focus styled to combobox selected items ([14f0434](https://github.com/adevinta/spark/commit/14f0434193ea6449ab989704079482209980632f))

## [0.12.9](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-15)

**Note:** Version bump only for package @spark-ui/combobox
Expand Down
8 changes: 4 additions & 4 deletions packages/components/combobox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spark-ui/combobox",
"version": "0.12.9",
"version": "1.0.1",
"description": "An input that behaves similarly to a select, with the addition of a free text input to filter options.",
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -28,11 +28,11 @@
"tailwindcss": "^3.0.0"
},
"dependencies": {
"@spark-ui/form-field": "^1.5.3",
"@spark-ui/form-field": "^1.5.5",
"@spark-ui/icon": "^2.1.3",
"@spark-ui/icon-button": "^2.2.5",
"@spark-ui/icons": "^1.21.8",
"@spark-ui/popover": "^1.5.10",
"@spark-ui/icons": "^1.21.9",
"@spark-ui/popover": "^1.6.0",
"@spark-ui/spinner": "^2.2.3",
"@spark-ui/use-merge-refs": "^0.4.1",
"@spark-ui/visually-hidden": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/combobox/src/Combobox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import React, { ComponentProps, useState } from 'react'
import { Combobox } from '.'

const meta: Meta<typeof Combobox> = {
title: 'Experimental/Combobox',
title: 'Components/Combobox',
component: Combobox,
}

Expand Down
4 changes: 3 additions & 1 deletion packages/components/combobox/src/ComboboxInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const Input = forwardRef(
ref: inputRef,
})

const hasPlaceholder = ctx.multiple ? ctx.selectedItems.length === 0 : ctx.selectedItem === null

return (
<>
{ariaLabel && (
Expand All @@ -86,7 +88,7 @@ export const Input = forwardRef(
<input
data-spark-component="combobox-input"
type="text"
placeholder={placeholder}
{...(hasPlaceholder && { placeholder })}
className={cx(
'max-w-full shrink-0 grow basis-[80px]',
'h-sz-28 text-ellipsis bg-surface px-sm text-body-1 outline-none',
Expand Down
131 changes: 67 additions & 64 deletions packages/components/combobox/src/ComboboxSelectedItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import { cx } from 'class-variance-authority'
import { FocusEvent } from 'react'

import { useComboboxContext } from './ComboboxContext'
import { ComboboxItem } from './types'

export const SelectedItems = () => {
const SelectedItem = ({ item: selectedItem, index }: { item: ComboboxItem; index: number }) => {
const ctx = useComboboxContext()

if (!ctx.selectedItems.length || !ctx.multiple) {
return null
}

const isCleanable = !ctx.disabled && !ctx.readOnly

const handleFocus = (e: FocusEvent<HTMLSpanElement>) => {
Expand All @@ -25,72 +22,78 @@ export const SelectedItems = () => {
}
}

const { disabled, ...selectedItemProps } = ctx.getSelectedItemProps({
disabled: ctx.disabled || ctx.readOnly,
selectedItem,
index,
})

const Element = disabled ? 'button' : 'span'

return (
<>
{ctx.selectedItems.map((selectedItemForRender, index) => {
const { disabled, ...selectedItemProps } = ctx.getSelectedItemProps({
disabled: ctx.disabled || ctx.readOnly,
selectedItem: selectedItemForRender,
index,
})
<Element
role="presentation"
data-spark-component="combobox-selected-item"
key={`selected-item-${index}`}
className={cx(
'flex h-sz-28 items-center rounded-md bg-neutral-container align-middle',
'text-body-2 text-on-neutral-container',
'disabled:cursor-not-allowed disabled:opacity-dim-3',
'outline-none focus-visible:u-ring-inset',
{ 'px-md': !isCleanable, 'pl-md': isCleanable }
)}
{...selectedItemProps}
tabIndex={-1}
{...(disabled && { disabled: true })}
onFocus={handleFocus}
>
<span
className={cx('line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal', {
'w-max': !ctx.wrap,
})}
>
{selectedItem.text}
</span>
{ctx.disabled}
{isCleanable && (
<button
type="button"
tabIndex={-1}
aria-hidden
className="h-full cursor-pointer px-md"
onClick={e => {
e.stopPropagation()

const Element = disabled ? 'button' : 'span'
const updatedSelectedItems = ctx.selectedItems.filter(
item => item.value !== selectedItem.value
)

return (
<Element
role="presentation"
data-spark-component="combobox-selected-item"
key={`selected-item-${index}`}
className={cx(
'flex h-sz-28 items-center rounded-md bg-neutral-container align-middle',
'text-body-2 text-on-neutral-container',
'disabled:cursor-not-allowed disabled:opacity-dim-3',
{ 'px-md': !isCleanable, 'pl-md': isCleanable }
)}
{...selectedItemProps}
tabIndex={-1}
{...(disabled && { disabled: true })}
onFocus={handleFocus}
>
<span
className={cx(
'line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal',
{ 'w-max': !ctx.wrap }
)}
>
{selectedItemForRender.text}
</span>
{ctx.disabled}
{isCleanable && (
<button
type="button"
tabIndex={-1}
aria-hidden
className="h-full cursor-pointer px-md"
onClick={e => {
e.stopPropagation()
ctx.setSelectedItems(updatedSelectedItems)

const updatedSelectedItems = ctx.selectedItems.filter(
item => item.value !== selectedItemForRender.value
)
if (ctx.innerInputRef.current) {
ctx.innerInputRef.current.focus({ preventScroll: true })
}
}}
>
<Icon size="sm">
<DeleteOutline />
</Icon>
</button>
)}
</Element>
)
}

ctx.setSelectedItems(updatedSelectedItems)
export const SelectedItems = () => {
const ctx = useComboboxContext()

if (ctx.innerInputRef.current) {
ctx.innerInputRef.current.focus({ preventScroll: true })
}
}}
>
<Icon size="sm">
<DeleteOutline />
</Icon>
</button>
)}
</Element>
)
})}
return ctx.multiple && ctx.selectedItems.length ? (
<>
{ctx.selectedItems.map((item, index) => (
<SelectedItem item={item} index={index} />
))}
</>
)
) : null
}

SelectedItems.displayName = 'Combobox.SelectedItems'
4 changes: 4 additions & 0 deletions packages/components/dialog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.12.2](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/dialog

## [1.12.1](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-14)

**Note:** Version bump only for package @spark-ui/dialog
Expand Down
4 changes: 2 additions & 2 deletions packages/components/dialog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spark-ui/dialog",
"version": "1.12.1",
"version": "1.12.2",
"description": "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.",
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -46,7 +46,7 @@
"@radix-ui/react-dialog": "1.0.5",
"@spark-ui/icon": "^2.1.3",
"@spark-ui/icon-button": "^2.2.5",
"@spark-ui/icons": "^1.21.8",
"@spark-ui/icons": "^1.21.9",
"@spark-ui/internal-utils": "^2.3.0",
"class-variance-authority": "0.7.0"
}
Expand Down
4 changes: 4 additions & 0 deletions packages/components/drawer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.3.7](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-16)

**Note:** Version bump only for package @spark-ui/drawer

## [1.3.6](https://github.com/adevinta/spark/compare/@spark-ui/[email protected]...@spark-ui/[email protected]) (2024-05-14)

**Note:** Version bump only for package @spark-ui/drawer
Expand Down
Loading

0 comments on commit c9a8e34

Please sign in to comment.