@nearform/quantum 0.0.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.
Files changed (59) hide show
  1. package/.commitlintrc +5 -0
  2. package/.editorconfig +6 -0
  3. package/.eslintrc +11 -0
  4. package/.github/ISSUE_TEMPLATE/component-issue-template.md +13 -0
  5. package/.github/ISSUE_TEMPLATE/tailwind-config-customisation-issue.md +11 -0
  6. package/.github/dependabot.yml +10 -0
  7. package/.github/workflows/check-linked-issues.yml +20 -0
  8. package/.github/workflows/ci.yml +31 -0
  9. package/.github/workflows/deploy-github-pages.yml +44 -0
  10. package/.github/workflows/notify-release.yml +19 -0
  11. package/.github/workflows/release.yml +29 -0
  12. package/.husky/commit-msg +4 -0
  13. package/.husky/pre-commit +4 -0
  14. package/.nvmrc +1 -0
  15. package/.prettierrc +6 -0
  16. package/.storybook/main.ts +34 -0
  17. package/.storybook/manager.ts +6 -0
  18. package/.storybook/preview.ts +21 -0
  19. package/.storybook/theme.ts +6 -0
  20. package/.svg-to-tsrc +18 -0
  21. package/README.md +32 -0
  22. package/dist/global.css +678 -0
  23. package/dist/global.css.map +1 -0
  24. package/dist/index.d.ts +137 -0
  25. package/dist/index.js +3537 -0
  26. package/dist/index.js.map +1 -0
  27. package/index.js +0 -0
  28. package/package.json +68 -0
  29. package/postcss.config.js +3 -0
  30. package/src/assets/build/check.icon.tsx +16 -0
  31. package/src/assets/build/minus.icon.tsx +14 -0
  32. package/src/assets/build/radioselected.icon.tsx +7 -0
  33. package/src/assets/index.ts +3 -0
  34. package/src/assets/svg-icons/check.svg +5 -0
  35. package/src/assets/svg-icons/minus.svg +5 -0
  36. package/src/assets/svg-icons/radio-selected.svg +5 -0
  37. package/src/colors.ts +164 -0
  38. package/src/components/Button/index.tsx +72 -0
  39. package/src/components/Checkbox/index.tsx +32 -0
  40. package/src/components/Label/index.tsx +26 -0
  41. package/src/components/Radio/RadioGroup.tsx +20 -0
  42. package/src/components/Radio/RadioGroupItem.tsx +26 -0
  43. package/src/components/Radio/index.tsx +2 -0
  44. package/src/global.css +4 -0
  45. package/src/index.ts +2 -0
  46. package/src/lib/utils.ts +6 -0
  47. package/stories/Button/Button.stories.tsx +74 -0
  48. package/stories/Checkbox/CheckBox.example.tsx +16 -0
  49. package/stories/Checkbox/Checkbox.stories.ts +42 -0
  50. package/stories/Colors.mdx +49 -0
  51. package/stories/Label/Label.example.tsx +20 -0
  52. package/stories/Label/Label.stories.ts +27 -0
  53. package/stories/Radio/Radio.example.tsx +39 -0
  54. package/stories/Radio/Radio.stories.ts +32 -0
  55. package/stories/global.css +6 -0
  56. package/stories/tailwind.config.js +5 -0
  57. package/tailwind.config.js +47 -0
  58. package/tsconfig.json +14 -0
  59. package/tsup.config.ts +8 -0
@@ -0,0 +1,49 @@
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
+
@@ -0,0 +1,20 @@
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 }
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,32 @@
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
+ }
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,5 @@
1
+ const config = require('../tailwind.config')
2
+
3
+ config.content.push('./stories/**/*.{tsx, ts}')
4
+
5
+ module.exports = config
@@ -0,0 +1,47 @@
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 ADDED
@@ -0,0 +1,14 @@
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 ADDED
@@ -0,0 +1,8 @@
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
+ })