@kids-reporter/routing-ui 0.1.0-alpha.5 → 0.1.0-alpha.6
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.
- package/dist/header/desktop-header.d.ts +1 -3
- package/dist/header/desktop-header.d.ts.map +1 -1
- package/dist/header/desktop-header.js +2 -4
- package/dist/header/desktop-header.js.map +1 -1
- package/dist/header/header-context.d.ts +0 -6
- package/dist/header/header-context.d.ts.map +1 -1
- package/dist/header/header-context.js +2 -11
- package/dist/header/header-context.js.map +1 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +2 -10
- package/dist/header/index.js.map +1 -1
- package/dist/header/mobile-header.d.ts +1 -4
- package/dist/header/mobile-header.d.ts.map +1 -1
- package/dist/header/mobile-header.js +3 -13
- package/dist/header/mobile-header.js.map +1 -1
- package/dist/icons/index.d.ts +0 -1
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +1 -18
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +6 -0
- package/package.json +6 -4
- package/.prettierignore +0 -17
- package/babel.config.cjs +0 -31
- package/dist/header/is-logged-in-setter.d.ts +0 -7
- package/dist/header/is-logged-in-setter.d.ts.map +0 -1
- package/dist/header/is-logged-in-setter.js +0 -27
- package/dist/header/is-logged-in-setter.js.map +0 -1
- package/dist/header/mobile-back-button-href-setter.d.ts +0 -6
- package/dist/header/mobile-back-button-href-setter.d.ts.map +0 -1
- package/dist/header/mobile-back-button-href-setter.js +0 -21
- package/dist/header/mobile-back-button-href-setter.js.map +0 -1
- package/eslint.config.mjs +0 -56
- package/prettier.config.mjs +0 -13
- package/scripts/build.sh +0 -18
- package/src/components/button.tsx +0 -108
- package/src/components/index.tsx +0 -2
- package/src/components/input.tsx +0 -171
- package/src/constants/default-values.tsx +0 -153
- package/src/footer.tsx +0 -149
- package/src/header/desktop-header.tsx +0 -132
- package/src/header/header-context.tsx +0 -82
- package/src/header/index.tsx +0 -104
- package/src/header/is-logged-in-setter.tsx +0 -27
- package/src/header/menu/header-menu-item-group.tsx +0 -37
- package/src/header/menu/header-menu-item.tsx +0 -132
- package/src/header/menu/index.tsx +0 -205
- package/src/header/mobile-back-button-href-setter.tsx +0 -22
- package/src/header/mobile-header.tsx +0 -77
- package/src/header/post-title-setter.tsx +0 -22
- package/src/header/shared-components.tsx +0 -325
- package/src/hooks/index.ts +0 -3
- package/src/hooks/use-is-at-top.ts +0 -23
- package/src/hooks/use-media-query.ts +0 -57
- package/src/hooks/use-scroll-level.ts +0 -52
- package/src/icons/index.tsx +0 -378
- package/src/index.ts +0 -11
- package/src/styles.css +0 -354
- package/src/types/index.ts +0 -10
- package/src/utils/cn.ts +0 -41
- package/src/utils/generate-social-media-config.ts +0 -75
- package/src/utils/index.ts +0 -2
- package/tsconfig.json +0 -33
package/dist/index.js
CHANGED
|
@@ -8,8 +8,6 @@ var _exportNames = {
|
|
|
8
8
|
Footer: true,
|
|
9
9
|
Header: true,
|
|
10
10
|
HeaderProvider: true,
|
|
11
|
-
HeaderIsLoggedInSetter: true,
|
|
12
|
-
HeaderMobileBackButtonHrefSetter: true,
|
|
13
11
|
HeaderPostTitleSetter: true
|
|
14
12
|
};
|
|
15
13
|
Object.defineProperty(exports, "Footer", {
|
|
@@ -24,18 +22,6 @@ Object.defineProperty(exports, "Header", {
|
|
|
24
22
|
return _header.default;
|
|
25
23
|
}
|
|
26
24
|
});
|
|
27
|
-
Object.defineProperty(exports, "HeaderIsLoggedInSetter", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _isLoggedInSetter.default;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "HeaderMobileBackButtonHrefSetter", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return _mobileBackButtonHrefSetter.default;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
25
|
Object.defineProperty(exports, "HeaderPostTitleSetter", {
|
|
40
26
|
enumerable: true,
|
|
41
27
|
get: function () {
|
|
@@ -63,8 +49,6 @@ Object.keys(_components).forEach(function (key) {
|
|
|
63
49
|
var _footer = _interopRequireDefault(require("./footer"));
|
|
64
50
|
var _header = _interopRequireDefault(require("./header"));
|
|
65
51
|
var _headerContext = require("./header/header-context");
|
|
66
|
-
var _isLoggedInSetter = _interopRequireDefault(require("./header/is-logged-in-setter"));
|
|
67
|
-
var _mobileBackButtonHrefSetter = _interopRequireDefault(require("./header/mobile-back-button-href-setter"));
|
|
68
52
|
var _postTitleSetter = _interopRequireDefault(require("./header/post-title-setter"));
|
|
69
53
|
var _hooks = require("./hooks");
|
|
70
54
|
Object.keys(_hooks).forEach(function (key) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_footer","_interopRequireDefault","_header","_headerContext","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_footer","_interopRequireDefault","_header","_headerContext","_postTitleSetter","_hooks","_icons","_types","_utils"],"sources":["../src/index.ts"],"sourcesContent":["export * from './components'\nexport { default as Footer } from './footer'\nexport { default as Header } from './header'\nexport { HeaderProvider } from './header/header-context'\nexport { default as HeaderPostTitleSetter } from './header/post-title-setter'\nexport * from './hooks'\nexport * from './icons'\nexport * from './types'\nexport * from './utils'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,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regular', sans-serif;
|
|
49
50
|
|
|
50
51
|
/* Typography - Font Sizes */
|
|
51
52
|
--font-size-h1-large: 48px;
|
|
@@ -320,6 +321,11 @@
|
|
|
320
321
|
letter-spacing: 0.5px;
|
|
321
322
|
}
|
|
322
323
|
|
|
324
|
+
/* Swei Marker Sans Font Variants */
|
|
325
|
+
@utility font-swei {
|
|
326
|
+
font-family: var(--font-family-swei);
|
|
327
|
+
}
|
|
328
|
+
|
|
323
329
|
@utility scrollbar-thin {
|
|
324
330
|
scrollbar-width: thin;
|
|
325
331
|
scrollbar-color: var(--color-neutral-300) transparent;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kids-reporter/routing-ui",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.6",
|
|
5
5
|
"description": "Routing UI for Kids Reporter",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"build": "./scripts/build.sh",
|
|
19
19
|
"lint": "eslint . --config ./eslint.config.mjs",
|
|
20
20
|
"lint:check": "eslint . --config ./eslint.config.mjs",
|
|
21
|
-
"type-check": "tsc --noEmit"
|
|
22
|
-
"postinstall": "yarn build"
|
|
21
|
+
"type-check": "tsc --noEmit"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"@radix-ui/react-slot": "^1.2.3",
|
|
@@ -50,5 +49,8 @@
|
|
|
50
49
|
"react": "18.3.1",
|
|
51
50
|
"react-dom": "18.3.1",
|
|
52
51
|
"tailwindcss": "^4.1.14"
|
|
53
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist"
|
|
55
|
+
]
|
|
54
56
|
}
|
package/.prettierignore
DELETED
package/babel.config.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
[
|
|
4
|
-
'@babel/preset-env',
|
|
5
|
-
{
|
|
6
|
-
targets: {
|
|
7
|
-
node: '18',
|
|
8
|
-
browsers: ['> 1%', 'last 2 versions', 'not dead'],
|
|
9
|
-
},
|
|
10
|
-
modules: 'commonjs', // Build CommonJS modules
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
[
|
|
14
|
-
'@babel/preset-react',
|
|
15
|
-
{
|
|
16
|
-
runtime: 'automatic',
|
|
17
|
-
development: process.env.NODE_ENV === 'development',
|
|
18
|
-
pragma: undefined, // Use automatic runtime
|
|
19
|
-
pragmaFrag: undefined, // Use automatic runtime
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
[
|
|
23
|
-
'@babel/preset-typescript',
|
|
24
|
-
{
|
|
25
|
-
isTSX: true,
|
|
26
|
-
allExtensions: true,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
],
|
|
30
|
-
plugins: ['@babel/plugin-transform-runtime'],
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-logged-in-setter.d.ts","sourceRoot":"","sources":["../../src/header/is-logged-in-setter.tsx"],"names":[],"mappings":"AAIA,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,iBAAS,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,qBAAqB,QAexE;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _headerContext = require("./header-context");
|
|
9
|
-
function IsLoggedInSetter({
|
|
10
|
-
isLoggedIn,
|
|
11
|
-
loginUrl
|
|
12
|
-
}) {
|
|
13
|
-
const context = (0, _headerContext.useHeaderContext)();
|
|
14
|
-
const setIsLoggedIn = context?.setIsLoggedIn;
|
|
15
|
-
const setLoginUrl = context?.setLoginUrl;
|
|
16
|
-
(0, _react.useEffect)(() => {
|
|
17
|
-
setIsLoggedIn?.(isLoggedIn);
|
|
18
|
-
setLoginUrl?.(loginUrl);
|
|
19
|
-
return () => {
|
|
20
|
-
setIsLoggedIn?.(false);
|
|
21
|
-
setLoginUrl?.(undefined);
|
|
22
|
-
};
|
|
23
|
-
}, [isLoggedIn, setIsLoggedIn, loginUrl, setLoginUrl]);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
var _default = exports.default = IsLoggedInSetter;
|
|
27
|
-
//# sourceMappingURL=is-logged-in-setter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-logged-in-setter.js","names":["_react","require","_headerContext","IsLoggedInSetter","isLoggedIn","loginUrl","context","useHeaderContext","setIsLoggedIn","setLoginUrl","useEffect","undefined","_default","exports","default"],"sources":["../../src/header/is-logged-in-setter.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { useHeaderContext } from './header-context'\n\ntype IsLoggedInSetterProps = {\n isLoggedIn: boolean\n loginUrl: string\n}\n\nfunction IsLoggedInSetter({ isLoggedIn, loginUrl }: IsLoggedInSetterProps) {\n const context = useHeaderContext()\n const setIsLoggedIn = context?.setIsLoggedIn\n const setLoginUrl = context?.setLoginUrl\n\n useEffect(() => {\n setIsLoggedIn?.(isLoggedIn)\n setLoginUrl?.(loginUrl)\n return () => {\n setIsLoggedIn?.(false)\n setLoginUrl?.(undefined)\n }\n }, [isLoggedIn, setIsLoggedIn, loginUrl, setLoginUrl])\n\n return null\n}\n\nexport default IsLoggedInSetter\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAOA,SAASE,gBAAgBA,CAAC;EAAEC,UAAU;EAAEC;AAAgC,CAAC,EAAE;EACzE,MAAMC,OAAO,GAAG,IAAAC,+BAAgB,EAAC,CAAC;EAClC,MAAMC,aAAa,GAAGF,OAAO,EAAEE,aAAa;EAC5C,MAAMC,WAAW,GAAGH,OAAO,EAAEG,WAAW;EAExC,IAAAC,gBAAS,EAAC,MAAM;IACdF,aAAa,GAAGJ,UAAU,CAAC;IAC3BK,WAAW,GAAGJ,QAAQ,CAAC;IACvB,OAAO,MAAM;MACXG,aAAa,GAAG,KAAK,CAAC;MACtBC,WAAW,GAAGE,SAAS,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAACP,UAAU,EAAEI,aAAa,EAAEH,QAAQ,EAAEI,WAAW,CAAC,CAAC;EAEtD,OAAO,IAAI;AACb;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcX,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-back-button-href-setter.d.ts","sourceRoot":"","sources":["../../src/header/mobile-back-button-href-setter.tsx"],"names":[],"mappings":"AAIA,KAAK,+BAA+B,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,iBAAS,0BAA0B,CAAC,EAAE,IAAI,EAAE,EAAE,+BAA+B,QAW5E;AAED,eAAe,0BAA0B,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _headerContext = require("./header-context");
|
|
9
|
-
function MobileBackButtonHrefSetter({
|
|
10
|
-
href
|
|
11
|
-
}) {
|
|
12
|
-
const context = (0, _headerContext.useHeaderContext)();
|
|
13
|
-
const setMobileBackButtonHref = context?.setMobileBackButtonHref;
|
|
14
|
-
(0, _react.useEffect)(() => {
|
|
15
|
-
setMobileBackButtonHref?.(href);
|
|
16
|
-
return () => setMobileBackButtonHref?.(undefined);
|
|
17
|
-
}, [href, setMobileBackButtonHref]);
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
var _default = exports.default = MobileBackButtonHrefSetter;
|
|
21
|
-
//# sourceMappingURL=mobile-back-button-href-setter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-back-button-href-setter.js","names":["_react","require","_headerContext","MobileBackButtonHrefSetter","href","context","useHeaderContext","setMobileBackButtonHref","useEffect","undefined","_default","exports","default"],"sources":["../../src/header/mobile-back-button-href-setter.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { useHeaderContext } from './header-context'\n\ntype MobileBackButtonHrefSetterProps = {\n href?: string\n}\n\nfunction MobileBackButtonHrefSetter({ href }: MobileBackButtonHrefSetterProps) {\n const context = useHeaderContext()\n const setMobileBackButtonHref = context?.setMobileBackButtonHref\n\n useEffect(() => {\n setMobileBackButtonHref?.(href)\n\n return () => setMobileBackButtonHref?.(undefined)\n }, [href, setMobileBackButtonHref])\n\n return null\n}\n\nexport default MobileBackButtonHrefSetter\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAMA,SAASE,0BAA0BA,CAAC;EAAEC;AAAsC,CAAC,EAAE;EAC7E,MAAMC,OAAO,GAAG,IAAAC,+BAAgB,EAAC,CAAC;EAClC,MAAMC,uBAAuB,GAAGF,OAAO,EAAEE,uBAAuB;EAEhE,IAAAC,gBAAS,EAAC,MAAM;IACdD,uBAAuB,GAAGH,IAAI,CAAC;IAE/B,OAAO,MAAMG,uBAAuB,GAAGE,SAAS,CAAC;EACnD,CAAC,EAAE,CAACL,IAAI,EAAEG,uBAAuB,CAAC,CAAC;EAEnC,OAAO,IAAI;AACb;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcT,0BAA0B"}
|
package/eslint.config.mjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import globals from 'globals'
|
|
2
|
-
|
|
3
|
-
import baseConfig, {
|
|
4
|
-
javascriptConfig,
|
|
5
|
-
typescriptConfig,
|
|
6
|
-
} from '../../eslint.base.config.mjs'
|
|
7
|
-
|
|
8
|
-
export default [
|
|
9
|
-
...baseConfig,
|
|
10
|
-
// Override for routing-ui package - React/TypeScript focused
|
|
11
|
-
{
|
|
12
|
-
...typescriptConfig,
|
|
13
|
-
files: ['src/**/*.{ts,tsx}'],
|
|
14
|
-
rules: {
|
|
15
|
-
...typescriptConfig.rules,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
...javascriptConfig,
|
|
20
|
-
files: ['src/**/*.{js,jsx}'],
|
|
21
|
-
rules: {
|
|
22
|
-
...javascriptConfig.rules,
|
|
23
|
-
// Tailwind CSS classname sorting rules
|
|
24
|
-
'no-restricted-syntax': [
|
|
25
|
-
'warn',
|
|
26
|
-
{
|
|
27
|
-
selector: 'JSXAttribute[name.name="className"]',
|
|
28
|
-
message:
|
|
29
|
-
'Tailwind CSS classes should be sorted. Use prettier-plugin-tailwindcss for automatic sorting.',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
selector: 'JSXAttribute[name.name="class"]',
|
|
33
|
-
message:
|
|
34
|
-
'CSS classes should be sorted. Consider using a class sorting tool.',
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
files: ['**/*.config.{js,mjs,cjs}'],
|
|
41
|
-
languageOptions: {
|
|
42
|
-
ecmaVersion: 2022,
|
|
43
|
-
sourceType: 'module',
|
|
44
|
-
globals: {
|
|
45
|
-
...globals.node,
|
|
46
|
-
...globals.es2022,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
rules: {
|
|
50
|
-
'no-undef': 'error',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
ignores: ['node_modules/**', 'dist/**', 'build/**'],
|
|
55
|
-
},
|
|
56
|
-
]
|
package/prettier.config.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
|
2
|
-
export default {
|
|
3
|
-
printWidth: 80,
|
|
4
|
-
tabWidth: 2,
|
|
5
|
-
semi: false,
|
|
6
|
-
singleQuote: true,
|
|
7
|
-
trailingComma: 'es5',
|
|
8
|
-
bracketSpacing: true,
|
|
9
|
-
arrowParens: 'always',
|
|
10
|
-
plugins: ['prettier-plugin-tailwindcss'],
|
|
11
|
-
tailwindStylesheet: './src/styles.css',
|
|
12
|
-
tailwindFunctions: ['clsx', 'cn', 'cva'],
|
|
13
|
-
}
|
package/scripts/build.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
|
|
5
|
-
echo "Cleaning dist directory..."
|
|
6
|
-
rm -rf ./dist
|
|
7
|
-
mkdir -p ./dist
|
|
8
|
-
|
|
9
|
-
echo "Building CJS version..."
|
|
10
|
-
npx babel src --out-dir dist --extensions ".ts,.tsx" --source-maps
|
|
11
|
-
|
|
12
|
-
echo "Copying CSS file..."
|
|
13
|
-
cp ./src/styles.css ./dist/styles.css
|
|
14
|
-
|
|
15
|
-
echo "Generating TypeScript declarations..."
|
|
16
|
-
npx tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist
|
|
17
|
-
|
|
18
|
-
echo "Build completed successfully!"
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
4
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
import { cn } from '../utils/cn'
|
|
8
|
-
|
|
9
|
-
const buttonVariants = cva(
|
|
10
|
-
// Base styles
|
|
11
|
-
'font-noto gap-2.5 font-bold inline-flex cursor-pointer items-center justify-center rounded-full transition-colors duration-200',
|
|
12
|
-
{
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
primary: [
|
|
16
|
-
'text-white border-0 bg-red-400',
|
|
17
|
-
'hover:bg-red-500',
|
|
18
|
-
'active:bg-red-600',
|
|
19
|
-
'disabled:text-white disabled:cursor-default disabled:bg-neutral-400',
|
|
20
|
-
],
|
|
21
|
-
secondary: [
|
|
22
|
-
'bg-white text-gray-900 border-2 border-red-400',
|
|
23
|
-
'hover:text-white hover:border-red-500 hover:bg-red-500',
|
|
24
|
-
'active:text-white active:border-red-600 active:bg-red-600',
|
|
25
|
-
'disabled:bg-white disabled:cursor-default disabled:border-neutral-400 disabled:text-neutral-400',
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
size: {
|
|
29
|
-
44: 'h-11 px-5 py-2 text-base', // 44px height, 16px font size
|
|
30
|
-
36: 'h-9 px-4 py-2 text-sm', // 36px height, 14px font size
|
|
31
|
-
32: 'h-8 px-3 py-1 text-sm', // 32px height, 14px font size
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
defaultVariants: {
|
|
35
|
-
variant: 'primary',
|
|
36
|
-
size: 44,
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
// Loading spinner icon component
|
|
42
|
-
const LoadingSpinner = ({ size = 20 }: { size?: number }) => (
|
|
43
|
-
<svg
|
|
44
|
-
width={size}
|
|
45
|
-
height={size}
|
|
46
|
-
viewBox="0 0 25 24"
|
|
47
|
-
fill="none"
|
|
48
|
-
className="animate-spin"
|
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
-
>
|
|
51
|
-
<path
|
|
52
|
-
opacity="0.5"
|
|
53
|
-
d="M12.5 2C10.5222 2 8.58879 2.58649 6.9443 3.6853C5.29981 4.78412 4.01809 6.3459 3.26121 8.17317C2.50433 10.0004 2.3063 12.0111 2.69215 13.9509C3.078 15.8907 4.03041 17.6725 5.42894 19.0711C6.82746 20.4696 8.60929 21.422 10.5491 21.8079C12.4889 22.1937 14.4996 21.9957 16.3268 21.2388C18.1541 20.4819 19.7159 19.2002 20.8147 17.5557C21.9135 15.9112 22.5 13.9778 22.5 12C22.5 10.6868 22.2413 9.38642 21.7388 8.17317C21.2363 6.95991 20.4997 5.85752 19.5711 4.92893C18.6425 4.00035 17.5401 3.26375 16.3268 2.7612C15.1136 2.25866 13.8132 2 12.5 2ZM12.5 20C10.9178 20 9.37104 19.5308 8.05544 18.6518C6.73985 17.7727 5.71447 16.5233 5.10897 15.0615C4.50347 13.5997 4.34504 11.9911 4.65372 10.4393C4.9624 8.88743 5.72433 7.46197 6.84315 6.34315C7.96197 5.22433 9.38743 4.4624 10.9393 4.15372C12.4911 3.84504 14.0997 4.00346 15.5615 4.60896C17.0233 5.21447 18.2727 6.23984 19.1518 7.55544C20.0308 8.87103 20.5 10.4177 20.5 12C20.5 14.1217 19.6572 16.1566 18.1569 17.6569C16.6566 19.1571 14.6217 20 12.5 20Z"
|
|
54
|
-
fill="currentColor"
|
|
55
|
-
/>
|
|
56
|
-
<path
|
|
57
|
-
d="M20.5 12H22.5C22.5 10.6868 22.2413 9.38642 21.7388 8.17317C21.2362 6.95991 20.4997 5.85752 19.5711 4.92893C18.6425 4.00035 17.5401 3.26375 16.3268 2.7612C15.1136 2.25866 13.8132 2 12.5 2V4C14.6217 4 16.6566 4.84285 18.1569 6.34315C19.6571 7.84344 20.5 9.87827 20.5 12Z"
|
|
58
|
-
fill="currentColor"
|
|
59
|
-
/>
|
|
60
|
-
</svg>
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
export type ButtonProps = {
|
|
64
|
-
isLoading?: boolean
|
|
65
|
-
disabled?: boolean
|
|
66
|
-
asChild?: boolean
|
|
67
|
-
children: React.ReactNode
|
|
68
|
-
} & VariantProps<typeof buttonVariants> &
|
|
69
|
-
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
70
|
-
|
|
71
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
72
|
-
(
|
|
73
|
-
{
|
|
74
|
-
isLoading = false,
|
|
75
|
-
disabled = false,
|
|
76
|
-
asChild = false,
|
|
77
|
-
size,
|
|
78
|
-
variant,
|
|
79
|
-
className,
|
|
80
|
-
children,
|
|
81
|
-
...props
|
|
82
|
-
},
|
|
83
|
-
ref
|
|
84
|
-
) => {
|
|
85
|
-
const isDisabled = disabled || isLoading
|
|
86
|
-
|
|
87
|
-
const buttonClasses = cn(buttonVariants({ variant, size }), className)
|
|
88
|
-
|
|
89
|
-
const Comp = asChild ? Slot : 'button'
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<Comp
|
|
93
|
-
ref={ref}
|
|
94
|
-
className={buttonClasses}
|
|
95
|
-
disabled={isDisabled}
|
|
96
|
-
{...props}
|
|
97
|
-
>
|
|
98
|
-
{isLoading ? (
|
|
99
|
-
<LoadingSpinner size={size === 32 ? 16 : size === 36 ? 18 : 20} />
|
|
100
|
-
) : (
|
|
101
|
-
children
|
|
102
|
-
)}
|
|
103
|
-
</Comp>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
export default Button
|
package/src/components/index.tsx
DELETED
package/src/components/input.tsx
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { cva } from 'class-variance-authority'
|
|
4
|
-
import { forwardRef, useRef, useState } from 'react'
|
|
5
|
-
|
|
6
|
-
import { SearchIconSmall } from '../icons'
|
|
7
|
-
import { cn } from '../utils/cn'
|
|
8
|
-
|
|
9
|
-
// Close icon component
|
|
10
|
-
const CloseIcon = ({ className }: { className?: string }) => (
|
|
11
|
-
<svg
|
|
12
|
-
width="20"
|
|
13
|
-
height="20"
|
|
14
|
-
viewBox="0 0 20 20"
|
|
15
|
-
fill="none"
|
|
16
|
-
className={className}
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
>
|
|
19
|
-
<circle cx="10" cy="10" r="10" fill="currentColor" />
|
|
20
|
-
<path
|
|
21
|
-
d="M7 7l6 6M13 7l-6 6"
|
|
22
|
-
stroke="white"
|
|
23
|
-
strokeWidth="1.5"
|
|
24
|
-
strokeLinecap="round"
|
|
25
|
-
strokeLinejoin="round"
|
|
26
|
-
/>
|
|
27
|
-
</svg>
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
const inputVariants = cva(
|
|
31
|
-
// Base styles
|
|
32
|
-
'desktop:bg-white! px-4 py-1.5 h-11 flex items-center rounded-full border border-transparent bg-neutral-100 prose-p1 transition-colors duration-200 hover:border-neutral-600',
|
|
33
|
-
{
|
|
34
|
-
variants: {
|
|
35
|
-
state: {
|
|
36
|
-
default: 'border-transparent',
|
|
37
|
-
hover: 'border-neutral-600',
|
|
38
|
-
focus: 'border-neutral-600',
|
|
39
|
-
active: 'border-neutral-600',
|
|
40
|
-
unfocus: 'border-transparent',
|
|
41
|
-
error: 'border-red-600',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
defaultVariants: {
|
|
45
|
-
state: 'default',
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
export type InputProps = {
|
|
51
|
-
placeholder?: string
|
|
52
|
-
value?: string
|
|
53
|
-
onChange?: (value: string) => void
|
|
54
|
-
onClear?: () => void
|
|
55
|
-
showClearButton?: boolean
|
|
56
|
-
children?: React.ReactNode
|
|
57
|
-
inputRef?: React.RefObject<HTMLInputElement>
|
|
58
|
-
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'>
|
|
59
|
-
|
|
60
|
-
const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
61
|
-
(
|
|
62
|
-
{
|
|
63
|
-
placeholder = '搜尋更多新聞、議題',
|
|
64
|
-
value,
|
|
65
|
-
onChange,
|
|
66
|
-
onClear,
|
|
67
|
-
showClearButton = true,
|
|
68
|
-
className,
|
|
69
|
-
onFocus,
|
|
70
|
-
onBlur,
|
|
71
|
-
inputRef,
|
|
72
|
-
...props
|
|
73
|
-
},
|
|
74
|
-
ref
|
|
75
|
-
) => {
|
|
76
|
-
const [internalValue, setInternalValue] = useState('')
|
|
77
|
-
const [isFocused, setIsFocused] = useState(false)
|
|
78
|
-
const [isActive, setIsActive] = useState(false)
|
|
79
|
-
const innerInputRef = useRef<HTMLInputElement>(null)
|
|
80
|
-
const currentValue = value !== undefined ? value : internalValue
|
|
81
|
-
const hasValue = currentValue.length > 0
|
|
82
|
-
|
|
83
|
-
// Determine current state
|
|
84
|
-
const currentState = isFocused
|
|
85
|
-
? 'focus'
|
|
86
|
-
: hasValue
|
|
87
|
-
? isActive
|
|
88
|
-
? 'active'
|
|
89
|
-
: 'unfocus'
|
|
90
|
-
: 'default'
|
|
91
|
-
|
|
92
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
93
|
-
const newValue = e.target.value
|
|
94
|
-
if (onChange) {
|
|
95
|
-
onChange(newValue)
|
|
96
|
-
} else {
|
|
97
|
-
setInternalValue(newValue)
|
|
98
|
-
}
|
|
99
|
-
setIsActive(true)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
103
|
-
if (onFocus) {
|
|
104
|
-
onFocus(e)
|
|
105
|
-
}
|
|
106
|
-
setIsFocused(true)
|
|
107
|
-
setIsActive(true)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
111
|
-
if (onBlur) {
|
|
112
|
-
onBlur(e)
|
|
113
|
-
}
|
|
114
|
-
setIsFocused(false)
|
|
115
|
-
setIsActive(false)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const handleClear = (e: React.MouseEvent) => {
|
|
119
|
-
e.preventDefault()
|
|
120
|
-
e.stopPropagation()
|
|
121
|
-
|
|
122
|
-
if (onChange) {
|
|
123
|
-
onChange('')
|
|
124
|
-
} else {
|
|
125
|
-
setInternalValue('')
|
|
126
|
-
}
|
|
127
|
-
if (onClear) {
|
|
128
|
-
onClear()
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const currentRef = inputRef ?? innerInputRef
|
|
132
|
-
currentRef.current?.focus()
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const inputClasses = cn(inputVariants({ state: currentState }), className)
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<div className="gap-2 flex flex-col">
|
|
139
|
-
<div className={inputClasses} ref={ref}>
|
|
140
|
-
<div className="text-neutral-600">
|
|
141
|
-
<SearchIconSmall />
|
|
142
|
-
</div>
|
|
143
|
-
<input
|
|
144
|
-
type="text"
|
|
145
|
-
value={currentValue}
|
|
146
|
-
onChange={handleChange}
|
|
147
|
-
onFocus={handleFocus}
|
|
148
|
-
onBlur={handleBlur}
|
|
149
|
-
placeholder={placeholder}
|
|
150
|
-
className="placeholder:font-medium ml-2 max-w-[72%] flex-1 flex-shrink-1 bg-transparent text-neutral-900 placeholder:text-neutral-400 focus:outline-none"
|
|
151
|
-
ref={inputRef ?? innerInputRef}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
154
|
-
|
|
155
|
-
{showClearButton && hasValue && (
|
|
156
|
-
<button
|
|
157
|
-
type="button"
|
|
158
|
-
onClick={handleClear}
|
|
159
|
-
className="p-1/2 ml-auto flex-shrink-0 cursor-pointer rounded-full text-neutral-400 transition-colors hover:text-neutral-600 active:bg-neutral-200"
|
|
160
|
-
aria-label="Clear input"
|
|
161
|
-
>
|
|
162
|
-
<CloseIcon />
|
|
163
|
-
</button>
|
|
164
|
-
)}
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
export default Input
|