@abydahana/aksara-ui 1.2.4 → 1.2.5

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.
@@ -4,6 +4,8 @@ export interface SettingsGroupProps {
4
4
  title?: string;
5
5
  className?: string;
6
6
  attributes?: Record<string, unknown>;
7
+ /** Inset iOS-style group with soft background and rounded corners */
8
+ inset?: boolean;
7
9
  }
8
10
  /**
9
11
  * Container for a group of settings-style rows.
@@ -4,12 +4,13 @@ import { classNames, escapeHtml, toAttributes } from "../utils";
4
4
  * Renders as `.list-group` with an optional uppercase section heading above.
5
5
  */
6
6
  export function SettingsGroup(props = {}) {
7
- const { children = "", title = "", className = "", attributes } = props;
7
+ const { children = "", title = "", className = "", attributes, inset = false } = props;
8
8
  const baseAttrs = toAttributes(attributes);
9
- const groupHtml = `<div class="${classNames("list-group", className)}"${baseAttrs}>${children}</div>`;
9
+ const groupClasses = classNames("list-group", inset && "list-group-inset", className);
10
+ const groupHtml = `<div class="${groupClasses}"${baseAttrs}>${children}</div>`;
10
11
  if (!title)
11
12
  return groupHtml.trim();
12
- return `<div><p class="text-xs font-800 uppercase tracking-wider text-subtle mb-2 px-1">${escapeHtml(title)}</p><div class="${classNames("list-group", className)}">${children}</div></div>`.trim();
13
+ return `<div><p class="text-xs font-800 uppercase tracking-wider text-subtle mb-2 px-1">${escapeHtml(title)}</p><div class="${groupClasses}">${children}</div></div>`.trim();
13
14
  }
14
15
  export const settingsGroup = SettingsGroup;
15
16
  /**
@@ -21,7 +21,7 @@ export function UserItem(props) {
21
21
  : "";
22
22
  const hasDistinctSubtitle = Boolean(subtitle && (!cleanHandle || subtitle.replace(/^@/, "").trim() !== cleanHandle));
23
23
  const subtitleHtml = hasDistinctSubtitle
24
- ? `<div class="user-item-subtitle text-subtle ${cleanHandle ? "text-xs" : "text-sm"} text-truncate mt-0.5">${escapeHtml(subtitle)}</div>`
24
+ ? `<div class="user-item-subtitle text-subtle ${cleanHandle ? "text-xs" : "text-sm"} text-truncate mt-1">${escapeHtml(subtitle)}</div>`
25
25
  : "";
26
26
  const contentCol = `
27
27
  <div class="user-item-info flex-1 min-w-0">
@@ -16,7 +16,7 @@ export function DropdownSelect(props) {
16
16
  value: selectedOption?.value ?? ""
17
17
  });
18
18
  const triggerIcon = selectedOption?.icon
19
- ? `<i class="mdi ${escapeHtml(selectedOption.icon)} ${escapeHtml(selectedOption.iconClass ?? "")} me-1.5 select-current-icon"></i>`
19
+ ? `<i class="mdi ${escapeHtml(selectedOption.icon)} ${escapeHtml(selectedOption.iconClass ?? "")} me-2 select-current-icon"></i>`
20
20
  : "";
21
21
  const triggerBtn = isFormSelect
22
22
  ? `<button type="button" class="form-select ${selectSizeClass} ${btnClassName} text-start d-flex align-items-center justify-content-between cursor-pointer" data-dropdown="" aria-haspopup="true" aria-expanded="false">
@@ -1,6 +1,7 @@
1
1
  export interface TabItem {
2
2
  id: string;
3
3
  label: string;
4
+ icon?: string;
4
5
  content: string;
5
6
  active?: boolean;
6
7
  disabled?: boolean;
@@ -12,6 +13,8 @@ export interface TabsProps {
12
13
  attributes?: Record<string, unknown>;
13
14
  /** When true (default: true), tab panels render in a swipeable slider track that tracks finger movement */
14
15
  swipeable?: boolean;
16
+ /** Visual style variant: 'default' (standard underline), 'segmented' (iOS/macOS style segmented control), or 'pills' */
17
+ variant?: "default" | "segmented" | "pills";
15
18
  }
16
19
  export declare function Tabs(props: TabsProps): string;
17
20
  export declare const tabs: typeof Tabs;
@@ -1,6 +1,6 @@
1
1
  import { classNames, escapeHtml, toAttributes } from "../utils";
2
2
  export function Tabs(props) {
3
- const { items = [], ariaLabel = "Tabs", className = "", attributes, swipeable = true } = props;
3
+ const { items = [], ariaLabel = "Tabs", className = "", attributes, swipeable = true, variant = "default" } = props;
4
4
  const hasActive = items.some((item) => item.active);
5
5
  const activeIndex = hasActive ? items.findIndex((item) => item.active) : 0;
6
6
  const buttonsHtml = items
@@ -8,6 +8,7 @@ export function Tabs(props) {
8
8
  const isSelected = idx === activeIndex;
9
9
  const btnClasses = classNames("tab", isSelected && "active", item.disabled && "disabled");
10
10
  const disabledAttr = item.disabled ? " disabled" : "";
11
+ const iconHtml = item.icon ? `<span class="tab-icon me-1 shrink-0" aria-hidden="true">${item.icon}</span>` : "";
11
12
  return `
12
13
  <button
13
14
  id="tab-${escapeHtml(item.id)}"
@@ -20,7 +21,7 @@ export function Tabs(props) {
20
21
  aria-controls="panel-${escapeHtml(item.id)}"
21
22
  ${disabledAttr}
22
23
  >
23
- ${escapeHtml(item.label)}
24
+ ${iconHtml}${escapeHtml(item.label)}
24
25
  </button>
25
26
  `.trim();
26
27
  })
@@ -44,9 +45,10 @@ export function Tabs(props) {
44
45
  .join("\n");
45
46
  const baseAttrs = toAttributes(attributes);
46
47
  const trackClass = classNames("tab-content", swipeable && "tabs-slider-track", "mt-3");
48
+ const tablistClass = classNames("tabs", variant === "segmented" && "tabs-segmented", variant === "pills" && "nav nav-pills");
47
49
  return `
48
- <div class="${classNames("tabs-wrapper", swipeable && "tabs-slider", className)}"${baseAttrs}>
49
- <div class="tabs" role="tablist" aria-label="${escapeHtml(ariaLabel)}">
50
+ <div class="${classNames("tabs-wrapper", swipeable && "tabs-slider", variant === "segmented" && "tabs-segmented-wrapper", className)}"${baseAttrs}>
51
+ <div class="${tablistClass}" role="tablist" aria-label="${escapeHtml(ariaLabel)}">
50
52
  ${buttonsHtml}
51
53
  </div>
52
54
  <div class="${trackClass}"${swipeable ? ' data-tabs-slider=""' : ""}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abydahana/aksara-ui",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },