sonahang-ui 1.0.0

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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/dist/components/Accordion/Accordion.d.ts +36 -0
  4. package/dist/components/Accordion/AccordionItem.d.ts +15 -0
  5. package/dist/components/Accordion/accordion.context.d.ts +18 -0
  6. package/dist/components/Accordion/index.d.ts +5 -0
  7. package/dist/components/Alert/Alert.d.ts +24 -0
  8. package/dist/components/Alert/alert.tokens.d.ts +2 -0
  9. package/dist/components/Alert/index.d.ts +4 -0
  10. package/dist/components/Avatar/Avatar.d.ts +17 -0
  11. package/dist/components/Avatar/AvatarGroup.d.ts +12 -0
  12. package/dist/components/Avatar/avatar.context.d.ts +7 -0
  13. package/dist/components/Avatar/avatar.tokens.d.ts +2 -0
  14. package/dist/components/Avatar/getInitials.d.ts +6 -0
  15. package/dist/components/Avatar/index.d.ts +6 -0
  16. package/dist/components/Breadcrumb/Breadcrumb.d.ts +19 -0
  17. package/dist/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  18. package/dist/components/Breadcrumb/breadcrumb.context.d.ts +10 -0
  19. package/dist/components/Breadcrumb/index.d.ts +4 -0
  20. package/dist/components/Button/Button.d.ts +20 -0
  21. package/dist/components/Button/button.tokens.d.ts +4 -0
  22. package/dist/components/Button/buttonClassNames.d.ts +17 -0
  23. package/dist/components/Button/index.d.ts +6 -0
  24. package/dist/components/Checkbox/Checkbox.d.ts +24 -0
  25. package/dist/components/Checkbox/CheckboxGroup.d.ts +28 -0
  26. package/dist/components/Checkbox/checkbox.context.d.ts +17 -0
  27. package/dist/components/Checkbox/index.d.ts +4 -0
  28. package/dist/components/Chip/Chip.d.ts +21 -0
  29. package/dist/components/Chip/chip.tokens.d.ts +4 -0
  30. package/dist/components/Chip/index.d.ts +4 -0
  31. package/dist/components/CodeBlock/CodeBlock.d.ts +41 -0
  32. package/dist/components/CodeBlock/dedentCode.d.ts +12 -0
  33. package/dist/components/CodeBlock/index.d.ts +3 -0
  34. package/dist/components/Dialog/Dialog.d.ts +70 -0
  35. package/dist/components/Dialog/dialog.tokens.d.ts +8 -0
  36. package/dist/components/Dialog/index.d.ts +4 -0
  37. package/dist/components/Drawer/Drawer.d.ts +72 -0
  38. package/dist/components/Drawer/drawer.tokens.d.ts +10 -0
  39. package/dist/components/Drawer/index.d.ts +4 -0
  40. package/dist/components/Dropdown/Dropdown.d.ts +24 -0
  41. package/dist/components/Dropdown/DropdownItem.d.ts +16 -0
  42. package/dist/components/Dropdown/DropdownMenu.d.ts +13 -0
  43. package/dist/components/Dropdown/DropdownSeparator.d.ts +10 -0
  44. package/dist/components/Dropdown/DropdownTrigger.d.ts +8 -0
  45. package/dist/components/Dropdown/dropdown.context.d.ts +24 -0
  46. package/dist/components/Dropdown/index.d.ts +11 -0
  47. package/dist/components/EmptyState/EmptyState.d.ts +47 -0
  48. package/dist/components/EmptyState/index.d.ts +2 -0
  49. package/dist/components/FileDrop/FileDrop.d.ts +41 -0
  50. package/dist/components/FileDrop/index.d.ts +3 -0
  51. package/dist/components/FileDrop/isFileAccepted.d.ts +11 -0
  52. package/dist/components/Input/Input.d.ts +20 -0
  53. package/dist/components/Input/index.d.ts +2 -0
  54. package/dist/components/InputOtp/InputOtp.d.ts +39 -0
  55. package/dist/components/InputOtp/index.d.ts +4 -0
  56. package/dist/components/InputOtp/sanitizeOtpValue.d.ts +20 -0
  57. package/dist/components/MinMaxSlider/MinMaxSlider.d.ts +41 -0
  58. package/dist/components/MinMaxSlider/index.d.ts +2 -0
  59. package/dist/components/Pagination/Pagination.d.ts +41 -0
  60. package/dist/components/Pagination/getPaginationRange.d.ts +25 -0
  61. package/dist/components/Pagination/index.d.ts +4 -0
  62. package/dist/components/ProgressBar/ProgressBar.d.ts +34 -0
  63. package/dist/components/ProgressBar/index.d.ts +4 -0
  64. package/dist/components/ProgressBar/progressBar.tokens.d.ts +2 -0
  65. package/dist/components/Radio/Radio.d.ts +18 -0
  66. package/dist/components/Radio/RadioGroup.d.ts +28 -0
  67. package/dist/components/Radio/index.d.ts +4 -0
  68. package/dist/components/Radio/radio.context.d.ts +17 -0
  69. package/dist/components/RangeSlider/RangeSlider.d.ts +36 -0
  70. package/dist/components/RangeSlider/index.d.ts +2 -0
  71. package/dist/components/SegmentedControl/SegmentedControl.d.ts +39 -0
  72. package/dist/components/SegmentedControl/index.d.ts +2 -0
  73. package/dist/components/Select/Select.d.ts +39 -0
  74. package/dist/components/Select/index.d.ts +2 -0
  75. package/dist/components/Skeleton/Skeleton.d.ts +24 -0
  76. package/dist/components/Skeleton/index.d.ts +4 -0
  77. package/dist/components/Skeleton/skeleton.tokens.d.ts +4 -0
  78. package/dist/components/Spinner/Spinner.d.ts +22 -0
  79. package/dist/components/Spinner/index.d.ts +4 -0
  80. package/dist/components/Spinner/spinner.tokens.d.ts +2 -0
  81. package/dist/components/Stepper/Step.d.ts +20 -0
  82. package/dist/components/Stepper/Stepper.d.ts +25 -0
  83. package/dist/components/Stepper/index.d.ts +5 -0
  84. package/dist/components/Stepper/stepper.context.d.ts +14 -0
  85. package/dist/components/Switch/Switch.d.ts +22 -0
  86. package/dist/components/Switch/SwitchGroup.d.ts +30 -0
  87. package/dist/components/Switch/index.d.ts +4 -0
  88. package/dist/components/Switch/switch.context.d.ts +19 -0
  89. package/dist/components/Tabs/Tab.d.ts +10 -0
  90. package/dist/components/Tabs/TabList.d.ts +20 -0
  91. package/dist/components/Tabs/TabPanel.d.ts +16 -0
  92. package/dist/components/Tabs/Tabs.d.ts +22 -0
  93. package/dist/components/Tabs/index.d.ts +9 -0
  94. package/dist/components/Tabs/tabs.context.d.ts +24 -0
  95. package/dist/components/Tag/Tag.d.ts +10 -0
  96. package/dist/components/Tag/index.d.ts +4 -0
  97. package/dist/components/Tag/tag.tokens.d.ts +2 -0
  98. package/dist/components/Text/Text.d.ts +19 -0
  99. package/dist/components/Text/index.d.ts +4 -0
  100. package/dist/components/Text/text.tokens.d.ts +8 -0
  101. package/dist/components/Textarea/Textarea.d.ts +19 -0
  102. package/dist/components/Textarea/index.d.ts +2 -0
  103. package/dist/components/Tooltip/Tooltip.d.ts +44 -0
  104. package/dist/components/Tooltip/index.d.ts +4 -0
  105. package/dist/components/Tooltip/resolveTooltipPlacement.d.ts +39 -0
  106. package/dist/index.d.ts +82 -0
  107. package/dist/internal/bodyScrollLock.d.ts +2 -0
  108. package/dist/internal/portalInto.d.ts +7 -0
  109. package/dist/internal/useModalSurface.d.ts +27 -0
  110. package/dist/sonahang-ui.cjs +7 -0
  111. package/dist/sonahang-ui.cjs.map +1 -0
  112. package/dist/sonahang-ui.css +2 -0
  113. package/dist/sonahang-ui.js +2578 -0
  114. package/dist/sonahang-ui.js.map +1 -0
  115. package/dist/tokens/colors.d.ts +167 -0
  116. package/package.json +101 -0
  117. package/style.css.d.ts +17 -0
