@nearform/quantum 0.0.1 → 0.0.3

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.
Files changed (56) hide show
  1. package/dist/index.d.ts +13 -1
  2. package/dist/index.js +142 -8
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -1
  5. package/.commitlintrc +0 -5
  6. package/.editorconfig +0 -6
  7. package/.eslintrc +0 -11
  8. package/.github/ISSUE_TEMPLATE/component-issue-template.md +0 -13
  9. package/.github/ISSUE_TEMPLATE/tailwind-config-customisation-issue.md +0 -11
  10. package/.github/dependabot.yml +0 -10
  11. package/.github/workflows/check-linked-issues.yml +0 -20
  12. package/.github/workflows/ci.yml +0 -31
  13. package/.github/workflows/deploy-github-pages.yml +0 -44
  14. package/.github/workflows/notify-release.yml +0 -19
  15. package/.github/workflows/release.yml +0 -29
  16. package/.husky/commit-msg +0 -4
  17. package/.husky/pre-commit +0 -4
  18. package/.nvmrc +0 -1
  19. package/.prettierrc +0 -6
  20. package/.storybook/main.ts +0 -34
  21. package/.storybook/manager.ts +0 -6
  22. package/.storybook/preview.ts +0 -21
  23. package/.storybook/theme.ts +0 -6
  24. package/.svg-to-tsrc +0 -18
  25. package/index.js +0 -0
  26. package/postcss.config.js +0 -3
  27. package/src/assets/build/check.icon.tsx +0 -16
  28. package/src/assets/build/minus.icon.tsx +0 -14
  29. package/src/assets/build/radioselected.icon.tsx +0 -7
  30. package/src/assets/index.ts +0 -3
  31. package/src/assets/svg-icons/check.svg +0 -5
  32. package/src/assets/svg-icons/minus.svg +0 -5
  33. package/src/assets/svg-icons/radio-selected.svg +0 -5
  34. package/src/colors.ts +0 -164
  35. package/src/components/Button/index.tsx +0 -72
  36. package/src/components/Checkbox/index.tsx +0 -32
  37. package/src/components/Label/index.tsx +0 -26
  38. package/src/components/Radio/RadioGroup.tsx +0 -20
  39. package/src/components/Radio/RadioGroupItem.tsx +0 -26
  40. package/src/components/Radio/index.tsx +0 -2
  41. package/src/global.css +0 -4
  42. package/src/index.ts +0 -2
  43. package/src/lib/utils.ts +0 -6
  44. package/stories/Button/Button.stories.tsx +0 -74
  45. package/stories/Checkbox/CheckBox.example.tsx +0 -16
  46. package/stories/Checkbox/Checkbox.stories.ts +0 -42
  47. package/stories/Colors.mdx +0 -49
  48. package/stories/Label/Label.example.tsx +0 -20
  49. package/stories/Label/Label.stories.ts +0 -27
  50. package/stories/Radio/Radio.example.tsx +0 -39
  51. package/stories/Radio/Radio.stories.ts +0 -32
  52. package/stories/global.css +0 -6
  53. package/stories/tailwind.config.js +0 -5
  54. package/tailwind.config.js +0 -47
  55. package/tsconfig.json +0 -14
  56. package/tsup.config.ts +0 -8
