Skip to content

Commit

Permalink
fix: alwaysLTR when endIcon is present
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Aug 31, 2024
1 parent e1db31d commit a26bfd9
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 11 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.128

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.49.11

## 0.0.127

### 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.127",
"version": "0.0.128",
"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.49.11

### Patch Changes

- Fix `alwaysLTR` while `endIcon` is present in `Input` component

## 0.49.10

### Patch Changes
Expand Down
19 changes: 13 additions & 6 deletions packages/components/elements/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,20 @@ export const Input = forwardRef<HTMLInputElement, InputFieldProps>(
className={cn(
defaultInputStyle,
"focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 dark:hawa-text-white",
{
"hawa-pe-9": props.endIcon,
"hawa-ps-9": props.startIcon,
"hawa-pe-[60px]": countPosition === "center",
},

props.alwaysLTR
? {
"hawa-ps-9": props.endIcon,
"hawa-pe-9": props.startIcon,
"hawa-ps-[60px]": countPosition === "center",
}
: {
"hawa-pe-9": props.endIcon,
"hawa-ps-9": props.startIcon,
"hawa-pe-[60px]": countPosition === "center",
},
preview && "hawa-border-transparent hawa-bg-transparent hawa-px-0",
props.alwaysLTR && "hawa-text-end",
props.alwaysLTR && props.dir === "rtl" && "hawa-text-end",
inputProps?.className,
)}
/>
Expand Down
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.49.10",
"version": "0.49.11",
"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.150

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.49.11

## 0.26.149

### 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.149",
"version": "0.26.150",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
36 changes: 34 additions & 2 deletions packages/storybook/stories/ElementsStories/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from "react";

import { Story } from "@storybook/blocks";
import type { Meta, StoryObj } from "@storybook/react";
import { Lock, Search } from "lucide-react";
import { EyeOffIcon, Lock, Search } from "lucide-react";

import { SA, USA } from "@sikka/alam";
import { Label, Skeleton } from "@sikka/hawa/elements";
Expand Down Expand Up @@ -49,7 +49,39 @@ export const Default: Story = {
</div>
</div>
<div className="hawa-flex hawa-flex-row hawa-gap-4">
<Input label="Always LTR" placeholder={"Bismillah"} alwaysLTR />
<Input
label="Always LTR"
placeholder={"Bismillah"}
alwaysLTR
dir={locale === "ar" ? "rtl" : "ltr"}
/>
<Input
label="Always LTR + End Icon"
placeholder={"Bismillah"}
alwaysLTR
dir={locale === "ar" ? "rtl" : "ltr"}
endIcon={<EyeOffIcon className="hawa-icon" />}
/>
<Input
label="Always LTR + Start Icon"
placeholder={"Bismillah"}
alwaysLTR
dir={locale === "ar" ? "rtl" : "ltr"}
startIcon={<EyeOffIcon className="hawa-icon" />}
/>
<Input
label="End Icon"
placeholder={"Bismillah"}
dir={locale === "ar" ? "rtl" : "ltr"}
endIcon={<EyeOffIcon className="hawa-icon" />}
/>
<Input
label="Start Icon"
placeholder={"Bismillah"}
dir={locale === "ar" ? "rtl" : "ltr"}
startIcon={<EyeOffIcon className="hawa-icon" />}
/>
{/* <Input label="Default" placeholder={"Bismillah"} /> */}
</div>
</div>
);
Expand Down

0 comments on commit a26bfd9

Please sign in to comment.