{"id":20910874,"url":"https://github.com/kelysty/system","last_synced_at":"2026-04-15T19:41:50.233Z","repository":{"id":209621428,"uuid":"724469940","full_name":"Kelysty/system","owner":"Kelysty","description":"This is a pack of Kelysty React UI system components","archived":false,"fork":false,"pushed_at":"2023-12-01T11:40:23.000Z","size":149,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T16:24:23.719Z","etag":null,"topics":["library","provider","react","system","ui"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kelysty.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-28T06:19:50.000Z","updated_at":"2023-11-30T05:33:32.000Z","dependencies_parsed_at":"2024-11-18T14:28:30.911Z","dependency_job_id":null,"html_url":"https://github.com/Kelysty/system","commit_stats":null,"previous_names":["kelysty/system"],"tags_count":1,"template":false,"template_full_name":"Kelysty/npm-template","purl":"pkg:github/Kelysty/system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kelysty%2Fsystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kelysty%2Fsystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kelysty%2Fsystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kelysty%2Fsystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kelysty","download_url":"https://codeload.github.com/Kelysty/system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kelysty%2Fsystem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28006375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","provider","react","system","ui"],"created_at":"2024-11-18T14:18:08.705Z","updated_at":"2025-12-24T19:04:08.760Z","avatar_url":"https://github.com/Kelysty.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @kelysty/system \u0026middot; [![npm package](https://img.shields.io/npm/v/@kelysty/system)](https://www.npmjs.com/package/@kelysty/system) [![CI](https://img.shields.io/github/actions/workflow/status/Kelysty/system/.github%2Fworkflows%2Fci.yml?logo=github\u0026label=CI)](https://github.com/kelysty/system/actions/workflows/ci.yml?query=branch:main) [![storybook](https://img.shields.io/badge/Storybook-deployed-ff4685)](https://preview.kelysty.com/system/)\n\nThis npm package can help you with providing pre-configured React Context API that contains:\n\n1. **Device context**\n2. **Authorization context**\n3. **Language context**\n4. **Theme context**\n\nEach context can be applied separatelly and supported by custom hooks;\n\n## Installation\n\nUsing `npm`:\n\n```bash\nnpm install @kelysty/system\n```\n\nUsing `yarn`:\n\n```bash\nyarn add @kelysty/system\n```\n\n## Usage\n\nHow to lift off as fast as possible?\n\nImport `KelystyProvider` into your workspace:\n\n```ts\nimport {KelystyProvider} from '@kelysty/system';\n```\n\nThen you need to simply wrap your application in it:\n\n```ts\n\u003cKelystyProvider\n  mobileMaxWidth={450}\n  tabletMaxWidth={900}\n  defaultIsAuth={false}\n  defaultLanguage='english'\n  languages={[...]}\n  defaultTheme='light'\n\u003e\n  \u003cApp/\u003e\n\u003c/KelystyProvider\u003e\n```\n\nIt's done and ready to use. You can proceed with reading [hooks section](#hooks) or stay with us and learn about props thoroughly.\n\n## Props\n\n**NOTE**: All props are guarded by default fallbacks. So they are **optional**, means **they are not required**. In order to customize your setup you obviously need to pass them.\n\n#### mobileMaxWidth\n\n- `type`: number\n- `defaultValue`: 766\n- `restriction`: value must be less than 'tabletMaxWidth' prop\n\nThe mobile's maximum value of the screen width. Once screen width becomes more than that it is no longer a 'mobile' device - it is a 'tablet'; Metric system is pixels;\n\n#### tabletMaxWidth\n\n- `type`: number\n- `defaultValue`: 1199\n- `restriction`: value must be greater than 'mobileMaxWidth' prop\n\nThe mobile's maximum value of the screen width. Once screen width becomes more than that it is no longer a 'tablet' device - it is a 'desktop'; Metric system is pixels;\n\n#### defaultIsAuth\n\n- `type`: boolean\n- `defaultValue`: false\n- `restriction`: none\n\nThis prop provides auth status to start with.\n\n#### defaultLanguage\n\n- `type`: string\n- `defaultValue`: english\n- `restriction`: to be successfully applied it must correlate with the 'languages' prop\n\nThe language of the app to start with. It has to be one of the available languages. If you provide `languages` prop - list of available languages throughout the app - without `english` (or any other passed defaultLanguage) in it, then defaultLanguage prop will be configured as a first item of the `languages`;\n\n#### languages\n\n- `type`: Array\u003c{name: string, code: string}\u003e\n- `defaultValue`: [{name: 'english', code: 'en'}]\n- `restriction`: if provided, it must contain at least one item\n\nArray of the languages in the app. By default there is only english language. If the prop is being passed, it **overrides** defaultValue. If you want to pass more languages beside the english one, make sure english language is in your list.\n\n#### defaultTheme\n\n- `type`: 'system' | 'light' | 'dark' | 'alternative'\n- `defaultValue`: 'system'\n- `restriction`: TEMPORARY: there is no styling system yet that goes alongside with it\n\nDefault theme of the app. Right now it just contains a value of the active theme, but generating and applying styling system is up to you. The good news is we are working on it)\n\n## Hooks\n\nThere are `4 hooks` right now:\n\n```ts\n// You can access all hooks via common gateway:\nimport {useDevice, useAuth, useLanguage, useTheme} from '@kelysty/system';\n\n// and destructurize them as objects, what gives you power\n// to choose only those items that you actualy need\nconst {...} = useDevice();\n```\n\nNow lets talk about each of them closely\n\n#### useDevice()\n\nWith `KelystyProvider` you **don't need** and you **cannot** control the current active device. Using 'useDevice()' hook you can get automatically calculated device state. Doing so, you subscribe your component onto Device context.\n\n```ts\n// importing\nimport {useDevice} from '@kelysty/system';\n\n// full destructurization\nconst {device, isDesktop, isTablet, isMobile} = useDevice();\n\n// usage\n```\n\n- `args`: none\n- `device`: current device as a string (desktop, tablet or mobile)\n- `isDesktop`: semantic helper, true when device === 'desktop', false otherwise\n- `isTablet`: the same logic but for tablet\n- `isMobile`: the same logic but for mobile\n- `restriction`: subscriber must be nested into either 'KelystyProvider' or 'DeviceProvider' component\n\n#### useAuth()\n\n'useAuth()' hook allows you to get and to control authorization state. Doing so, you subscribe your component onto Auth context.\n\n```ts\n// importing\nimport {useAuth} from '@kelysty/system';\n\n// full destructurization\nconst {isAuth, login, logout, setIsAuth} = useAuth();\n\n// usage\n```\n\n- `args`: none\n- `isAuth`: current state as a boolean (true or false)\n- `login()`: calling this method switches isAuth to `true`\n- `logout()`: calling this method switches isAuth to `false`\n- `setIsAuth(bool)`: renews isAuth with provided value\n- `restriction`: subscriber must be nested into either 'KelystyProvider' or 'AuthProvider' component\n\n#### useLanguage()\n\n'useLanguage()' hook allows you to get language state and control it. Doing so, you subscribe your component onto Language context.\n\n```ts\n// importing\nimport {useLanguage} from '@kelysty/system';\n\n// full destructurization\nconst {language, availableLanguages, setLanguage} = useLanguage();\n\n// further usage...\n```\n\n- `args`: none\n- `language`: current language state as an object, ex {name: 'english', code: 'en'}\n- `availableLanguages`: array of all available langs in the app (Language[])\n- `setLanguage(string)`: renews active language accepting language name\n- `restriction`: subscriber must be nested into either 'KelystyProvider' or 'LanguageProvider' component\n\n#### useTheme()\n\n'useTheme()' hook allows you to get and to control language state. Doing so, you subscribe your component onto Language context.\n\n```ts\n// importing\nimport {useTheme} from '@kelysty/system';\n\n// full destructurization\nconst {theme, toggleTheme, setTheme} = useTheme();\n\n// usage\n```\n\n- `args`: none\n- `theme`: current active theme as string (system, light, dark or alternative)\n- `toggleTheme()`: calling this method toggles theme between `light` and `dark` (swithes to `light` from system or alternative ones)\n- `setTheme(Theme)`: renews active theme with provided value\n- `restriction`: subscriber must be nested into either 'KelystyProvider' or 'ThemeProvider' component\n\n## Precise usage\n\n`KelystyProvider` is a very convenient way to provide whole bunch of the context in a minute. But, you might not need so much of context.\n\nIs there a way to apply them precisely?! Absolutely!\n\nThis is the example we provided at the very beginning of this page:\n\n```ts\nimport {KelystyProvider} from '@kelysty/system'\n// ...\n\n\u003cKelystyProvider\n  mobileMaxWidth={450}\n  tabletMaxWidth={900}\n  defaultIsAuth={false}\n  defaultLanguage='english'\n  languages={[...]}\n  defaultTheme='light'\n\u003e\n  \u003cApp/\u003e\n\u003c/KelystyProvider\u003e\n```\n\nNow, guess what, it was a HOC for\n\n```ts\nimport {\n  DeviceProvider,\n  AuthProvider,\n  LanguageProvider,\n  ThemeProvider\n} from '@kelysty/system';\n// ...\n\n\u003cDeviceProvider\n  mobileMaxWidth={450}\n  tabletMaxWidth={900}\n\u003e\n  \u003cAuthProvider defaultIsAuth={false}\u003e\n    \u003cLanguageProvider\n      defaultLanguage='english'\n      languages={[...]}\n    \u003e\n      \u003cThemeProvider defaultTheme='light'\u003e\n        \u003cApp/\u003e\n      \u003c/ThemeProvider\u003e\n    \u003c/LanguageProvider\u003e\n  \u003c/AuthProvider\u003e\n\u003c/DeviceProvider\u003e\n```\n\nAs you can see, `KelystyProvider` is an abstraction that renders all nested providers underneath; The truth is:\n\n- `all props` are the same\n- `all fallbacks (defaultValues)` are the same\n- `each hook` is linked to it's provider\n\n\u003e Just pick providers you need and use them separately!\n\nWe hope you enjoy using this library!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelysty%2Fsystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelysty%2Fsystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelysty%2Fsystem/lists"}