@@ -1,32 +0,0 @@
1
- import * as React from 'react'
2
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
3
- import { cn } from '@/lib/utils'
4
- import { Check, Minus } from '@/assets/index'
5
-
6
- const Checkbox = React.forwardRef<
7
- React.ElementRef<typeof CheckboxPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
9
- >(({ className, ...props }, ref) => (
10
- <CheckboxPrimitive.Root
11
- ref={ref}
12
- className={cn(
13
- 'peer h-5 w-5 p-0.5 shrink-0 gap-0 rounded border border-border-default data-[state=checked]:border-blue-600 data-[state=checked]:bg-blue-600 data-[state=checked]:text-foreground-inverse data-[state=indeterminate]:border-blue-600 data-[state=indeterminate]:bg-blue-600 data-[state=indeterminate]:text-foreground-inverse',
14
- className
15
- )}
16
- {...props}
17
- >
18
- <CheckboxPrimitive.Indicator
19
- className={cn('flex items-center justify-center text-inherit')}
20
- >
21
- {(props.checked === true || props.checked === undefined) && (
22
- <Check className="text-inherit stroke-current stroke-1 fill-current" />
23
- )}
24
- {props.checked === 'indeterminate' && (
25
- <Minus className="text-inherit stroke-current stroke-3 fill-current" />
26
- )}
27
- </CheckboxPrimitive.Indicator>
28
- </CheckboxPrimitive.Root>
29
- ))
30
- Checkbox.displayName = CheckboxPrimitive.Root.displayName
31
-
32
- export { Checkbox }
@@ -1,26 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as LabelPrimitive from '@radix-ui/react-label'
5
- import type { LabelProps } from '@radix-ui/react-label'
6
- import { cva, type VariantProps } from 'class-variance-authority'
7
-
8
- import { cn } from '@/lib/utils'
9
-
10
- const labelVariants = cva(
11
- 'text-sm font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-foreground-inverse'
12
- )
13
- const Label = React.forwardRef<
14
- React.ElementRef<typeof LabelPrimitive.Root>,
15
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
16
- VariantProps<typeof labelVariants>
17
- >(({ className, ...props }, ref) => (
18
- <LabelPrimitive.Root
19
- ref={ref}
20
- className={cn(labelVariants(), className)}
21
- {...props}
22
- />
23
- ))
24
- Label.displayName = LabelPrimitive.Root.displayName
25
-
26
- export { Label, LabelProps }
@@ -1,20 +0,0 @@
1
- import * as React from 'react'
2
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
3
-
4
- import { cn } from '@/lib/utils'
5
-
6
- const RadioGroup = React.forwardRef<
7
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
- >(({ className, ...props }, ref) => {
10
- return (
11
- <RadioGroupPrimitive.Root
12
- className={cn('grid gap-2', className)}
13
- {...props}
14
- ref={ref}
15
- />
16
- )
17
- })
18
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
19
-
20
- export { RadioGroup }
@@ -1,26 +0,0 @@
1
- import * as React from 'react'
2
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
3
- import { cn } from '@/lib/utils'
4
- import { RadioSelected } from '@/assets'
5
- const RadioGroupItem = React.forwardRef<
6
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
7
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
8
- >(({ className, children, ...props }, ref) => {
9
- return (
10
- <RadioGroupPrimitive.Item
11
- ref={ref}
12
- className={cn(
13
- 'h-5 w-5 rounded-full border-[0.67px] border-border-default bg-grey-50 disabled:opacity-50 data-[state=checked]:border-primary-600 data-[state=checked]:bg-primary-600 text-foreground-inverse',
14
- className
15
- )}
16
- {...props}
17
- >
18
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
19
- <RadioSelected className="text-inherit stroke-current stroke-1 fill-current" />
20
- </RadioGroupPrimitive.Indicator>
21
- </RadioGroupPrimitive.Item>
22
- )
23
- })
24
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
25
-
26
- export { RadioGroupItem as Radio }
@@ -1,2 +0,0 @@
1
- export { RadioGroup } from './RadioGroup'
2
- export { Radio } from './RadioGroupItem'
package/src/global.css DELETED
@@ -1,4 +0,0 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
2
- @tailwind base;
3
- @tailwind components;
4
- @tailwind utilities;
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export { colors } from './colors'
2
- export * from './components/Button'
package/src/lib/utils.ts DELETED
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from 'clsx'
2
- import { twMerge } from 'tailwind-merge'
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
@@ -1,74 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import { Button } from '@/components/Button'
3
-
4
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
5
- const meta = {
6
- title: 'Components/Button',
7
- component: Button,
8
- parameters: {
9
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
10
- layout: 'centered',
11
- controls: {
12
- hideNoControlsWarning: true
13
- }
14
- },
15
- args: {
16
- children: 'Button Text',
17
- size: 'md',
18
- },
19
- argTypes: {
20
- variant: {
21
- control: 'radio',
22
- options: ['primary', 'secondary', 'tertiary', 'success', 'danger']
23
- },
24
- size: {
25
- control: 'radio',
26
- options: ['xs', 'sm', 'md', 'lg']
27
- },
28
- disabled: {
29
- control: 'boolean'
30
- },
31
- asChild: {
32
- table: {
33
- disable: true
34
- }
35
- }
36
- },
37
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
38
- tags: ['autodocs']
39
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
40
- } satisfies Meta<typeof Button>
41
-
42
- export default meta
43
- type Story = StoryObj<typeof meta>
44
-
45
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
46
- export const Primary: Story = {
47
- args: {
48
- variant: 'primary',
49
- },
50
- }
51
-
52
- export const Secondary: Story = {
53
- args: {
54
- variant: 'secondary',
55
- },
56
- }
57
-
58
- export const Tertiary: Story = {
59
- args: {
60
- variant: 'tertiary',
61
- },
62
- }
63
-
64
- export const Success: Story = {
65
- args: {
66
- variant: 'success',
67
- },
68
- }
69
-
70
- export const Danger: Story = {
71
- args: {
72
- variant: 'danger',
73
- },
74
- }
@@ -1,16 +0,0 @@
1
- import { Checkbox } from '@/components/Checkbox'
2
- import { CheckboxProps } from '@radix-ui/react-checkbox'
3
- import { useState } from 'react'
4
- export const CheckboxDemo = ({
5
- checked
6
- }: {
7
- checked: CheckboxProps['checked']
8
- }): JSX.Element => {
9
- const [check, setCheck] = useState<typeof checked>(checked)
10
- const handleOnCheckChanged = () => {
11
- if (check !== 'indeterminate') {
12
- setCheck(!check)
13
- }
14
- }
15
- return <Checkbox checked={check} onCheckedChange={handleOnCheckChanged} />
16
- }
@@ -1,42 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { CheckboxDemo } from './CheckBox.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/Checkbox',
8
- component: CheckboxDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- argTypes: {
16
- checked: {
17
- options: [true, false, 'indeterminate'],
18
- control: { type: 'radio' }
19
- }
20
- }
21
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
22
- } satisfies Meta<typeof CheckboxDemo>
23
-
24
- export default meta
25
- type Story = StoryObj<typeof meta>
26
-
27
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
28
- export const CheckBoxUnchecked: Story = {
29
- args: {
30
- checked: false
31
- }
32
- }
33
- export const CheckBoxChecked: Story = {
34
- args: {
35
- checked: true
36
- }
37
- }
38
- export const CheckBoxIndeterminate: Story = {
39
- args: {
40
- checked: 'indeterminate'
41
- }
42
- }
@@ -1,49 +0,0 @@
1
- import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
2
- import { colors, default as aliasColors } from '@/colors.ts';
3
-
4
- <Meta title="Colors" />
5
-
6
- # Colours
7
-
8
- Base colours provide a full colour spectrum of dark to light hues, and are used as aliases in the [brand theme](#brand-theme-and-ui-colours).
9
-
10
- ## Base Colours
11
- #
12
-
13
- <ColorPalette>
14
-
15
- {Object.keys(colors).map((token, index) => {
16
- const color = colors[token];
17
- return (
18
- <ColorItem
19
- key={index}
20
- index={index}
21
- title={`${token}`}
22
- colors={color}
23
- />
24
- );
25
- })}
26
-
27
- </ColorPalette>
28
-
29
- ## Brand Theme and UI Colours
30
- #
31
-
32
- <ColorPalette>
33
-
34
- {Object.keys(aliasColors).map((token, index) => {
35
- const color = aliasColors[token];
36
- if (typeof color === 'object' && !colors[token]) {
37
- return (
38
- <ColorItem
39
- key={index}
40
- index={index}
41
- title={`${token}`}
42
- colors={color}
43
- />
44
- )
45
- }
46
- })}
47
-
48
- </ColorPalette>
49
-
@@ -1,20 +0,0 @@
1
- import { Checkbox } from '@/components/Checkbox'
2
- import { Label, LabelProps } from '@/components/Label'
3
-
4
- interface LabelDemoProps extends LabelProps {
5
- labelText: string
6
- }
7
- const LabelDemo = (props: LabelDemoProps) => {
8
- return (
9
- <>
10
- <div className="space-x-2">
11
- <Label htmlFor={'checkbox'} className="dark:">
12
- {props.labelText}
13
- </Label>
14
- <Checkbox id="checkbox" />
15
- </div>
16
- </>
17
- )
18
- }
19
-
20
- export { LabelDemo }
@@ -1,27 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { LabelDemo } from './Label.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/Label',
8
- component: LabelDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs']
15
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
- } satisfies Meta<typeof LabelDemo>
17
-
18
- export default meta
19
- type Story = StoryObj<typeof meta>
20
-
21
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
22
- export const Default: Story = {
23
- args: {
24
- labelText: 'A Label with a Checkbox',
25
- htmlFor: 'checkbox'
26
- }
27
- }
@@ -1,39 +0,0 @@
1
- import { Label } from '@/components/Label'
2
- import { Radio, RadioGroup } from '@/components/Radio'
3
- import { useState } from 'react'
4
- export const RadioGroupDemo = ({
5
- defaultValue,
6
- disabled,
7
- loop
8
- }: {
9
- defaultValue?: string
10
- disabled?: boolean
11
- loop?: boolean
12
- }): JSX.Element => {
13
- const [value, setValue] = useState(defaultValue)
14
- const handleValueChange = (newValue: string) => {
15
- console.log(newValue)
16
- setValue(newValue)
17
- }
18
- return (
19
- <RadioGroup
20
- defaultValue={defaultValue}
21
- onValueChange={handleValueChange}
22
- disabled={disabled}
23
- loop={loop}
24
- >
25
- <RadioWithLabel value="hello" />
26
- <RadioWithLabel value="world" />
27
- <RadioWithLabel value="goodbye" />
28
- <RadioWithLabel value="friend" />
29
- </RadioGroup>
30
- )
31
- }
32
- const RadioWithLabel = ({ value }: { value: string }) => {
33
- return (
34
- <span className="flex items-center space-x-1">
35
- <Radio value={value} />
36
- <Label htmlFor={value}>{value}</Label>
37
- </span>
38
- )
39
- }
@@ -1,32 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { RadioGroupDemo } from './Radio.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/RadioGroup',
8
- component: RadioGroupDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs']
15
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
- } satisfies Meta<typeof RadioGroupDemo>
17
-
18
- export default meta
19
- type Story = StoryObj<typeof meta>
20
-
21
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
22
- export const NoDefault: Story = {}
23
- export const DefaultSet: Story = {
24
- args: {
25
- defaultValue: 'goodbye'
26
- }
27
- }
28
- export const RadioButtonDisabled: Story = {
29
- args: {
30
- disabled: true
31
- }
32
- }
@@ -1,6 +0,0 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
2
- @config "./tailwind.config.js";
3
-
4
- @tailwind base;
5
- @tailwind components;
6
- @tailwind utilities;
@@ -1,5 +0,0 @@
1
- const config = require('../tailwind.config')
2
-
3
- config.content.push('./stories/**/*.{tsx, ts}')
4
-
5
- module.exports = config
@@ -1,47 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- import colors from './src/colors'
3
- import defaultTheme from 'tailwindcss/defaultTheme'
4
-
5
- module.exports = {
6
- content: ['./src/**/*.tsx'],
7
- darkMode: 'class',
8
- plugins: [],
9
- theme: {
10
- colors: colors,
11
- boxShadow: {
12
- sm: '0px 1px 2px 0px',
13
- DEFAULT: '0px 1px 2px -1px',
14
- md: '0px 2px 4px -2px',
15
- lg: '0px 4px 6px 0px',
16
- xl: '0px 20px 25px -5px',
17
- '2xl': '0px 25px 50px -12px',
18
- none: '0px 0px'
19
- },
20
- fontFamily: {
21
- sans: ['"Inter"', ...defaultTheme.fontFamily.sans]
22
- },
23
- strokeWidth: {
24
- 0: '0px',
25
- 1: '1px',
26
- 2: '2px',
27
- 3: '4px',
28
- 4: '6px'
29
- },
30
- extend: {
31
- keyframes: {
32
- 'accordion-down': {
33
- from: { height: '0' },
34
- to: { height: 'var(--radix-accordion-content-height)' }
35
- },
36
- 'accordion-up': {
37
- from: { height: 'var(--radix-accordion-content-height)' },
38
- to: { height: '0' }
39
- }
40
- },
41
- animation: {
42
- 'accordion-down': 'accordion-down 0.2s ease-out',
43
- 'accordion-up': 'accordion-up 0.2s ease-out'
44
- }
45
- }
46
- }
47
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
- "module": "commonjs" /* Specify what module code is generated. */,
5
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
- "strict": true /* Enable all strict type-checking options. */,
8
- "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
- "jsx": "react-jsx",
10
- "paths": {
11
- "@/*": ["./src/*"]
12
- }
13
- }
14
- }
package/tsup.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts', 'src/global.css'],
5
- dts: { entry: ['src/index.ts'] },
6
- clean: true,
7
- sourcemap: true
8
- })