@@ -0,0 +1,167 @@
1
+ /**
2
+ * TS mirror of colors.css / colors.semantic.css, for places that need
3
+ * the raw values in JS (Storybook docs, color pickers, tests) rather
4
+ * than a CSS var. Keep in sync with the .css files by hand — there's
5
+ * no build step generating one from the other; `__test__/colors.test.ts`
6
+ * parses the stylesheets and fails if the two drift apart.
7
+ *
8
+ * In app code prefer the CSS vars (or `colorVar()`), so colors follow
9
+ * the active theme. The hex values here are per-theme snapshots and
10
+ * don't flip on their own.
11
+ */
12
+ export declare const accent: {
13
+ readonly 50: "#f6f0ff";
14
+ readonly 100: "#ece0ff";
15
+ readonly 200: "#d9c2ff";
16
+ readonly 300: "#c19dff";
17
+ readonly 400: "#a672ff";
18
+ readonly 500: "#8b47fa";
19
+ readonly 600: "#7429e0";
20
+ readonly 700: "#5d1fb8";
21
+ readonly 800: "#461890";
22
+ readonly 900: "#331269";
23
+ readonly 950: "#1f0b40";
24
+ };
25
+ export declare const neutral: {
26
+ readonly 0: "#ffffff";
27
+ readonly 50: "#f8f7fa";
28
+ readonly 100: "#efedf3";
29
+ readonly 200: "#e2dfe8";
30
+ readonly 300: "#cac6d3";
31
+ readonly 400: "#a29cae";
32
+ readonly 500: "#79728a";
33
+ readonly 600: "#5a5468";
34
+ readonly 700: "#423d4d";
35
+ readonly 800: "#2c2836";
36
+ readonly 900: "#1a1720";
37
+ readonly 950: "#0d0b12";
38
+ };
39
+ export declare const danger: {
40
+ readonly 50: "#fef3f2";
41
+ readonly 100: "#fee4e2";
42
+ readonly 200: "#fecdca";
43
+ readonly 300: "#fda29b";
44
+ readonly 400: "#f97066";
45
+ readonly 500: "#f04438";
46
+ readonly 600: "#d92d20";
47
+ readonly 700: "#b42318";
48
+ readonly 800: "#912018";
49
+ readonly 900: "#7a271a";
50
+ readonly 950: "#55160c";
51
+ };
52
+ export type AccentStep = keyof typeof accent;
53
+ export type NeutralStep = keyof typeof neutral;
54
+ export type DangerStep = keyof typeof danger;
55
+ /** Every primitive scale, keyed by name — for iterating over the whole palette. */
56
+ export declare const palette: {
57
+ readonly accent: {
58
+ readonly 50: "#f6f0ff";
59
+ readonly 100: "#ece0ff";
60
+ readonly 200: "#d9c2ff";
61
+ readonly 300: "#c19dff";
62
+ readonly 400: "#a672ff";
63
+ readonly 500: "#8b47fa";
64
+ readonly 600: "#7429e0";
65
+ readonly 700: "#5d1fb8";
66
+ readonly 800: "#461890";
67
+ readonly 900: "#331269";
68
+ readonly 950: "#1f0b40";
69
+ };
70
+ readonly neutral: {
71
+ readonly 0: "#ffffff";
72
+ readonly 50: "#f8f7fa";
73
+ readonly 100: "#efedf3";
74
+ readonly 200: "#e2dfe8";
75
+ readonly 300: "#cac6d3";
76
+ readonly 400: "#a29cae";
77
+ readonly 500: "#79728a";
78
+ readonly 600: "#5a5468";
79
+ readonly 700: "#423d4d";
80
+ readonly 800: "#2c2836";
81
+ readonly 900: "#1a1720";
82
+ readonly 950: "#0d0b12";
83
+ };
84
+ readonly danger: {
85
+ readonly 50: "#fef3f2";
86
+ readonly 100: "#fee4e2";
87
+ readonly 200: "#fecdca";
88
+ readonly 300: "#fda29b";
89
+ readonly 400: "#f97066";
90
+ readonly 500: "#f04438";
91
+ readonly 600: "#d92d20";
92
+ readonly 700: "#b42318";
93
+ readonly 800: "#912018";
94
+ readonly 900: "#7a271a";
95
+ readonly 950: "#55160c";
96
+ };
97
+ };
98
+ export type PaletteName = keyof typeof palette;
99
+ /** Fixed across themes — see colors.semantic.css for why. */
100
+ export declare const accentFill: {
101
+ readonly bg: "#5d1fb8";
102
+ readonly text: "#ece0ff";
103
+ };
104
+ export declare const semanticColors: {
105
+ readonly light: {
106
+ readonly danger: "#b42318";
107
+ readonly 'danger-border': "#f04438";
108
+ readonly scrim: "rgb(0 0 0 / 0.45)";
109
+ readonly 'accent-tint-1': "#f6f0ff";
110
+ readonly 'accent-tint-2': "#ece0ff";
111
+ readonly 'accent-tint-3': "#d9c2ff";
112
+ readonly 'accent-tint-4': "#c19dff";
113
+ readonly 'accent-on-tint': "#331269";
114
+ readonly 'accent-fill-bg': "#5d1fb8";
115
+ readonly 'accent-fill-text': "#ece0ff";
116
+ readonly 'bg-canvas': "#ffffff";
117
+ readonly 'bg-surface': "#f8f7fa";
118
+ readonly 'bg-subtle': "#efedf3";
119
+ readonly text: "#1a1720";
120
+ readonly 'text-subtle': "#5a5468";
121
+ readonly 'text-inverse': "#ffffff";
122
+ readonly border: "#e2dfe8";
123
+ readonly 'border-strong': "#cac6d3";
124
+ readonly accent: "#7429e0";
125
+ readonly 'accent-hover': "#5d1fb8";
126
+ readonly 'accent-subtle-bg': "#f6f0ff";
127
+ readonly 'accent-subtle-text': "#5d1fb8";
128
+ };
129
+ readonly dark: {
130
+ readonly danger: "#fda29b";
131
+ readonly 'danger-border': "#f97066";
132
+ readonly scrim: "rgb(0 0 0 / 0.65)";
133
+ readonly 'accent-tint-1': "#1f0b40";
134
+ readonly 'accent-tint-2': "#331269";
135
+ readonly 'accent-tint-3': "#461890";
136
+ readonly 'accent-tint-4': "#5d1fb8";
137
+ readonly 'accent-on-tint': "#ece0ff";
138
+ readonly 'accent-fill-bg': "#5d1fb8";
139
+ readonly 'accent-fill-text': "#ece0ff";
140
+ readonly 'bg-canvas': "#0d0b12";
141
+ readonly 'bg-surface': "#1a1720";
142
+ readonly 'bg-subtle': "#2c2836";
143
+ readonly text: "#f8f7fa";
144
+ readonly 'text-subtle': "#a29cae";
145
+ readonly 'text-inverse': "#0d0b12";
146
+ readonly border: "#423d4d";
147
+ readonly 'border-strong': "#5a5468";
148
+ readonly accent: "#a672ff";
149
+ readonly 'accent-hover': "#c19dff";
150
+ readonly 'accent-subtle-bg': "#331269";
151
+ readonly 'accent-subtle-text': "#d9c2ff";
152
+ };
153
+ };
154
+ export type ColorTheme = keyof typeof semanticColors;
155
+ export type SemanticColorName = keyof typeof semanticColors.light;
156
+ /**
157
+ * The CSS var for a semantic token, ready to drop into an inline style or a
158
+ * styled-component. Unlike the hex values above it stays theme-aware:
159
+ *
160
+ * <div style={{ background: colorVar('bg-surface') }} />
161
+ */
162
+ export declare function colorVar(name: SemanticColorName): `var(--color-${SemanticColorName})`;
163
+ /**
164
+ * The CSS var for a primitive step, e.g. `paletteVar('accent', 600)`. Reach for
165
+ * `colorVar()` first — primitives carry no meaning and don't respond to theme.
166
+ */
167
+ export declare function paletteVar<S extends PaletteName>(scale: S, step: keyof (typeof palette)[S]): string;
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "sonahang-ui",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "React component library and design system, documented in Storybook.",
6
+ "keywords": [
7
+ "react",
8
+ "component-library",
9
+ "design-system",
10
+ "ui-components",
11
+ "storybook",
12
+ "accessible",
13
+ "typescript",
14
+ "design-tokens"
15
+ ],
16
+ "homepage": "https://github.com/sonangrai/sonahang-ui#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/sonangrai/sonahang-ui.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/sonangrai/sonahang-ui/issues"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "style.css.d.ts"
27
+ ],
28
+ "main": "./dist/sonahang-ui.cjs",
29
+ "module": "./dist/sonahang-ui.js",
30
+ "types": "./dist/index.d.ts",
31
+ "sideEffects": [
32
+ "*.css",
33
+ "**/*.css"
34
+ ],
35
+ "author": {
36
+ "name": "Sonahang Rai",
37
+ "url": "https://www.sonahangrai.com.np",
38
+ "email": "shonahangrae@gmail.com"
39
+ },
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "import": "./dist/sonahang-ui.js",
44
+ "require": "./dist/sonahang-ui.cjs"
45
+ },
46
+ "./style.css": {
47
+ "types": "./style.css.d.ts",
48
+ "default": "./dist/sonahang-ui.css"
49
+ },
50
+ "./package.json": "./package.json"
51
+ },
52
+ "license": "MIT",
53
+ "scripts": {
54
+ "dev": "vite",
55
+ "dev:all": "concurrently --kill-others-on-fail -n vite,storybook -c cyan,magenta \"pnpm dev\" \"pnpm storybook --no-open\"",
56
+ "build": "tsc -b && vite build",
57
+ "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json",
58
+ "build:site": "tsc -b && vite build && storybook build -o site-dist/storybook",
59
+ "prepublishOnly": "pnpm build:lib",
60
+ "lint": "eslint .",
61
+ "test": "vitest run",
62
+ "test:watch": "vitest",
63
+ "preview": "vite preview",
64
+ "storybook": "storybook dev -p 6006",
65
+ "build-storybook": "storybook build"
66
+ },
67
+ "peerDependencies": {
68
+ "react": "^19.0.0",
69
+ "react-dom": "^19.0.0"
70
+ },
71
+ "devDependencies": {
72
+ "@chromatic-com/storybook": "^5.2.1",
73
+ "@eslint/js": "^10.0.1",
74
+ "@storybook/addon-a11y": "^10.5.5",
75
+ "@storybook/addon-docs": "^10.5.5",
76
+ "@storybook/addon-mcp": "^0.7.0",
77
+ "@storybook/addon-themes": "10.5.5",
78
+ "@storybook/react-vite": "^10.5.5",
79
+ "@testing-library/jest-dom": "^7.0.0",
80
+ "@testing-library/react": "^16.3.2",
81
+ "@testing-library/user-event": "^14.6.1",
82
+ "@types/node": "^24.13.3",
83
+ "@types/react": "^19.2.17",
84
+ "@types/react-dom": "^19.2.3",
85
+ "@vitejs/plugin-react": "^6.0.4",
86
+ "concurrently": "^10.0.4",
87
+ "eslint": "^10.8.0",
88
+ "eslint-plugin-react-hooks": "^7.1.1",
89
+ "eslint-plugin-react-refresh": "^0.5.3",
90
+ "eslint-plugin-storybook": "^10.5.5",
91
+ "globals": "^17.7.0",
92
+ "jsdom": "^30.0.1",
93
+ "react": "^19.2.8",
94
+ "react-dom": "^19.2.8",
95
+ "storybook": "^10.5.5",
96
+ "typescript": "~6.0.2",
97
+ "typescript-eslint": "^8.65.0",
98
+ "vite": "^8.2.0",
99
+ "vitest": "^4.1.10"
100
+ }
101
+ }
package/style.css.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Declaration for the `sonahang-ui/style.css` subpath export.
3
+ *
4
+ * TypeScript 6 raises TS2882 for a side-effect import that resolves to no
5
+ * declarations, and not every consumer pulls in a bundler's ambient CSS module
6
+ * types (`vite/client`, `next-env.d.ts`, …). Shipping this means
7
+ * `import 'sonahang-ui/style.css'` typechecks anywhere.
8
+ *
9
+ * Deliberately empty: the stylesheet has no runtime exports, it is only ever
10
+ * imported for its side effect.
11
+ *
12
+ * Lives at the repo root rather than in `dist/` because the library build runs
13
+ * with `emptyOutDir`, which would wipe it on every rebuild. It's listed in
14
+ * `files` so it still ships.
15
+ */
16
+
17
+ export {};