Skip to content

Commit

Permalink
chore: add VisuallyHidden
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Aug 13, 2024
1 parent ace146e commit 57de517
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 3 deletions.
7 changes: 7 additions & 0 deletions apps/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-docs

## 0.0.108

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.46.0

## 0.0.107

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-docs",
"version": "0.0.107",
"version": "0.0.108",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
Expand Down
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sikka/hawa

## 0.46.0

### Minor Changes

- Adds `VisuallyHidden` to be used for better accessibility

## 0.45.1

### Patch Changes
Expand Down
50 changes: 50 additions & 0 deletions packages/components/elements/visuallyHidden/VisuallyHidden.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as React from "react";

/* -------------------------------------------------------------------------------------------------
* VisuallyHidden
* -----------------------------------------------------------------------------------------------*/

const NAME = "VisuallyHidden";

type VisuallyHiddenElement = React.ElementRef<"span">;
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<"span">;
interface VisuallyHiddenProps extends PrimitiveSpanProps {}

const VisuallyHidden = React.forwardRef<
VisuallyHiddenElement,
VisuallyHiddenProps
>((props, forwardedRef) => {
return (
<span
{...props}
ref={forwardedRef}
style={{
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
position: "absolute",
border: 0,
width: 1,
height: 1,
padding: 0,
margin: -1,
overflow: "hidden",
clip: "rect(0, 0, 0, 0)",
whiteSpace: "nowrap",
wordWrap: "normal",
...props.style,
}}
/>
);
});

VisuallyHidden.displayName = NAME;

/* -----------------------------------------------------------------------------------------------*/

const Root = VisuallyHidden;

export {
VisuallyHidden,
//
Root,
};
export type { VisuallyHiddenProps };
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sikka/hawa",
"version": "0.45.1",
"version": "0.46.0",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
7 changes: 7 additions & 0 deletions packages/storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-storybook

## 0.26.130

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.46.0

## 0.26.129

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-storybook",
"version": "0.26.129",
"version": "0.26.130",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down

0 comments on commit 57de517

Please sign in to comment.