tera-system-ui 0.0.25 → 0.0.26

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.
@@ -1,5 +1,47 @@
1
1
  import { type VariantProps } from "tailwind-variants";
2
- export declare const styles: import("tailwind-variants").TVReturnType<{}, undefined, "", import("tailwind-variants/dist/config").TVConfig<{}, {}>, {}, undefined, import("tailwind-variants").TVReturnType<{}, undefined, "", import("tailwind-variants/dist/config").TVConfig<{}, {}>, unknown, unknown, undefined>>;
2
+ export declare const styles: import("tailwind-variants").TVReturnType<{
3
+ size: {
4
+ sm: string;
5
+ md: string;
6
+ lg: string;
7
+ };
8
+ }, undefined, "", import("tailwind-variants/dist/config").TVConfig<{
9
+ size: {
10
+ sm: string;
11
+ md: string;
12
+ lg: string;
13
+ };
14
+ }, {
15
+ size: {
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ };
20
+ }>, {
21
+ size: {
22
+ sm: string;
23
+ md: string;
24
+ lg: string;
25
+ };
26
+ }, undefined, import("tailwind-variants").TVReturnType<{
27
+ size: {
28
+ sm: string;
29
+ md: string;
30
+ lg: string;
31
+ };
32
+ }, undefined, "", import("tailwind-variants/dist/config").TVConfig<{
33
+ size: {
34
+ sm: string;
35
+ md: string;
36
+ lg: string;
37
+ };
38
+ }, {
39
+ size: {
40
+ sm: string;
41
+ md: string;
42
+ lg: string;
43
+ };
44
+ }>, unknown, unknown, undefined>>;
3
45
  type StarRatingVariants = VariantProps<typeof styles>;
4
46
  export interface StarRatingProps extends StarRatingVariants {
5
47
  children?: any;
@@ -1,7 +1,15 @@
1
1
  import { tv } from "tailwind-variants";
2
2
  export const styles = tv({
3
3
  base: '',
4
- variants: {},
4
+ variants: {
5
+ size: {
6
+ sm: 'h-6 px-1',
7
+ md: 'h-8 px-1',
8
+ lg: 'h-10 px-1'
9
+ }
10
+ },
5
11
  compoundVariants: [],
6
- defaultVariants: {},
12
+ defaultVariants: {
13
+ size: 'md'
14
+ },
7
15
  });
@@ -6,6 +6,7 @@
6
6
  children,
7
7
  value = $bindable(),
8
8
  onchange,
9
+ size = 'md',
9
10
  ...props
10
11
  }: StarRatingProps = $props();
11
12
 
@@ -48,18 +49,24 @@
48
49
 
49
50
  </script>
50
51
 
51
- <div class="inline-flex items-center">
52
+ <div
53
+ tabindex="0"
54
+ role="radiogroup"
55
+ class="star-rating-container inline-flex items-center">
52
56
  {#each Array(5) as _, index (index)}
53
- <button
54
- data-rating-icon
55
- data-highlight={(hoverRating || value) > index}
56
- data-hovering={hoverRating === (index + 1)}
57
- aria-label=""
58
- onpointerenter={(e) => setHover(index + 1, e)}
59
- onpointerleave={resetHover}
60
- ontouchendcapture={resetHover}
61
- onclick={(e) => setRating(index + 1, e)}
62
- class={cn(" h-6 px-1 ")}>
57
+ <button role="radio"
58
+ tabindex="0"
59
+ aria-checked={(hoverRating || value) > index}
60
+ aria-posinset={index + 1}
61
+ aria-setsize="5"
62
+ data-rating-icon
63
+ data-hovering={hoverRating === (index + 1)}
64
+ aria-label=""
65
+ onpointerenter={(e) => setHover(index + 1, e)}
66
+ onpointerleave={resetHover}
67
+ ontouchendcapture={resetHover}
68
+ onclick={(e) => setRating(index + 1, e)}
69
+ class={styles({size})}>
63
70
  <svg
64
71
  viewBox="64 64 896 896" focusable="true" data-icon="star" width="1em" height="1em"
65
72
  fill="currentColor"
@@ -72,13 +79,19 @@
72
79
  </div>
73
80
 
74
81
 
75
- <style global>[data-rating-icon] {
82
+ <style>[data-rating-icon] {
76
83
  fill: hsl(var(--tw---token-color-neutral-token-5));
77
84
  transition-property: all;
78
85
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
79
86
  transition-duration: 300ms
80
87
  }
81
- [data-rating-icon][data-highlight=true] {
88
+ [data-rating-icon]:first-child {
89
+ padding-left: 0px
90
+ }
91
+ [data-rating-icon]:last-child {
92
+ padding-right: 0px
93
+ }
94
+ [data-rating-icon][aria-checked=true] {
82
95
  fill: #facc15
83
96
  }
84
97
  [data-rating-icon][data-hovering=true] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tera-system-ui",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "npm run customPrepublish && npm run generate-index && vite build && npm run package && npm run postpublish",